diff --git a/src/main/java/ru/betterend/blocks/CavePumpkinBlock.java b/src/main/java/ru/betterend/blocks/CavePumpkinBlock.java index 6b1feb7e..166c13e8 100644 --- a/src/main/java/ru/betterend/blocks/CavePumpkinBlock.java +++ b/src/main/java/ru/betterend/blocks/CavePumpkinBlock.java @@ -58,7 +58,7 @@ public class CavePumpkinBlock extends BaseBlockNotFull implements IRenderTyped { VoxelShape top = Block.box(5, 15, 5, 11, 16, 11); SHAPE_BIG = Shapes.or(lantern, cap, top); - lantern = Block.box(1, 7, 1, 15, 13, 15); + lantern = Block.box(5, 7, 5, 11, 13, 11); cap = Block.box(4, 12, 4, 12, 15, 12); top = Block.box(6, 15, 6, 10, 16, 10); SHAPE_SMALL = Shapes.or(lantern, cap, top); diff --git a/src/main/java/ru/betterend/blocks/InfusionPedestal.java b/src/main/java/ru/betterend/blocks/InfusionPedestal.java index d1401a17..45c2e56e 100644 --- a/src/main/java/ru/betterend/blocks/InfusionPedestal.java +++ b/src/main/java/ru/betterend/blocks/InfusionPedestal.java @@ -6,12 +6,16 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.Nullable; import ru.betterend.blocks.basis.PedestalBlock; import ru.betterend.blocks.entities.InfusionPedestalEntity; +import ru.betterend.blocks.entities.PedestalBlockEntity; import ru.betterend.rituals.InfusionRitual; @SuppressWarnings("deprecation") @@ -73,6 +77,12 @@ public class InfusionPedestal extends PedestalBlock { return super.getShape(state, world, pos, context); } + @Override + @Nullable + public BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType blockEntityType) { + return InfusionPedestalEntity::tickEnity; + } + static { VoxelShape basinUp = Block.box(2, 3, 2, 14, 4, 14); VoxelShape basinDown = Block.box(0, 0, 0, 16, 3, 16); diff --git a/src/main/java/ru/betterend/blocks/entities/InfusionPedestalEntity.java b/src/main/java/ru/betterend/blocks/entities/InfusionPedestalEntity.java index 1136d154..b4f67dce 100644 --- a/src/main/java/ru/betterend/blocks/entities/InfusionPedestalEntity.java +++ b/src/main/java/ru/betterend/blocks/entities/InfusionPedestalEntity.java @@ -3,6 +3,7 @@ package ru.betterend.blocks.entities; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import ru.betterend.registry.EndBlockEntities; import ru.betterend.rituals.InfusionRitual; @@ -26,15 +27,6 @@ public class InfusionPedestalEntity extends PedestalBlockEntity { } } - public void setLevelAndPosition(Level world, BlockPos pos) { - if (hasRitual()) { - linkedRitual.setLocation(world, pos); - } - else { - linkRitual(new InfusionRitual(this, world, pos)); - } - } - public void linkRitual(InfusionRitual ritual) { linkedRitual = ritual; } @@ -47,13 +39,6 @@ public class InfusionPedestalEntity extends PedestalBlockEntity { return linkedRitual != null; } - public static void tick(Level tickLevel, BlockPos tickPos, BlockState tickState, InfusionPedestalEntity blockEntity) { - if (blockEntity.hasRitual()) { - blockEntity.linkedRitual.tick(); - } - PedestalBlockEntity.tick(tickLevel, tickPos, tickState, blockEntity); - } - @Override public CompoundTag save(CompoundTag tag) { if (hasRitual()) { @@ -70,4 +55,14 @@ public class InfusionPedestalEntity extends PedestalBlockEntity { linkedRitual.fromTag(tag.getCompound("ritual")); } } + + public static void tickEnity(Level level, BlockPos blockPos, BlockState blockState, T uncastedEntity) { + if (uncastedEntity instanceof InfusionPedestalEntity) { + InfusionPedestalEntity blockEntity = (InfusionPedestalEntity) uncastedEntity; + if (blockEntity.hasRitual()) { + blockEntity.linkedRitual.tick(); + } + PedestalBlockEntity.tick(level, blockPos, blockState, blockEntity); + } + } }