Posted February 2, 201312 yr Hello; I'm having a minor issue with my mod. There's an item in my mod, that when right clicked on a block will turn it into a different block. This works fine; however it also is set to spawn an item there. When it does this, it spawns both the actual item, and a sort of ghost entity of the item. How do I fix this? Here's all the code used to do this. public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { MovingObjectPosition var4 = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true); if (var4 == null) { return par1ItemStack; } else { if (var4.typeOfHit == EnumMovingObjectType.TILE) { int var5 = var4.blockX; int var6 = var4.blockY; int var7 = var4.blockZ; if (!par2World.canMineBlock(par3EntityPlayer, var5, var6, var7)) { return par1ItemStack; } if (!par3EntityPlayer.canPlayerEdit(var5, var6, var7, var4.sideHit, par1ItemStack)) { return par1ItemStack; } if (par2World.getBlockId(var5, var6, var7) == ModAdamant.witherdirt.blockID) { par2World.setBlockWithNotify(var5, var6, var7, Block.dirt.blockID); par1ItemStack.damageItem(1, par3EntityPlayer); par2World.spawnEntityInWorld(new EntityItem(par2World, var5, var6, var7, new ItemStack(ModAdamant.withershard))); } } return par1ItemStack; } } Thanks for helping me
February 3, 201312 yr Add [solved] to the beginning of the title at least, then people knows it's solved and people willing to help can skipp it while others having similar problems will find the solution faster when searching If you guys dont get it.. then well ya.. try harder...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.