Skip to content

Commit

Permalink
allow using inventory Preview on Empty Block Entities.
Browse files Browse the repository at this point in the history
  • Loading branch information
sakura-ryoko committed Dec 7, 2024
1 parent 73c3ab8 commit 57181c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ else if (context.nbt() != null)
}
}

//Tweakeroo.logger.warn("renderInventoryOverlay: type [{}] // Nbt Type [{}]", type.toString(), context.nbt() != null ? InventoryOverlay.getInventoryType(context.nbt()) : "INVALID");
//Tweakeroo.logger.warn("renderInventoryOverlay: type [{}] // Nbt Type [{}] // inv.isEmpty({})", type.toString(), context.nbt() != null ? InventoryOverlay.getInventoryType(context.nbt()) : "INVALID", inv.isEmpty());

if (context.be() != null && context.be().getCachedState().getBlock() instanceof ShulkerBoxBlock sbb)
{
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/fi/dy/masa/tweakeroo/util/RayTraceUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ public static HitResult getRayTraceFromEntity(World worldIn, Entity entityIn, bo
lastBlockEntityContext = null;
}

if (ctx != null &&
(ctx.inv() != null && !ctx.inv().isEmpty()))
if (ctx != null && ctx.inv() != null)
{
lastBlockEntityContext = Pair.of(pos, ctx);
return ctx;
Expand Down Expand Up @@ -208,7 +207,7 @@ else if (trace.getType() == HitResult.Type.ENTITY)
}

if (ctx != null &&
(ctx.inv() != null && !ctx.inv().isEmpty()))
(ctx.inv() != null && !ctx.inv().isEmpty()))
{
lastEntityContext = Pair.of(entity.getId(), ctx);
return ctx;
Expand Down Expand Up @@ -370,8 +369,8 @@ else if (inv != null && nbt.contains(NbtKeys.SADDLE))
}
// 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())
nbt.contains(NbtKeys.INVENTORY) &&
!nbt.getList(NbtKeys.INVENTORY, Constants.NBT.TAG_COMPOUND).isEmpty())
{
inv2 = InventoryUtils.getNbtInventory(nbt, 8, entity.getRegistryManager());
inv = null;
Expand Down

0 comments on commit 57181c2

Please sign in to comment.