Cleanup some of the block placement code.

This commit is contained in:
Myles 2016-06-19 18:07:00 +01:00
parent cdd9ff4469
commit 91344a0b50
3 changed files with 1 additions and 43 deletions

View File

@ -283,46 +283,6 @@ public class WorldPackets {
wrapper.write(Type.BYTE, (byte) 0); 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();
// }
// });
} }
}); });

View File

@ -44,8 +44,6 @@ public class EntityTracker extends StoredObject {
@Setter @Setter
private boolean autoTeam = false; private boolean autoTeam = false;
@Setter @Setter
private Long lastPlaceBlock = -1L;
@Setter
private int entityID; private int entityID;
@Setter @Setter
private Position currentlyDigging = null; private Position currentlyDigging = null;

View File

@ -8,7 +8,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
@Getter @Getter
public class PlaceBlockTracker extends StoredObject { public class PlaceBlockTracker extends StoredObject {
private long lastPlaceTimestamp = System.currentTimeMillis(); private long lastPlaceTimestamp = 0;
@Setter @Setter
private Position lastPlacedPosition = null; private Position lastPlacedPosition = null;