From 00366450506f7120f9db24b64eda2a27e5ccf1ae Mon Sep 17 00:00:00 2001 From: baguchan Date: Mon, 13 Nov 2023 23:44:01 +0900 Subject: [PATCH] fix seagrass cannot collide --- ...ockFluidWithSeagrass.java => BlockWaterPlant.java} | 11 +++++++++-- .../baguchan/better_with_aquatic/block/ModBlocks.java | 5 +++-- 2 files changed, 12 insertions(+), 4 deletions(-) rename src/main/java/baguchan/better_with_aquatic/block/{BlockFluidWithSeagrass.java => BlockWaterPlant.java} (93%) diff --git a/src/main/java/baguchan/better_with_aquatic/block/BlockFluidWithSeagrass.java b/src/main/java/baguchan/better_with_aquatic/block/BlockWaterPlant.java similarity index 93% rename from src/main/java/baguchan/better_with_aquatic/block/BlockFluidWithSeagrass.java rename to src/main/java/baguchan/better_with_aquatic/block/BlockWaterPlant.java index fe4edf3..a99e6a0 100644 --- a/src/main/java/baguchan/better_with_aquatic/block/BlockFluidWithSeagrass.java +++ b/src/main/java/baguchan/better_with_aquatic/block/BlockWaterPlant.java @@ -11,8 +11,8 @@ import java.util.Random; -public class BlockFluidWithSeagrass extends BlockFluidStill { - public BlockFluidWithSeagrass(String name, int openIds, Material water) { +public class BlockWaterPlant extends BlockFluidStill { + public BlockWaterPlant(String name, int openIds, Material water) { super(name, openIds, water); float f = 0.4f; this.setBlockBounds(0.5f - f, 0.0f, 0.5f - f, 0.5f + f, 0.8f, 0.5f + f); @@ -121,6 +121,13 @@ protected final void func_268_h(World world, int i, int j, int k) { } } + @Override + public void onBlockRemoval(World world, int x, int y, int z) { + super.onBlockRemoval(world, x, y, z); + world.setBlockAndMetadataWithNotify(x, y, z, fluidWaterStill.id, world.getBlockMetadata(x, y, z)); + + } + public boolean canCollideCheck(int meta, boolean shouldCollideWithFluids) { return this.isCollidable(); } diff --git a/src/main/java/baguchan/better_with_aquatic/block/ModBlocks.java b/src/main/java/baguchan/better_with_aquatic/block/ModBlocks.java index 642cc6c..52f8f7c 100644 --- a/src/main/java/baguchan/better_with_aquatic/block/ModBlocks.java +++ b/src/main/java/baguchan/better_with_aquatic/block/ModBlocks.java @@ -16,12 +16,13 @@ public class ModBlocks { public static final Block sea_grass = new BlockBuilder(BetterWithAquatic.MOD_ID) - .setHardness(100.0f) + .setHardness(0.0f) + .setResistance(100F) .setLightOpacity(1) .setTextures("sea_grass.png") .setTags(BlockTags.IS_WATER, BlockTags.PLACE_OVERWRITES, BlockTags.SHEARS_DO_SILK_TOUCH) .setBlockSound(BlockSounds.GRASS) - .build(new BlockFluidWithSeagrass("sea_grass", findOpenIds(IDUtils.getCurrBlockId()), Material.water)); + .build(new BlockWaterPlant("sea_grass", findOpenIds(IDUtils.getCurrBlockId()), Material.water)); public static final Block coral_blue = new BlockBuilder(BetterWithAquatic.MOD_ID) .setHardness(0.6f) .setResistance(0.65F)