2015-08-18 20:40:55 -04:00
|
|
|
package team.chisel.block;
|
2015-06-22 16:00:35 -04:00
|
|
|
|
2015-10-07 01:20:58 -04:00
|
|
|
import java.util.List;
|
2015-08-18 20:40:55 -04:00
|
|
|
|
2015-06-22 16:00:35 -04:00
|
|
|
import net.minecraft.block.BlockBeacon;
|
2015-10-07 01:20:58 -04:00
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
2015-06-22 16:00:35 -04:00
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2015-10-07 01:20:58 -04:00
|
|
|
import net.minecraft.item.Item;
|
2015-06-22 16:00:35 -04:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2015-10-07 01:20:58 -04:00
|
|
|
import net.minecraft.util.MovingObjectPosition;
|
2015-06-22 16:00:35 -04:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
|
import net.minecraft.world.World;
|
2015-10-07 01:20:58 -04:00
|
|
|
import team.chisel.block.tileentity.TileEntityCarvableBeacon;
|
|
|
|
|
import team.chisel.init.ChiselBlocks;
|
|
|
|
|
|
|
|
|
|
import com.cricketcraft.chisel.api.ChiselTabs;
|
|
|
|
|
import com.cricketcraft.chisel.api.ICarvable;
|
|
|
|
|
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
|
|
|
|
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
2015-06-22 16:00:35 -04:00
|
|
|
|
|
|
|
|
public class BlockCarvableBeacon extends BlockBeacon implements ICarvable {
|
|
|
|
|
|
2015-06-25 15:06:12 -04:00
|
|
|
public static int renderId;
|
2015-06-22 16:00:35 -04:00
|
|
|
|
2015-08-06 00:00:22 -04:00
|
|
|
public CarvableHelper carverHelper;
|
2015-06-22 16:00:35 -04:00
|
|
|
|
2015-08-06 00:00:22 -04:00
|
|
|
public BlockCarvableBeacon() {
|
|
|
|
|
super();
|
|
|
|
|
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
|
|
|
|
setLightLevel(5.0F);
|
|
|
|
|
setBlockTextureName("beacon");
|
|
|
|
|
carverHelper = new CarvableHelper(this);
|
|
|
|
|
}
|
2015-06-22 16:00:35 -04:00
|
|
|
|
2015-08-06 00:00:22 -04:00
|
|
|
@Override
|
|
|
|
|
public TileEntity createNewTileEntity(World world, int meta) {
|
|
|
|
|
return new TileEntityCarvableBeacon();
|
|
|
|
|
}
|
2015-06-22 16:00:35 -04:00
|
|
|
|
2015-08-06 00:00:22 -04:00
|
|
|
@Override
|
|
|
|
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par5, float hitX, float hitY, float hitZ) {
|
|
|
|
|
if (world.isRemote) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
TileEntityCarvableBeacon tileentitybeacon = (TileEntityCarvableBeacon) world.getTileEntity(x, y, z);
|
2015-06-22 16:00:35 -04:00
|
|
|
|
2015-08-06 00:00:22 -04:00
|
|
|
if (tileentitybeacon != null) {
|
|
|
|
|
player.func_146104_a(tileentitybeacon);
|
|
|
|
|
}
|
2015-06-22 16:00:35 -04:00
|
|
|
|
2015-08-06 00:00:22 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-06-22 16:00:35 -04:00
|
|
|
|
2015-10-07 01:20:58 -04:00
|
|
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
|
|
|
|
@Override
|
|
|
|
|
public void getSubBlocks(Item item, CreativeTabs p_149666_2_, List list) {
|
|
|
|
|
for (int i = 0; i < 16; i++) {
|
|
|
|
|
list.add(new ItemStack(item, 1, i));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
|
|
|
|
return new ItemStack(ChiselBlocks.beacon, 1, world.getBlockMetadata(x, y, z));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int damageDropped(int meta) {
|
|
|
|
|
return meta;
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-06 00:00:22 -04:00
|
|
|
@Override
|
|
|
|
|
public int getRenderType() {
|
|
|
|
|
return renderId;
|
|
|
|
|
}
|
2015-06-22 16:00:35 -04:00
|
|
|
|
2015-08-06 00:00:22 -04:00
|
|
|
@Override
|
|
|
|
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
|
|
|
|
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
|
|
|
|
|
|
|
|
|
if (stack.hasDisplayName()) {
|
|
|
|
|
((TileEntityCarvableBeacon) world.getTileEntity(x, y, z)).func_145999_a(stack.getDisplayName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
|
|
|
|
return carverHelper.getVariation(metadata);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IVariationInfo getManager(int meta) {
|
|
|
|
|
return carverHelper.getVariation(meta);
|
|
|
|
|
}
|
2015-06-22 16:00:35 -04:00
|
|
|
}
|