diff --git a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightBlockMaterial.java b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightBlockMaterial.java index c453e5b90e..8e87c883c3 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightBlockMaterial.java +++ b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightBlockMaterial.java @@ -1,186 +1,126 @@ package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R2; +import com.fastasyncworldedit.bukkit.adapter.BukkitBlockMaterial; import com.fastasyncworldedit.core.nbt.FaweCompoundTag; -import com.sk89q.util.ReflectionUtil; -import com.sk89q.worldedit.bukkit.adapter.Refraction; -import com.sk89q.worldedit.world.registry.BlockMaterial; import net.minecraft.core.BlockPos; import net.minecraft.world.level.EmptyBlockGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; -import net.minecraft.world.level.block.LiquidBlock; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.material.PushReaction; import org.bukkit.craftbukkit.v1_20_R2.block.data.CraftBlockData; -import javax.annotation.Nullable; +public class PaperweightBlockMaterial extends BukkitBlockMaterial { -public class PaperweightBlockMaterial implements BlockMaterial { - - private final Block block; - private final BlockState blockState; - private final boolean isTranslucent; - private final CraftBlockData craftBlockData; - private final org.bukkit.Material craftMaterial; private final int opacity; - private final FaweCompoundTag tile; public PaperweightBlockMaterial(Block block) { this(block, block.defaultBlockState()); } public PaperweightBlockMaterial(Block block, BlockState blockState) { - this.block = block; - this.blockState = blockState; - this.craftBlockData = CraftBlockData.fromData(blockState); - this.craftMaterial = craftBlockData.getMaterial(); - BlockBehaviour.Properties blockInfo = ReflectionUtil.getField(BlockBehaviour.class, block, - Refraction.pickName("properties", "aN")); - this.isTranslucent = !(boolean) ReflectionUtil.getField(BlockBehaviour.Properties.class, blockInfo, - Refraction.pickName("canOcclude", "m") - ); - opacity = blockState.getLightBlock(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); - BlockEntity tileEntity = !(block instanceof EntityBlock) ? null : ((EntityBlock) block).newBlockEntity( - BlockPos.ZERO, - blockState - ); - tile = tileEntity == null - ? null - : PaperweightGetBlocks.NMS_TO_TILE.apply(tileEntity); - } - - public Block getBlock() { - return block; + super(block, blockState, CraftBlockData.fromData(blockState)); + this.opacity = blockState.getLightBlock(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); } - public BlockState getState() { - return blockState; - } - - public CraftBlockData getCraftBlockData() { - return craftBlockData; + @Override + protected FaweCompoundTag tileForBlock(final Block block) { + BlockEntity tileEntity = !(block instanceof EntityBlock eb) ? null : eb.newBlockEntity(BlockPos.ZERO, this.blockState); + return tileEntity == null ? null : PaperweightGetBlocks.NMS_TO_TILE.apply(tileEntity); } @Override public boolean isAir() { - return blockState.isAir(); + return this.blockState.isAir(); } @Override public boolean isFullCube() { - return Block.isShapeFullBlock(blockState.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); + return Block.isShapeFullBlock(this.blockState.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); } @Override public boolean isOpaque() { - return blockState.isOpaque(); + return this.blockState.canOcclude(); } @Override public boolean isPowerSource() { - return blockState.isSignalSource(); + return this.blockState.isSignalSource(); } @Override public boolean isLiquid() { - // TODO: Better check ? - return block instanceof LiquidBlock; + return !this.blockState.getFluidState().is(Fluids.EMPTY); } @Override public boolean isSolid() { - // TODO: Replace - return blockState.isSolid(); + return this.blockState.isSolidRender(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); } @Override public float getHardness() { - return craftBlockData.getState().destroySpeed; + return this.blockState.destroySpeed; } @Override public float getResistance() { - return block.getExplosionResistance(); + return this.block.getExplosionResistance(); } @Override public float getSlipperiness() { - return block.getFriction(); + return this.block.getFriction(); } @Override public int getLightValue() { - return blockState.getLightEmission(); + return this.blockState.getLightEmission(); } @Override public int getLightOpacity() { - return opacity; + return this.opacity; } @Override public boolean isFragileWhenPushed() { - return blockState.getPistonPushReaction() == PushReaction.DESTROY; + return this.blockState.getPistonPushReaction() == PushReaction.DESTROY; } @Override public boolean isUnpushable() { - return blockState.getPistonPushReaction() == PushReaction.BLOCK; + return this.blockState.getPistonPushReaction() == PushReaction.BLOCK; } @Override public boolean isTicksRandomly() { - return block.isRandomlyTicking(blockState); + return this.blockState.isRandomlyTicking(); } @SuppressWarnings("deprecation") @Override public boolean isMovementBlocker() { - return blockState.blocksMotion(); - } - - @Override - public boolean isBurnable() { - return craftMaterial.isBurnable(); - } - - @Override - public boolean isToolRequired() { - // Removed in 1.16.1, this is not present in higher versions - return false; + return this.blockState.blocksMotion(); } @Override public boolean isReplacedDuringPlacement() { - return blockState.canBeReplaced(); + return this.blockState.canBeReplaced(); } @Override public boolean isTranslucent() { - return isTranslucent; - } - - @Override - public boolean hasContainer() { - return block instanceof EntityBlock; - } - - @Override - public boolean isTile() { - return block instanceof EntityBlock; - } - - @Override - public @Nullable FaweCompoundTag defaultTile() { - return tile; + return !this.blockState.canOcclude(); } @Override public int getMapColor() { // rgb field - return block.defaultMapColor().col; + return this.block.defaultMapColor().col; } } diff --git a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightFaweAdapter.java index af676c0fd1..d5071a1bf7 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightFaweAdapter.java @@ -347,7 +347,7 @@ public Component getRichItemName(BaseItemStack itemStack) { @Override public OptionalInt getInternalBlockStateId(BlockState state) { PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); - net.minecraft.world.level.block.state.BlockState mcState = material.getCraftBlockData().getState(); + net.minecraft.world.level.block.state.BlockState mcState = material.getState(); return OptionalInt.of(Block.BLOCK_STATE_REGISTRY.getId(mcState)); } @@ -440,7 +440,7 @@ public int[] getOrdinalToIbdID() { @Override public > BlockData adapt(B state) { PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); - return material.getCraftBlockData(); + return material.getBlockData(); } public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockState) { diff --git a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightBlockMaterial.java b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightBlockMaterial.java index 7a04adf41b..b29e2ff5f3 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightBlockMaterial.java +++ b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightBlockMaterial.java @@ -1,7 +1,7 @@ package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R3; +import com.fastasyncworldedit.bukkit.adapter.BukkitBlockMaterial; import com.fastasyncworldedit.core.nbt.FaweCompoundTag; -import com.sk89q.worldedit.world.registry.BlockMaterial; import net.minecraft.core.BlockPos; import net.minecraft.world.level.EmptyBlockGetter; import net.minecraft.world.level.block.Block; @@ -12,165 +12,115 @@ import net.minecraft.world.level.material.PushReaction; import org.bukkit.craftbukkit.v1_20_R3.block.data.CraftBlockData; -import javax.annotation.Nullable; +public class PaperweightBlockMaterial extends BukkitBlockMaterial { -public class PaperweightBlockMaterial implements BlockMaterial { - - private final Block block; - private final BlockState blockState; - private final CraftBlockData craftBlockData; - private final org.bukkit.Material craftMaterial; private final int opacity; - private final FaweCompoundTag tile; public PaperweightBlockMaterial(Block block) { this(block, block.defaultBlockState()); } public PaperweightBlockMaterial(Block block, BlockState blockState) { - this.block = block; - this.blockState = blockState; - this.craftBlockData = CraftBlockData.fromData(blockState); - this.craftMaterial = craftBlockData.getMaterial(); - opacity = blockState.getLightBlock(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); - BlockEntity tileEntity = !(block instanceof EntityBlock) ? null : ((EntityBlock) block).newBlockEntity( - BlockPos.ZERO, - blockState - ); - tile = tileEntity == null - ? null - : PaperweightGetBlocks.NMS_TO_TILE.apply(tileEntity); - } - - public Block getBlock() { - return block; + super(block, blockState, CraftBlockData.fromData(blockState)); + this.opacity = blockState.getLightBlock(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); } - public BlockState getState() { - return blockState; - } - - public CraftBlockData getCraftBlockData() { - return craftBlockData; + @Override + protected FaweCompoundTag tileForBlock(final Block block) { + BlockEntity tileEntity = !(block instanceof EntityBlock eb) ? null : eb.newBlockEntity(BlockPos.ZERO, this.blockState); + return tileEntity == null ? null : PaperweightGetBlocks.NMS_TO_TILE.apply(tileEntity); } @Override public boolean isAir() { - return blockState.isAir(); + return this.blockState.isAir(); } @Override public boolean isFullCube() { - return Block.isShapeFullBlock(blockState.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); + return Block.isShapeFullBlock(this.blockState.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); } @Override public boolean isOpaque() { - return blockState.canOcclude(); + return this.blockState.canOcclude(); } @Override public boolean isPowerSource() { - return blockState.isSignalSource(); + return this.blockState.isSignalSource(); } @Override public boolean isLiquid() { - return !blockState.getFluidState().is(Fluids.EMPTY); + return !this.blockState.getFluidState().is(Fluids.EMPTY); } @Override public boolean isSolid() { - // No access to world -> EmptyBlockGetter - return blockState.isSolidRender(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); + return this.blockState.isSolidRender(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); } @Override public float getHardness() { - return craftBlockData.getState().destroySpeed; + return this.blockState.destroySpeed; } @Override public float getResistance() { - return block.getExplosionResistance(); + return this.block.getExplosionResistance(); } @Override public float getSlipperiness() { - return block.getFriction(); + return this.block.getFriction(); } @Override public int getLightValue() { - return blockState.getLightEmission(); + return this.blockState.getLightEmission(); } @Override public int getLightOpacity() { - return opacity; + return this.opacity; } @Override public boolean isFragileWhenPushed() { - return blockState.getPistonPushReaction() == PushReaction.DESTROY; + return this.blockState.getPistonPushReaction() == PushReaction.DESTROY; } @Override public boolean isUnpushable() { - return blockState.getPistonPushReaction() == PushReaction.BLOCK; + return this.blockState.getPistonPushReaction() == PushReaction.BLOCK; } @Override public boolean isTicksRandomly() { - return block.isRandomlyTicking(blockState); + return this.blockState.isRandomlyTicking(); } @SuppressWarnings("deprecation") @Override public boolean isMovementBlocker() { - return blockState.blocksMotion(); - } - - @Override - public boolean isBurnable() { - return craftMaterial.isBurnable(); - } - - @Override - public boolean isToolRequired() { - // Removed in 1.16.1, this is not present in higher versions - return false; + return this.blockState.blocksMotion(); } @Override public boolean isReplacedDuringPlacement() { - return blockState.canBeReplaced(); + return this.blockState.canBeReplaced(); } @Override public boolean isTranslucent() { - return !blockState.canOcclude(); - } - - @Override - public boolean hasContainer() { - return block instanceof EntityBlock; - } - - @Override - public boolean isTile() { - return block instanceof EntityBlock; - } - - @Override - public @Nullable FaweCompoundTag defaultTile() { - return tile; + return !this.blockState.canOcclude(); } @Override public int getMapColor() { // rgb field - return block.defaultMapColor().col; + return this.block.defaultMapColor().col; } } diff --git a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightFaweAdapter.java index 34a2d6ee00..ef9f5da324 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightFaweAdapter.java @@ -346,7 +346,7 @@ public Component getRichItemName(BaseItemStack itemStack) { @Override public OptionalInt getInternalBlockStateId(BlockState state) { PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); - net.minecraft.world.level.block.state.BlockState mcState = material.getCraftBlockData().getState(); + net.minecraft.world.level.block.state.BlockState mcState = material.getState(); return OptionalInt.of(Block.BLOCK_STATE_REGISTRY.getId(mcState)); } @@ -439,7 +439,7 @@ public int[] getOrdinalToIbdID() { @Override public > BlockData adapt(B state) { PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); - return material.getCraftBlockData(); + return material.getBlockData(); } public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockState) { diff --git a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightBlockMaterial.java b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightBlockMaterial.java index abde16dee1..3e4ebeb449 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightBlockMaterial.java +++ b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightBlockMaterial.java @@ -1,7 +1,7 @@ package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R4; +import com.fastasyncworldedit.bukkit.adapter.BukkitBlockMaterial; import com.fastasyncworldedit.core.nbt.FaweCompoundTag; -import com.sk89q.worldedit.world.registry.BlockMaterial; import net.minecraft.core.BlockPos; import net.minecraft.world.level.EmptyBlockGetter; import net.minecraft.world.level.block.Block; @@ -12,165 +12,115 @@ import net.minecraft.world.level.material.PushReaction; import org.bukkit.craftbukkit.block.data.CraftBlockData; -import javax.annotation.Nullable; +public class PaperweightBlockMaterial extends BukkitBlockMaterial { -public class PaperweightBlockMaterial implements BlockMaterial { - - private final Block block; - private final BlockState blockState; - private final CraftBlockData craftBlockData; - private final org.bukkit.Material craftMaterial; private final int opacity; - private final FaweCompoundTag tile; public PaperweightBlockMaterial(Block block) { this(block, block.defaultBlockState()); } public PaperweightBlockMaterial(Block block, BlockState blockState) { - this.block = block; - this.blockState = blockState; - this.craftBlockData = CraftBlockData.fromData(blockState); - this.craftMaterial = craftBlockData.getMaterial(); - opacity = blockState.getLightBlock(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); - BlockEntity tileEntity = !(block instanceof EntityBlock) ? null : ((EntityBlock) block).newBlockEntity( - BlockPos.ZERO, - blockState - ); - tile = tileEntity == null - ? null - : PaperweightGetBlocks.NMS_TO_TILE.apply(tileEntity); - } - - public Block getBlock() { - return block; + super(block, blockState, CraftBlockData.fromData(blockState)); + this.opacity = blockState.getLightBlock(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); } - public BlockState getState() { - return blockState; - } - - public CraftBlockData getCraftBlockData() { - return craftBlockData; + @Override + protected FaweCompoundTag tileForBlock(final Block block) { + BlockEntity tileEntity = !(block instanceof EntityBlock eb) ? null : eb.newBlockEntity(BlockPos.ZERO, this.blockState); + return tileEntity == null ? null : PaperweightGetBlocks.NMS_TO_TILE.apply(tileEntity); } @Override public boolean isAir() { - return blockState.isAir(); + return this.blockState.isAir(); } @Override public boolean isFullCube() { - return Block.isShapeFullBlock(blockState.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); + return Block.isShapeFullBlock(this.blockState.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); } @Override public boolean isOpaque() { - return blockState.canOcclude(); + return this.blockState.canOcclude(); } @Override public boolean isPowerSource() { - return blockState.isSignalSource(); + return this.blockState.isSignalSource(); } @Override public boolean isLiquid() { - return !blockState.getFluidState().is(Fluids.EMPTY); + return !this.blockState.getFluidState().is(Fluids.EMPTY); } @Override public boolean isSolid() { - // No access to world -> EmptyBlockGetter - return blockState.isSolidRender(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); + return this.blockState.isSolidRender(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); } @Override public float getHardness() { - return craftBlockData.getState().destroySpeed; + return this.blockState.destroySpeed; } @Override public float getResistance() { - return block.getExplosionResistance(); + return this.block.getExplosionResistance(); } @Override public float getSlipperiness() { - return block.getFriction(); + return this.block.getFriction(); } @Override public int getLightValue() { - return blockState.getLightEmission(); + return this.blockState.getLightEmission(); } @Override public int getLightOpacity() { - return opacity; + return this.opacity; } @Override public boolean isFragileWhenPushed() { - return blockState.getPistonPushReaction() == PushReaction.DESTROY; + return this.blockState.getPistonPushReaction() == PushReaction.DESTROY; } @Override public boolean isUnpushable() { - return blockState.getPistonPushReaction() == PushReaction.BLOCK; + return this.blockState.getPistonPushReaction() == PushReaction.BLOCK; } @Override public boolean isTicksRandomly() { - return blockState.isRandomlyTicking(); + return this.blockState.isRandomlyTicking(); } @SuppressWarnings("deprecation") @Override public boolean isMovementBlocker() { - return blockState.blocksMotion(); - } - - @Override - public boolean isBurnable() { - return craftMaterial.isBurnable(); - } - - @Override - public boolean isToolRequired() { - // Removed in 1.16.1, this is not present in higher versions - return false; + return this.blockState.blocksMotion(); } @Override public boolean isReplacedDuringPlacement() { - return blockState.canBeReplaced(); + return this.blockState.canBeReplaced(); } @Override public boolean isTranslucent() { - return !blockState.canOcclude(); - } - - @Override - public boolean hasContainer() { - return block instanceof EntityBlock; - } - - @Override - public boolean isTile() { - return block instanceof EntityBlock; - } - - @Override - public @Nullable FaweCompoundTag defaultTile() { - return tile; + return !this.blockState.canOcclude(); } @Override public int getMapColor() { // rgb field - return block.defaultMapColor().col; + return this.block.defaultMapColor().col; } } diff --git a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightFaweAdapter.java index 6351210dff..1f3975d9c3 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightFaweAdapter.java @@ -356,7 +356,7 @@ public Component getRichItemName(BaseItemStack itemStack) { @Override public OptionalInt getInternalBlockStateId(BlockState state) { PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); - net.minecraft.world.level.block.state.BlockState mcState = material.getCraftBlockData().getState(); + net.minecraft.world.level.block.state.BlockState mcState = material.getState(); return OptionalInt.of(Block.BLOCK_STATE_REGISTRY.getId(mcState)); } @@ -449,7 +449,7 @@ public int[] getOrdinalToIbdID() { @Override public > BlockData adapt(B state) { PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); - return material.getCraftBlockData(); + return material.getBlockData(); } public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockState) { diff --git a/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightBlockMaterial.java b/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightBlockMaterial.java index b8adb7f81d..88cd992298 100644 --- a/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightBlockMaterial.java +++ b/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightBlockMaterial.java @@ -1,7 +1,7 @@ package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_21_R1; +import com.fastasyncworldedit.bukkit.adapter.BukkitBlockMaterial; import com.fastasyncworldedit.core.nbt.FaweCompoundTag; -import com.sk89q.worldedit.world.registry.BlockMaterial; import net.minecraft.core.BlockPos; import net.minecraft.world.level.EmptyBlockGetter; import net.minecraft.world.level.block.Block; @@ -12,165 +12,115 @@ import net.minecraft.world.level.material.PushReaction; import org.bukkit.craftbukkit.block.data.CraftBlockData; -import javax.annotation.Nullable; +public class PaperweightBlockMaterial extends BukkitBlockMaterial { -public class PaperweightBlockMaterial implements BlockMaterial { - - private final Block block; - private final BlockState blockState; - private final CraftBlockData craftBlockData; - private final org.bukkit.Material craftMaterial; private final int opacity; - private final FaweCompoundTag tile; public PaperweightBlockMaterial(Block block) { this(block, block.defaultBlockState()); } public PaperweightBlockMaterial(Block block, BlockState blockState) { - this.block = block; - this.blockState = blockState; - this.craftBlockData = CraftBlockData.fromData(blockState); - this.craftMaterial = craftBlockData.getMaterial(); - opacity = blockState.getLightBlock(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); - BlockEntity tileEntity = !(block instanceof EntityBlock) ? null : ((EntityBlock) block).newBlockEntity( - BlockPos.ZERO, - blockState - ); - tile = tileEntity == null - ? null - : PaperweightGetBlocks.NMS_TO_TILE.apply(tileEntity); - } - - public Block getBlock() { - return block; + super(block, blockState, CraftBlockData.fromData(blockState)); + this.opacity = blockState.getLightBlock(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); } - public BlockState getState() { - return blockState; - } - - public CraftBlockData getCraftBlockData() { - return craftBlockData; + @Override + protected FaweCompoundTag tileForBlock(final Block block) { + BlockEntity tileEntity = !(block instanceof EntityBlock eb) ? null : eb.newBlockEntity(BlockPos.ZERO, this.blockState); + return tileEntity == null ? null : PaperweightGetBlocks.NMS_TO_TILE.apply(tileEntity); } @Override public boolean isAir() { - return blockState.isAir(); + return this.blockState.isAir(); } @Override public boolean isFullCube() { - return Block.isShapeFullBlock(blockState.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); + return Block.isShapeFullBlock(this.blockState.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); } @Override public boolean isOpaque() { - return blockState.canOcclude(); + return this.blockState.canOcclude(); } @Override public boolean isPowerSource() { - return blockState.isSignalSource(); + return this.blockState.isSignalSource(); } @Override public boolean isLiquid() { - return !blockState.getFluidState().is(Fluids.EMPTY); + return !this.blockState.getFluidState().is(Fluids.EMPTY); } @Override public boolean isSolid() { - // No access to world -> EmptyBlockGetter - return blockState.isSolidRender(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); + return this.blockState.isSolidRender(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); } @Override public float getHardness() { - return craftBlockData.getState().destroySpeed; + return this.blockState.destroySpeed; } @Override public float getResistance() { - return block.getExplosionResistance(); + return this.block.getExplosionResistance(); } @Override public float getSlipperiness() { - return block.getFriction(); + return this.block.getFriction(); } @Override public int getLightValue() { - return blockState.getLightEmission(); + return this.blockState.getLightEmission(); } @Override public int getLightOpacity() { - return opacity; + return this.opacity; } @Override public boolean isFragileWhenPushed() { - return blockState.getPistonPushReaction() == PushReaction.DESTROY; + return this.blockState.getPistonPushReaction() == PushReaction.DESTROY; } @Override public boolean isUnpushable() { - return blockState.getPistonPushReaction() == PushReaction.BLOCK; + return this.blockState.getPistonPushReaction() == PushReaction.BLOCK; } @Override public boolean isTicksRandomly() { - return blockState.isRandomlyTicking(); + return this.blockState.isRandomlyTicking(); } @SuppressWarnings("deprecation") @Override public boolean isMovementBlocker() { - return blockState.blocksMotion(); - } - - @Override - public boolean isBurnable() { - return craftMaterial.isBurnable(); - } - - @Override - public boolean isToolRequired() { - // Removed in 1.16.1, this is not present in higher versions - return false; + return this.blockState.blocksMotion(); } @Override public boolean isReplacedDuringPlacement() { - return blockState.canBeReplaced(); + return this.blockState.canBeReplaced(); } @Override public boolean isTranslucent() { - return !blockState.canOcclude(); - } - - @Override - public boolean hasContainer() { - return block instanceof EntityBlock; - } - - @Override - public boolean isTile() { - return block instanceof EntityBlock; - } - - @Override - public @Nullable FaweCompoundTag defaultTile() { - return tile; + return !this.blockState.canOcclude(); } @Override public int getMapColor() { // rgb field - return block.defaultMapColor().col; + return this.block.defaultMapColor().col; } } diff --git a/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightFaweAdapter.java index b75a6529e6..1f953f40cf 100644 --- a/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightFaweAdapter.java @@ -356,7 +356,7 @@ public Component getRichItemName(BaseItemStack itemStack) { @Override public OptionalInt getInternalBlockStateId(BlockState state) { PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); - net.minecraft.world.level.block.state.BlockState mcState = material.getCraftBlockData().getState(); + net.minecraft.world.level.block.state.BlockState mcState = material.getState(); return OptionalInt.of(Block.BLOCK_STATE_REGISTRY.getId(mcState)); } @@ -449,7 +449,7 @@ public int[] getOrdinalToIbdID() { @Override public > BlockData adapt(B state) { PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); - return material.getCraftBlockData(); + return material.getBlockData(); } public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockState) { diff --git a/worldedit-bukkit/adapters/adapter-1_21_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_3/PaperweightBlockMaterial.java b/worldedit-bukkit/adapters/adapter-1_21_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_3/PaperweightBlockMaterial.java index 5c1f12044b..dc52309569 100644 --- a/worldedit-bukkit/adapters/adapter-1_21_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_3/PaperweightBlockMaterial.java +++ b/worldedit-bukkit/adapters/adapter-1_21_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_3/PaperweightBlockMaterial.java @@ -1,7 +1,7 @@ package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_21_3; +import com.fastasyncworldedit.bukkit.adapter.BukkitBlockMaterial; import com.fastasyncworldedit.core.nbt.FaweCompoundTag; -import com.sk89q.worldedit.world.registry.BlockMaterial; import net.minecraft.core.BlockPos; import net.minecraft.world.level.EmptyBlockGetter; import net.minecraft.world.level.block.Block; @@ -12,164 +12,112 @@ import net.minecraft.world.level.material.PushReaction; import org.bukkit.craftbukkit.block.data.CraftBlockData; -import javax.annotation.Nullable; - -public class PaperweightBlockMaterial implements BlockMaterial { - - private final Block block; - private final BlockState blockState; - private final CraftBlockData craftBlockData; - private final org.bukkit.Material craftMaterial; - private final int opacity; - private final FaweCompoundTag tile; +public class PaperweightBlockMaterial extends BukkitBlockMaterial { public PaperweightBlockMaterial(Block block) { this(block, block.defaultBlockState()); } public PaperweightBlockMaterial(Block block, BlockState blockState) { - this.block = block; - this.blockState = blockState; - this.craftBlockData = CraftBlockData.fromData(blockState); - this.craftMaterial = craftBlockData.getMaterial(); - opacity = blockState.getLightBlock(); - BlockEntity tileEntity = !(block instanceof EntityBlock) ? null : ((EntityBlock) block).newBlockEntity( - BlockPos.ZERO, - blockState - ); - tile = tileEntity == null - ? null - : PaperweightGetBlocks.NMS_TO_TILE.apply(tileEntity); - } - - public Block getBlock() { - return block; - } - - public BlockState getState() { - return blockState; + super(block, blockState, CraftBlockData.fromData(blockState)); } - public CraftBlockData getCraftBlockData() { - return craftBlockData; + @Override + protected FaweCompoundTag tileForBlock(final Block block) { + BlockEntity tileEntity = !(block instanceof EntityBlock eb) ? null : eb.newBlockEntity(BlockPos.ZERO, this.blockState); + return tileEntity == null ? null : PaperweightGetBlocks.NMS_TO_TILE.apply(tileEntity); } @Override public boolean isAir() { - return blockState.isAir(); + return this.blockState.isAir(); } @Override public boolean isFullCube() { - return Block.isShapeFullBlock(blockState.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); + return Block.isShapeFullBlock(this.blockState.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); } @Override public boolean isOpaque() { - return blockState.canOcclude(); + return this.blockState.canOcclude(); } @Override public boolean isPowerSource() { - return blockState.isSignalSource(); + return this.blockState.isSignalSource(); } @Override public boolean isLiquid() { - return !blockState.getFluidState().is(Fluids.EMPTY); + return !this.blockState.getFluidState().is(Fluids.EMPTY); } @Override public boolean isSolid() { - return blockState.isSolidRender(); + return this.blockState.isSolidRender(); } @Override public float getHardness() { - return craftBlockData.getState().destroySpeed; + return this.blockState.destroySpeed; } @Override public float getResistance() { - return block.getExplosionResistance(); + return this.block.getExplosionResistance(); } @Override public float getSlipperiness() { - return block.getFriction(); + return this.block.getFriction(); } @Override public int getLightValue() { - return blockState.getLightEmission(); + return this.blockState.getLightEmission(); } @Override public int getLightOpacity() { - return opacity; + return this.blockState.getLightBlock(); } @Override public boolean isFragileWhenPushed() { - return blockState.getPistonPushReaction() == PushReaction.DESTROY; + return this.blockState.getPistonPushReaction() == PushReaction.DESTROY; } @Override public boolean isUnpushable() { - return blockState.getPistonPushReaction() == PushReaction.BLOCK; + return this.blockState.getPistonPushReaction() == PushReaction.BLOCK; } @Override public boolean isTicksRandomly() { - return blockState.isRandomlyTicking(); + return this.blockState.isRandomlyTicking(); } @SuppressWarnings("deprecation") @Override public boolean isMovementBlocker() { - return blockState.blocksMotion(); - } - - @Override - public boolean isBurnable() { - return craftMaterial.isBurnable(); - } - - @Override - public boolean isToolRequired() { - // Removed in 1.16.1, this is not present in higher versions - return false; + return this.blockState.blocksMotion(); } @Override public boolean isReplacedDuringPlacement() { - return blockState.canBeReplaced(); + return this.blockState.canBeReplaced(); } @Override public boolean isTranslucent() { - return !blockState.canOcclude(); - } - - @Override - public boolean hasContainer() { - return block instanceof EntityBlock; - } - - @Override - public boolean isTile() { - return block instanceof EntityBlock; - } - - @Override - public @Nullable FaweCompoundTag defaultTile() { - return tile; + return !this.blockState.canOcclude(); } @Override public int getMapColor() { // rgb field - return block.defaultMapColor().col; + return this.block.defaultMapColor().col; } } diff --git a/worldedit-bukkit/adapters/adapter-1_21_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_3/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_21_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_3/PaperweightFaweAdapter.java index 69ba10a71c..e2a192a6ab 100644 --- a/worldedit-bukkit/adapters/adapter-1_21_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_3/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_21_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_3/PaperweightFaweAdapter.java @@ -338,7 +338,7 @@ public Component getRichItemName(BaseItemStack itemStack) { @Override public OptionalInt getInternalBlockStateId(BlockState state) { PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); - net.minecraft.world.level.block.state.BlockState mcState = material.getCraftBlockData().getState(); + net.minecraft.world.level.block.state.BlockState mcState = material.getState(); return OptionalInt.of(Block.BLOCK_STATE_REGISTRY.getId(mcState)); } @@ -431,7 +431,7 @@ public int[] getOrdinalToIbdID() { @Override public > BlockData adapt(B state) { PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); - return material.getCraftBlockData(); + return material.getBlockData(); } public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockState) { diff --git a/worldedit-bukkit/adapters/adapter-1_21_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_4/PaperweightBlockMaterial.java b/worldedit-bukkit/adapters/adapter-1_21_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_4/PaperweightBlockMaterial.java index 2f158f2c51..30a1bb62f7 100644 --- a/worldedit-bukkit/adapters/adapter-1_21_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_4/PaperweightBlockMaterial.java +++ b/worldedit-bukkit/adapters/adapter-1_21_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_4/PaperweightBlockMaterial.java @@ -1,7 +1,7 @@ package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_21_4; +import com.fastasyncworldedit.bukkit.adapter.BukkitBlockMaterial; import com.fastasyncworldedit.core.nbt.FaweCompoundTag; -import com.sk89q.worldedit.world.registry.BlockMaterial; import net.minecraft.core.BlockPos; import net.minecraft.world.level.EmptyBlockGetter; import net.minecraft.world.level.block.Block; @@ -12,164 +12,112 @@ import net.minecraft.world.level.material.PushReaction; import org.bukkit.craftbukkit.block.data.CraftBlockData; -import javax.annotation.Nullable; - -public class PaperweightBlockMaterial implements BlockMaterial { - - private final Block block; - private final BlockState blockState; - private final CraftBlockData craftBlockData; - private final org.bukkit.Material craftMaterial; - private final int opacity; - private final FaweCompoundTag tile; +public class PaperweightBlockMaterial extends BukkitBlockMaterial { public PaperweightBlockMaterial(Block block) { this(block, block.defaultBlockState()); } public PaperweightBlockMaterial(Block block, BlockState blockState) { - this.block = block; - this.blockState = blockState; - this.craftBlockData = CraftBlockData.fromData(blockState); - this.craftMaterial = craftBlockData.getMaterial(); - opacity = blockState.getLightBlock(); - BlockEntity tileEntity = !(block instanceof EntityBlock) ? null : ((EntityBlock) block).newBlockEntity( - BlockPos.ZERO, - blockState - ); - tile = tileEntity == null - ? null - : PaperweightGetBlocks.NMS_TO_TILE.apply(tileEntity); - } - - public Block getBlock() { - return block; - } - - public BlockState getState() { - return blockState; + super(block, blockState, CraftBlockData.fromData(blockState)); } - public CraftBlockData getCraftBlockData() { - return craftBlockData; + @Override + protected FaweCompoundTag tileForBlock(final Block block) { + BlockEntity tileEntity = !(block instanceof EntityBlock eb) ? null : eb.newBlockEntity(BlockPos.ZERO, this.blockState); + return tileEntity == null ? null : PaperweightGetBlocks.NMS_TO_TILE.apply(tileEntity); } @Override public boolean isAir() { - return blockState.isAir(); + return this.blockState.isAir(); } @Override public boolean isFullCube() { - return Block.isShapeFullBlock(blockState.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); + return Block.isShapeFullBlock(this.blockState.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); } @Override public boolean isOpaque() { - return blockState.canOcclude(); + return this.blockState.canOcclude(); } @Override public boolean isPowerSource() { - return blockState.isSignalSource(); + return this.blockState.isSignalSource(); } @Override public boolean isLiquid() { - return !blockState.getFluidState().is(Fluids.EMPTY); + return !this.blockState.getFluidState().is(Fluids.EMPTY); } @Override public boolean isSolid() { - return blockState.isSolidRender(); + return this.blockState.isSolidRender(); } @Override public float getHardness() { - return craftBlockData.getState().destroySpeed; + return this.blockState.destroySpeed; } @Override public float getResistance() { - return block.getExplosionResistance(); + return this.block.getExplosionResistance(); } @Override public float getSlipperiness() { - return block.getFriction(); + return this.block.getFriction(); } @Override public int getLightValue() { - return blockState.getLightEmission(); + return this.blockState.getLightEmission(); } @Override public int getLightOpacity() { - return opacity; + return this.blockState.getLightBlock(); } @Override public boolean isFragileWhenPushed() { - return blockState.getPistonPushReaction() == PushReaction.DESTROY; + return this.blockState.getPistonPushReaction() == PushReaction.DESTROY; } @Override public boolean isUnpushable() { - return blockState.getPistonPushReaction() == PushReaction.BLOCK; + return this.blockState.getPistonPushReaction() == PushReaction.BLOCK; } @Override public boolean isTicksRandomly() { - return blockState.isRandomlyTicking(); + return this.blockState.isRandomlyTicking(); } @SuppressWarnings("deprecation") @Override public boolean isMovementBlocker() { - return blockState.blocksMotion(); - } - - @Override - public boolean isBurnable() { - return craftMaterial.isBurnable(); - } - - @Override - public boolean isToolRequired() { - // Removed in 1.16.1, this is not present in higher versions - return false; + return this.blockState.blocksMotion(); } @Override public boolean isReplacedDuringPlacement() { - return blockState.canBeReplaced(); + return this.blockState.canBeReplaced(); } @Override public boolean isTranslucent() { - return !blockState.canOcclude(); - } - - @Override - public boolean hasContainer() { - return block instanceof EntityBlock; - } - - @Override - public boolean isTile() { - return block instanceof EntityBlock; - } - - @Override - public @Nullable FaweCompoundTag defaultTile() { - return tile; + return !this.blockState.canOcclude(); } @Override public int getMapColor() { // rgb field - return block.defaultMapColor().col; + return this.block.defaultMapColor().col; } } diff --git a/worldedit-bukkit/adapters/adapter-1_21_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_4/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_21_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_4/PaperweightFaweAdapter.java index ae3b591beb..8f053162ce 100644 --- a/worldedit-bukkit/adapters/adapter-1_21_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_4/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_21_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_4/PaperweightFaweAdapter.java @@ -37,7 +37,6 @@ import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.SideEffect; -import com.sk89q.worldedit.util.SideEffectSet; import com.sk89q.worldedit.util.concurrency.LazyReference; import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.world.RegenOptions; @@ -339,7 +338,7 @@ public Component getRichItemName(BaseItemStack itemStack) { @Override public OptionalInt getInternalBlockStateId(BlockState state) { PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); - net.minecraft.world.level.block.state.BlockState mcState = material.getCraftBlockData().getState(); + net.minecraft.world.level.block.state.BlockState mcState = material.getState(); return OptionalInt.of(Block.BLOCK_STATE_REGISTRY.getId(mcState)); } @@ -432,7 +431,7 @@ public int[] getOrdinalToIbdID() { @Override public > BlockData adapt(B state) { PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); - return material.getCraftBlockData(); + return material.getBlockData(); } public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockState) { diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/BukkitBlockMaterial.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/BukkitBlockMaterial.java new file mode 100644 index 0000000000..d4570126b1 --- /dev/null +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/BukkitBlockMaterial.java @@ -0,0 +1,68 @@ +package com.fastasyncworldedit.bukkit.adapter; + +import com.fastasyncworldedit.core.nbt.FaweCompoundTag; +import com.sk89q.worldedit.world.registry.BlockMaterial; +import org.bukkit.Material; +import org.bukkit.block.data.BlockData; +import org.jetbrains.annotations.ApiStatus; + +import javax.annotation.Nullable; + +@ApiStatus.Internal +public abstract class BukkitBlockMaterial implements BlockMaterial { + + protected final B block; + protected final BS blockState; + private final BlockData blockData; + private final Material craftMaterial; + private final FaweCompoundTag tile; + + public BukkitBlockMaterial(B block, BS blockState, BlockData blockData) { + this.block = block; + this.blockState = blockState; + this.blockData = blockData; + this.craftMaterial = this.blockData.getMaterial(); + this.tile = tileForBlock(block); + } + + protected abstract FaweCompoundTag tileForBlock(B block); + + public B getBlock() { + return this.block; + } + + public BS getState() { + return this.blockState; + } + + public BlockData getBlockData() { + return this.blockData; + } + + @Override + public boolean isBurnable() { + return this.craftMaterial.isBurnable(); + } + + @Override + public @Nullable FaweCompoundTag defaultTile() { + return this.tile; + } + + @Override + public boolean hasContainer() { + return this.tile != null; + } + + @Override + public boolean isTile() { + return this.tile != null; + } + + @Override + public boolean isToolRequired() { + // Removed in 1.16.1, this is not present in higher versions + return false; + } + +}