From 2e5d3f9a943fa457472555a28783adf1b9ccefc4 Mon Sep 17 00:00:00 2001 From: eligibbs Date: Sun, 3 May 2026 12:32:29 -0400 Subject: [PATCH] hopefully last fix for fluid rendering and handling, as well as saving for tank block and fossil cleaner block. need to confirm fabric tho --- .../custom/FossilCleanerBlockEntity.java | 5 +-- .../block/entity/custom/TankBlockEntity.java | 5 +-- .../renderer/TankBlockEntityRenderer.java | 32 +++++++++++++++---- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/common/src/main/java/net/cmr/jurassicrevived/block/entity/custom/FossilCleanerBlockEntity.java b/common/src/main/java/net/cmr/jurassicrevived/block/entity/custom/FossilCleanerBlockEntity.java index 372ee2f..ebd7a4f 100644 --- a/common/src/main/java/net/cmr/jurassicrevived/block/entity/custom/FossilCleanerBlockEntity.java +++ b/common/src/main/java/net/cmr/jurassicrevived/block/entity/custom/FossilCleanerBlockEntity.java @@ -154,11 +154,8 @@ public class FossilCleanerBlockEntity extends BlockEntity implements ExtendedMen tag.putInt("Prog", this.progress); tag.putInt("MaxProg", this.maxProgress); tag.put("Energy", energyStorage.saveNBT()); - tag.remove("Fluid"); if (!fluidStack.isEmpty()) { - CompoundTag fluidTag = new CompoundTag(); - fluidStack.write(registries, fluidTag); - tag.put("Fluid", fluidTag); + tag.put("Fluid", fluidStack.write(registries, new CompoundTag())); } } diff --git a/common/src/main/java/net/cmr/jurassicrevived/block/entity/custom/TankBlockEntity.java b/common/src/main/java/net/cmr/jurassicrevived/block/entity/custom/TankBlockEntity.java index 3a10a69..852aa95 100644 --- a/common/src/main/java/net/cmr/jurassicrevived/block/entity/custom/TankBlockEntity.java +++ b/common/src/main/java/net/cmr/jurassicrevived/block/entity/custom/TankBlockEntity.java @@ -270,11 +270,8 @@ public class TankBlockEntity extends BlockEntity implements ExtendedMenuProvider protected void saveAdditional(CompoundTag pTag, HolderLookup.Provider pRegistries) { super.saveAdditional(pTag, pRegistries); pTag.put("Inventory", itemHandler.createTag(pRegistries)); - pTag.remove("Fluid"); if (!fluidStack.isEmpty()) { - CompoundTag fluidTag = new CompoundTag(); - fluidStack.write(pRegistries, fluidTag); - pTag.put("Fluid", fluidTag); + pTag.put("Fluid", fluidStack.write(pRegistries, new CompoundTag())); } } diff --git a/common/src/main/java/net/cmr/jurassicrevived/block/renderer/TankBlockEntityRenderer.java b/common/src/main/java/net/cmr/jurassicrevived/block/renderer/TankBlockEntityRenderer.java index 64e5cc8..2393199 100644 --- a/common/src/main/java/net/cmr/jurassicrevived/block/renderer/TankBlockEntityRenderer.java +++ b/common/src/main/java/net/cmr/jurassicrevived/block/renderer/TankBlockEntityRenderer.java @@ -65,14 +65,14 @@ public class TankBlockEntityRenderer implements BlockEntityRenderer1.20.1 { + /*private static float spriteU(TextureAtlasSprite sprite, float normalizedU) { + return sprite.getU0() + (sprite.getU1() - sprite.getU0()) * normalizedU; + } + + private static float spriteV(TextureAtlasSprite sprite, float normalizedV) { + return sprite.getV0() + (sprite.getV1() - sprite.getV0()) * normalizedV; + } + *///?} else { + private static float spriteU(TextureAtlasSprite sprite, float normalizedU) { + return sprite.getU(normalizedU * 16); + } + + private static float spriteV(TextureAtlasSprite sprite, float normalizedV) { + return sprite.getV(normalizedV * 16); + } + //?} + private static void addQuad(VertexConsumer builder, PoseStack poseStack, float x0, float y0, float z0, float u0, float v0, float x1, float y1, float z1, float u1, float v1,