From dbd1fb2aa2abd514bc7866b4c702ba8e9514b22f Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 17:15:33 -0700 Subject: [PATCH] misc cleanup 2 --- .../event/listener/IGameEventListener.java | 5 ++++ .../baritone/behavior/PathingBehavior.java | 6 ++--- src/main/java/baritone/cache/ChunkPacker.java | 27 +++---------------- 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/api/java/baritone/api/event/listener/IGameEventListener.java b/src/api/java/baritone/api/event/listener/IGameEventListener.java index c63cbfbc..9587376a 100644 --- a/src/api/java/baritone/api/event/listener/IGameEventListener.java +++ b/src/api/java/baritone/api/event/listener/IGameEventListener.java @@ -109,6 +109,8 @@ public interface IGameEventListener { * Runs before a outbound packet is sent * * @see NetworkManager#dispatchPacket(Packet, GenericFutureListener[]) + * @see Packet + * @see GenericFutureListener */ void onSendPacket(PacketEvent event); @@ -116,6 +118,8 @@ public interface IGameEventListener { * Runs before an inbound packet is processed * * @see NetworkManager#dispatchPacket(Packet, GenericFutureListener[]) + * @see Packet + * @see GenericFutureListener */ void onReceivePacket(PacketEvent event); @@ -140,6 +144,7 @@ public interface IGameEventListener { * Called when the local player dies, as indicated by the creation of the {@link GuiGameOver} screen. * * @see GuiGameOver(ITextComponent) + * @see ITextComponent */ void onPlayerDeath(); diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index 99d7f5e2..22440af4 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -355,7 +355,7 @@ public final class PathingBehavior extends Behavior implements Helper { return; } - long start = System.nanoTime(); + //long start = System.nanoTime(); PathExecutor current = this.current; // this should prevent most race conditions? @@ -372,7 +372,7 @@ public final class PathingBehavior extends Behavior implements Helper { PathRenderer.drawPath(next.getPath(), 0, player(), partialTicks, Color.MAGENTA, Baritone.settings().fadePath.get(), 10, 20); } - long split = System.nanoTime(); + //long split = System.nanoTime(); if (current != null) { PathRenderer.drawManySelectionBoxes(player(), current.toBreak(), partialTicks, Color.RED); PathRenderer.drawManySelectionBoxes(player(), current.toPlace(), partialTicks, Color.GREEN); @@ -390,7 +390,7 @@ public final class PathingBehavior extends Behavior implements Helper { }); }); }); - long end = System.nanoTime(); + //long end = System.nanoTime(); //System.out.println((end - split) + " " + (split - start)); // if (end - start > 0) { // System.out.println("Frame took " + (split - start) + " " + (end - split)); diff --git a/src/main/java/baritone/cache/ChunkPacker.java b/src/main/java/baritone/cache/ChunkPacker.java index 46d0f175..c73a0212 100644 --- a/src/main/java/baritone/cache/ChunkPacker.java +++ b/src/main/java/baritone/cache/ChunkPacker.java @@ -42,24 +42,8 @@ public final class ChunkPacker implements Helper { private ChunkPacker() {} - private static BitSet originalPacker(Chunk chunk) { - BitSet bitSet = new BitSet(CachedChunk.SIZE); - for (int y = 0; y < 256; y++) { - for (int z = 0; z < 16; z++) { - for (int x = 0; x < 16; x++) { - int index = CachedChunk.getPositionIndex(x, y, z); - IBlockState state = chunk.getBlockState(x, y, z); - boolean[] bits = getPathingBlockType(state).getBits(); - bitSet.set(index, bits[0]); - bitSet.set(index + 1, bits[1]); - } - } - } - return bitSet; - } - public static CachedChunk pack(Chunk chunk) { - long start = System.nanoTime() / 1000000L; + //long start = System.nanoTime() / 1000000L; Map> specialBlocks = new HashMap<>(); BitSet bitSet = new BitSet(CachedChunk.SIZE); @@ -100,18 +84,15 @@ public final class ChunkPacker implements Helper { } } } - /*if (!bitSet.equals(originalPacker(chunk))) { - throw new IllegalStateException(); - }*/ } catch (Exception e) { e.printStackTrace(); } - //System.out.println("Packed special blocks: " + specialBlocks); - long end = System.nanoTime() / 1000000L; + //long end = System.nanoTime() / 1000000L; //System.out.println("Chunk packing took " + (end - start) + "ms for " + chunk.x + "," + chunk.z); String[] blockNames = new String[256]; for (int z = 0; z < 16; z++) { - https://www.ibm.com/developerworks/library/j-perry-writing-good-java-code/index.html + https: +//www.ibm.com/developerworks/library/j-perry-writing-good-java-code/index.html for (int x = 0; x < 16; x++) { for (int y = 255; y >= 0; y--) { int index = CachedChunk.getPositionIndex(x, y, z);