dispatchFunction) {
+ Baritone.INSTANCE.getBehaviors().stream().filter(Behavior::isEnabled).forEach(dispatchFunction);
+ }
+
+ private void drawChunkLine(int posX, int posZ, float partialTicks) {
+ GlStateManager.enableBlend();
+ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
+ GlStateManager.color(1.0F, 1.0F, 0.0F, 0.4F);
+ GlStateManager.glLineWidth(2.0F);
+ GlStateManager.disableTexture2D();
+
+ Tessellator tessellator = Tessellator.getInstance();
+ BufferBuilder buffer = tessellator.getBuffer();
+ double d0 = mc.getRenderManager().viewerPosX;
+ double d1 = mc.getRenderManager().viewerPosY;
+ double d2 = mc.getRenderManager().viewerPosZ;
+ buffer.begin(3, DefaultVertexFormats.POSITION);
+ buffer.pos(posX - d0, 0 - d1, posZ - d2).endVertex();
+ buffer.pos(posX - d0, 256 - d1, posZ - d2).endVertex();
+ tessellator.draw();
+
+ GlStateManager.enableDepth();
+ GlStateManager.depthMask(true);
+ GlStateManager.enableTexture2D();
+ GlStateManager.disableBlend();
+ }
+}
diff --git a/src/main/java/baritone/bot/event/AbstractGameEventListener.java b/src/main/java/baritone/bot/event/listener/AbstractGameEventListener.java
similarity index 69%
rename from src/main/java/baritone/bot/event/AbstractGameEventListener.java
rename to src/main/java/baritone/bot/event/listener/AbstractGameEventListener.java
index 0dc82130..23fd18ab 100644
--- a/src/main/java/baritone/bot/event/AbstractGameEventListener.java
+++ b/src/main/java/baritone/bot/event/listener/AbstractGameEventListener.java
@@ -15,7 +15,24 @@
* along with Baritone. If not, see .
*/
-package baritone.bot.event;
+/*
+ * This file is part of Baritone.
+ *
+ * Baritone is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Baritone is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Baritone. If not, see .
+ */
+
+package baritone.bot.event.listener;
import baritone.bot.event.events.*;
diff --git a/src/main/java/baritone/bot/event/IGameEventListener.java b/src/main/java/baritone/bot/event/listener/IGameEventListener.java
old mode 100755
new mode 100644
similarity index 80%
rename from src/main/java/baritone/bot/event/IGameEventListener.java
rename to src/main/java/baritone/bot/event/listener/IGameEventListener.java
index 2563009f..f72bebfe
--- a/src/main/java/baritone/bot/event/IGameEventListener.java
+++ b/src/main/java/baritone/bot/event/listener/IGameEventListener.java
@@ -1,99 +1,116 @@
-/*
- * This file is part of Baritone.
- *
- * Baritone is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Baritone is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Baritone. If not, see .
- */
-
-package baritone.bot.event;
-
-import baritone.bot.event.events.*;
-import io.netty.util.concurrent.GenericFutureListener;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.entity.EntityPlayerSP;
-import net.minecraft.client.multiplayer.WorldClient;
-import net.minecraft.client.renderer.EntityRenderer;
-import net.minecraft.client.settings.GameSettings;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.Packet;
-
-/**
- * @author Brady
- * @since 7/31/2018 11:05 PM
- */
-public interface IGameEventListener {
-
- /**
- * Run once per game tick before screen input is handled.
- *
- * @see Minecraft#runTick()
- */
- void onTick(TickEvent event);
-
- /**
- * Run once per game tick from before the player rotation is sent to the server.
- * @see EntityPlayerSP#onUpdate()
- */
- void onPlayerUpdate();
-
- /**
- * Run once per game tick from before keybinds are processed.
- *
- * @see Minecraft#processKeyBinds()
- */
- void onProcessKeyBinds();
-
- /**
- * Runs whenever the client player sends a message to the server.
- *
- * @see EntityPlayerSP#sendChatMessage(String)
- */
- void onSendChatMessage(ChatEvent event);
-
- /**
- * Runs before and after whenever a chunk is either loaded, unloaded, or populated.
- *
- * @see WorldClient#doPreChunk(int, int, boolean)
- */
- void onChunkEvent(ChunkEvent event);
-
- /**
- * Runs once per world render pass. Two passes are made when {@link GameSettings#anaglyph} is on.
- *
- * Note: {@link GameSettings#anaglyph} has been removed in Minecraft 1.13
- *
- * @see EntityRenderer#renderWorldPass(int, float, long)
- */
- void onRenderPass(RenderEvent event);
-
- /**
- * Runs before and after whenever a new world is loaded
- *
- * @see Minecraft#loadWorld(WorldClient, String)
- */
- void onWorldEvent(WorldEvent event);
-
- /**
- * Runs before a outbound packet is sent
- *
- * @see NetworkManager#dispatchPacket(Packet, GenericFutureListener[])
- */
- void onSendPacket(PacketEvent event);
-
- /**
- * Runs before an inbound packet is processed
- *
- * @see NetworkManager#dispatchPacket(Packet, GenericFutureListener[])
- */
- void onReceivePacket(PacketEvent event);
-}
+/*
+ * This file is part of Baritone.
+ *
+ * Baritone is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Baritone is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Baritone. If not, see .
+ */
+
+/*
+ * This file is part of Baritone.
+ *
+ * Baritone is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Baritone is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Baritone. If not, see .
+ */
+
+package baritone.bot.event.listener;
+
+import baritone.bot.event.events.*;
+import io.netty.util.concurrent.GenericFutureListener;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.client.multiplayer.WorldClient;
+import net.minecraft.client.renderer.EntityRenderer;
+import net.minecraft.client.settings.GameSettings;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+
+/**
+ * @author Brady
+ * @since 7/31/2018 11:05 PM
+ */
+public interface IGameEventListener {
+
+ /**
+ * Run once per game tick before screen input is handled.
+ *
+ * @see Minecraft#runTick()
+ */
+ void onTick(TickEvent event);
+
+ /**
+ * Run once per game tick from before the player rotation is sent to the server.
+ * @see EntityPlayerSP#onUpdate()
+ */
+ void onPlayerUpdate();
+
+ /**
+ * Run once per game tick from before keybinds are processed.
+ *
+ * @see Minecraft#processKeyBinds()
+ */
+ void onProcessKeyBinds();
+
+ /**
+ * Runs whenever the client player sends a message to the server.
+ *
+ * @see EntityPlayerSP#sendChatMessage(String)
+ */
+ void onSendChatMessage(ChatEvent event);
+
+ /**
+ * Runs before and after whenever a chunk is either loaded, unloaded, or populated.
+ *
+ * @see WorldClient#doPreChunk(int, int, boolean)
+ */
+ void onChunkEvent(ChunkEvent event);
+
+ /**
+ * Runs once per world render pass. Two passes are made when {@link GameSettings#anaglyph} is on.
+ *
+ * Note: {@link GameSettings#anaglyph} has been removed in Minecraft 1.13
+ *
+ * @see EntityRenderer#renderWorldPass(int, float, long)
+ */
+ void onRenderPass(RenderEvent event);
+
+ /**
+ * Runs before and after whenever a new world is loaded
+ *
+ * @see Minecraft#loadWorld(WorldClient, String)
+ */
+ void onWorldEvent(WorldEvent event);
+
+ /**
+ * Runs before a outbound packet is sent
+ *
+ * @see NetworkManager#dispatchPacket(Packet, GenericFutureListener[])
+ */
+ void onSendPacket(PacketEvent event);
+
+ /**
+ * Runs before an inbound packet is processed
+ *
+ * @see NetworkManager#dispatchPacket(Packet, GenericFutureListener[])
+ */
+ void onReceivePacket(PacketEvent event);
+}
diff --git a/src/main/java/baritone/bot/pathing/movement/CalculationContext.java b/src/main/java/baritone/bot/pathing/movement/CalculationContext.java
index 3f5e6783..2e63e112 100644
--- a/src/main/java/baritone/bot/pathing/movement/CalculationContext.java
+++ b/src/main/java/baritone/bot/pathing/movement/CalculationContext.java
@@ -19,6 +19,7 @@ package baritone.bot.pathing.movement;
import baritone.bot.utils.Helper;
import baritone.bot.utils.ToolSet;
+import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@@ -28,6 +29,8 @@ import net.minecraft.item.ItemStack;
*/
public class CalculationContext implements Helper {
+ private static final ItemStack STACK_BUCKET_WATER = new ItemStack(Items.WATER_BUCKET);
+
private final ToolSet toolSet;
private final boolean hasWaterBucket;
@@ -37,7 +40,7 @@ public class CalculationContext implements Helper {
public CalculationContext(ToolSet toolSet) {
this.toolSet = toolSet;
- this.hasWaterBucket = player().inventory.hasItemStack(new ItemStack(Items.WATER_BUCKET)); // TODO check if water bucket is on hotbar or main inventory
+ this.hasWaterBucket = InventoryPlayer.isHotbar(player().inventory.getSlotFor(STACK_BUCKET_WATER));
}
public ToolSet getToolSet() {
diff --git a/src/main/java/baritone/bot/pathing/movement/movements/MovementFall.java b/src/main/java/baritone/bot/pathing/movement/movements/MovementFall.java
index daf37c3f..8881b371 100644
--- a/src/main/java/baritone/bot/pathing/movement/movements/MovementFall.java
+++ b/src/main/java/baritone/bot/pathing/movement/movements/MovementFall.java
@@ -35,7 +35,7 @@ import java.util.Optional;
public class MovementFall extends Movement {
private static final ItemStack STACK_BUCKET_WATER = new ItemStack(Items.WATER_BUCKET);
- private static final ItemStack STACK_BUCKET_AIR = new ItemStack(Items.BUCKET);
+ private static final ItemStack STACK_BUCKET_EMPTY = new ItemStack(Items.BUCKET);
public MovementFall(BlockPos src, BlockPos dest) {
super(src, dest, MovementFall.buildPositionsToBreak(src, dest), new BlockPos[]{dest.down()});
@@ -89,8 +89,8 @@ public class MovementFall extends Movement {
}
if (playerFeet.equals(dest) && (player().posY - playerFeet.getY() < 0.01
|| BlockStateInterface.isWater(dest))) {
- if (BlockStateInterface.isWater(dest) && player().inventory.hasItemStack(STACK_BUCKET_AIR)) {
- player().inventory.currentItem = player().inventory.getSlotFor(STACK_BUCKET_AIR);
+ if (BlockStateInterface.isWater(dest) && player().inventory.hasItemStack(STACK_BUCKET_EMPTY)) {
+ player().inventory.currentItem = player().inventory.getSlotFor(STACK_BUCKET_EMPTY);
if (player().motionY >= 0) {
return state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true);
} else {
diff --git a/src/main/java/baritone/bot/utils/PathRenderer.java b/src/main/java/baritone/bot/utils/PathRenderer.java
index 701093f4..57bd573b 100644
--- a/src/main/java/baritone/bot/utils/PathRenderer.java
+++ b/src/main/java/baritone/bot/utils/PathRenderer.java
@@ -29,7 +29,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
-import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.util.Collection;
@@ -52,7 +51,7 @@ public final class PathRenderer implements Helper {
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
- GL11.glLineWidth(3.0F);
+ GlStateManager.glLineWidth(3.0F);
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
List positions = path.positions();
@@ -99,7 +98,7 @@ public final class PathRenderer implements Helper {
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
- GL11.glLineWidth(5.0F);
+ GlStateManager.glLineWidth(5.0F);
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
float expand = 0.002F;