misc cleanup 2

This commit is contained in:
Leijurv 2018-09-16 17:15:33 -07:00
parent fb7d729b11
commit dbd1fb2aa2
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
3 changed files with 12 additions and 26 deletions

View File

@ -109,6 +109,8 @@ public interface IGameEventListener {
* Runs before a outbound packet is sent * Runs before a outbound packet is sent
* *
* @see NetworkManager#dispatchPacket(Packet, GenericFutureListener[]) * @see NetworkManager#dispatchPacket(Packet, GenericFutureListener[])
* @see Packet
* @see GenericFutureListener
*/ */
void onSendPacket(PacketEvent event); void onSendPacket(PacketEvent event);
@ -116,6 +118,8 @@ public interface IGameEventListener {
* Runs before an inbound packet is processed * Runs before an inbound packet is processed
* *
* @see NetworkManager#dispatchPacket(Packet, GenericFutureListener[]) * @see NetworkManager#dispatchPacket(Packet, GenericFutureListener[])
* @see Packet
* @see GenericFutureListener
*/ */
void onReceivePacket(PacketEvent event); 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. * Called when the local player dies, as indicated by the creation of the {@link GuiGameOver} screen.
* *
* @see GuiGameOver(ITextComponent) * @see GuiGameOver(ITextComponent)
* @see ITextComponent
*/ */
void onPlayerDeath(); void onPlayerDeath();

View File

@ -355,7 +355,7 @@ public final class PathingBehavior extends Behavior implements Helper {
return; return;
} }
long start = System.nanoTime(); //long start = System.nanoTime();
PathExecutor current = this.current; // this should prevent most race conditions? 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); 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) { if (current != null) {
PathRenderer.drawManySelectionBoxes(player(), current.toBreak(), partialTicks, Color.RED); PathRenderer.drawManySelectionBoxes(player(), current.toBreak(), partialTicks, Color.RED);
PathRenderer.drawManySelectionBoxes(player(), current.toPlace(), partialTicks, Color.GREEN); 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)); //System.out.println((end - split) + " " + (split - start));
// if (end - start > 0) { // if (end - start > 0) {
// System.out.println("Frame took " + (split - start) + " " + (end - split)); // System.out.println("Frame took " + (split - start) + " " + (end - split));

View File

@ -42,24 +42,8 @@ public final class ChunkPacker implements Helper {
private ChunkPacker() {} 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) { public static CachedChunk pack(Chunk chunk) {
long start = System.nanoTime() / 1000000L; //long start = System.nanoTime() / 1000000L;
Map<String, List<BlockPos>> specialBlocks = new HashMap<>(); Map<String, List<BlockPos>> specialBlocks = new HashMap<>();
BitSet bitSet = new BitSet(CachedChunk.SIZE); 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) { } catch (Exception e) {
e.printStackTrace(); 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); //System.out.println("Chunk packing took " + (end - start) + "ms for " + chunk.x + "," + chunk.z);
String[] blockNames = new String[256]; String[] blockNames = new String[256];
for (int z = 0; z < 16; z++) { 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 x = 0; x < 16; x++) {
for (int y = 255; y >= 0; y--) { for (int y = 255; y >= 0; y--) {
int index = CachedChunk.getPositionIndex(x, y, z); int index = CachedChunk.getPositionIndex(x, y, z);