Skip to content

Commit ff376ea

Browse files
committed
Fix ender chest looting and add gapple looting
1 parent f423620 commit ff376ea

File tree

4 files changed

+31
-17
lines changed

4 files changed

+31
-17
lines changed

‎src/main/java/baritone/behavior/highway/state/LootEnderChestPlaceLocPrep.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public void handle(HighwayContext context) {
4040
return;
4141
}
4242

43+
context.setRepeatCheck(false);
44+
context.resetTimer();
45+
4346
Vec3 curPos = new Vec3(context.playerContext().playerFeet().getX() + (7 * -context.highwayDirection().getX()), context.playerContext().playerFeet().getY(), context.playerContext().playerFeet().getZ() + (7 * -context.highwayDirection().getZ())); // Go back a bit just in case
4447
Vec3 direction = new Vec3(context.highwayDirection().getX(), context.highwayDirection().getY(), context.highwayDirection().getZ());
4548

‎src/main/java/baritone/behavior/highway/state/LootingLootEnderChestEnderChests.java‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,15 @@ public void handle(HighwayContext context) {
4343
int enderShulksLooted = context.lootShulkerChestSlot(ShulkerType.EnderChest);
4444
if (enderShulksLooted > 0) {
4545
Helper.HELPER.logDirect("Looted " + enderShulksLooted + " ender chest shulker");
46-
context.setRepeatCheck(false);
4746
} else {
4847
Helper.HELPER.logDirect("No more ender chest shulkers. Rolling with what we have.");
4948
context.transitionTo(HighwayState.LootingLootEnderChestGapples);
5049
context.setEnderChestHasEnderShulks(false);
51-
context.playerContext().player().closeContainer();
5250
}
5351

54-
//if (getItemCountInventory(Item.getId(Items.AIR)) == 0) {
55-
// Helper.HELPER.logDirect("No space for ender chest shulkers. Rolling with what we have.");
56-
// currentState = State.LootingLootEnderChestGapples;
57-
// ctx.player().closeContainer();
58-
//}
59-
6052
context.resetTimer();
6153
} else {
6254
context.transitionTo(HighwayState.LootingLootEnderChestGapples);
63-
context.playerContext().player().closeContainer();
6455
}
6556
}
6657
}

‎src/main/java/baritone/behavior/highway/state/LootingLootEnderChestGapples.java‎

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@
1717

1818
package baritone.behavior.highway.state;
1919

20+
import baritone.api.utils.Helper;
2021
import baritone.behavior.highway.HighwayContext;
2122
import baritone.behavior.highway.State;
2223
import baritone.behavior.highway.enums.HighwayState;
24+
import net.minecraft.client.gui.screens.inventory.ContainerScreen;
25+
import net.minecraft.world.item.Item;
26+
import net.minecraft.world.item.Items;
2327

2428
public class LootingLootEnderChestGapples extends State {
2529
public LootingLootEnderChestGapples(HighwayState state) {
@@ -28,7 +32,29 @@ public LootingLootEnderChestGapples(HighwayState state) {
2832

2933
@Override
3034
public void handle(HighwayContext context) {
31-
// TODO: Finish this
32-
context.transitionTo(HighwayState.Nothing);
35+
if (context.timer() < 40) {
36+
return;
37+
}
38+
39+
if (!(context.playerContext().minecraft().screen instanceof ContainerScreen)) {
40+
context.transitionTo(HighwayState.OpeningLootEnderChest);
41+
return;
42+
}
43+
44+
if (context.getItemCountInventory(Item.getId(Items.ENCHANTED_GOLDEN_APPLE)) < context.settings().highwayGapplesToHave.value) {
45+
int gapplesLooted = context.lootGappleChestSlot();
46+
if (gapplesLooted > 0) {
47+
Helper.HELPER.logDirect("Looted " + gapplesLooted + " gapples");
48+
} else {
49+
Helper.HELPER.logDirect("No more gapples. Rolling with what we have.");
50+
context.transitionTo(HighwayState.Nothing);
51+
context.playerContext().player().closeContainer();
52+
}
53+
54+
context.resetTimer();
55+
} else {
56+
context.transitionTo(HighwayState.Nothing);
57+
context.playerContext().player().closeContainer();
58+
}
3359
}
3460
}

‎src/main/java/baritone/behavior/highway/state/LootingLootEnderChestPicks.java‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,12 @@ public void handle(HighwayContext context) {
4343
int picksShulksLooted = context.lootShulkerChestSlot(context.picksToUse());
4444
if (picksShulksLooted > 0) {
4545
Helper.HELPER.logDirect("Looted " + picksShulksLooted + " pickaxe shulker");
46-
context.setRepeatCheck(false);
4746
} else {
4847
Helper.HELPER.logDirect("No more pickaxe shulkers. Rolling with what we have.");
4948
context.transitionTo(HighwayState.LootingLootEnderChestEnderChests);
5049
context.setEnderChestHasPickShulks(false);
5150
}
5251

53-
//if (getItemCountInventory(Item.getId(Items.AIR)) == 0) {
54-
// Helper.HELPER.logDirect("No space for pickaxe shulkers. Rolling with what we have.");
55-
// currentState = State.LootingLootEnderChestEnderChests;
56-
//}
57-
5852
context.resetTimer();
5953
} else {
6054
context.transitionTo(HighwayState.LootingLootEnderChestEnderChests);

0 commit comments

Comments
 (0)