diff --git a/src/main/java/baritone/Baritone.java b/src/main/java/baritone/Baritone.java index 18b6798c..a0d5ba84 100755 --- a/src/main/java/baritone/Baritone.java +++ b/src/main/java/baritone/Baritone.java @@ -95,7 +95,6 @@ public enum Baritone implements IBaritoneProvider { pathingBehavior = new PathingBehavior(this); lookBehavior = new LookBehavior(this); memoryBehavior = new MemoryBehavior(this); - new LocationTrackingBehavior(this); followBehavior = new FollowBehavior(this); mineBehavior = new MineBehavior(this); new ExampleBaritoneControl(this); diff --git a/src/main/java/baritone/behavior/LocationTrackingBehavior.java b/src/main/java/baritone/behavior/LocationTrackingBehavior.java deleted file mode 100644 index 28c1ee70..00000000 --- a/src/main/java/baritone/behavior/LocationTrackingBehavior.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is part of Baritone. - * - * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Baritone. If not, see . - */ - -package baritone.behavior; - -import baritone.Baritone; -import baritone.api.event.events.BlockInteractEvent; -import baritone.cache.Waypoint; -import baritone.cache.WorldProvider; -import baritone.utils.BlockStateInterface; -import baritone.utils.Helper; -import net.minecraft.block.BlockBed; - -/** - * A collection of event methods that are used to interact with Baritone's - * waypoint system. This class probably needs a better name. - * - * @author Brady - * @see Waypoint - * @since 8/22/2018 - */ -public final class LocationTrackingBehavior extends Behavior implements Helper { - - public LocationTrackingBehavior(Baritone baritone) { - super(baritone); - } - - @Override - public void onBlockInteract(BlockInteractEvent event) { - if (event.getType() == BlockInteractEvent.Type.USE && BlockStateInterface.getBlock(event.getPos()) instanceof BlockBed) { - WorldProvider.INSTANCE.getCurrentWorld().getWaypoints().addWaypoint(new Waypoint("bed", Waypoint.Tag.BED, event.getPos())); - } - } - - @Override - public void onPlayerDeath() { - WorldProvider.INSTANCE.getCurrentWorld().getWaypoints().addWaypoint(new Waypoint("death", Waypoint.Tag.DEATH, playerFeet())); - } -} diff --git a/src/main/java/baritone/behavior/MemoryBehavior.java b/src/main/java/baritone/behavior/MemoryBehavior.java index 08f933f4..510cecff 100644 --- a/src/main/java/baritone/behavior/MemoryBehavior.java +++ b/src/main/java/baritone/behavior/MemoryBehavior.java @@ -21,11 +21,15 @@ import baritone.Baritone; import baritone.api.behavior.IMemoryBehavior; import baritone.api.behavior.memory.IRememberedInventory; import baritone.api.cache.IWorldData; +import baritone.api.event.events.BlockInteractEvent; import baritone.api.event.events.PacketEvent; import baritone.api.event.events.PlayerUpdateEvent; import baritone.api.event.events.type.EventState; +import baritone.cache.Waypoint; import baritone.cache.WorldProvider; +import baritone.utils.BlockStateInterface; import baritone.utils.Helper; +import net.minecraft.block.BlockBed; import net.minecraft.item.ItemStack; import net.minecraft.network.Packet; import net.minecraft.network.play.client.CPacketCloseWindow; @@ -115,6 +119,18 @@ public final class MemoryBehavior extends Behavior implements IMemoryBehavior, H } } + @Override + public void onBlockInteract(BlockInteractEvent event) { + if (event.getType() == BlockInteractEvent.Type.USE && BlockStateInterface.getBlock(event.getPos()) instanceof BlockBed) { + WorldProvider.INSTANCE.getCurrentWorld().getWaypoints().addWaypoint(new Waypoint("bed", Waypoint.Tag.BED, event.getPos())); + } + } + + @Override + public void onPlayerDeath() { + WorldProvider.INSTANCE.getCurrentWorld().getWaypoints().addWaypoint(new Waypoint("death", Waypoint.Tag.DEATH, playerFeet())); + } + private Optional getInventoryFromWindow(int windowId) { return this.getCurrentContainer().rememberedInventories.values().stream().filter(i -> i.windowId == windowId).findFirst(); }