+14
-2
src/main/java/com/github/puregero/minecraftstresstest/Bot.java
+14
-2
src/main/java/com/github/puregero/minecraftstresstest/Bot.java
···
32
32
private float yaw = 0;
33
33
34
34
private boolean goUp = false;
35
+
private boolean goDown = false;
35
36
36
37
public Bot(String username, String address, int port) {
37
38
this.username = username;
···
132
133
if (goUp) {
133
134
y += 0.1;
134
135
goUp = Math.random() < 0.98;
136
+
} else if (goDown) {
137
+
y -= 0.1;
138
+
goDown = Math.random() < 0.98;
135
139
} else {
136
140
if (Math.max(Math.abs(x), Math.abs(z)) > RADIUS) {
137
141
double tx = Math.random() * RADIUS * 2 - RADIUS;
···
189
193
}
190
194
191
195
// Try going up to go over the block, or turn around and go a different way
192
-
goUp = Math.random() < 0.5;
193
-
if (!goUp) yaw = (float) (Math.random() * 360);
196
+
if (goDown) {
197
+
goDown = false;
198
+
} else if (!goUp) {
199
+
goUp = true;
200
+
} else {
201
+
// We hit our head on something
202
+
goUp = false;
203
+
goDown = Math.random() < 0.5;
204
+
if (!goDown) yaw = (float) (Math.random() * 360);
205
+
}
194
206
195
207
FriendlyByteBuf teleportConfirmPacket = new FriendlyByteBuf(ctx.alloc().buffer());
196
208
teleportConfirmPacket.writeVarInt(0x00);