- 30
- 0
Я сделал так что если игрок кликнул ПКМ волшебной палочкой по блоку то он превращается в другой блок, но если по блоку кликнуть ПКМ без палочки происходит краш.
Код:
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if(par5EntityPlayer.getCurrentEquippedItem().getItem() == Items.coal_stick){
par5EntityPlayer.addStat(New_Craft.coal_diamond_a, 1);
par1World.setBlock(par2, par3, par4, Block.blockDiamond.blockID);
par1World.setBlock(par2, par3, par4+1, Blocks.radiation_block.blockID);
par1World.setBlock(par2, par3, par4-1, Blocks.radiation_block.blockID);
par1World.setBlock(par2+1, par3, par4, Blocks.radiation_block.blockID);
par1World.setBlock(par2-1, par3, par4, Blocks.radiation_block.blockID);
par1World.setBlock(par2, par3+1, par4, Blocks.radiation_block.blockID);
par1World.setBlock(par2, par3-1, par4, Blocks.radiation_block.blockID);
worldObj = Minecraft.getMinecraft().theWorld;
worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, par2, par3+1, par4));
}
return true;
}