Posted September 2, 201510 yr So I am here in my Item Class: Entity entity; @Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { if(entity == null){ System.out.println(FMLCommonHandler.instance().getEffectiveSide() + "Take"); takeBlock(world, pos, hitX, hitY, hitZ, 3); }else{ if(entity instanceof EntityNotFallingBlock){ System.out.println(FMLCommonHandler.instance().getEffectiveSide() + "Place"); world.setBlockState(new BlockPos(entity), ((EntityNotFallingBlock) entity).theBlock); entity.setDead(); entity = null; } } return true; } @Override public void onUpdate(ItemStack stack, World world, Entity player, int itemSlot, boolean isSelected) { // if(blockPlaced){ // entity = null; // blockPlaced = false; // } if(!stack.hasTagCompound()){ stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound nbt = stack.getTagCompound(); if(player instanceof EntityPlayer){ if(((EntityPlayer) player).getCurrentEquippedItem() == stack){ if(entity != null){ boolean flag = true; if(entity instanceof EntityNotFallingBlock){ if(((EntityNotFallingBlock) entity).getAllowFall()){ flag = false; } } if(flag){ int far = 5; if(player.rayTrace(far, 1) != null){ if(player.rayTrace(far, 1).hitVec != null){ MovingObjectPosition mop = player.rayTrace(far, 1); Vec3 hit = mop.hitVec; int side = mop.sideHit.getIndex(); switch(side){ case 0: entity.setPositionAndUpdate((int)hit.xCoord + 0.5, (int)hit.yCoord - 1, (int)hit.zCoord - 0.5); break; case 1: entity.setPositionAndUpdate((int)hit.xCoord + 0.5, (int)hit.yCoord, (int)hit.zCoord - 0.5); break; case 2: entity.setPositionAndUpdate((int)hit.xCoord + 0.5, (int)hit.yCoord, (int)hit.zCoord - 0.5); break; case 3: entity.setPositionAndUpdate((int)hit.xCoord + 0.5, (int)hit.yCoord, (int)hit.zCoord + 0.5); break; case 4: entity.setPositionAndUpdate((int)hit.xCoord - 0.5, (int)hit.yCoord, (int)hit.zCoord - 0.5); break; case 5: entity.setPositionAndUpdate((int)hit.xCoord + 0.5, (int)hit.yCoord, (int)hit.zCoord - 0.5); break; } } } } } } } } I know the Entity entity is not the best solution, if this is the problem I'm sorry, but the problem is, when I use my item on a block, it takes it on client(or the other way around), and places it on server, if I delete the code which should place the block, it works, but thats not a solution Should I try with network, but I mean the onItemUsed is called the exact same way on both server and client, so it makes no sense to me Creator of Extra Shoes Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then
September 2, 201510 yr Why not read what people told you in the first post on this? Someone chimed in and told you to add a check for side in it 'if (!world.isRemote()). Go delete entity. Its not that is a bad way to do it, it is flat wrong. Entity will always be wrong the way you are using it. Long time Bukkit & Forge Programmer Happy to try and help
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.