70 lines
2.1 KiB
Java
70 lines
2.1 KiB
Java
![]() |
package WayofTime.bloodmagic.block;
|
||
|
|
||
|
import WayofTime.bloodmagic.BloodMagic;
|
||
|
import net.minecraft.block.Block;
|
||
|
import net.minecraft.block.material.Material;
|
||
|
import net.minecraft.block.properties.PropertyInteger;
|
||
|
import net.minecraft.block.state.BlockState;
|
||
|
import net.minecraft.block.state.IBlockState;
|
||
|
import net.minecraft.creativetab.CreativeTabs;
|
||
|
import net.minecraft.entity.player.EntityPlayer;
|
||
|
import net.minecraft.item.Item;
|
||
|
import net.minecraft.item.ItemStack;
|
||
|
import net.minecraft.util.BlockPos;
|
||
|
import net.minecraft.util.MovingObjectPosition;
|
||
|
import net.minecraft.world.World;
|
||
|
import net.minecraftforge.fml.relauncher.Side;
|
||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||
|
|
||
|
import java.util.List;
|
||
|
|
||
|
public class BlockSocket extends Block {
|
||
|
|
||
|
public static final String[] names = { "empty", "filled" };
|
||
|
public static final PropertyInteger META = PropertyInteger.create("META", 0, names.length - 1);
|
||
|
|
||
|
public BlockSocket() {
|
||
|
super(Material.iron);
|
||
|
|
||
|
setUnlocalizedName(BloodMagic.MODID + ".socket.");
|
||
|
setHardness(2.0F);
|
||
|
setResistance(5.0F);
|
||
|
setStepSound(soundTypeMetal);
|
||
|
setHarvestLevel("pickaxe", 2);
|
||
|
setCreativeTab(BloodMagic.tabBloodMagic);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public IBlockState getStateFromMeta(int meta) {
|
||
|
return this.getDefaultState().withProperty(META, meta);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public int getMetaFromState(IBlockState state) {
|
||
|
return (Integer) state.getValue(META);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public int damageDropped(IBlockState state) {
|
||
|
return getMetaFromState(state);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected BlockState createBlockState() {
|
||
|
return new BlockState(this, META);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
|
||
|
return new ItemStack(this, 1, this.getMetaFromState(world.getBlockState(pos)));
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
@SideOnly(Side.CLIENT)
|
||
|
@SuppressWarnings("unchecked")
|
||
|
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||
|
for (int i = 0; i < names.length; i++)
|
||
|
list.add(new ItemStack(this, 1, i));
|
||
|
}
|
||
|
}
|