From 2122ba24c4d4d23d109ccc3586da0406e43ec910 Mon Sep 17 00:00:00 2001 From: NewJumper Date: Mon, 20 May 2024 16:03:23 -0500 Subject: [PATCH] rotation is no longer saved in crystallized amber's nbt tag --- src/main/java/com/kyanite/deeperdarker/DeeperDarker.java | 1 - .../client/render/CrystallizedAmberBlockRenderer.java | 4 +++- .../blocks/entity/CrystallizedAmberBlockEntity.java | 9 ++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/kyanite/deeperdarker/DeeperDarker.java b/src/main/java/com/kyanite/deeperdarker/DeeperDarker.java index fabc989ee..3de7c6af4 100644 --- a/src/main/java/com/kyanite/deeperdarker/DeeperDarker.java +++ b/src/main/java/com/kyanite/deeperdarker/DeeperDarker.java @@ -187,7 +187,6 @@ public static void breakEvent(final BlockEvent.BreakEvent event) { CompoundTag tag = new CompoundTag(); tag.put("item", blockEntity.getLoot().save(new CompoundTag())); tag.putBoolean("leech", blockEntity.fossilizedEntity); - tag.putFloat("rotation", blockEntity.rotation); ItemStack stack = new ItemStack(DDBlocks.CRYSTALLIZED_AMBER.get()); BlockItem.setBlockEntityData(stack, DDBlockEntities.CRYSTALLIZED_AMBER.get(), tag); diff --git a/src/main/java/com/kyanite/deeperdarker/client/render/CrystallizedAmberBlockRenderer.java b/src/main/java/com/kyanite/deeperdarker/client/render/CrystallizedAmberBlockRenderer.java index 0819649bd..49b746e5a 100644 --- a/src/main/java/com/kyanite/deeperdarker/client/render/CrystallizedAmberBlockRenderer.java +++ b/src/main/java/com/kyanite/deeperdarker/client/render/CrystallizedAmberBlockRenderer.java @@ -11,6 +11,7 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.ItemDisplayContext; public class CrystallizedAmberBlockRenderer implements BlockEntityRenderer { @@ -29,7 +30,8 @@ public void render(CrystallizedAmberBlockEntity pBlockEntity, float pPartialTick pPoseStack.pushPose(); pPoseStack.translate(0.5f, 0.5f, 0.5f); pPoseStack.mulPose(Axis.XP.rotationDegrees(-40f)); - pPoseStack.mulPose(Axis.YP.rotationDegrees(pBlockEntity.rotation)); + RandomSource random = RandomSource.create(pBlockEntity.getBlockPos().asLong() / (pBlockEntity.getBlockPos().getX() + pBlockEntity.getBlockPos().getZ())); + pPoseStack.mulPose(Axis.YP.rotationDegrees(random.nextFloat() * 180f)); if(pBlockEntity.fossilizedEntity) { pPoseStack.scale(0.9f, 0.9f, 0.9f); SculkLeech leech = new SculkLeech(DDEntities.SCULK_LEECH.get(), pBlockEntity.getLevel()); diff --git a/src/main/java/com/kyanite/deeperdarker/content/blocks/entity/CrystallizedAmberBlockEntity.java b/src/main/java/com/kyanite/deeperdarker/content/blocks/entity/CrystallizedAmberBlockEntity.java index e57310591..7de2095de 100644 --- a/src/main/java/com/kyanite/deeperdarker/content/blocks/entity/CrystallizedAmberBlockEntity.java +++ b/src/main/java/com/kyanite/deeperdarker/content/blocks/entity/CrystallizedAmberBlockEntity.java @@ -34,9 +34,11 @@ public void generateFossil(Level level, BlockPos pos) { if(fossilizedEntity || loot != ItemStack.EMPTY) return; RandomSource random = RandomSource.create(pos.asLong()); - if(random.nextFloat() < 0.15f) fossilizedEntity = true; rotation = random.nextFloat() * 180; - if(fossilizedEntity) return; + if(random.nextFloat() < 0.15f) { + fossilizedEntity = true; + return; + } LootTable table = level.getServer().getLootData().getLootTable(DDChestLoot.CRYSTALLIZED_AMBER); List list = table.getRandomItems(new LootParams.Builder((ServerLevel) level).withParameter(LootContextParams.ORIGIN, this.getBlockPos().getCenter()).withParameter(LootContextParams.BLOCK_ENTITY, this).create(LootContextParamSets.CHEST)); @@ -58,7 +60,6 @@ public Packet getUpdatePacket() { CompoundTag tag = new CompoundTag(); tag.put("item", this.loot.save(new CompoundTag())); tag.putBoolean("leech", this.fossilizedEntity); - tag.putFloat("rotation", this.rotation); return tag; } @@ -66,13 +67,11 @@ public Packet getUpdatePacket() { public void load(CompoundTag pTag) { if(pTag.contains("item")) this.loot = ItemStack.of(pTag.getCompound("item")); if(pTag.contains("leech")) this.fossilizedEntity = pTag.getBoolean("leech"); - if(pTag.contains("rotation")) this.rotation = pTag.getFloat("rotation"); } @Override protected void saveAdditional(CompoundTag pTag) { pTag.put("item", this.loot.save(new CompoundTag())); pTag.putBoolean("leech", this.fossilizedEntity); - pTag.putFloat("rotation", this.rotation); } }