From 4714cffe875a2828cf197dbcff3ebf68839beaae Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Fri, 1 Nov 2024 23:08:58 -0400 Subject: [PATCH] fix inventoryPreview for OP-only mode --- .../dy/masa/tweakeroo/util/RayTraceUtils.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/RayTraceUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/RayTraceUtils.java index 40f4704bf..d868a70aa 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/RayTraceUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/RayTraceUtils.java @@ -34,7 +34,6 @@ import fi.dy.masa.malilib.render.InventoryOverlay; import fi.dy.masa.malilib.util.InventoryUtils; import fi.dy.masa.malilib.util.*; -import fi.dy.masa.tweakeroo.data.DataManager; import fi.dy.masa.tweakeroo.data.ServerDataSyncer; import fi.dy.masa.tweakeroo.mixin.IMixinAbstractHorseEntity; import fi.dy.masa.tweakeroo.mixin.IMixinPiglinEntity; @@ -270,10 +269,11 @@ else if (entity instanceof PiglinEntity) //Tweakeroo.logger.warn("getTargetInventoryFromEntity(): rawNbt: [{}]", nbt.toString()); // Fix for empty horse inv - if (inv != null && inv.size() == 1 && + if (inv != null && + //inv.size() == 1 && nbt.contains(NbtKeys.ITEMS) && - nbt.getList(NbtKeys.ITEMS, Constants.NBT.TAG_COMPOUND).size() > 1 && - !DataManager.getInstance().hasIntegratedServer()) + nbt.getList(NbtKeys.ITEMS, Constants.NBT.TAG_COMPOUND).size() > 1) + //!DataManager.getInstance().hasIntegratedServer()) { if (entity instanceof AbstractHorseEntity) { @@ -286,9 +286,10 @@ else if (entity instanceof PiglinEntity) inv = null; } // Fix for saddled horse, no inv - else if (inv != null && inv.size() == 1 && - nbt.contains(NbtKeys.SADDLE) && - !DataManager.getInstance().hasIntegratedServer()) + else if (inv != null && + //inv.size() == 1 && + nbt.contains(NbtKeys.SADDLE)) + //!DataManager.getInstance().hasIntegratedServer()) { inv2 = InventoryUtils.getNbtInventoryHorseFix(nbt, -1, entity.getRegistryManager()); inv = null; @@ -296,8 +297,8 @@ else if (inv != null && inv.size() == 1 && // Fix for empty Villager/Piglin inv else if (inv != null && inv.size() == 8 && nbt.contains(NbtKeys.INVENTORY) && - !nbt.getList(NbtKeys.INVENTORY, Constants.NBT.TAG_COMPOUND).isEmpty() && - !DataManager.getInstance().hasIntegratedServer()) + !nbt.getList(NbtKeys.INVENTORY, Constants.NBT.TAG_COMPOUND).isEmpty()) + //!DataManager.getInstance().hasIntegratedServer()) { inv2 = InventoryUtils.getNbtInventory(nbt, 8, entity.getRegistryManager()); inv = null; @@ -305,7 +306,11 @@ else if (inv != null && inv.size() == 8 && else { inv2 = InventoryUtils.getNbtInventory(nbt, inv != null ? inv.size() : -1, entity.getRegistryManager()); - inv = null; + + if (inv2 != null) + { + inv = null; + } } //Tweakeroo.logger.error("getTargetInventoryFromEntity(): inv.size [{}], inv2.size [{}]", inv != null ? inv.size() : "null", inv2 != null ? inv2.size() : "null");