Skip to content

Commit b59020a

Browse files
committed
Spawn jitter
1 parent ae87e10 commit b59020a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/java/io/github/restioson/loopdeloop/game/LoopDeLoopActive.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ private void failHoop(ServerPlayerEntity player, LoopDeLoopPlayer state, long ti
269269
LoopDeLoopHoop lastHoop = this.map.hoops.get(state.lastHoop);
270270
Vec3d centre = Vec3d.ofCenter(lastHoop.centre);
271271
float radius = 2;
272-
273272
double x = centre.x + MathHelper.nextDouble(player.getRandom(), -radius, radius);
274273
double y = centre.y + MathHelper.nextFloat(player.getRandom(), -radius, radius);
275274
double z = centre.z + 2;

src/main/java/io/github/restioson/loopdeloop/game/LoopDeLoopSpawnLogic.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import net.minecraft.server.network.ServerPlayerEntity;
99
import net.minecraft.server.world.ServerWorld;
1010
import net.minecraft.util.math.BlockPos;
11+
import net.minecraft.util.math.MathHelper;
1112
import net.minecraft.world.GameMode;
1213

1314
public final class LoopDeLoopSpawnLogic {
@@ -46,6 +47,10 @@ public void spawnPlayer(ServerPlayerEntity player) {
4647
return;
4748
}
4849

49-
player.teleport(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 0.0F, 0.0F);
50+
float radius = 4.5f;
51+
double x = pos.getX() + MathHelper.nextDouble(player.getRandom(), -radius, radius);
52+
double z = pos.getZ() + MathHelper.nextFloat(player.getRandom(), -radius, radius);
53+
54+
player.teleport(world, x, pos.getY() + 0.5, z, 0.0F, 0.0F);
5055
}
5156
}

0 commit comments

Comments
 (0)