From 845ca65cabc419c22b88bcc5922d5a562b08f926 Mon Sep 17 00:00:00 2001 From: Tobias Date: Thu, 5 Sep 2019 03:48:54 +0200 Subject: [PATCH] Changed SoundType and visible Material of wooden path blocks from stone/rock to wood (#1638) * Changed SoundType and visible Material of wooden path blocks from stone/rock to wood. Breaking wooden path blocks is now effective & faster with an axe and slow with a pickaxe type tool. * Moved hacky to getter. * Cleanup unneeded override * Using Enums instead of meta IDs --- .../WayofTime/bloodmagic/block/BlockPath.java | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockPath.java b/src/main/java/WayofTime/bloodmagic/block/BlockPath.java index 779c1389..fc60a3b5 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockPath.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockPath.java @@ -9,10 +9,12 @@ import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import javax.annotation.Nullable; import java.util.List; public class BlockPath extends BlockEnum implements IIncensePath { @@ -26,14 +28,14 @@ public class BlockPath extends BlockEnum implements IIncensePath { setResistance(5.0F); setSoundType(SoundType.STONE); - setHarvestLevel("axe", 0, getStateFromMeta(0)); - setHarvestLevel("axe", 0, getStateFromMeta(1)); - setHarvestLevel("pickaxe", 0, getStateFromMeta(2)); - setHarvestLevel("pickaxe", 0, getStateFromMeta(3)); - setHarvestLevel("pickaxe", 0, getStateFromMeta(4)); - setHarvestLevel("pickaxe", 0, getStateFromMeta(5)); - setHarvestLevel("pickaxe", 3, getStateFromMeta(6)); - setHarvestLevel("pickaxe", 3, getStateFromMeta(7)); + setHarvestLevel("axe", 0, getDefaultState().withProperty(getProperty(), EnumPath.WOOD)); + setHarvestLevel("axe", 0, getDefaultState().withProperty(getProperty(), EnumPath.WOODTILE)); + setHarvestLevel("pickaxe", 0, getDefaultState().withProperty(getProperty(), EnumPath.STONE)); + setHarvestLevel("pickaxe", 0, getDefaultState().withProperty(getProperty(), EnumPath.STONETILE)); + setHarvestLevel("pickaxe", 0, getDefaultState().withProperty(getProperty(), EnumPath.WORNSTONE)); + setHarvestLevel("pickaxe", 0, getDefaultState().withProperty(getProperty(), EnumPath.WORNSTONETILE)); + setHarvestLevel("pickaxe", 3, getDefaultState().withProperty(getProperty(), EnumPath.OBSIDIAN)); + setHarvestLevel("pickaxe", 3, getDefaultState().withProperty(getProperty(), EnumPath.OBSIDIANTILE)); } @Override @@ -42,6 +44,24 @@ public class BlockPath extends BlockEnum implements IIncensePath { super.addInformation(stack, world, tooltip, tooltipFlag); } + @Override + public Material getMaterial(IBlockState state) { + EnumPath path = state.getValue(getProperty()); + if (path.equals(EnumPath.WOOD) || path.equals(EnumPath.WOODTILE)) + return Material.WOOD; + else + return Material.ROCK; + } + + @Override + public SoundType getSoundType(IBlockState state, World world, BlockPos pos, @Nullable Entity entity) { + EnumPath path = state.getValue(getProperty()); + if (path.equals(EnumPath.WOOD) || path.equals(EnumPath.WOODTILE)) + return SoundType.WOOD; + else + return super.getSoundType(); + } + @Override public int getLevelOfPath(World world, BlockPos pos, IBlockState state) { switch (this.getMetaFromState(state)) {