Skip to content

Commit

Permalink
Fix bug with request tick count
Browse files Browse the repository at this point in the history
  • Loading branch information
aria1th committed Jun 27, 2023
1 parent 8719886 commit 94d9ef6
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ public static void tick(ClientPlayNetworkHandler clientPlayNetworkHandler, Clien
return;
}
if (requestedTicks >= -1) {
MessageHolder.sendOrderMessage("Requested ticks: " + requestedTicks);
if (PRINTER_FAKE_ROTATION_AGGRESSIVE.getBooleanValue() || fakeYaw != previousFakeYaw || fakePitch != previousFakePitch) {
MessageHolder.sendOrderMessage("Sending look packet" + fakeYaw + " " + fakePitch + " " + fakeDirection);
sendLookPacket(clientPlayNetworkHandler, playerEntity);
previousFakePitch = fakePitch;
previousFakeYaw = fakeYaw;
Expand Down Expand Up @@ -196,13 +198,15 @@ public static void sendLookPacket(ClientPlayNetworkHandler networkHandler, Clien
public static boolean request(float yaw, float pitch, Direction direction, int duration, boolean force) {
if (isHandling()) {
if (!force) {
MessageHolder.sendOrderMessage("Already handling " + handlingState + " for " + requestedTicks + " ticks");
return false;
}
}
fakeDirection = direction;
fakeYaw = yaw;
fakePitch = pitch;
requestedTicks = duration;
MessageHolder.sendOrderMessage("Requested " + duration + " ticks of handling " + handlingState + " with yaw " + yaw + " pitch " + pitch + " direction " + direction);
// we might need it instantly
final MinecraftClient minecraftClient = MinecraftClient.getInstance();
final ClientPlayNetworkHandler networkHandler = minecraftClient.getNetworkHandler();
Expand Down Expand Up @@ -582,7 +586,7 @@ private static boolean pickFirst(BlockState blockState, BlockPos pos) {
if (Printer.doSchematicWorldPickBlock(minecraftClient, blockState, pos)) {
currentHandling = getStackForState(minecraftClient, blockState, minecraftClient.world, pos).getItem();
handlingState = blockState;
requestedTicks = 0;
requestedTicks = Math.max(requestedTicks,0);
return true;
}
return false;
Expand Down

0 comments on commit 94d9ef6

Please sign in to comment.