diff --git a/gradle.properties b/gradle.properties index f06e96ca..52c089f5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,10 +5,10 @@ org.gradle.jvmargs=-Xmx1G # check on modmuss' website https://modmuss50.me/fabric.html minecraft_version=1.14.4 yarn_mappings=1.14.4+build.12 - loader_version=0.6.1+build.164 + loader_version=0.6.1+build.165 # Mod Properties - mod_version = 2.7.0 + mod_version = 2.7.1 maven_group = com.shnupbups archives_base_name = extrapieces @@ -24,7 +24,7 @@ org.gradle.jvmargs=-Xmx1G # Other Stuff # check on maven at https://maven.fabricmc.net/me/shedaniel/RoughlyEnoughItems/ - rei_version=3.1-pre+build.4 + rei_version=3.1.1+build.8 # check on maven at https://maven.fabricmc.net/io/github/prospector/modmenu/ - modmenu_version=1.7.9+build.118 \ No newline at end of file + modmenu_version=1.7.10+build.119 \ No newline at end of file diff --git a/src/main/java/com/shnupbups/extrapieces/blocks/ColumnPieceBlock.java b/src/main/java/com/shnupbups/extrapieces/blocks/ColumnPieceBlock.java index 944701a9..8a20a624 100644 --- a/src/main/java/com/shnupbups/extrapieces/blocks/ColumnPieceBlock.java +++ b/src/main/java/com/shnupbups/extrapieces/blocks/ColumnPieceBlock.java @@ -6,6 +6,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.block.*; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityContext; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; @@ -16,6 +17,8 @@ import net.minecraft.state.property.EnumProperty; import net.minecraft.state.property.Properties; import net.minecraft.util.BlockRotation; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.shape.VoxelShape; @@ -23,6 +26,7 @@ import net.minecraft.world.IWorld; import net.minecraft.world.ViewableWorld; import net.minecraft.world.World; +import net.minecraft.world.explosion.Explosion; import java.util.Random; @@ -123,30 +127,112 @@ public FluidState getFluidState(BlockState blockState_1) { public boolean canPlaceAtSide(BlockState blockState_1, BlockView blockView_1, BlockPos blockPos_1, BlockPlacementEnvironment blockPlacementEnvironment_1) { return false; } - + @Environment(EnvType.CLIENT) + @Override public void randomDisplayTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { - this.set.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + super.randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + try { + this.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public void onBlockBreakStart(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1) { - this.set.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1); + super.onBlockBreakStart(blockState_1, world_1, blockPos_1, playerEntity_1); + try { + this.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public void onBroken(IWorld iWorld_1, BlockPos blockPos_1, BlockState blockState_1) { - this.set.getBase().onBroken(iWorld_1, blockPos_1, blockState_1); + super.onBroken(iWorld_1, blockPos_1, blockState_1); + try { + this.getBase().onBroken(iWorld_1, blockPos_1, blockState_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public float getBlastResistance() { - return this.set.getBase().getBlastResistance(); + try { + return this.getBase().getBlastResistance(); + } catch (IllegalArgumentException ignored) { + return super.getBlastResistance(); + } } - + + @Override public BlockRenderLayer getRenderLayer() { - return this.set.getBase().getRenderLayer(); + try { + return this.getBase().getRenderLayer(); + } catch (IllegalArgumentException ignored) { + return super.getRenderLayer(); + } } - + + @Override public int getTickRate(ViewableWorld viewableWorld_1) { - return this.set.getBase().getTickRate(viewableWorld_1); + try { + return this.getBase().getTickRate(viewableWorld_1); + } catch (IllegalArgumentException ignored) { + return super.getTickRate(viewableWorld_1); + } + } + + @Override + public void onBlockAdded(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + super.onBlockAdded(blockState_1, world_1, blockPos_1, blockState_2, boolean_1); + try { + if (blockState_1.getBlock() != blockState_1.getBlock()) { + this.getBase().getDefaultState().neighborUpdate(world_1, blockPos_1, Blocks.AIR, blockPos_1, false); + this.getBase().onBlockAdded(this.set.getBase().getDefaultState(), world_1, blockPos_1, blockState_2, false); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onBlockRemoved(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + super.onBlockRemoved(blockState_1, world_1, blockPos_1, blockState_2, boolean_1); + try { + if (blockState_1.getBlock() != blockState_2.getBlock()) { + this.getBase().getDefaultState().onBlockRemoved(world_1, blockPos_1, blockState_2, boolean_1); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onSteppedOn(World world_1, BlockPos blockPos_1, Entity entity_1) { + super.onSteppedOn(world_1, blockPos_1, entity_1); + try { + this.getBase().onSteppedOn(world_1, blockPos_1, entity_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onScheduledTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { + super.onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + try { + this.getBase().onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public boolean activate(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1, Hand hand_1, BlockHitResult blockHitResult_1) { + try { + boolean a = super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1); + return a || this.getBase().getDefaultState().activate(world_1, playerEntity_1, hand_1, blockHitResult_1); + } catch (IllegalArgumentException ignored) { + return super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1); + } + } + + @Override + public void onDestroyedByExplosion(World world_1, BlockPos blockPos_1, Explosion explosion_1) { + super.onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + try { + this.getBase().onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + } catch (IllegalArgumentException ignored) {} } @Environment(EnvType.CLIENT) diff --git a/src/main/java/com/shnupbups/extrapieces/blocks/CornerPieceBlock.java b/src/main/java/com/shnupbups/extrapieces/blocks/CornerPieceBlock.java index ad63e49a..03c05fcb 100644 --- a/src/main/java/com/shnupbups/extrapieces/blocks/CornerPieceBlock.java +++ b/src/main/java/com/shnupbups/extrapieces/blocks/CornerPieceBlock.java @@ -100,59 +100,112 @@ public VoxelShape getOutlineShape(BlockState blockState_1, BlockView blockView_1 return NORTH_SHAPE; } } - + @Environment(EnvType.CLIENT) + @Override public void randomDisplayTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { - this.set.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + super.randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + try { + this.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public void onBlockBreakStart(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1) { - this.set.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1); + super.onBlockBreakStart(blockState_1, world_1, blockPos_1, playerEntity_1); + try { + this.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public void onBroken(IWorld iWorld_1, BlockPos blockPos_1, BlockState blockState_1) { - this.set.getBase().onBroken(iWorld_1, blockPos_1, blockState_1); + super.onBroken(iWorld_1, blockPos_1, blockState_1); + try { + this.getBase().onBroken(iWorld_1, blockPos_1, blockState_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public float getBlastResistance() { - return this.set.getBase().getBlastResistance(); + try { + return this.getBase().getBlastResistance(); + } catch (IllegalArgumentException ignored) { + return super.getBlastResistance(); + } } - + + @Override public BlockRenderLayer getRenderLayer() { - return this.set.getBase().getRenderLayer(); + try { + return this.getBase().getRenderLayer(); + } catch (IllegalArgumentException ignored) { + return super.getRenderLayer(); + } } - + + @Override public int getTickRate(ViewableWorld viewableWorld_1) { - return this.set.getBase().getTickRate(viewableWorld_1); - } - - public void onBlockAdded(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { - if (blockState_1.getBlock() != blockState_1.getBlock()) { - this.set.getBase().getDefaultState().neighborUpdate(world_1, blockPos_1, Blocks.AIR, blockPos_1, false); - this.set.getBase().onBlockAdded(this.set.getBase().getDefaultState(), world_1, blockPos_1, blockState_2, false); + try { + return this.getBase().getTickRate(viewableWorld_1); + } catch (IllegalArgumentException ignored) { + return super.getTickRate(viewableWorld_1); } } - + + @Override + public void onBlockAdded(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + super.onBlockAdded(blockState_1, world_1, blockPos_1, blockState_2, boolean_1); + try { + if (blockState_1.getBlock() != blockState_1.getBlock()) { + this.getBase().getDefaultState().neighborUpdate(world_1, blockPos_1, Blocks.AIR, blockPos_1, false); + this.getBase().onBlockAdded(this.set.getBase().getDefaultState(), world_1, blockPos_1, blockState_2, false); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override public void onBlockRemoved(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { - if (blockState_1.getBlock() != blockState_2.getBlock()) { - this.set.getBase().getDefaultState().onBlockRemoved(world_1, blockPos_1, blockState_2, boolean_1); - } - } - + super.onBlockRemoved(blockState_1, world_1, blockPos_1, blockState_2, boolean_1); + try { + if (blockState_1.getBlock() != blockState_2.getBlock()) { + this.getBase().getDefaultState().onBlockRemoved(world_1, blockPos_1, blockState_2, boolean_1); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override public void onSteppedOn(World world_1, BlockPos blockPos_1, Entity entity_1) { - this.set.getBase().onSteppedOn(world_1, blockPos_1, entity_1); + super.onSteppedOn(world_1, blockPos_1, entity_1); + try { + this.getBase().onSteppedOn(world_1, blockPos_1, entity_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public void onScheduledTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { - this.set.getBase().onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + super.onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + try { + this.getBase().onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public boolean activate(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1, Hand hand_1, BlockHitResult blockHitResult_1) { - return this.set.getBase().getDefaultState().activate(world_1, playerEntity_1, hand_1, blockHitResult_1); + try { + boolean a = super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1); + return a || this.getBase().getDefaultState().activate(world_1, playerEntity_1, hand_1, blockHitResult_1); + } catch (IllegalArgumentException ignored) { + return super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1); + } } - + + @Override public void onDestroyedByExplosion(World world_1, BlockPos blockPos_1, Explosion explosion_1) { - this.set.getBase().onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + super.onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + try { + this.getBase().onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + } catch (IllegalArgumentException ignored) {} } public BlockState getPlacementState(ItemPlacementContext itemPlacementContext_1) { diff --git a/src/main/java/com/shnupbups/extrapieces/blocks/FenceGatePieceBlock.java b/src/main/java/com/shnupbups/extrapieces/blocks/FenceGatePieceBlock.java index 42de7f8c..57025983 100644 --- a/src/main/java/com/shnupbups/extrapieces/blocks/FenceGatePieceBlock.java +++ b/src/main/java/com/shnupbups/extrapieces/blocks/FenceGatePieceBlock.java @@ -5,16 +5,18 @@ import com.shnupbups.extrapieces.core.PieceTypes; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.block.Block; -import net.minecraft.block.BlockRenderLayer; -import net.minecraft.block.BlockState; -import net.minecraft.block.FenceGateBlock; + +import net.minecraft.block.*; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.IWorld; import net.minecraft.world.ViewableWorld; import net.minecraft.world.World; +import net.minecraft.world.explosion.Explosion; import java.util.Random; @@ -39,30 +41,112 @@ public PieceSet getSet() { public PieceType getType() { return PieceTypes.FENCE_GATE; } - + @Environment(EnvType.CLIENT) + @Override public void randomDisplayTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { - this.set.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + super.randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + try { + this.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public void onBlockBreakStart(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1) { - this.set.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1); + super.onBlockBreakStart(blockState_1, world_1, blockPos_1, playerEntity_1); + try { + this.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public void onBroken(IWorld iWorld_1, BlockPos blockPos_1, BlockState blockState_1) { - this.set.getBase().onBroken(iWorld_1, blockPos_1, blockState_1); + super.onBroken(iWorld_1, blockPos_1, blockState_1); + try { + this.getBase().onBroken(iWorld_1, blockPos_1, blockState_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public float getBlastResistance() { - return this.set.getBase().getBlastResistance(); + try { + return this.getBase().getBlastResistance(); + } catch (IllegalArgumentException ignored) { + return super.getBlastResistance(); + } } - + + @Override public BlockRenderLayer getRenderLayer() { - return this.set.getBase().getRenderLayer(); + try { + return this.getBase().getRenderLayer(); + } catch (IllegalArgumentException ignored) { + return super.getRenderLayer(); + } } - + + @Override public int getTickRate(ViewableWorld viewableWorld_1) { - return this.set.getBase().getTickRate(viewableWorld_1); + try { + return this.getBase().getTickRate(viewableWorld_1); + } catch (IllegalArgumentException ignored) { + return super.getTickRate(viewableWorld_1); + } + } + + @Override + public void onBlockAdded(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + super.onBlockAdded(blockState_1, world_1, blockPos_1, blockState_2, boolean_1); + try { + if (blockState_1.getBlock() != blockState_1.getBlock()) { + this.getBase().getDefaultState().neighborUpdate(world_1, blockPos_1, Blocks.AIR, blockPos_1, false); + this.getBase().onBlockAdded(this.set.getBase().getDefaultState(), world_1, blockPos_1, blockState_2, false); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onBlockRemoved(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + super.onBlockRemoved(blockState_1, world_1, blockPos_1, blockState_2, boolean_1); + try { + if (blockState_1.getBlock() != blockState_2.getBlock()) { + this.getBase().getDefaultState().onBlockRemoved(world_1, blockPos_1, blockState_2, boolean_1); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onSteppedOn(World world_1, BlockPos blockPos_1, Entity entity_1) { + super.onSteppedOn(world_1, blockPos_1, entity_1); + try { + this.getBase().onSteppedOn(world_1, blockPos_1, entity_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onScheduledTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { + super.onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + try { + this.getBase().onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public boolean activate(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1, Hand hand_1, BlockHitResult blockHitResult_1) { + try { + boolean a = super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1); + return a || this.getBase().getDefaultState().activate(world_1, playerEntity_1, hand_1, blockHitResult_1); + } catch (IllegalArgumentException ignored) { + return super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1); + } + } + + @Override + public void onDestroyedByExplosion(World world_1, BlockPos blockPos_1, Explosion explosion_1) { + super.onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + try { + this.getBase().onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + } catch (IllegalArgumentException ignored) {} } @Environment(EnvType.CLIENT) diff --git a/src/main/java/com/shnupbups/extrapieces/blocks/FencePieceBlock.java b/src/main/java/com/shnupbups/extrapieces/blocks/FencePieceBlock.java index d42cc606..a1ab5d07 100644 --- a/src/main/java/com/shnupbups/extrapieces/blocks/FencePieceBlock.java +++ b/src/main/java/com/shnupbups/extrapieces/blocks/FencePieceBlock.java @@ -5,16 +5,18 @@ import com.shnupbups.extrapieces.core.PieceTypes; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.block.Block; -import net.minecraft.block.BlockRenderLayer; -import net.minecraft.block.BlockState; -import net.minecraft.block.FenceBlock; + +import net.minecraft.block.*; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.IWorld; import net.minecraft.world.ViewableWorld; import net.minecraft.world.World; +import net.minecraft.world.explosion.Explosion; import java.util.Random; @@ -26,42 +28,127 @@ public FencePieceBlock(PieceSet set) { super(Settings.copy(set.getBase())); this.set = set; } - + + @Override public Block getBlock() { return this; } - + + @Override public PieceSet getSet() { return set; } - + + @Override public PieceType getType() { return PieceTypes.FENCE; } - + @Environment(EnvType.CLIENT) + @Override public void randomDisplayTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { - this.set.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + super.randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + try { + this.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public void onBlockBreakStart(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1) { - this.set.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1); + super.onBlockBreakStart(blockState_1, world_1, blockPos_1, playerEntity_1); + try { + this.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public void onBroken(IWorld iWorld_1, BlockPos blockPos_1, BlockState blockState_1) { - this.set.getBase().onBroken(iWorld_1, blockPos_1, blockState_1); + super.onBroken(iWorld_1, blockPos_1, blockState_1); + try { + this.getBase().onBroken(iWorld_1, blockPos_1, blockState_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public float getBlastResistance() { - return this.set.getBase().getBlastResistance(); + try { + return this.getBase().getBlastResistance(); + } catch (IllegalArgumentException ignored) { + return super.getBlastResistance(); + } } - + + @Override public BlockRenderLayer getRenderLayer() { - return this.set.getBase().getRenderLayer(); + try { + return this.getBase().getRenderLayer(); + } catch (IllegalArgumentException ignored) { + return super.getRenderLayer(); + } } - + + @Override public int getTickRate(ViewableWorld viewableWorld_1) { - return this.set.getBase().getTickRate(viewableWorld_1); + try { + return this.getBase().getTickRate(viewableWorld_1); + } catch (IllegalArgumentException ignored) { + return super.getTickRate(viewableWorld_1); + } + } + + @Override + public void onBlockAdded(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + super.onBlockAdded(blockState_1, world_1, blockPos_1, blockState_2, boolean_1); + try { + if (blockState_1.getBlock() != blockState_1.getBlock()) { + this.getBase().getDefaultState().neighborUpdate(world_1, blockPos_1, Blocks.AIR, blockPos_1, false); + this.getBase().onBlockAdded(this.set.getBase().getDefaultState(), world_1, blockPos_1, blockState_2, false); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onBlockRemoved(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + super.onBlockRemoved(blockState_1, world_1, blockPos_1, blockState_2, boolean_1); + try { + if (blockState_1.getBlock() != blockState_2.getBlock()) { + this.getBase().getDefaultState().onBlockRemoved(world_1, blockPos_1, blockState_2, boolean_1); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onSteppedOn(World world_1, BlockPos blockPos_1, Entity entity_1) { + super.onSteppedOn(world_1, blockPos_1, entity_1); + try { + this.getBase().onSteppedOn(world_1, blockPos_1, entity_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onScheduledTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { + super.onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + try { + this.getBase().onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public boolean activate(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1, Hand hand_1, BlockHitResult blockHitResult_1) { + try { + boolean a = super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1); + return a || this.getBase().getDefaultState().activate(world_1, playerEntity_1, hand_1, blockHitResult_1); + } catch (IllegalArgumentException ignored) { + return super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1); + } + } + + @Override + public void onDestroyedByExplosion(World world_1, BlockPos blockPos_1, Explosion explosion_1) { + super.onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + try { + this.getBase().onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + } catch (IllegalArgumentException ignored) {} } @Environment(EnvType.CLIENT) diff --git a/src/main/java/com/shnupbups/extrapieces/blocks/LayerPieceBlock.java b/src/main/java/com/shnupbups/extrapieces/blocks/LayerPieceBlock.java index b2a22bf5..9a562c0a 100644 --- a/src/main/java/com/shnupbups/extrapieces/blocks/LayerPieceBlock.java +++ b/src/main/java/com/shnupbups/extrapieces/blocks/LayerPieceBlock.java @@ -3,10 +3,14 @@ import com.shnupbups.extrapieces.core.PieceSet; import com.shnupbups.extrapieces.core.PieceType; import com.shnupbups.extrapieces.core.PieceTypes; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Waterloggable; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +import net.minecraft.block.*; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityContext; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; @@ -16,12 +20,19 @@ import net.minecraft.state.property.EnumProperty; import net.minecraft.state.property.IntProperty; import net.minecraft.state.property.Properties; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import net.minecraft.world.IWorld; +import net.minecraft.world.ViewableWorld; +import net.minecraft.world.World; +import net.minecraft.world.explosion.Explosion; + +import java.util.Random; @SuppressWarnings("deprecation") public class LayerPieceBlock extends Block implements Waterloggable, PieceBlock { @@ -124,4 +135,111 @@ public boolean tryFillWithFluid(IWorld iWorld_1, BlockPos blockPos_1, BlockState public boolean canFillWithFluid(BlockView blockView_1, BlockPos blockPos_1, BlockState blockState_1, Fluid fluid_1) { return blockState_1.get(LAYERS) < 8 && Waterloggable.super.canFillWithFluid(blockView_1, blockPos_1, blockState_1, fluid_1); } + + @Environment(EnvType.CLIENT) + @Override + public void randomDisplayTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { + super.randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + try { + this.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onBlockBreakStart(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1) { + super.onBlockBreakStart(blockState_1, world_1, blockPos_1, playerEntity_1); + try { + this.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onBroken(IWorld iWorld_1, BlockPos blockPos_1, BlockState blockState_1) { + super.onBroken(iWorld_1, blockPos_1, blockState_1); + try { + this.getBase().onBroken(iWorld_1, blockPos_1, blockState_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public float getBlastResistance() { + try { + return this.getBase().getBlastResistance(); + } catch (IllegalArgumentException ignored) { + return super.getBlastResistance(); + } + } + + @Override + public BlockRenderLayer getRenderLayer() { + try { + return this.getBase().getRenderLayer(); + } catch (IllegalArgumentException ignored) { + return super.getRenderLayer(); + } + } + + @Override + public int getTickRate(ViewableWorld viewableWorld_1) { + try { + return this.getBase().getTickRate(viewableWorld_1); + } catch (IllegalArgumentException ignored) { + return super.getTickRate(viewableWorld_1); + } + } + + @Override + public void onBlockAdded(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + super.onBlockAdded(blockState_1, world_1, blockPos_1, blockState_2, boolean_1); + try { + if (blockState_1.getBlock() != blockState_1.getBlock()) { + this.getBase().getDefaultState().neighborUpdate(world_1, blockPos_1, Blocks.AIR, blockPos_1, false); + this.getBase().onBlockAdded(this.set.getBase().getDefaultState(), world_1, blockPos_1, blockState_2, false); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onBlockRemoved(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + super.onBlockRemoved(blockState_1, world_1, blockPos_1, blockState_2, boolean_1); + try { + if (blockState_1.getBlock() != blockState_2.getBlock()) { + this.getBase().getDefaultState().onBlockRemoved(world_1, blockPos_1, blockState_2, boolean_1); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onSteppedOn(World world_1, BlockPos blockPos_1, Entity entity_1) { + super.onSteppedOn(world_1, blockPos_1, entity_1); + try { + this.getBase().onSteppedOn(world_1, blockPos_1, entity_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onScheduledTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { + super.onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + try { + this.getBase().onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public boolean activate(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1, Hand hand_1, BlockHitResult blockHitResult_1) { + try { + boolean a = super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1); + return a || this.getBase().getDefaultState().activate(world_1, playerEntity_1, hand_1, blockHitResult_1); + } catch (IllegalArgumentException ignored) { + return super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1); + } + } + + @Override + public void onDestroyedByExplosion(World world_1, BlockPos blockPos_1, Explosion explosion_1) { + super.onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + try { + this.getBase().onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + } catch (IllegalArgumentException ignored) {} + } } diff --git a/src/main/java/com/shnupbups/extrapieces/blocks/PieceBlock.java b/src/main/java/com/shnupbups/extrapieces/blocks/PieceBlock.java index 59c638e7..383b14d1 100644 --- a/src/main/java/com/shnupbups/extrapieces/blocks/PieceBlock.java +++ b/src/main/java/com/shnupbups/extrapieces/blocks/PieceBlock.java @@ -11,4 +11,8 @@ public interface PieceBlock extends ItemConvertible { Block getBlock(); PieceSet getSet(); + + default Block getBase() { + return getSet().getBase(); + } } diff --git a/src/main/java/com/shnupbups/extrapieces/blocks/PostPieceBlock.java b/src/main/java/com/shnupbups/extrapieces/blocks/PostPieceBlock.java index 8323ad79..74e3babe 100644 --- a/src/main/java/com/shnupbups/extrapieces/blocks/PostPieceBlock.java +++ b/src/main/java/com/shnupbups/extrapieces/blocks/PostPieceBlock.java @@ -6,6 +6,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.block.*; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityContext; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; @@ -16,6 +17,8 @@ import net.minecraft.state.property.EnumProperty; import net.minecraft.state.property.Properties; import net.minecraft.util.BlockRotation; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.shape.VoxelShape; @@ -23,6 +26,7 @@ import net.minecraft.world.IWorld; import net.minecraft.world.ViewableWorld; import net.minecraft.world.World; +import net.minecraft.world.explosion.Explosion; import java.util.Random; @@ -123,30 +127,112 @@ public FluidState getFluidState(BlockState blockState_1) { public boolean canPlaceAtSide(BlockState blockState_1, BlockView blockView_1, BlockPos blockPos_1, BlockPlacementEnvironment blockPlacementEnvironment_1) { return false; } - + @Environment(EnvType.CLIENT) + @Override public void randomDisplayTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { - this.set.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + super.randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + try { + this.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public void onBlockBreakStart(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1) { - this.set.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1); + super.onBlockBreakStart(blockState_1, world_1, blockPos_1, playerEntity_1); + try { + this.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public void onBroken(IWorld iWorld_1, BlockPos blockPos_1, BlockState blockState_1) { - this.set.getBase().onBroken(iWorld_1, blockPos_1, blockState_1); + super.onBroken(iWorld_1, blockPos_1, blockState_1); + try { + this.getBase().onBroken(iWorld_1, blockPos_1, blockState_1); + } catch (IllegalArgumentException ignored) {} } - + + @Override public float getBlastResistance() { - return this.set.getBase().getBlastResistance(); + try { + return this.getBase().getBlastResistance(); + } catch (IllegalArgumentException ignored) { + return super.getBlastResistance(); + } } - + + @Override public BlockRenderLayer getRenderLayer() { - return this.set.getBase().getRenderLayer(); + try { + return this.getBase().getRenderLayer(); + } catch (IllegalArgumentException ignored) { + return super.getRenderLayer(); + } } - + + @Override public int getTickRate(ViewableWorld viewableWorld_1) { - return this.set.getBase().getTickRate(viewableWorld_1); + try { + return this.getBase().getTickRate(viewableWorld_1); + } catch (IllegalArgumentException ignored) { + return super.getTickRate(viewableWorld_1); + } + } + + @Override + public void onBlockAdded(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + super.onBlockAdded(blockState_1, world_1, blockPos_1, blockState_2, boolean_1); + try { + if (blockState_1.getBlock() != blockState_1.getBlock()) { + this.getBase().getDefaultState().neighborUpdate(world_1, blockPos_1, Blocks.AIR, blockPos_1, false); + this.getBase().onBlockAdded(this.set.getBase().getDefaultState(), world_1, blockPos_1, blockState_2, false); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onBlockRemoved(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + super.onBlockRemoved(blockState_1, world_1, blockPos_1, blockState_2, boolean_1); + try { + if (blockState_1.getBlock() != blockState_2.getBlock()) { + this.getBase().getDefaultState().onBlockRemoved(world_1, blockPos_1, blockState_2, boolean_1); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onSteppedOn(World world_1, BlockPos blockPos_1, Entity entity_1) { + super.onSteppedOn(world_1, blockPos_1, entity_1); + try { + this.getBase().onSteppedOn(world_1, blockPos_1, entity_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onScheduledTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { + super.onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + try { + this.getBase().onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public boolean activate(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1, Hand hand_1, BlockHitResult blockHitResult_1) { + try { + boolean a = super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1); + return a || this.getBase().getDefaultState().activate(world_1, playerEntity_1, hand_1, blockHitResult_1); + } catch (IllegalArgumentException ignored) { + return super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1); + } + } + + @Override + public void onDestroyedByExplosion(World world_1, BlockPos blockPos_1, Explosion explosion_1) { + super.onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + try { + this.getBase().onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + } catch (IllegalArgumentException ignored) {} } @Environment(EnvType.CLIENT) diff --git a/src/main/java/com/shnupbups/extrapieces/blocks/SidingPieceBlock.java b/src/main/java/com/shnupbups/extrapieces/blocks/SidingPieceBlock.java index 41b026f7..3cecf0a5 100644 --- a/src/main/java/com/shnupbups/extrapieces/blocks/SidingPieceBlock.java +++ b/src/main/java/com/shnupbups/extrapieces/blocks/SidingPieceBlock.java @@ -6,11 +6,11 @@ import com.shnupbups.extrapieces.register.ModProperties; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.block.Block; -import net.minecraft.block.BlockPlacementEnvironment; -import net.minecraft.block.BlockState; -import net.minecraft.block.Waterloggable; + +import net.minecraft.block.*; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityContext; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; @@ -22,12 +22,19 @@ import net.minecraft.state.property.EnumProperty; import net.minecraft.state.property.Properties; import net.minecraft.tag.FluidTags; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import net.minecraft.world.IWorld; +import net.minecraft.world.ViewableWorld; +import net.minecraft.world.World; +import net.minecraft.world.explosion.Explosion; + +import java.util.Random; @SuppressWarnings("deprecation") public class SidingPieceBlock extends Block implements Waterloggable, PieceBlock { @@ -177,8 +184,6 @@ public boolean canPlaceAtSide(BlockState blockState_1, BlockView blockView_1, Bl return blockState_1.get(TYPE) == ModProperties.SidingType.SINGLE; case WATER: return blockView_1.getFluidState(blockPos_1).matches(FluidTags.WATER); - case AIR: - return false; default: return false; } @@ -188,4 +193,111 @@ public boolean canPlaceAtSide(BlockState blockState_1, BlockView blockView_1, Bl public boolean isSideInvisible(BlockState blockState_1, BlockState blockState_2, Direction direction_1) { return getSet().isTransparent() ? (blockState_2.getBlock() == this || super.isSideInvisible(blockState_1, blockState_2, direction_1)) : super.isSideInvisible(blockState_1, blockState_2, direction_1); } + + @Environment(EnvType.CLIENT) + @Override + public void randomDisplayTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { + super.randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + try { + this.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onBlockBreakStart(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1) { + super.onBlockBreakStart(blockState_1, world_1, blockPos_1, playerEntity_1); + try { + this.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onBroken(IWorld iWorld_1, BlockPos blockPos_1, BlockState blockState_1) { + super.onBroken(iWorld_1, blockPos_1, blockState_1); + try { + this.getBase().onBroken(iWorld_1, blockPos_1, blockState_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public float getBlastResistance() { + try { + return this.getBase().getBlastResistance(); + } catch (IllegalArgumentException ignored) { + return super.getBlastResistance(); + } + } + + @Override + public BlockRenderLayer getRenderLayer() { + try { + return this.getBase().getRenderLayer(); + } catch (IllegalArgumentException ignored) { + return super.getRenderLayer(); + } + } + + @Override + public int getTickRate(ViewableWorld viewableWorld_1) { + try { + return this.getBase().getTickRate(viewableWorld_1); + } catch (IllegalArgumentException ignored) { + return super.getTickRate(viewableWorld_1); + } + } + + @Override + public void onBlockAdded(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + super.onBlockAdded(blockState_1, world_1, blockPos_1, blockState_2, boolean_1); + try { + if (blockState_1.getBlock() != blockState_1.getBlock()) { + this.getBase().getDefaultState().neighborUpdate(world_1, blockPos_1, Blocks.AIR, blockPos_1, false); + this.getBase().onBlockAdded(this.set.getBase().getDefaultState(), world_1, blockPos_1, blockState_2, false); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onBlockRemoved(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + super.onBlockRemoved(blockState_1, world_1, blockPos_1, blockState_2, boolean_1); + try { + if (blockState_1.getBlock() != blockState_2.getBlock()) { + this.getBase().getDefaultState().onBlockRemoved(world_1, blockPos_1, blockState_2, boolean_1); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onSteppedOn(World world_1, BlockPos blockPos_1, Entity entity_1) { + super.onSteppedOn(world_1, blockPos_1, entity_1); + try { + this.getBase().onSteppedOn(world_1, blockPos_1, entity_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onScheduledTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { + super.onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + try { + this.getBase().onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public boolean activate(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1, Hand hand_1, BlockHitResult blockHitResult_1) { + try { + boolean a = super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1); + return a || this.getBase().getDefaultState().activate(world_1, playerEntity_1, hand_1, blockHitResult_1); + } catch (IllegalArgumentException ignored) { + return super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1); + } + } + + @Override + public void onDestroyedByExplosion(World world_1, BlockPos blockPos_1, Explosion explosion_1) { + super.onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + try { + this.getBase().onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + } catch (IllegalArgumentException ignored) {} + } } diff --git a/src/main/java/com/shnupbups/extrapieces/blocks/SlabPieceBlock.java b/src/main/java/com/shnupbups/extrapieces/blocks/SlabPieceBlock.java index dbbfa338..a525647f 100644 --- a/src/main/java/com/shnupbups/extrapieces/blocks/SlabPieceBlock.java +++ b/src/main/java/com/shnupbups/extrapieces/blocks/SlabPieceBlock.java @@ -5,10 +5,20 @@ import com.shnupbups.extrapieces.core.PieceTypes; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.SlabBlock; + +import net.minecraft.block.*; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.world.IWorld; +import net.minecraft.world.ViewableWorld; +import net.minecraft.world.World; +import net.minecraft.world.explosion.Explosion; + +import java.util.Random; @SuppressWarnings("deprecation") public class SlabPieceBlock extends SlabBlock implements PieceBlock { @@ -35,4 +45,111 @@ public PieceType getType() { public boolean isSideInvisible(BlockState blockState_1, BlockState blockState_2, Direction direction_1) { return getSet().isTransparent() ? (blockState_2.getBlock() == this || super.isSideInvisible(blockState_1, blockState_2, direction_1)) : super.isSideInvisible(blockState_1, blockState_2, direction_1); } + + @Environment(EnvType.CLIENT) + @Override + public void randomDisplayTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { + super.randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + try { + this.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onBlockBreakStart(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1) { + super.onBlockBreakStart(blockState_1, world_1, blockPos_1, playerEntity_1); + try { + this.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onBroken(IWorld iWorld_1, BlockPos blockPos_1, BlockState blockState_1) { + super.onBroken(iWorld_1, blockPos_1, blockState_1); + try { + this.getBase().onBroken(iWorld_1, blockPos_1, blockState_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public float getBlastResistance() { + try { + return this.getBase().getBlastResistance(); + } catch (IllegalArgumentException ignored) { + return super.getBlastResistance(); + } + } + + @Override + public BlockRenderLayer getRenderLayer() { + try { + return this.getBase().getRenderLayer(); + } catch (IllegalArgumentException ignored) { + return super.getRenderLayer(); + } + } + + @Override + public int getTickRate(ViewableWorld viewableWorld_1) { + try { + return this.getBase().getTickRate(viewableWorld_1); + } catch (IllegalArgumentException ignored) { + return super.getTickRate(viewableWorld_1); + } + } + + @Override + public void onBlockAdded(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + super.onBlockAdded(blockState_1, world_1, blockPos_1, blockState_2, boolean_1); + try { + if (blockState_1.getBlock() != blockState_1.getBlock()) { + this.getBase().getDefaultState().neighborUpdate(world_1, blockPos_1, Blocks.AIR, blockPos_1, false); + this.getBase().onBlockAdded(this.set.getBase().getDefaultState(), world_1, blockPos_1, blockState_2, false); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onBlockRemoved(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + super.onBlockRemoved(blockState_1, world_1, blockPos_1, blockState_2, boolean_1); + try { + if (blockState_1.getBlock() != blockState_2.getBlock()) { + this.getBase().getDefaultState().onBlockRemoved(world_1, blockPos_1, blockState_2, boolean_1); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onSteppedOn(World world_1, BlockPos blockPos_1, Entity entity_1) { + super.onSteppedOn(world_1, blockPos_1, entity_1); + try { + this.getBase().onSteppedOn(world_1, blockPos_1, entity_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onScheduledTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { + super.onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + try { + this.getBase().onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public boolean activate(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1, Hand hand_1, BlockHitResult blockHitResult_1) { + try { + boolean a = super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1); + return a || this.getBase().getDefaultState().activate(world_1, playerEntity_1, hand_1, blockHitResult_1); + } catch (IllegalArgumentException ignored) { + return super.activate(blockState_1, world_1, blockPos_1, playerEntity_1, hand_1, blockHitResult_1); + } + } + + @Override + public void onDestroyedByExplosion(World world_1, BlockPos blockPos_1, Explosion explosion_1) { + super.onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + try { + this.getBase().onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + } catch (IllegalArgumentException ignored) {} + } } diff --git a/src/main/java/com/shnupbups/extrapieces/blocks/StairsPieceBlock.java b/src/main/java/com/shnupbups/extrapieces/blocks/StairsPieceBlock.java index ce0fa46f..db01bf3f 100644 --- a/src/main/java/com/shnupbups/extrapieces/blocks/StairsPieceBlock.java +++ b/src/main/java/com/shnupbups/extrapieces/blocks/StairsPieceBlock.java @@ -5,10 +5,20 @@ import com.shnupbups.extrapieces.core.PieceTypes; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.StairsBlock; + +import net.minecraft.block.*; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.world.IWorld; +import net.minecraft.world.ViewableWorld; +import net.minecraft.world.World; +import net.minecraft.world.explosion.Explosion; + +import java.util.Random; @SuppressWarnings("deprecation") public class StairsPieceBlock extends StairsBlock implements PieceBlock { @@ -35,4 +45,102 @@ public PieceType getType() { public boolean isSideInvisible(BlockState blockState_1, BlockState blockState_2, Direction direction_1) { return getSet().isTransparent() ? (blockState_2.getBlock() == this || super.isSideInvisible(blockState_1, blockState_2, direction_1)) : super.isSideInvisible(blockState_1, blockState_2, direction_1); } + + @Environment(EnvType.CLIENT) + @Override + public void randomDisplayTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { + try { + this.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onBlockBreakStart(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1) { + try { + this.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onBroken(IWorld iWorld_1, BlockPos blockPos_1, BlockState blockState_1) { + try { + this.getBase().onBroken(iWorld_1, blockPos_1, blockState_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public float getBlastResistance() { + try { + return this.getBase().getBlastResistance(); + } catch (IllegalArgumentException ignored) { + return this.resistance; + } + } + + @Override + public BlockRenderLayer getRenderLayer() { + try { + return this.getBase().getRenderLayer(); + } catch (IllegalArgumentException ignored) { + return BlockRenderLayer.SOLID; + } + } + + @Override + public int getTickRate(ViewableWorld viewableWorld_1) { + try { + return this.getBase().getTickRate(viewableWorld_1); + } catch (IllegalArgumentException ignored) { + return 10; + } + } + + @Override + public void onBlockAdded(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + try { + if (blockState_1.getBlock() != blockState_1.getBlock()) { + this.getBase().getDefaultState().neighborUpdate(world_1, blockPos_1, Blocks.AIR, blockPos_1, false); + this.getBase().onBlockAdded(this.set.getBase().getDefaultState(), world_1, blockPos_1, blockState_2, false); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onBlockRemoved(BlockState blockState_1, World world_1, BlockPos blockPos_1, BlockState blockState_2, boolean boolean_1) { + try { + if (blockState_1.getBlock() != blockState_2.getBlock()) { + this.getBase().getDefaultState().onBlockRemoved(world_1, blockPos_1, blockState_2, boolean_1); + } + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onSteppedOn(World world_1, BlockPos blockPos_1, Entity entity_1) { + try { + this.getBase().onSteppedOn(world_1, blockPos_1, entity_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public void onScheduledTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { + try { + this.getBase().onScheduledTick(blockState_1, world_1, blockPos_1, random_1); + } catch (IllegalArgumentException ignored) {} + } + + @Override + public boolean activate(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1, Hand hand_1, BlockHitResult blockHitResult_1) { + try { + return this.getBase().getDefaultState().activate(world_1, playerEntity_1, hand_1, blockHitResult_1); + } catch (IllegalArgumentException ignored) { + return false; + } + } + + @Override + public void onDestroyedByExplosion(World world_1, BlockPos blockPos_1, Explosion explosion_1) { + try { + this.getBase().onDestroyedByExplosion(world_1, blockPos_1, explosion_1); + } catch (IllegalArgumentException ignored) {} + } } diff --git a/src/main/java/com/shnupbups/extrapieces/blocks/WallPieceBlock.java b/src/main/java/com/shnupbups/extrapieces/blocks/WallPieceBlock.java index e1070c84..b0f66aed 100644 --- a/src/main/java/com/shnupbups/extrapieces/blocks/WallPieceBlock.java +++ b/src/main/java/com/shnupbups/extrapieces/blocks/WallPieceBlock.java @@ -41,27 +41,27 @@ public PieceType getType() { @Environment(EnvType.CLIENT) public void randomDisplayTick(BlockState blockState_1, World world_1, BlockPos blockPos_1, Random random_1) { - this.set.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); + this.getBase().randomDisplayTick(blockState_1, world_1, blockPos_1, random_1); } public void onBlockBreakStart(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1) { - this.set.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1); + this.getBase().getDefaultState().onBlockBreakStart(world_1, blockPos_1, playerEntity_1); } public void onBroken(IWorld iWorld_1, BlockPos blockPos_1, BlockState blockState_1) { - this.set.getBase().onBroken(iWorld_1, blockPos_1, blockState_1); + this.getBase().onBroken(iWorld_1, blockPos_1, blockState_1); } public float getBlastResistance() { - return this.set.getBase().getBlastResistance(); + return this.getBase().getBlastResistance(); } public BlockRenderLayer getRenderLayer() { - return this.set.getBase().getRenderLayer(); + return this.getBase().getRenderLayer(); } public int getTickRate(ViewableWorld viewableWorld_1) { - return this.set.getBase().getTickRate(viewableWorld_1); + return this.getBase().getTickRate(viewableWorld_1); } @Environment(EnvType.CLIENT) diff --git a/src/main/java/com/shnupbups/extrapieces/core/PieceSet.java b/src/main/java/com/shnupbups/extrapieces/core/PieceSet.java index 0f6830ef..ac6b8489 100644 --- a/src/main/java/com/shnupbups/extrapieces/core/PieceSet.java +++ b/src/main/java/com/shnupbups/extrapieces/core/PieceSet.java @@ -566,7 +566,7 @@ public static class Builder { public Builder(String name, JsonObject ob, String packName) { this.name = name; this.packName = packName; - this.base = new Identifier(ob.get(String.class, "base")); + this.base = new Identifier(Objects.requireNonNull(ob.get(String.class, "base"))); if (ob.containsKey("stonecuttable")) { this.stonecuttable = ob.get("stonecuttable").equals(JsonPrimitive.TRUE); } @@ -579,13 +579,13 @@ public Builder(String name, JsonObject ob, String packName) { if (ob.containsKey("textures")) { JsonObject tx = ob.getObject("textures"); if (tx.containsKey("main")) { - this.mainTexture = new Identifier(tx.get(String.class, "main")); + this.mainTexture = new Identifier(Objects.requireNonNull(tx.get(String.class, "main"))); } if (tx.containsKey("top")) { - this.topTexture = new Identifier(tx.get(String.class, "top")); + this.topTexture = new Identifier(Objects.requireNonNull(tx.get(String.class, "top"))); } if (tx.containsKey("bottom")) { - this.bottomTexture = new Identifier(tx.get(String.class, "bottom")); + this.bottomTexture = new Identifier(Objects.requireNonNull(tx.get(String.class, "bottom"))); } } if (ob.containsKey("vanilla_pieces")) { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 089454af..a76cea96 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "extrapieces", - "version": "2.7.0", + "version": "2.7.1", "name": "Extra Pieces", "description": "Adds more block shapes to Minecraft!", @@ -12,7 +12,7 @@ "coderbot" ], "contact": { - "homepage": "https://minecraft.curseforge.com/projects/extra-pieces", + "homepage": "https://www.curseforge.com/minecraft/mc-mods/extra-pieces", "sources": "https://github.com/Shnupbups/extra-pieces", "issues": "https://github.com/Shnupbups/extra-pieces/issues" },