Skip to content

Commit

Permalink
Merge branch 'pre-rewrite/fabric/1.21.4' into pre-rewrite/fabric/DEV
Browse files Browse the repository at this point in the history
  • Loading branch information
sakura-ryoko authored Dec 4, 2024
2 parents 76d8ae1 + 0e3c6d2 commit 790d2f5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
6 changes: 5 additions & 1 deletion src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,25 +206,29 @@ else if (context.nbt() != null)
horseInv.setStack(1, inv.getStack(0));

InventoryOverlay.renderInventoryBackground(type, xInv, yInv, 1, 2, mc);
if (type == InventoryOverlay.InventoryRenderType.LLAMA)

if (type == InventoryOverlay.InventoryRenderType.LLAMA)
{
InventoryOverlay.renderLlamaArmorBackgroundSlots(horseInv, xInv + props.slotOffsetX, yInv + props.slotOffsetY, drawContext);
}
else
{
InventoryOverlay.renderHorseArmorBackgroundSlots(horseInv, xInv + props.slotOffsetX, yInv + props.slotOffsetY, drawContext);
}

InventoryOverlay.renderInventoryStacks(type, horseInv, xInv + props.slotOffsetX, yInv + props.slotOffsetY, 1, 0, 2, mc, drawContext);
xInv += 32 + 4;
}

if (totalSlots > 0)
{
InventoryOverlay.renderInventoryBackground(type, xInv, yInv, props.slotsPerRow, totalSlots, mc);

if (type == InventoryOverlay.InventoryRenderType.BREWING_STAND)
{
InventoryOverlay.renderBrewerBackgroundSlots(inv, xInv, yInv, drawContext);
}

InventoryOverlay.renderInventoryStacks(type, inv, xInv + props.slotOffsetX, yInv + props.slotOffsetY, props.slotsPerRow, firstSlot, totalSlots, lockedSlots, mc, drawContext);
}
}
Expand Down
28 changes: 11 additions & 17 deletions src/main/java/fi/dy/masa/tweakeroo/util/RayTraceUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public static HitResult getRayTraceFromEntity(World worldIn, Entity entityIn, bo
}

if (ctx != null &&
(ctx.inv() != null && !ctx.inv().isEmpty()))
(ctx.inv() != null && !ctx.inv().isEmpty()))
{
lastBlockEntityContext = Pair.of(pos, ctx);
return ctx;
Expand Down Expand Up @@ -208,17 +208,17 @@ 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;
}
// Non-Inventory/Empty Entity
else if (ctx != null &&
(ctx.type() == InventoryOverlay.InventoryRenderType.WOLF ||
ctx.type() == InventoryOverlay.InventoryRenderType.VILLAGER ||
ctx.type() == InventoryOverlay.InventoryRenderType.HORSE ||
ctx.type() == InventoryOverlay.InventoryRenderType.PLAYER))
(ctx.type() == InventoryOverlay.InventoryRenderType.WOLF ||
ctx.type() == InventoryOverlay.InventoryRenderType.VILLAGER ||
ctx.type() == InventoryOverlay.InventoryRenderType.HORSE ||
ctx.type() == InventoryOverlay.InventoryRenderType.PLAYER))
{
lastEntityContext = Pair.of(entity.getId(), ctx);
return ctx;
Expand Down Expand Up @@ -349,10 +349,8 @@ else if (entity instanceof PiglinEntity)

// Fix for empty horse inv
if (inv != null &&
//inv.size() == 1 &&
nbt.contains(NbtKeys.ITEMS) &&
nbt.getList(NbtKeys.ITEMS, Constants.NBT.TAG_COMPOUND).size() > 1)
//!DataManager.getInstance().hasIntegratedServer())
nbt.contains(NbtKeys.ITEMS) &&
nbt.getList(NbtKeys.ITEMS, Constants.NBT.TAG_COMPOUND).size() > 1)
{
if (entity instanceof AbstractHorseEntity)
{
Expand All @@ -365,19 +363,15 @@ 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 && nbt.contains(NbtKeys.SADDLE))
{
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.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 790d2f5

Please sign in to comment.