diff --git a/src/main/java/io/redspace/ironsspellbooks/block/alchemist_cauldron/AlchemistCauldronBlock.java b/src/main/java/io/redspace/ironsspellbooks/block/alchemist_cauldron/AlchemistCauldronBlock.java index 83cc1e05d..1153a6c00 100644 --- a/src/main/java/io/redspace/ironsspellbooks/block/alchemist_cauldron/AlchemistCauldronBlock.java +++ b/src/main/java/io/redspace/ironsspellbooks/block/alchemist_cauldron/AlchemistCauldronBlock.java @@ -8,27 +8,21 @@ import io.redspace.ironsspellbooks.registries.ItemRegistry; import io.redspace.ironsspellbooks.util.ParticleHelper; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.BaseEntityBlock; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.RenderShape; 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.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.phys.BlockHitResult; @@ -42,8 +36,6 @@ public class AlchemistCauldronBlock extends BaseEntityBlock { public AlchemistCauldronBlock() { super(Properties.ofFullCopy(Blocks.CAULDRON).lightLevel((blockState) -> 3)); - this.registerDefaultState(this.stateDefinition.any().setValue(LIT, true)/*.setValue(LEVEL, 0)*/); - } // private static final VoxelShape INSIDE = box(2, 4, 2, 14, 16, 14); @@ -56,9 +48,6 @@ public AlchemistCauldronBlock() { //magic shape. see comment above for legible shape private static final VoxelShape SHAPE = Shapes.or(Shapes.or(box(0, 0, 4, 16, 2, 6), box(0, 0, 10, 16, 2, 12), box(4, 0, 0, 6, 2, 16), box(10, 0, 0, 12, 2, 16)), Shapes.join(Shapes.or(Shapes.join(box(0, 2, 0, 16, 16, 16), box(0, 12, 0, 16, 14, 16), BooleanOp.ONLY_FIRST), box(1, 12, 1, 15, 14, 15)), box(2, 4, 2, 14, 16, 14), BooleanOp.ONLY_FIRST)); - public static final BooleanProperty LIT = BlockStateProperties.LIT; - //public static final int MAX_LEVELS = 4; - //public static final IntegerProperty LEVEL = IntegerProperty.create("level", 0, MAX_LEVELS); @Override public BlockEntityTicker getTicker(Level pLevel, BlockState pState, BlockEntityType pBlockEntityType) { @@ -70,11 +59,6 @@ protected static BlockEntityTicker createTicker(Level return pLevel.isClientSide ? null : createTickerHelper(pServerType, pClientType, AlchemistCauldronTile::serverTick); } - @Override - protected void createBlockStateDefinition(StateDefinition.Builder builder) { - builder.add(LIT/*, LEVEL*/); - } - public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) { return SHAPE; } @@ -91,14 +75,12 @@ protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Lev public void entityInside(BlockState blockState, Level level, BlockPos pos, Entity entity) { if (entity.tickCount % 20 == 0) { if (level.getBlockEntity(pos) instanceof AlchemistCauldronTile cauldronTile) { - if (AlchemistCauldronBlock.isLit(blockState)) { if (entity instanceof LivingEntity livingEntity && livingEntity.hurt(DamageSources.get(level, ISSDamageTypes.CAULDRON), 2)) { MagicManager.spawnParticles(level, ParticleHelper.BLOOD, entity.getX(), entity.getY() + entity.getBbHeight() / 2, entity.getZ(), 20, .05, .05, .05, .1, false); if (cauldronTile.addToOutput(new ItemStack(ItemRegistry.BLOOD_VIAL.get()))) { cauldronTile.setChanged(); } } - } } } super.entityInside(blockState, level, pos, entity); @@ -110,24 +92,6 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new AlchemistCauldronTile(pos, state); } - @Override - @SuppressWarnings({"all"}) - public BlockState updateShape(BlockState state, Direction direction, BlockState neighborstate, LevelAccessor level, BlockPos pos, BlockPos pNeighborPos) { - if (direction.equals(Direction.DOWN)) { - level.setBlock(pos, state.setValue(LIT, isFireSource(neighborstate)), 11); - } - return super.updateShape(state, direction, neighborstate, level, pos, pNeighborPos); - } - - @Nullable - @Override - public BlockState getStateForPlacement(BlockPlaceContext pContext) { - LevelAccessor levelaccessor = pContext.getLevel(); - BlockPos blockpos = pContext.getClickedPos().below(); - boolean flag = isFireSource(levelaccessor.getBlockState(blockpos)); - return this.defaultBlockState().setValue(LIT, flag); - } - @Override public void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState pNewState, boolean pIsMoving) { if (pState.getBlock() != pNewState.getBlock()) { @@ -145,15 +109,6 @@ public void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState return RenderShape.MODEL; } - public boolean isFireSource(BlockState blockState) { - //TODO: its a magic cauldron. why does it need a fire source? - return true;//CampfireBlock.isLitCampfire(blockState); - } - - public static boolean isLit(BlockState blockState) { - return blockState.hasProperty(LIT) && blockState.getValue(LIT); - } - public static final MapCodec CODEC = simpleCodec((t) -> new AlchemistCauldronBlock()); @Override diff --git a/src/main/java/io/redspace/ironsspellbooks/block/alchemist_cauldron/AlchemistCauldronTile.java b/src/main/java/io/redspace/ironsspellbooks/block/alchemist_cauldron/AlchemistCauldronTile.java index cc4c79ae7..545a52bf2 100644 --- a/src/main/java/io/redspace/ironsspellbooks/block/alchemist_cauldron/AlchemistCauldronTile.java +++ b/src/main/java/io/redspace/ironsspellbooks/block/alchemist_cauldron/AlchemistCauldronTile.java @@ -534,7 +534,7 @@ public void setItem(int pSlot, ItemStack pStack) { } public boolean isBoiling(BlockState blockState) { - return AlchemistCauldronBlock.isLit(blockState) && getLiquidLevel() >= 1; + return getLiquidLevel() >= 1; } public int getLiquidLevel() { diff --git a/src/main/resources/assets/irons_spellbooks/blockstates/alchemist_cauldron.json b/src/main/resources/assets/irons_spellbooks/blockstates/alchemist_cauldron.json index e4f76ca3d..1e22e560f 100644 --- a/src/main/resources/assets/irons_spellbooks/blockstates/alchemist_cauldron.json +++ b/src/main/resources/assets/irons_spellbooks/blockstates/alchemist_cauldron.json @@ -1,9 +1,6 @@ { "variants": { - "lit=false": { - "model": "irons_spellbooks:block/alchemist_cauldron" - }, - "lit=true": { + "": { "model": "irons_spellbooks:block/alchemist_cauldron" } }