mirror of
				https://github.com/catfoolyou/Project164.git
				synced 2025-06-12 10:04:23 -05:00 
			
		
		
		
	Connection fixed, inventory screwed up
This commit is contained in:
		
							parent
							
								
									27a91f4260
								
							
						
					
					
						commit
						d7ce60ce3b
					
				
							
								
								
									
										2
									
								
								.idea/compiler.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.idea/compiler.xml
									
									
									
										generated
									
									
									
								
							| @ -1,6 +1,6 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
|   <component name="CompilerConfiguration"> | ||||
|     <bytecodeTargetLevel target="18" /> | ||||
|     <bytecodeTargetLevel target="17" /> | ||||
|   </component> | ||||
| </project> | ||||
							
								
								
									
										2
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							| @ -1,5 +1,5 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
|   <component name="ExternalStorageConfigurationManager" enabled="true" /> | ||||
|   <component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="corretto-18" project-jdk-type="JavaSDK" /> | ||||
|   <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-18" project-jdk-type="JavaSDK" /> | ||||
| </project> | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -93,9 +93,10 @@ public class WorkerNetworkManager implements INetworkManager { | ||||
| 				//System.out.println("[Server][" + ipcChannel + "]: packet '" + pkt.getClass().getSimpleName() + "' recieved"); | ||||
| 				 | ||||
| 				try { | ||||
| 					//System.out.println("processing packet with nethandler " + theNetHandler.getClass().getSimpleName()); | ||||
| 					pkt.processPacket(theNetHandler); // This is a problem | ||||
| 				}catch(Throwable t) { | ||||
| 					System.out.println(theNetHandler.getClass().getSimpleName()); | ||||
| 					System.out.println(theNetHandler.getClass().getSimpleName() + " fucked up"); | ||||
| 					System.err.println("Could not process minecraft packet 0x" + Integer.toHexString(pkt.getPacketId()) + " class '" + pkt.getClass().getSimpleName() + "' on channel 'NET|" + ipcChannel + "'"); | ||||
| 					t.printStackTrace(); | ||||
| 				} | ||||
|  | ||||
| @ -118,14 +118,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting | ||||
| 
 | ||||
|         if (par1NBTTagCompound.hasKey("playerGameType")) | ||||
|         { | ||||
|             if (true) // FIX THIS SHIT | ||||
|             { | ||||
|                 this.theItemInWorldManager.setGameType(MinecraftServer.getServer().getGameType()); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 this.theItemInWorldManager.setGameType(EnumGameType.getByID(par1NBTTagCompound.getInteger("playerGameType"))); | ||||
|             } | ||||
|             this.theItemInWorldManager.setGameType(MinecraftServer.getServer().getGameType()); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| @ -187,58 +180,46 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting | ||||
|             Iterator var3 = this.destroyedItemsNetCache.iterator(); | ||||
|             int var4 = 0; | ||||
| 
 | ||||
|             while (var3.hasNext() && var4 < var1) | ||||
|             { | ||||
|                 var2[var4++] = ((Integer)var3.next()).intValue(); | ||||
|             while (var3.hasNext() && var4 < var1) { | ||||
|                 var2[var4++] = ((Integer) var3.next()).intValue(); | ||||
|                 var3.remove(); | ||||
|             } | ||||
| 
 | ||||
|             this.playerNetServerHandler.sendPacketToPlayer(new Packet29DestroyEntity(var2)); | ||||
|         } | ||||
| 
 | ||||
|         if (!this.loadedChunks.isEmpty()) | ||||
|         { | ||||
|         if (!this.loadedChunks.isEmpty()) { | ||||
|             ArrayList var6 = new ArrayList(); | ||||
|             Iterator var7 = this.loadedChunks.iterator(); | ||||
|             ArrayList var8 = new ArrayList(); | ||||
| 
 | ||||
|             while (var7.hasNext() && var6.size() < 5) | ||||
|             { | ||||
|                 ChunkCoordIntPair var9 = (ChunkCoordIntPair)var7.next(); | ||||
|             while (var7.hasNext() && var6.size() < this.renderDistance / 2) { | ||||
|                 ChunkCoordIntPair var9 = (ChunkCoordIntPair) var7.next(); | ||||
|                 var7.remove(); | ||||
| 
 | ||||
|                 if (var9 != null && this.worldObj.blockExists(var9.chunkXPos << 4, 0, var9.chunkZPos << 4)) | ||||
|                 { | ||||
|                 if (var9 != null && this.worldObj.blockExists(var9.chunkXPos << 4, 0, var9.chunkZPos << 4)) { | ||||
|                     var6.add(this.worldObj.getChunkFromChunkCoords(var9.chunkXPos, var9.chunkZPos)); | ||||
|                     var8.addAll(((WorldServer)this.worldObj).getAllTileEntityInBox(var9.chunkXPos * 16, 0, var9.chunkZPos * 16, var9.chunkXPos * 16 + 16, 256, var9.chunkZPos * 16 + 16)); | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             if (!var6.isEmpty()) | ||||
|             { | ||||
|             if (!var6.isEmpty()) { | ||||
|                 this.playerNetServerHandler.sendPacketToPlayer(new Packet56MapChunks(var6)); | ||||
|                 Iterator var10 = var8.iterator(); | ||||
| 
 | ||||
|                 while (var10.hasNext()) | ||||
|                 { | ||||
|                     TileEntity var5 = (TileEntity)var10.next(); | ||||
|                 while (var10.hasNext()) { | ||||
|                     TileEntity var5 = (TileEntity) var10.next(); | ||||
|                     this.sendTileEntityToPlayer(var5); | ||||
|                 } | ||||
| 
 | ||||
|                 var10 = var6.iterator(); | ||||
| 
 | ||||
|                 while (var10.hasNext()) | ||||
|                 { | ||||
|                     Chunk var11 = (Chunk)var10.next(); | ||||
|                 while (var10.hasNext()) { | ||||
|                     Chunk var11 = (Chunk) var10.next(); | ||||
|                     this.getServerForPlayer().getEntityTracker().func_85172_a(this, var11); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         /*if (this.field_143005_bX > 0L && this.mcServer.func_143007_ar() > 0 && EaglerAdapter.steadyTimeMillis() - this.field_143005_bX > (long)(this.mcServer.func_143007_ar() * 1000 * 60)) | ||||
|         { | ||||
|             this.playerNetServerHandler.kickPlayerFromServer("You have been idle for too long!"); | ||||
|         }*/ | ||||
|     } | ||||
| 
 | ||||
|     public void onUpdateEntity() | ||||
| @ -277,7 +258,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting | ||||
|             while (var7.hasNext()) | ||||
|             { | ||||
|                 ScoreObjective var9 = (ScoreObjective)var7.next(); | ||||
|                 this.getWorldScoreboard().func_96529_a(this.getEntityName(), var9).func_96651_a(Arrays.asList(new EntityPlayer[] {this})); | ||||
|                 this.getWorldScoreboard().func_96529_a(this.getEntityName(), var9).func_96651_a(Arrays.asList(this)); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
| @ -946,15 +927,6 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting | ||||
|         return this.chatVisibility; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * on recieving this message the client (if permission is given) will download the requested textures | ||||
|      */ | ||||
|     public void requestTexturePackLoad(String par1Str, int par2) | ||||
|     { | ||||
|         String var3 = par1Str + "\u0000" + par2; | ||||
|         this.playerNetServerHandler.sendPacketToPlayer(new Packet250CustomPayload("MC|TPack", var3.getBytes())); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Return the position for this command sender. | ||||
|      */ | ||||
|  | ||||
| @ -50,14 +50,14 @@ public class NetLoginHandler extends NetHandler { | ||||
| 	 * network packets unless the timeout has occurred. | ||||
| 	 */ | ||||
| 	public void handlePackets() { | ||||
| 		System.out.println("[SP-Server][LOGIN][HANDLE][" + clientUsername + "]"); | ||||
| 		if (this.field_72544_i) { // FIX THIS SHIT!!! this.field_72544_i | ||||
| 		//System.out.println("[SP-Server][LOGIN][HANDLE][" + clientUsername + "]"); | ||||
| 		if (this.field_72544_i) { // FIX THIS SHIT!!! | ||||
| 			this.initializePlayerConnection(); | ||||
| 			return; | ||||
| 		} | ||||
| 
 | ||||
| 		if (this.loginTimer++ == 600) { | ||||
| 			this.kickUser("Took too long to log in"); | ||||
| 		if (this.loginTimer++ == 600 && finishedProcessing == false) { | ||||
| 			//this.kickUser("Took too long to log in"); | ||||
| 		} else { | ||||
| 			this.myTCPConnection.processReadPackets(); // problem | ||||
| 		} | ||||
| @ -86,6 +86,7 @@ public class NetLoginHandler extends NetHandler { | ||||
| 	} | ||||
| 
 | ||||
| 	public void handleClientProtocol(Packet2ClientProtocol par1Packet2ClientProtocol) { | ||||
| 		System.out.println("handling client protocol, netloginhandler"); | ||||
| 		this.clientUsername = par1Packet2ClientProtocol.getUsername(); | ||||
| 		int var2 = 64 << 3 - par1Packet2ClientProtocol.getViewDistance(); | ||||
| 		if(var2 > 400) { | ||||
| @ -111,7 +112,9 @@ public class NetLoginHandler extends NetHandler { | ||||
| 	} | ||||
| 
 | ||||
| 	public void handleClientCommand(Packet205ClientCommand par1Packet205ClientCommand) { | ||||
| 		System.out.println("handling client command"); | ||||
| 		if (par1Packet205ClientCommand.forceRespawn == 0) { | ||||
| 			System.out.println("actually handling client command"); | ||||
| 			if (this.field_92079_k) { | ||||
| 				this.kickUser("Duplicate login"); | ||||
| 				return; | ||||
| @ -130,6 +133,7 @@ public class NetLoginHandler extends NetHandler { | ||||
| 	 * otherwise they are packet255'd | ||||
| 	 */ | ||||
| 	public void initializePlayerConnection() { | ||||
| 		System.out.println("Init player connection"); | ||||
| 		String var1 = this.mcServer.getConfigurationManager().allowUserToConnect(this.clientUsername); | ||||
| 
 | ||||
| 		if (var1 != null) { | ||||
| @ -151,6 +155,7 @@ public class NetLoginHandler extends NetHandler { | ||||
| 		} | ||||
| 
 | ||||
| 		this.finishedProcessing = true; | ||||
| 		System.out.println(this.finishedProcessing); | ||||
| 	} | ||||
| 
 | ||||
| 	public void handleErrorMessage(String par1Str, Object[] par2ArrayOfObj) { | ||||
|  | ||||
| @ -571,6 +571,7 @@ public class NetServerHandler extends NetHandler | ||||
| 
 | ||||
|     public void handleBlockItemSwitch(Packet16BlockItemSwitch par1Packet16BlockItemSwitch) | ||||
|     { | ||||
|         System.out.println("handleBlockItemSwitch"); | ||||
|         if (par1Packet16BlockItemSwitch.id >= 0 && par1Packet16BlockItemSwitch.id < InventoryPlayer.getHotbarSize()) | ||||
|         { | ||||
|             this.playerEntity.inventory.currentItem = par1Packet16BlockItemSwitch.id; | ||||
| @ -801,8 +802,6 @@ public class NetServerHandler extends NetHandler | ||||
| 
 | ||||
|     public void handleWindowClick(Packet102WindowClick par1Packet102WindowClick) | ||||
|     { | ||||
|         //this.playerEntity.func_143004_u(); | ||||
| 
 | ||||
|         if (this.playerEntity.openContainer.windowId == par1Packet102WindowClick.window_Id && this.playerEntity.openContainer.isPlayerNotUsingContainer(this.playerEntity)) | ||||
|         { | ||||
|             ItemStack var2 = this.playerEntity.openContainer.slotClick(par1Packet102WindowClick.inventorySlot, par1Packet102WindowClick.mouseClick, par1Packet102WindowClick.holdingShift, this.playerEntity); | ||||
|  | ||||
| @ -62,54 +62,51 @@ public abstract class ServerConfigurationManager | ||||
| 
 | ||||
|     public void initializeConnectionToPlayer(INetworkManager par1INetworkManager, EntityPlayerMP par2EntityPlayerMP) | ||||
|     { | ||||
|         System.out.println("player connection initialized"); | ||||
|         if(par2EntityPlayerMP.username.equals(mcServer.getServerOwner())) { | ||||
|             viewDistance = par2EntityPlayerMP.renderDistance; | ||||
|         } | ||||
| 
 | ||||
|         NBTTagCompound var3 = this.readPlayerDataFromFile(par2EntityPlayerMP); | ||||
|         par2EntityPlayerMP.setWorld(this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension)); | ||||
|         par2EntityPlayerMP.theItemInWorldManager.setWorld((WorldServer)par2EntityPlayerMP.worldObj); | ||||
|         par2EntityPlayerMP.theItemInWorldManager.setWorld((WorldServer) par2EntityPlayerMP.worldObj); | ||||
|         String var4 = "local"; | ||||
| 
 | ||||
|         /*if (par1INetworkManager.getSocketAddress() != null) | ||||
|         { | ||||
|             var4 = par1INetworkManager.getSocketAddress().toString(); | ||||
|         }*/ | ||||
| 
 | ||||
|         this.mcServer.getLogAgent().logInfo(par2EntityPlayerMP.getCommandSenderName() + "[" + var4 + "] logged in with entity id " + par2EntityPlayerMP.entityId + " at (" + par2EntityPlayerMP.posX + ", " + par2EntityPlayerMP.posY + ", " + par2EntityPlayerMP.posZ + ")"); | ||||
|         this.mcServer.getLogAgent().logInfo(par2EntityPlayerMP.username + " [" + var4 + "] logged in with entity id " + par2EntityPlayerMP.entityId + " at (" + par2EntityPlayerMP.posX + ", " + par2EntityPlayerMP.posY + ", " + par2EntityPlayerMP.posZ + ")"); | ||||
|         WorldServer var5 = this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension); | ||||
|         ChunkCoordinates var6 = var5.getSpawnPoint(); | ||||
|         this.func_72381_a(par2EntityPlayerMP, (EntityPlayerMP)null, var5); | ||||
|         this.func_72381_a(par2EntityPlayerMP, (EntityPlayerMP) null, var5); | ||||
|         NetServerHandler var7 = new NetServerHandler(this.mcServer, par1INetworkManager, par2EntityPlayerMP); | ||||
|         var7.sendPacketToPlayer(new Packet1Login(par2EntityPlayerMP.entityId, var5.getWorldInfo().getTerrainType(), par2EntityPlayerMP.theItemInWorldManager.getGameType(), var5.getWorldInfo().isHardcoreModeEnabled(), var5.provider.dimensionId, var5.difficultySetting, var5.getHeight(), this.getMaxPlayers())); | ||||
|         //var7.sendPacketToPlayer(new Packet250CustomPayload("MC|Brand", this.getServerInstance().getServerModName().getBytes(Charset.UTF_8))); | ||||
|         var7.sendPacketToPlayer(new Packet6SpawnPosition(var6.posX, var6.posY, var6.posZ)); | ||||
|         var7.sendPacketToPlayer(new Packet202PlayerAbilities(par2EntityPlayerMP.capabilities)); | ||||
|         var7.sendPacketToPlayer(new Packet16BlockItemSwitch(par2EntityPlayerMP.inventory.currentItem)); | ||||
|         this.func_96456_a((ServerScoreboard)var5.getScoreboard(), par2EntityPlayerMP); | ||||
|         this.updateTimeAndWeatherForPlayer(par2EntityPlayerMP, var5); | ||||
|         this.sendChatMsg(StatCollector.translateToLocalFormatted(EnumChatFormatting.YELLOW + "multiplayer.player.joined", new Object[] {par2EntityPlayerMP.getTranslatedEntityName()})); | ||||
|         this.sendPacketToAllPlayers(new Packet3Chat(EnumChatFormatting.YELLOW + par2EntityPlayerMP.getTranslatedEntityName() + EnumChatFormatting.YELLOW + " joined the game.")); | ||||
|         this.playerLoggedIn(par2EntityPlayerMP); | ||||
|         var7.setPlayerLocation(par2EntityPlayerMP.posX, par2EntityPlayerMP.posY, par2EntityPlayerMP.posZ, par2EntityPlayerMP.rotationYaw, par2EntityPlayerMP.rotationPitch); | ||||
|         var7.sendPacketToPlayer(new Packet4UpdateTime(var5.getTotalWorldTime(), var5.getWorldTime(), var5.getGameRules().getGameRuleBooleanValue("doDaylightCycle"))); | ||||
| 
 | ||||
|         if (this.mcServer.getTexturePack().length() > 0) | ||||
|         { | ||||
|             par2EntityPlayerMP.requestTexturePackLoad(this.mcServer.getTexturePack(), this.mcServer.textureSize()); | ||||
| //            System.out.println("what the fuck??"); | ||||
| //            par2EntityPlayerMP.requestTexturePackLoad(this.mcServer.getTexturePack(), this.mcServer.textureSize()); | ||||
|         } | ||||
| 
 | ||||
|         Iterator var8 = par2EntityPlayerMP.getActivePotionEffects().iterator(); | ||||
| 
 | ||||
|         while (var8.hasNext()) | ||||
|         { | ||||
|             PotionEffect var9 = (PotionEffect)var8.next(); | ||||
|         while (var8.hasNext()) { | ||||
|             PotionEffect var9 = (PotionEffect) var8.next(); | ||||
|             var7.sendPacketToPlayer(new Packet41EntityEffect(par2EntityPlayerMP.entityId, var9)); | ||||
|         } | ||||
| 
 | ||||
|         par2EntityPlayerMP.addSelfToInternalCraftingInventory(); | ||||
| 
 | ||||
|         if (var3 != null && var3.hasKey("Riding")) | ||||
|         { | ||||
|         if (var3 != null && var3.hasKey("Riding")) { | ||||
|             Entity var10 = EntityList.createEntityFromNBT(var3.getCompoundTag("Riding"), var5); | ||||
| 
 | ||||
|             if (var10 != null) | ||||
|             { | ||||
|             if (var10 != null) { | ||||
|                 var10.forceSpawn = true; | ||||
|                 var5.spawnEntityInWorld(var10); | ||||
|                 par2EntityPlayerMP.mountEntity(var10); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user