diff options
author | Chris Xiong <chirs241097@gmail.com> | 2024-09-06 23:02:34 -0400 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2024-09-06 23:02:34 -0400 |
commit | 263695053d997e75ec4a10f0de3ea0cb8a0de80c (patch) | |
tree | a3d331738b56e0661731511cb46297d51e6ae9cd /src/main/java/org/chrisoft/trashyaddon/modules | |
parent | 04b4941e65693f8d6b55f924781d7dd7cd26b1d5 (diff) | |
download | meteor-trashy-addon-dev.tar.xz |
Special thanks to Xenapte for the 1.20.6 patch.
Diffstat (limited to 'src/main/java/org/chrisoft/trashyaddon/modules')
3 files changed, 11 insertions, 9 deletions
diff --git a/src/main/java/org/chrisoft/trashyaddon/modules/AcceptablePrices.java b/src/main/java/org/chrisoft/trashyaddon/modules/AcceptablePrices.java index 4809640..624a47f 100644 --- a/src/main/java/org/chrisoft/trashyaddon/modules/AcceptablePrices.java +++ b/src/main/java/org/chrisoft/trashyaddon/modules/AcceptablePrices.java @@ -76,7 +76,7 @@ public class AcceptablePrices implements ICopyable<AcceptablePrices>, ISerializa for (int i = 0; i < l.size(); ++i) { NbtCompound a = l.getCompound(i); String item_id = a.getString("Item"); - Item item = Registries.ITEM.get(new Identifier(item_id)); + Item item = Registries.ITEM.get(Identifier.of(item_id)); int price = a.getInt("Price"); ret.put(item, price); } diff --git a/src/main/java/org/chrisoft/trashyaddon/modules/AutoTrade.java b/src/main/java/org/chrisoft/trashyaddon/modules/AutoTrade.java index dfb343d..a062b38 100644 --- a/src/main/java/org/chrisoft/trashyaddon/modules/AutoTrade.java +++ b/src/main/java/org/chrisoft/trashyaddon/modules/AutoTrade.java @@ -39,7 +39,7 @@ public class AutoTrade extends Module { Items.ROTTEN_FLESH, Items.GOLD_INGOT, Items.RABBIT_FOOT, - Items.SCUTE, + Items.TURTLE_SCUTE, Items.GLASS_BOTTLE, Items.NETHER_WART, Items.WHEAT, @@ -184,11 +184,11 @@ public class AutoTrade extends Module { private boolean isOfferEligible(TradeOffer o) { // I don't give a SHIT to trades that use the second slot // well actually I do, but I don't need THAT many enchanted books... - if (!o.getSecondBuyItem().getItem().equals(Items.AIR)) + if (o.getSecondBuyItem().isPresent() && !o.getSecondBuyItem().get().equals(Items.AIR)) return false; if (o.isDisabled()) return false; - ItemStack mbuy = o.getAdjustedFirstBuyItem(); + ItemStack mbuy = o.getDisplayedFirstBuyItem(); ItemStack msell = o.getSellItem(); List<Item> sells = sellingEnabled.get() ? this.sellsSetting.get() : List.of(); List<Item> buys = buyingEnabled.get() ? this.buysSetting.get() : List.of(); @@ -223,7 +223,7 @@ public class AutoTrade extends Module { ticksRemaining = -0xdead; TradeOffer o = offers.get(currentOffer); Item tradedItem = o.getSellItem().getItem().equals(Items.EMERALD) ? - o.getAdjustedFirstBuyItem().getItem() : o.getSellItem().getItem(); + o.getDisplayedFirstBuyItem().getItem() : o.getSellItem().getItem(); countBefore = screen.getScreenHandler().slots.stream() .map(slot -> slot.getStack()) .filter(s -> s.getItem().equals(tradedItem)) @@ -236,7 +236,7 @@ public class AutoTrade extends Module { private void finalizeCurrentTrade() { TradeOffer o = offers.get(currentOffer); Item tradedItem = o.getSellItem().getItem().equals(Items.EMERALD) ? - o.getAdjustedFirstBuyItem().getItem() : o.getSellItem().getItem(); + o.getDisplayedFirstBuyItem().getItem() : o.getSellItem().getItem(); countAfter = screen.getScreenHandler().slots.stream() .map(slot -> slot.getStack()) .filter(s -> s.getItem().equals(tradedItem)) @@ -265,6 +265,7 @@ public class AutoTrade extends Module { first = false; } info(f.toString()); + f.close(); } if (!itemsBought.isEmpty()) { Formatter f = new Formatter(); @@ -275,6 +276,7 @@ public class AutoTrade extends Module { first = false; } info(f.toString()); + f.close(); } } if (autoClose.get() && (!itemsBought.isEmpty() || !itemsSold.isEmpty())) @@ -293,7 +295,7 @@ public class AutoTrade extends Module { return; } if (waitState != WaitState.None && currentOffer < offers.size() && (offers.get(currentOffer).isDisabled() || - screen.getScreenHandler().slots.get(0).getStack().getCount() < offers.get(currentOffer).getAdjustedFirstBuyItem().getCount())) { + screen.getScreenHandler().slots.get(0).getStack().getCount() < offers.get(currentOffer).getDisplayedFirstBuyItem().getCount())) { // the WaitingForInventoryUpdate state is mostly useless because ScreenHandlerSlotUpdateS2CPacket // isn't sent after the shift-click... finalizeCurrentTrade(); diff --git a/src/main/java/org/chrisoft/trashyaddon/modules/MatchedItemHighlight.java b/src/main/java/org/chrisoft/trashyaddon/modules/MatchedItemHighlight.java index 41910c7..2d5be7e 100644 --- a/src/main/java/org/chrisoft/trashyaddon/modules/MatchedItemHighlight.java +++ b/src/main/java/org/chrisoft/trashyaddon/modules/MatchedItemHighlight.java @@ -48,8 +48,8 @@ public class MatchedItemHighlight extends Module { for (int j = firstInventorySlot; j < screenHandler.slots.size(); ++ j) { if (screenHandler.getSlot(j).getStack().isEmpty()) continue; - if (ItemStack.canCombine(screenHandler.getSlot(i).getStack(), screenHandler.getSlot(j).getStack()) || - ItemStack.canCombine(screenHandler.getSlot(j).getStack(), screenHandler.getSlot(i).getStack())) { + if (ItemStack.areItemsAndComponentsEqual(screenHandler.getSlot(i).getStack(), screenHandler.getSlot(j).getStack()) || + ItemStack.areItemsAndComponentsEqual(screenHandler.getSlot(j).getStack(), screenHandler.getSlot(i).getStack())) { Color c; if (!slotColors.get(i).equals(transparent)) c = new Color(slotColors.get(i)); |