BloodMagic/src/main/java/WayofTime/bloodmagic/block/BlockPath.java

85 lines
3.2 KiB
Java
Raw Normal View History

package WayofTime.bloodmagic.block;
2017-08-16 04:30:48 +00:00
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.block.base.BlockEnum;
import WayofTime.bloodmagic.block.enums.EnumPath;
2018-02-15 07:38:57 +00:00
import WayofTime.bloodmagic.incense.IIncensePath;
2017-08-16 04:30:48 +00:00
import WayofTime.bloodmagic.util.helper.TextHelper;
2016-03-18 17:16:38 +00:00
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;
2016-03-18 17:16:38 +00:00
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
2016-03-18 17:16:38 +00:00
import javax.annotation.Nullable;
2017-08-16 04:30:48 +00:00
import java.util.List;
2016-03-16 22:37:55 +00:00
2017-08-16 04:30:48 +00:00
public class BlockPath extends BlockEnum<EnumPath> implements IIncensePath {
2017-08-16 04:30:48 +00:00
public BlockPath() {
super(Material.ROCK, EnumPath.class);
2019-02-01 03:10:37 +00:00
setTranslationKey(BloodMagic.MODID + ".path.");
setCreativeTab(BloodMagic.TAB_BM);
setHardness(2.0F);
setResistance(5.0F);
2016-03-21 19:55:36 +00:00
setSoundType(SoundType.STONE);
2016-02-08 08:57:02 +00:00
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
2017-08-16 04:30:48 +00:00
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag tooltipFlag) {
2017-01-02 09:18:29 +00:00
tooltip.add(TextHelper.localizeEffect("tooltip.bloodmagic.decoration.safe"));
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
2017-08-16 04:30:48 +00:00
public int getLevelOfPath(World world, BlockPos pos, IBlockState state) {
switch (this.getMetaFromState(state)) {
case 0:
case 1:
return 2;
case 2:
case 3:
return 4;
case 4:
case 5:
return 6;
case 6:
case 7:
return 8;
default:
return 0;
}
}
}