public override void handlePlace(Packet15Place packet15place) { ItemStack itemstack = playerEntity.inventory.getCurrentItem(); bool flag = mcServer.worldMngr.field_819_z = mcServer.configManager.isOp(playerEntity.username); if (packet15place.direction == 255) { if (itemstack == null) { return; } playerEntity.itemInWorldManager.func_6154_a(playerEntity, mcServer.worldMngr, itemstack); } else { int i = packet15place.xPosition; int j = packet15place.yPosition; int k = packet15place.zPosition; int l = packet15place.direction; ChunkCoordinates chunkcoordinates = mcServer.worldMngr.func_22078_l(); var i1 = (int) MathHelper.abs(i - chunkcoordinates.posX); var j1 = (int) MathHelper.abs(k - chunkcoordinates.posZ); if (i1 > j1) { j1 = i1; } if (j1 > 16 || flag) { playerEntity.itemInWorldManager.activeBlockOrUseItem(playerEntity, mcServer.worldMngr, itemstack, i, j, k, l); } playerEntity.playerNetServerHandler.sendPacket(new Packet53BlockChange(i, j, k, mcServer.worldMngr)); if (l == 0) { j--; } if (l == 1) { j++; } if (l == 2) { k--; } if (l == 3) { k++; } if (l == 4) { i--; } if (l == 5) { i++; } playerEntity.playerNetServerHandler.sendPacket(new Packet53BlockChange(i, j, k, mcServer.worldMngr)); } if (itemstack != null && itemstack.stackSize == 0) { playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem] = null; } playerEntity.isChangingQuantityOnly = true; playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem] = ItemStack.func_20117_a(playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem]); Slot slot = playerEntity.currentCraftingInventory.func_20127_a(playerEntity.inventory, playerEntity.inventory.currentItem); playerEntity.currentCraftingInventory.updateCraftingMatrix(); playerEntity.isChangingQuantityOnly = false; if (!ItemStack.areItemStacksEqual(playerEntity.inventory.getCurrentItem(), packet15place.itemStack)) { sendPacket(new Packet103(playerEntity.currentCraftingInventory.windowId, slot.id, playerEntity.inventory.getCurrentItem())); } mcServer.worldMngr.field_819_z = false; }
public override void handlePlace(Packet15Place packet15place) { ItemStack itemstack = playerEntity.inventory.getCurrentItem(); bool flag = mcServer.worldMngr.field_819_z = mcServer.configManager.isOp(playerEntity.username); if (packet15place.direction == 255) { if (itemstack == null) { return; } playerEntity.itemInWorldManager.func_6154_a(playerEntity, mcServer.worldMngr, itemstack); } else { int i = packet15place.xPosition; int j = packet15place.yPosition; int k = packet15place.zPosition; int l = packet15place.direction; ChunkCoordinates chunkcoordinates = mcServer.worldMngr.func_22078_l(); var i1 = (int)MathHelper.abs(i - chunkcoordinates.posX); var j1 = (int)MathHelper.abs(k - chunkcoordinates.posZ); if (i1 > j1) { j1 = i1; } if (j1 > 16 || flag) { playerEntity.itemInWorldManager.activeBlockOrUseItem(playerEntity, mcServer.worldMngr, itemstack, i, j, k, l); } playerEntity.playerNetServerHandler.sendPacket(new Packet53BlockChange(i, j, k, mcServer.worldMngr)); if (l == 0) { j--; } if (l == 1) { j++; } if (l == 2) { k--; } if (l == 3) { k++; } if (l == 4) { i--; } if (l == 5) { i++; } playerEntity.playerNetServerHandler.sendPacket(new Packet53BlockChange(i, j, k, mcServer.worldMngr)); } if (itemstack != null && itemstack.stackSize == 0) { playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem] = null; } playerEntity.isChangingQuantityOnly = true; playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem] = ItemStack.func_20117_a(playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem]); Slot slot = playerEntity.currentCraftingInventory.func_20127_a(playerEntity.inventory, playerEntity.inventory.currentItem); playerEntity.currentCraftingInventory.updateCraftingMatrix(); playerEntity.isChangingQuantityOnly = false; if (!ItemStack.areItemStacksEqual(playerEntity.inventory.getCurrentItem(), packet15place.itemStack)) { sendPacket(new Packet103(playerEntity.currentCraftingInventory.windowId, slot.id, playerEntity.inventory.getCurrentItem())); } mcServer.worldMngr.field_819_z = false; }