use of am2.blocks.tileentities.TileEntityEverstone in project ArsMagica2 by Mithion.
the class BlockEverstone method removedByPlayer.
@Override
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
TileEntityEverstone everstone = getTE(world, x, y, z);
if (everstone == null) {
if (player.capabilities.isCreativeMode) {
world.setTileEntity(x, y, z, null);
world.setBlockToAir(x, y, z);
return true;
}
return false;
}
everstone.onBreak();
if (player.capabilities.isCreativeMode) {
world.setTileEntity(x, y, z, null);
world.setBlockToAir(x, y, z);
return true;
}
return false;
}
use of am2.blocks.tileentities.TileEntityEverstone in project ArsMagica2 by Mithion.
the class BlockEverstone method onBlockActivated.
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
if (player.getHeldItem() != null) {
Block block = null;
int meta = -1;
TileEntityEverstone everstone = getTE(world, x, y, z);
if (everstone == null)
return false;
if (player.getHeldItem().getItem() == ItemsCommonProxy.crystalWrench) {
if (!world.isRemote) {
if (everstone.getFacade() != null) {
everstone.setFacade(null, -1);
return true;
} else {
world.setBlockToAir(x, y, z);
this.dropBlockAsItem(world, x, y, z, new ItemStack(BlocksCommonProxy.everstone));
return true;
}
}
} else if (player.getHeldItem().getItem() instanceof ItemBlock) {
ItemBlock itemblock = (ItemBlock) player.getHeldItem().getItem();
block = itemblock.field_150939_a;
if (block.isOpaqueCube()) {
meta = itemblock.getMetadata(player.getHeldItem().getItemDamage());
}
}
if (everstone.getFacade() == null && block != null) {
everstone.setFacade(block, meta);
world.notifyBlockChange(x, y, z, this);
return true;
}
}
return false;
}
Aggregations