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
1.12
Tobias 2019-09-05 03:48:54 +02:00 committed by Nick Ignoffo
parent 97d4967d31
commit 845ca65cab
1 changed files with 28 additions and 8 deletions

View File

@ -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<EnumPath> implements IIncensePath {
@ -26,14 +28,14 @@ public class BlockPath extends BlockEnum<EnumPath> 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<EnumPath> 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)) {