From 91344a0b5006053f37219a4fc0b88a688a92bca4 Mon Sep 17 00:00:00 2001 From: Myles Date: Sun, 19 Jun 2016 18:07:00 +0100 Subject: [PATCH] Cleanup some of the block placement code. --- .../packets/WorldPackets.java | 40 ------------------- .../storage/EntityTracker.java | 2 - .../storage/PlaceBlockTracker.java | 2 +- 3 files changed, 1 insertion(+), 43 deletions(-) diff --git a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java index 5a683888b..d36bc35ff 100644 --- a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java +++ b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java @@ -283,46 +283,6 @@ public class WorldPackets { wrapper.write(Type.BYTE, (byte) 0); } }); - /* - - The thing i've discovered is when using an item in air, it needs to send 2 packets. - I believe the issue is that this needs to be flipped with the packet above while still - sending block info. - - Otherwise no idea, the disadvantage: Interact does not get fired if you right click - special items. (there's quite a few...) - - */ -// handler(new PacketHandler() { -// @Override -// public void handle(PacketWrapper wrapper) throws Exception { -// if(wrapper.isCancelled()) return; -// EntityTracker tracker = wrapper.user().get(EntityTracker.class); -// if(tracker.isBlocking()) return; -// -// Long last = tracker.getLastPlaceBlock(); -// if (last != -1) { -// if ((wrapper.user().getReceivedPackets() - last) < 3) { -// tracker.setLastPlaceBlock(-1L); -// return; -// } -// tracker.setLastPlaceBlock(-1L); -// } -// final Item item = wrapper.get(Type.ITEM, 0); -// wrapper.create(0x08, new ValueCreator() { -// @Override -// public void write(PacketWrapper wrapper) throws Exception { -// wrapper.write(Type.POSITION, new Position(1L, 1L, 1L)); -// wrapper.write(Type.BYTE, (byte) 2); -// wrapper.write(Type.ITEM, item); // hand -// -// wrapper.write(Type.UNSIGNED_BYTE, (short) 1); -// wrapper.write(Type.UNSIGNED_BYTE, (short) 1); -// wrapper.write(Type.UNSIGNED_BYTE, (short) 1); -// } -// }).sendToServer(); -// } -// }); } }); diff --git a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/EntityTracker.java b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/EntityTracker.java index 63d4efc27..586e178e5 100644 --- a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/EntityTracker.java +++ b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/EntityTracker.java @@ -44,8 +44,6 @@ public class EntityTracker extends StoredObject { @Setter private boolean autoTeam = false; @Setter - private Long lastPlaceBlock = -1L; - @Setter private int entityID; @Setter private Position currentlyDigging = null; diff --git a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/PlaceBlockTracker.java b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/PlaceBlockTracker.java index 6aff45cc4..a8ea3fe73 100644 --- a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/PlaceBlockTracker.java +++ b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/storage/PlaceBlockTracker.java @@ -8,7 +8,7 @@ import us.myles.ViaVersion.api.minecraft.Position; @Getter public class PlaceBlockTracker extends StoredObject { - private long lastPlaceTimestamp = System.currentTimeMillis(); + private long lastPlaceTimestamp = 0; @Setter private Position lastPlacedPosition = null;