diff --git a/src/main/java/io/github/cottonmc/templates/api/TemplateInteractionUtil.java b/src/main/java/io/github/cottonmc/templates/api/TemplateInteractionUtil.java index eceadcf..d3d542d 100644 --- a/src/main/java/io/github/cottonmc/templates/api/TemplateInteractionUtil.java +++ b/src/main/java/io/github/cottonmc/templates/api/TemplateInteractionUtil.java @@ -55,6 +55,10 @@ public class TemplateInteractionUtil { return in; } + public static @Nullable BlockState modifyPlacementState(@Nullable BlockState in, ItemPlacementContext ctx) { + return TemplateEntity.weirdNbtLightLevelStuff(in, ctx.getStack()); + } + public static ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { if(!(world.getBlockEntity(pos) instanceof TemplateEntity be)) return ActionResult.PASS; if(!player.canModifyBlocks() || !world.canPlayerModifyAt(player, pos)) return ActionResult.PASS; diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateBlock.java index 754ee16..ae7b321 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateBlock.java @@ -10,6 +10,7 @@ import net.minecraft.block.ShapeContext; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.state.StateManager; import net.minecraft.util.ActionResult; @@ -38,6 +39,12 @@ public class TemplateBlock extends Block implements BlockEntityProvider { super.appendProperties(TemplateInteractionUtil.appendProperties(builder)); } + @Nullable + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return TemplateInteractionUtil.modifyPlacementState(super.getPlacementState(ctx), ctx); + } + @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateButtonBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateButtonBlock.java index 97638f9..72cb5a1 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateButtonBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateButtonBlock.java @@ -12,6 +12,7 @@ import net.minecraft.block.ShapeContext; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.state.StateManager; import net.minecraft.util.ActionResult; @@ -45,6 +46,12 @@ public class TemplateButtonBlock extends ButtonBlock implements BlockEntityProvi super.appendProperties(TemplateInteractionUtil.appendProperties(builder)); } + @Nullable + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return TemplateInteractionUtil.modifyPlacementState(super.getPlacementState(ctx), ctx); + } + @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateCandleBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateCandleBlock.java index 6fa0fc2..4bc9318 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateCandleBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateCandleBlock.java @@ -12,6 +12,7 @@ import net.minecraft.block.ShapeContext; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.state.StateManager; import net.minecraft.util.ActionResult; @@ -44,6 +45,12 @@ public class TemplateCandleBlock extends CandleBlock implements BlockEntityProvi super.appendProperties(TemplateInteractionUtil.appendProperties(builder)); } + @Nullable + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return TemplateInteractionUtil.modifyPlacementState(super.getPlacementState(ctx), ctx); + } + @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateCarpetBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateCarpetBlock.java index 2ffa42f..4d36fa6 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateCarpetBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateCarpetBlock.java @@ -11,6 +11,7 @@ import net.minecraft.block.ShapeContext; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.state.StateManager; import net.minecraft.util.ActionResult; @@ -40,6 +41,12 @@ public class TemplateCarpetBlock extends CarpetBlock implements BlockEntityProvi super.appendProperties(TemplateInteractionUtil.appendProperties(builder)); } + @Nullable + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return TemplateInteractionUtil.modifyPlacementState(super.getPlacementState(ctx), ctx); + } + @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateDoorBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateDoorBlock.java index cea9df5..9eafe74 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateDoorBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateDoorBlock.java @@ -7,6 +7,7 @@ import net.minecraft.block.*; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.state.StateManager; import net.minecraft.util.ActionResult; @@ -36,6 +37,12 @@ public class TemplateDoorBlock extends DoorBlock implements BlockEntityProvider super.appendProperties(TemplateInteractionUtil.appendProperties(builder)); } + @Nullable + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return TemplateInteractionUtil.modifyPlacementState(super.getPlacementState(ctx), ctx); + } + @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateEntity.java b/src/main/java/io/github/cottonmc/templates/block/TemplateEntity.java index 5c508aa..3627a45 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateEntity.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateEntity.java @@ -1,6 +1,7 @@ package io.github.cottonmc.templates.block; import io.github.cottonmc.templates.Templates; +import io.github.cottonmc.templates.api.TemplateInteractionUtil; import io.github.cottonmc.templates.api.ThemeableBlockEntity; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -33,8 +34,8 @@ public class TemplateEntity extends BlockEntity implements ThemeableBlockEntity protected static final int IS_SOLID_MASK = 0b00010000; protected static final byte DEFAULT_BITFIELD = IS_SOLID_MASK; //brand-new templates shall be solid - //Using one-character names is a little brash, like, what if there's a mod that adds crap to the NBT of ever - //block entity, and uses short names for the same reason I am (there are lots and lots of block entities). + //Using one-character names is a little brash, like, what if there's a mod that adds crap to the NBT of every + //block entity, and uses short names for the same reason I am (because there are lots and lots of block entities)? //Kinda doubt it? protected static final String BLOCKSTATE_KEY = "s"; protected static final String BITFIELD_KEY = "b"; @@ -92,6 +93,27 @@ public class TemplateEntity extends BlockEntity implements ThemeableBlockEntity else return NbtHelper.toBlockState(Registries.BLOCK.getReadOnlyWrapper(), subCompound); } + //Awkward: usually the BlockState is the source of truth for things like the "emits light" blockstate, but if you + //ctrl-pick a glowing block and place it, it should still be glowing. This is some hacky shit that guesses the value of + //the LIGHT blockstate based off information in the NBT tag, and also prevents bugginess like "the blockstate is not + //glowing but the copied NBT thinks glowstone dust was already added, so it refuses to accept more dust" + public static @Nullable BlockState weirdNbtLightLevelStuff(@Nullable BlockState state, ItemStack stack) { + if(state == null || stack == null) return state; + + NbtCompound blockEntityTag = BlockItem.getBlockEntityNbt(stack); + if(blockEntityTag == null) return state; + + if(state.contains(TemplateInteractionUtil.LIGHT)) { + state = state.with(TemplateInteractionUtil.LIGHT, + blockEntityTag.getBoolean("spentglow") || //2.0.4 + ((blockEntityTag.contains(BITFIELD_KEY) ? blockEntityTag.getByte(BITFIELD_KEY) : DEFAULT_BITFIELD) & SPENT_GLOWSTONE_DUST_MASK) != 0 || //2.0.5 + readStateFromItem(stack).getLuminance() != 0 //glowstone dust wasn't manually added, the block just emits light + ); + } + + return state; + } + //RenderAttachmentBlockEntity impl. Note that ThemeableBlockEntity depends on this returning a BlockState object. @Override public BlockState getRenderAttachmentData() { diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateFenceBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateFenceBlock.java index 1715ea8..b86df28 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateFenceBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateFenceBlock.java @@ -11,6 +11,7 @@ import net.minecraft.block.ShapeContext; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.state.StateManager; import net.minecraft.util.ActionResult; @@ -40,6 +41,12 @@ public class TemplateFenceBlock extends FenceBlock implements BlockEntityProvide super.appendProperties(TemplateInteractionUtil.appendProperties(builder)); } + @Nullable + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return TemplateInteractionUtil.modifyPlacementState(super.getPlacementState(ctx), ctx); + } + @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateFenceGateBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateFenceGateBlock.java index 0478b88..5ed502a 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateFenceGateBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateFenceGateBlock.java @@ -13,6 +13,7 @@ import net.minecraft.block.WoodType; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.state.StateManager; import net.minecraft.util.ActionResult; @@ -41,6 +42,12 @@ public class TemplateFenceGateBlock extends FenceGateBlock implements BlockEntit return Templates.TEMPLATE_BLOCK_ENTITY.instantiate(pos, state); } + @Nullable + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return TemplateInteractionUtil.modifyPlacementState(super.getPlacementState(ctx), ctx); + } + @Override protected void appendProperties(StateManager.Builder builder) { super.appendProperties(TemplateInteractionUtil.appendProperties(builder)); diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateLeverBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateLeverBlock.java index 3b1c478..e417609 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateLeverBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateLeverBlock.java @@ -11,6 +11,7 @@ import net.minecraft.block.ShapeContext; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.state.StateManager; import net.minecraft.util.ActionResult; @@ -35,6 +36,12 @@ public class TemplateLeverBlock extends LeverBlock implements BlockEntityProvide return Templates.TEMPLATE_BLOCK_ENTITY.instantiate(pos, state); } + @Nullable + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return TemplateInteractionUtil.modifyPlacementState(super.getPlacementState(ctx), ctx); + } + @Override protected void appendProperties(StateManager.Builder builder) { super.appendProperties(TemplateInteractionUtil.appendProperties(builder)); diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplatePaneBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplatePaneBlock.java index d33bd9a..b085185 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplatePaneBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplatePaneBlock.java @@ -11,6 +11,7 @@ import net.minecraft.block.ShapeContext; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.state.StateManager; import net.minecraft.util.ActionResult; @@ -34,6 +35,12 @@ public class TemplatePaneBlock extends PaneBlock implements BlockEntityProvider return Templates.TEMPLATE_BLOCK_ENTITY.instantiate(pos, state); } + @Nullable + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return TemplateInteractionUtil.modifyPlacementState(super.getPlacementState(ctx), ctx); + } + @Override protected void appendProperties(StateManager.Builder builder) { super.appendProperties(TemplateInteractionUtil.appendProperties(builder)); diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplatePostBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplatePostBlock.java index b575385..d182ae9 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplatePostBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplatePostBlock.java @@ -28,6 +28,7 @@ public class TemplatePostBlock extends WaterloggableTemplateBlock { @Override public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { + //not calling TemplateInteractionUtil.modifyPlacementState because we extend WaterloggableTemplateBlock which already does BlockState sup = super.getPlacementState(ctx); if(sup != null) sup = sup.with(Properties.AXIS, ctx.getSide().getAxis()); return sup; diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplatePressurePlateBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplatePressurePlateBlock.java index 8fef171..d789f69 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplatePressurePlateBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplatePressurePlateBlock.java @@ -12,6 +12,7 @@ import net.minecraft.block.ShapeContext; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.state.StateManager; import net.minecraft.util.ActionResult; @@ -44,6 +45,12 @@ public class TemplatePressurePlateBlock extends PressurePlateBlock implements Bl super.appendProperties(TemplateInteractionUtil.appendProperties(builder)); } + @Nullable + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return TemplateInteractionUtil.modifyPlacementState(super.getPlacementState(ctx), ctx); + } + @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateSlabBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateSlabBlock.java index 186fd43..cecf35b 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateSlabBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateSlabBlock.java @@ -11,6 +11,7 @@ import net.minecraft.block.SlabBlock; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.state.StateManager; import net.minecraft.util.ActionResult; @@ -40,6 +41,12 @@ public class TemplateSlabBlock extends SlabBlock implements BlockEntityProvider super.appendProperties(TemplateInteractionUtil.appendProperties(builder)); } + @Nullable + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return TemplateInteractionUtil.modifyPlacementState(super.getPlacementState(ctx), ctx); + } + @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateSlopeBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateSlopeBlock.java index cafd5b0..ceb3faa 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateSlopeBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateSlopeBlock.java @@ -39,6 +39,7 @@ public class TemplateSlopeBlock extends WaterloggableTemplateBlock { @Nullable @Override public BlockState getPlacementState(ItemPlacementContext ctx) { + //not calling TemplateInteractionUtil.modifyPlacementState because we extend TemplateBlock which already does BlockState sup = super.getPlacementState(ctx); if(sup != null) sup = sup.with(EDGE, Edge.stairslikePlacement(ctx)); diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateStairsBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateStairsBlock.java index a0a573f..b26310d 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateStairsBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateStairsBlock.java @@ -12,6 +12,7 @@ import net.minecraft.block.StairsBlock; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.state.StateManager; import net.minecraft.util.ActionResult; @@ -45,6 +46,12 @@ public class TemplateStairsBlock extends StairsBlock implements BlockEntityProvi super.appendProperties(TemplateInteractionUtil.appendProperties(builder)); } + @Nullable + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return TemplateInteractionUtil.modifyPlacementState(super.getPlacementState(ctx), ctx); + } + @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateTrapdoorBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateTrapdoorBlock.java index 1c12f99..a50b038 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateTrapdoorBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateTrapdoorBlock.java @@ -13,6 +13,7 @@ import net.minecraft.block.TrapdoorBlock; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.state.StateManager; import net.minecraft.util.ActionResult; @@ -45,6 +46,12 @@ public class TemplateTrapdoorBlock extends TrapdoorBlock implements BlockEntityP super.appendProperties(TemplateInteractionUtil.appendProperties(builder)); } + @Nullable + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return TemplateInteractionUtil.modifyPlacementState(super.getPlacementState(ctx), ctx); + } + @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateWallBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateWallBlock.java index 0f45583..12c4ce1 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateWallBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateWallBlock.java @@ -13,6 +13,7 @@ import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.enums.WallShape; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.state.StateManager; import net.minecraft.util.ActionResult; @@ -48,6 +49,12 @@ public class TemplateWallBlock extends WallBlock implements BlockEntityProvider super.appendProperties(TemplateInteractionUtil.appendProperties(builder)); } + @Nullable + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return TemplateInteractionUtil.modifyPlacementState(super.getPlacementState(ctx), ctx); + } + @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); diff --git a/src/main/java/io/github/cottonmc/templates/block/WaterloggableTemplateBlock.java b/src/main/java/io/github/cottonmc/templates/block/WaterloggableTemplateBlock.java index eeb7b5d..e03baba 100644 --- a/src/main/java/io/github/cottonmc/templates/block/WaterloggableTemplateBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/WaterloggableTemplateBlock.java @@ -28,6 +28,7 @@ public class WaterloggableTemplateBlock extends TemplateBlock implements Waterlo @Nullable @Override public BlockState getPlacementState(ItemPlacementContext ctx) { + //not calling TemplateInteractionUtil.modifyPlacementState because we extend TemplateBlock which already does BlockState sup = super.getPlacementState(ctx); if(sup != null) sup = sup.with(Properties.WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).isOf(Fluids.WATER)); return sup;