From 57181c29eb6665ec7611da83f90197d1b309923e Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Sat, 7 Dec 2024 16:33:23 -0500 Subject: [PATCH] allow using inventory Preview on Empty Block Entities. --- .../java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java | 2 +- .../java/fi/dy/masa/tweakeroo/util/RayTraceUtils.java | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java index 8a6e3640d..a24227f4f 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java @@ -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) { 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 54d60e2af..cbc48bef7 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/RayTraceUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/RayTraceUtils.java @@ -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; @@ -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; @@ -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;