Skip to content

Commit

Permalink
fix inventoryPreview for OP-only mode
Browse files Browse the repository at this point in the history
  • Loading branch information
sakura-ryoko committed Nov 2, 2024
1 parent 1a9cf37 commit 4714cff
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/main/java/fi/dy/masa/tweakeroo/util/RayTraceUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand All @@ -286,26 +286,31 @@ 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;
}
// 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;
}
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");
Expand Down

0 comments on commit 4714cff

Please sign in to comment.