Files
Chisel/src/main/java/team/chisel/block/BlockCarvableBeacon.java
T

74 lines
2.0 KiB
Java
Raw Normal View History

2015-08-18 20:40:55 -04:00
package team.chisel.block;
2015-06-22 16:00:35 -04:00
2015-08-18 20:40:55 -04:00
import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.api.carving.CarvableHelper;
import com.cricketcraft.chisel.api.carving.IVariationInfo;
import team.chisel.block.tileentity.TileEntityCarvableBeacon;
import team.chisel.init.ChiselTabs;
2015-06-22 16:00:35 -04:00
import net.minecraft.block.BlockBeacon;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockCarvableBeacon extends BlockBeacon implements ICarvable {
public static int renderId;
2015-06-22 16:00:35 -04:00
public CarvableHelper carverHelper;
2015-06-22 16:00:35 -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
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityCarvableBeacon();
}
2015-06-22 16:00:35 -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
if (tileentitybeacon != null) {
player.func_146104_a(tileentitybeacon);
}
2015-06-22 16:00:35 -04:00
return true;
}
}
2015-06-22 16:00:35 -04:00
@Override
public int getRenderType() {
return renderId;
}
2015-06-22 16:00:35 -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
}