public void func_72472_a(Packet15Place p_72472_1_) { WorldServer var2 = this.field_72573_d.func_71218_a(this.field_72574_e.field_71093_bK); ItemStack var3 = this.field_72574_e.field_71071_by.func_70448_g(); boolean var4 = false; int var5 = p_72472_1_.func_73403_d(); int var6 = p_72472_1_.func_73402_f(); int var7 = p_72472_1_.func_73407_g(); int var8 = p_72472_1_.func_73401_h(); if (p_72472_1_.func_73401_h() == 255) { if (var3 == null) { return; } this.field_72574_e.field_71134_c.func_73085_a(this.field_72574_e, var2, var3); } else if (p_72472_1_.func_73402_f() >= this.field_72573_d.func_71207_Z() - 1 && (p_72472_1_.func_73401_h() == 1 || p_72472_1_.func_73402_f() >= this.field_72573_d.func_71207_Z())) { this.field_72574_e.field_71135_a.func_72567_b( new Packet3Chat( "" + EnumChatFormatting.GRAY + "Height limit for building is " + this.field_72573_d.func_71207_Z())); var4 = true; } else { if (this.field_72587_r && this.field_72574_e.func_70092_e( (double) var5 + 0.5D, (double) var6 + 0.5D, (double) var7 + 0.5D) < 64.0D && !this.field_72573_d.func_96290_a(var2, var5, var6, var7, this.field_72574_e)) { this.field_72574_e.field_71134_c.func_73078_a( this.field_72574_e, var2, var3, var5, var6, var7, var8, p_72472_1_.func_73406_j(), p_72472_1_.func_73404_l(), p_72472_1_.func_73408_m()); } var4 = true; } if (var4) { this.field_72574_e.field_71135_a.func_72567_b( new Packet53BlockChange(var5, var6, var7, var2)); if (var8 == 0) { --var6; } if (var8 == 1) { ++var6; } if (var8 == 2) { --var7; } if (var8 == 3) { ++var7; } if (var8 == 4) { --var5; } if (var8 == 5) { ++var5; } this.field_72574_e.field_71135_a.func_72567_b( new Packet53BlockChange(var5, var6, var7, var2)); } var3 = this.field_72574_e.field_71071_by.func_70448_g(); if (var3 != null && var3.field_77994_a == 0) { this.field_72574_e .field_71071_by .field_70462_a[this.field_72574_e.field_71071_by.field_70461_c] = null; var3 = null; } if (var3 == null || var3.func_77988_m() == 0) { this.field_72574_e.field_71137_h = true; this.field_72574_e .field_71071_by .field_70462_a[this.field_72574_e.field_71071_by.field_70461_c] = ItemStack.func_77944_b( this.field_72574_e .field_71071_by .field_70462_a[this.field_72574_e.field_71071_by.field_70461_c]); Slot var9 = this.field_72574_e.field_71070_bA.func_75147_a( this.field_72574_e.field_71071_by, this.field_72574_e.field_71071_by.field_70461_c); this.field_72574_e.field_71070_bA.func_75142_b(); this.field_72574_e.field_71137_h = false; if (!ItemStack.func_77989_b( this.field_72574_e.field_71071_by.func_70448_g(), p_72472_1_.func_73405_i())) { this.func_72567_b( new Packet103SetSlot( this.field_72574_e.field_71070_bA.field_75152_c, var9.field_75222_d, this.field_72574_e.field_71071_by.func_70448_g())); } } }
public void handlePlace(Packet15Place par1Packet15Place) { WorldServer worldserver = mcServer.worldServerForDimension(playerEntity.dimension); ItemStack itemstack = playerEntity.inventory.getCurrentItem(); boolean flag = false; int i = par1Packet15Place.getXPosition(); int j = par1Packet15Place.getYPosition(); int k = par1Packet15Place.getZPosition(); int l = par1Packet15Place.getDirection(); boolean flag1 = worldserver.actionsAllowed = worldserver.provider.worldType != 0 || mcServer.getConfigurationManager().areCommandsAllowed(playerEntity.username) || mcServer.isSinglePlayer(); if (par1Packet15Place.getDirection() == 255) { if (itemstack == null) { return; } playerEntity.theItemInWorldManager.tryUseItem(playerEntity, worldserver, itemstack); } else if (par1Packet15Place.getYPosition() < mcServer.getBuildLimit() - 1 || par1Packet15Place.getDirection() != 1 && par1Packet15Place.getYPosition() < mcServer.getBuildLimit()) { ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint(); int i1 = MathHelper.abs_int(i - chunkcoordinates.posX); int j1 = MathHelper.abs_int(k - chunkcoordinates.posZ); if (i1 > j1) { j1 = i1; } if (field_72587_r && playerEntity.getDistanceSq((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D) < 64D && (j1 > 16 || flag1)) { playerEntity.theItemInWorldManager.activateBlockOrUseItem( playerEntity, worldserver, itemstack, i, j, k, l, par1Packet15Place.getXOffset(), par1Packet15Place.getYOffset(), par1Packet15Place.getZOffset()); } flag = true; } else { playerEntity.serverForThisPlayer.sendPacketToPlayer( new Packet3Chat( (new StringBuilder()) .append("\2477Height limit for building is ") .append(mcServer.getBuildLimit()) .toString())); flag = true; } if (flag) { playerEntity.serverForThisPlayer.sendPacketToPlayer( new Packet53BlockChange(i, j, k, worldserver)); 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.serverForThisPlayer.sendPacketToPlayer( new Packet53BlockChange(i, j, k, worldserver)); } itemstack = playerEntity.inventory.getCurrentItem(); if (itemstack != null && itemstack.stackSize == 0) { playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem] = null; itemstack = null; } if (itemstack == null || itemstack.getMaxItemUseDuration() == 0) { playerEntity.playerInventoryBeingManipulated = true; playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem] = ItemStack.copyItemStack( playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem]); Slot slot = playerEntity.craftingInventory.getSlotFromInventory( playerEntity.inventory, playerEntity.inventory.currentItem); playerEntity.craftingInventory.updateCraftingResults(); playerEntity.playerInventoryBeingManipulated = false; if (!ItemStack.areItemStacksEqual( playerEntity.inventory.getCurrentItem(), par1Packet15Place.getItemStack())) { sendPacketToPlayer( new Packet103SetSlot( playerEntity.craftingInventory.windowId, slot.slotNumber, playerEntity.inventory.getCurrentItem())); } } worldserver.actionsAllowed = false; }
public void handlePlace(Packet15Place par1Packet15Place) { WorldServer var2 = this.mcServer.getWorldManager(this.playerEntity.dimension); ItemStack var3 = this.playerEntity.inventory.getCurrentItem(); boolean var4 = false; int var5 = par1Packet15Place.getXPosition(); int var6 = par1Packet15Place.getYPosition(); int var7 = par1Packet15Place.getZPosition(); int var8 = par1Packet15Place.getDirection(); boolean var9 = var2.disableSpawnProtection = var2.provider.worldType != 0 || this.mcServer.getConfigurationManager().isOp(this.playerEntity.username) || this.mcServer.isSinglePlayer(); if (par1Packet15Place.getDirection() == 255) { if (var3 == null) { return; } this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, var2, var3); } else if (par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit() - 1 && (par1Packet15Place.getDirection() == 1 || par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit())) { this.playerEntity.playerNetServerHandler.sendPacket( new Packet3Chat("\u00a77Height limit for building is " + this.mcServer.getBuildLimit())); var4 = true; } else { ChunkCoordinates var10 = var2.getSpawnPoint(); int var11 = MathHelper.abs(var5 - var10.posX); int var12 = MathHelper.abs(var7 - var10.posZ); if (var11 > var12) { var12 = var11; } if (this.hasMoved && this.playerEntity.getDistanceSq( (double) var5 + 0.5D, (double) var6 + 0.5D, (double) var7 + 0.5D) < 64.0D && (var12 > 16 || var9)) { this.playerEntity.theItemInWorldManager.activateBlockOrUseItem( this.playerEntity, var2, var3, var5, var6, var7, var8, par1Packet15Place.getXOffset(), par1Packet15Place.getYOffset(), par1Packet15Place.getZOffset()); } var4 = true; } if (var4) { this.playerEntity.playerNetServerHandler.sendPacket( new Packet53BlockChange(var5, var6, var7, var2)); if (var8 == 0) { --var6; } if (var8 == 1) { ++var6; } if (var8 == 2) { --var7; } if (var8 == 3) { ++var7; } if (var8 == 4) { --var5; } if (var8 == 5) { ++var5; } this.playerEntity.playerNetServerHandler.sendPacket( new Packet53BlockChange(var5, var6, var7, var2)); } var3 = this.playerEntity.inventory.getCurrentItem(); if (var3 != null && var3.stackSize == 0) { this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = null; var3 = null; } if (var3 == null || var3.getMaxItemUseDuration() == 0) { this.playerEntity.isChangingQuantityOnly = true; this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = ItemStack.copyItemStack( this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem]); Slot var13 = this.playerEntity.craftingInventory.func_75147_a( this.playerEntity.inventory, this.playerEntity.inventory.currentItem); this.playerEntity.craftingInventory.updateCraftingResults(); this.playerEntity.isChangingQuantityOnly = false; if (!ItemStack.areItemStacksEqual( this.playerEntity.inventory.getCurrentItem(), par1Packet15Place.getItemStack())) { this.sendPacket( new Packet103SetSlot( this.playerEntity.craftingInventory.windowId, var13.slotNumber, this.playerEntity.inventory.getCurrentItem())); } } var2.disableSpawnProtection = false; }