/** Handles all incoming connections and packets */ public void handleNetworkListenThread() { for (int var1 = 0; var1 < this.connections.size(); ++var1) { NetServerHandler var2 = (NetServerHandler) this.connections.get(var1); try { var2.handlePackets(); } catch (Exception var5) { if (var2.netManager instanceof MemoryConnection) { CrashReport var4 = CrashReport.makeCrashReport(var5, "Ticking memory connection"); throw new ReportedException(var4); } this.mcServer .getLogAgent() .logWarningException( "Failed to handle packet for " + var2.playerEntity.getEntityName() + "/" + var2.playerEntity.getPlayerIP() + ": " + var5, var5); var2.kickPlayer("Internal server error"); } if (var2.connectionClosed) { this.connections.remove(var1--); } var2.netManager.wakeThreads(); } }
public EnumStatus sleepInBedAt(int i, int j, int k) { EnumStatus enumstatus = super.sleepInBedAt(i, j, k); if (enumstatus == EnumStatus.OK) { EntityTracker entitytracker = mcServer.getEntityTracker(dimension); Packet17Sleep packet17sleep = new Packet17Sleep(this, 0, i, j, k); entitytracker.sendPacketToTrackedPlayers(this, packet17sleep); playerNetServerHandler.teleportTo(posX, posY, posZ, rotationYaw, rotationPitch); playerNetServerHandler.sendPacket(packet17sleep); } return enumstatus; }
public void addStat(StatBase statbase, int i) { if (statbase == null) { return; } if (!statbase.isIndependent) { for (; i > 100; i -= 100) { playerNetServerHandler.sendPacket(new Packet200Statistic(statbase.statId, 100)); } playerNetServerHandler.sendPacket(new Packet200Statistic(statbase.statId, i)); } }
public void displayGUIEnchantment(int i, int j, int k) { getNextWidowId(); playerNetServerHandler.sendPacket(new Packet100OpenWindow(currentWindowId, 4, "Enchanting", 9)); currentCraftingInventory = new ContainerEnchantment(inventory, worldObj, i, j, k); currentCraftingInventory.windowId = currentWindowId; currentCraftingInventory.onCraftGuiOpened(this); }
private void getTileEntityInfo(TileEntity tileentity) { if (tileentity != null) { Packet packet = tileentity.getDescriptionPacket(); if (packet != null) { playerNetServerHandler.sendPacket(packet); } } }
public void updateHeldItem() { if (isChangingQuantityOnly) { return; } else { playerNetServerHandler.sendPacket(new Packet103SetSlot(-1, -1, inventory.getItemStack())); return; } }
public void displayGUIChest(IInventory iinventory) { getNextWidowId(); playerNetServerHandler.sendPacket( new Packet100OpenWindow( currentWindowId, 0, iinventory.getInvName(), iinventory.getSizeInventory())); currentCraftingInventory = new ContainerChest(inventory, iinventory); currentCraftingInventory.windowId = currentWindowId; currentCraftingInventory.onCraftGuiOpened(this); }
public void func_71747_b() { for (int i = 0; i < field_71748_d.size(); i++) { NetServerHandler netserverhandler = (NetServerHandler) field_71748_d.get(i); try { netserverhandler.func_72570_d(); } catch (Exception exception) { field_71751_a.log( Level.WARNING, (new StringBuilder()).append("Failed to handle packet: ").append(exception).toString(), exception); netserverhandler.func_72565_c("Internal server error"); } if (netserverhandler.field_72576_c) { field_71748_d.remove(i--); } netserverhandler.field_72575_b.func_74427_a(); } }
public void func_40107_e(int i) { if (dimension == 1 && i == 1) { triggerAchievement(AchievementList.theEnd2); worldObj.removePlayerForLogoff(this); field_41032_j = true; playerNetServerHandler.sendPacket(new Packet70Bed(4, 0)); } else { triggerAchievement(AchievementList.theEnd); ChunkCoordinates chunkcoordinates = mcServer.getWorldManager(i).func_40212_d(); if (chunkcoordinates != null) { playerNetServerHandler.teleportTo( chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ, 0.0F, 0.0F); } mcServer.configManager.sendPlayerToOtherDimension(this, 1); field_35220_ce = -1; lastHealth = -1; field_35221_cc = -1; } }
public void wakeUpPlayer(boolean flag, boolean flag1, boolean flag2) { if (isPlayerSleeping()) { EntityTracker entitytracker = mcServer.getEntityTracker(dimension); entitytracker.sendPacketToTrackedPlayersAndTrackedEntity( this, new Packet18Animation(this, 3)); } super.wakeUpPlayer(flag, flag1, flag2); if (playerNetServerHandler != null) { playerNetServerHandler.teleportTo(posX, posY, posZ, rotationYaw, rotationPitch); } }
public void updateCraftingInventorySlot(Container container, int i, ItemStack itemstack) { if (container.getSlot(i) instanceof SlotCrafting) { return; } if (isChangingQuantityOnly) { return; } else { playerNetServerHandler.sendPacket(new Packet103SetSlot(container.windowId, i, itemstack)); return; } }
public void displayGUIDispenser(TileEntityDispenser tileentitydispenser) { getNextWidowId(); playerNetServerHandler.sendPacket( new Packet100OpenWindow( currentWindowId, 3, tileentitydispenser.getInvName(), tileentitydispenser.getSizeInventory())); currentCraftingInventory = new ContainerDispenser(inventory, tileentitydispenser); currentCraftingInventory.windowId = currentWindowId; currentCraftingInventory.onCraftGuiOpened(this); }
public void displayGUIFurnace(TileEntityFurnace tileentityfurnace) { getNextWidowId(); playerNetServerHandler.sendPacket( new Packet100OpenWindow( currentWindowId, 2, tileentityfurnace.getInvName(), tileentityfurnace.getSizeInventory())); currentCraftingInventory = new ContainerFurnace(inventory, tileentityfurnace); currentCraftingInventory.windowId = currentWindowId; currentCraftingInventory.onCraftGuiOpened(this); }
public void displayGUIBrewingStand(TileEntityBrewingStand tileentitybrewingstand) { getNextWidowId(); playerNetServerHandler.sendPacket( new Packet100OpenWindow( currentWindowId, 5, tileentitybrewingstand.getInvName(), tileentitybrewingstand.getSizeInventory())); currentCraftingInventory = new ContainerBrewingStand(inventory, tileentitybrewingstand); currentCraftingInventory.windowId = currentWindowId; currentCraftingInventory.onCraftGuiOpened(this); }
public void func_72355_a(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_) { func_72380_a(p_72355_2_); p_72355_2_.func_70029_a(field_72400_f.func_71218_a(p_72355_2_.field_71093_bK)); p_72355_2_.field_71134_c.func_73080_a((WorldServer) p_72355_2_.field_70170_p); String s = "local"; if (p_72355_1_.func_74430_c() != null) { s = p_72355_1_.func_74430_c().toString(); } field_72406_a.info( (new StringBuilder()) .append(p_72355_2_.field_71092_bJ) .append("[") .append(s) .append("] logged in with entity id ") .append(p_72355_2_.field_70157_k) .append(" at (") .append(p_72355_2_.field_70165_t) .append(", ") .append(p_72355_2_.field_70163_u) .append(", ") .append(p_72355_2_.field_70161_v) .append(")") .toString()); WorldServer worldserver = field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); ChunkCoordinates chunkcoordinates = worldserver.func_72861_E(); func_72381_a(p_72355_2_, null, worldserver); NetServerHandler netserverhandler = new NetServerHandler(field_72400_f, p_72355_1_, p_72355_2_); netserverhandler.func_72567_b( new Packet1Login( p_72355_2_.field_70157_k, worldserver.func_72912_H().func_76067_t(), p_72355_2_.field_71134_c.func_73081_b(), worldserver.func_72912_H().func_76093_s(), worldserver.field_73011_w.field_76574_g, worldserver.field_73013_u, worldserver.func_72800_K(), func_72352_l())); netserverhandler.func_72567_b( new Packet6SpawnPosition( chunkcoordinates.field_71574_a, chunkcoordinates.field_71572_b, chunkcoordinates.field_71573_c)); netserverhandler.func_72567_b(new Packet202PlayerAbilities(p_72355_2_.field_71075_bZ)); func_72354_b(p_72355_2_, worldserver); func_72384_a( new Packet3Chat( (new StringBuilder()) .append("\247e") .append(p_72355_2_.field_71092_bJ) .append(" joined the game.") .toString())); func_72377_c(p_72355_2_); netserverhandler.func_72569_a( p_72355_2_.field_70165_t, p_72355_2_.field_70163_u, p_72355_2_.field_70161_v, p_72355_2_.field_70177_z, p_72355_2_.field_70125_A); field_72400_f.func_71212_ac().func_71745_a(netserverhandler); netserverhandler.func_72567_b(new Packet4UpdateTime(worldserver.func_72820_D())); if (field_72400_f.func_71202_P().length() > 0) { p_72355_2_.func_71115_a(field_72400_f.func_71202_P(), field_72400_f.func_71227_R()); } PotionEffect potioneffect; for (Iterator iterator = p_72355_2_.func_70651_bq().iterator(); iterator.hasNext(); netserverhandler.func_72567_b( new Packet41EntityEffect(p_72355_2_.field_70157_k, potioneffect))) { potioneffect = (PotionEffect) iterator.next(); } p_72355_2_.func_71116_b(); }
public void mountEntity(Entity entity) { super.mountEntity(entity); playerNetServerHandler.sendPacket(new Packet39AttachEntity(this, ridingEntity)); playerNetServerHandler.teleportTo(posX, posY, posZ, rotationYaw, rotationPitch); }
public void setPositionAndUpdate(double d, double d1, double d2) { playerNetServerHandler.teleportTo(d, d1, d2, rotationYaw, rotationPitch); }
protected void onFinishedPotionEffect(PotionEffect potioneffect) { super.onFinishedPotionEffect(potioneffect); playerNetServerHandler.sendPacket(new Packet42RemoveEntityEffect(entityId, potioneffect)); }
protected void onChangedPotionEffect(PotionEffect potioneffect) { super.onChangedPotionEffect(potioneffect); playerNetServerHandler.sendPacket(new Packet41EntityEffect(entityId, potioneffect)); }
protected void func_35199_C() { playerNetServerHandler.sendPacket(new Packet38EntityStatus(entityId, (byte) 9)); super.func_35199_C(); }
public void addChatMessage(String s) { StringTranslate stringtranslate = StringTranslate.getInstance(); String s1 = stringtranslate.translateKey(s); playerNetServerHandler.sendPacket(new Packet3Chat(s1)); }
public void usePersonalCraftingInventory() { playerNetServerHandler.sendPacket(new Packet101CloseWindow(currentCraftingInventory.windowId)); closeCraftingGui(); }
public void updateCraftingInventoryInfo(Container container, int i, int j) { playerNetServerHandler.sendPacket(new Packet105UpdateProgressbar(container.windowId, i, j)); }
public void updateCraftingInventory(Container container, List list) { playerNetServerHandler.sendPacket(new Packet104WindowItems(container.windowId, list)); playerNetServerHandler.sendPacket(new Packet103SetSlot(-1, -1, inventory.getItemStack())); }
public void onUpdateEntity(boolean flag) { super.onUpdate(); for (int i = 0; i < inventory.getSizeInventory(); i++) { ItemStack itemstack = inventory.getStackInSlot(i); if (itemstack == null || !Item.itemsList[itemstack.itemID].func_28019_b() || playerNetServerHandler.getNumChunkDataPackets() > 2) { continue; } Packet packet = ((ItemMapBase) Item.itemsList[itemstack.itemID]) .getUpdatePacket(itemstack, worldObj, this); if (packet != null) { playerNetServerHandler.sendPacket(packet); } } if (flag && !loadedChunks.isEmpty()) { ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) loadedChunks.get(0); if (chunkcoordintpair != null) { boolean flag1 = false; if (playerNetServerHandler.getNumChunkDataPackets() < 4) { flag1 = true; } if (flag1) { WorldServer worldserver = mcServer.getWorldManager(dimension); loadedChunks.remove(chunkcoordintpair); playerNetServerHandler.sendPacket( new Packet51MapChunk( chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, 16, worldserver.worldYMax, 16, worldserver)); List list = worldserver.getTileEntityList( chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 16, worldserver.worldYMax, chunkcoordintpair.chunkZPos * 16 + 16); for (int j = 0; j < list.size(); j++) { getTileEntityInfo((TileEntity) list.get(j)); } } } } if (inPortal) { if (mcServer.propertyManagerObj.getBooleanProperty("allow-nether", true)) { if (currentCraftingInventory != personalCraftingInventory) { usePersonalCraftingInventory(); } if (ridingEntity != null) { mountEntity(ridingEntity); } else { timeInPortal += 0.0125F; if (timeInPortal >= 1.0F) { timeInPortal = 1.0F; timeUntilPortal = 10; byte byte0 = 0; if (dimension == -1) { byte0 = 0; } else { byte0 = -1; } mcServer.configManager.sendPlayerToOtherDimension(this, byte0); field_35220_ce = -1; lastHealth = -1; field_35221_cc = -1; triggerAchievement(AchievementList.portal); } } inPortal = false; } } else { if (timeInPortal > 0.0F) { timeInPortal -= 0.05F; } if (timeInPortal < 0.0F) { timeInPortal = 0.0F; } } if (timeUntilPortal > 0) { timeUntilPortal--; } if (getEntityHealth() != lastHealth || field_35221_cc != foodStats.getFoodLevel() || (foodStats.getSaturationLevel() == 0.0F) != field_35222_cd) { playerNetServerHandler.sendPacket( new Packet8UpdateHealth( getEntityHealth(), foodStats.getFoodLevel(), foodStats.getSaturationLevel())); lastHealth = getEntityHealth(); field_35221_cc = foodStats.getFoodLevel(); field_35222_cd = foodStats.getSaturationLevel() == 0.0F; } if (experienceTotal != field_35220_ce) { field_35220_ce = experienceTotal; playerNetServerHandler.sendPacket( new Packet43Experience(experience, experienceTotal, experienceLevel)); } }