network code cleanup

This commit is contained in:
Sen 2025-05-24 20:38:49 +02:00
parent 1eefb197f0
commit bd4b8d427a
116 changed files with 1541 additions and 2022 deletions

View file

@ -63,37 +63,37 @@ import common.network.IClientPlayer;
import common.network.NetConnection;
import common.network.NetHandler;
import common.network.Packet;
import common.packet.CPacketPlayerPosLook;
import common.packet.CPacketAction;
import common.packet.CPacketKeepAlive;
import common.packet.CPacketPlayer;
import common.packet.S14PacketEntity;
import common.packet.S18PacketEntityTeleport;
import common.packet.S19PacketEntityHeadLook;
import common.packet.S1APacketEntityStatus;
import common.packet.S1BPacketEntityAttach;
import common.packet.S1CPacketEntityMetadata;
import common.packet.S1DPacketEntityEffect;
import common.packet.S1EPacketRemoveEntityEffect;
import common.packet.S20PacketEntityProperties;
import common.packet.S27PacketExplosion;
import common.packet.S28PacketEffect;
import common.packet.S29PacketSoundEffect;
import common.packet.S2APacketParticles;
import common.packet.S2BPacketChangeGameState;
import common.packet.S2CPacketSpawnGlobalEntity;
import common.packet.S2DPacketOpenWindow;
import common.packet.S2EPacketCloseWindow;
import common.packet.S2FPacketSetSlot;
import common.packet.S30PacketWindowItems;
import common.packet.S31PacketWindowProperty;
import common.packet.S32PacketConfirmTransaction;
import common.packet.S33PacketUpdateSign;
import common.packet.S35PacketUpdateTileEntity;
import common.packet.S36PacketSignEditorOpen;
import common.packet.S38PacketPlayerListItem;
import common.packet.S39PacketPlayerAbilities;
import common.packet.S3APacketTabComplete;
import common.packet.S43PacketUpdateEntityNBT;
import common.packet.SPacketEntity;
import common.packet.SPacketEntityTeleport;
import common.packet.SPacketEntityHeadLook;
import common.packet.SPacketEntityStatus;
import common.packet.SPacketEntityAttach;
import common.packet.SPacketEntityMetadata;
import common.packet.SPacketEntityEffect;
import common.packet.SPacketRemoveEntityEffect;
import common.packet.SPacketEntityProperties;
import common.packet.SPacketExplosion;
import common.packet.SPacketEffect;
import common.packet.SPacketSoundEffect;
import common.packet.SPacketParticles;
import common.packet.SPacketChangeGameState;
import common.packet.SPacketSpawnGlobalEntity;
import common.packet.SPacketOpenWindow;
import common.packet.SPacketCloseWindow;
import common.packet.SPacketSetSlot;
import common.packet.SPacketWindowItems;
import common.packet.SPacketWindowProperty;
import common.packet.SPacketConfirmTransaction;
import common.packet.SPacketUpdateSign;
import common.packet.SPacketUpdateTileEntity;
import common.packet.SPacketSignEditorOpen;
import common.packet.SPacketPlayerListItem;
import common.packet.SPacketPlayerAbilities;
import common.packet.SPacketTabComplete;
import common.packet.SPacketUpdateEntityNBT;
import common.packet.SPacketAnimation;
import common.packet.SPacketBiome;
import common.packet.SPacketBlockAction;
@ -452,7 +452,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
/**
* Handles globally visible entities. Used in vanilla for lightning bolts
*/
public void handleSpawnGlobalEntity(S2CPacketSpawnGlobalEntity packetIn)
public void handleSpawnGlobalEntity(SPacketSpawnGlobalEntity packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
double d0 = (double)packetIn.getEncodedX() / 32.0D;
@ -505,7 +505,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
* Invoked when the server registers new proximate objects in your watchlist or when objects in your watchlist have
* changed -> Registers any changes locally
*/
public void handleEntityMetadata(S1CPacketEntityMetadata packetIn)
public void handleEntityMetadata(SPacketEntityMetadata packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
@ -562,7 +562,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
/**
* Updates an entity's position and rotation as specified by the packet
*/
public void handleEntityTeleport(S18PacketEntityTeleport packetIn)
public void handleEntityTeleport(SPacketEntityTeleport packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
@ -609,7 +609,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
* subclassing of the packet allows for the specification of a subset of this data (e.g. only rel. position, abs.
* rotation or both).
*/
public void handleEntityMovement(S14PacketEntity packetIn)
public void handleEntityMovement(SPacketEntity packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = packetIn.getEntity(this.clientWorldController);
@ -633,7 +633,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
* Updates the direction in which the specified entity is looking, normally this head rotation is independent of the
* rotation of the entity itself
*/
public void handleEntityHeadLook(S19PacketEntityHeadLook packetIn)
public void handleEntityHeadLook(SPacketEntityHeadLook packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = packetIn.getEntity(this.clientWorldController);
@ -714,7 +714,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
}
entityplayer.setPositionAndRotation(d0, d1, d2, f, f1);
this.netManager.sendPacket(new CPacketPlayer.C06PacketPlayerPosLook(entityplayer.posX, entityplayer.getEntityBoundingBox().minY, entityplayer.posZ, entityplayer.rotYaw, entityplayer.rotPitch, false));
this.netManager.sendPacket(new CPacketPlayerPosLook(entityplayer.posX, entityplayer.getEntityBoundingBox().minY, entityplayer.posZ, entityplayer.rotYaw, entityplayer.rotPitch, false));
if (!this.doneLoadingTerrain)
{
@ -1008,7 +1008,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
// this.gameController.thePlayer.setSpawnPoint(packetIn.getSpawnPos(), true);
// }
public void handleEntityAttach(S1BPacketEntityAttach packetIn)
public void handleEntityAttach(SPacketEntityAttach packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
@ -1065,7 +1065,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
* (spawn particles), Zombie (villager transformation), Animal (breeding mode particles), Horse (breeding/smoke
* particles), Sheep (...), Tameable (...), Villager (particles for breeding mode, angry and happy), Wolf (...)
*/
public void handleEntityStatus(S1APacketEntityStatus packetIn)
public void handleEntityStatus(SPacketEntityStatus packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = packetIn.getEntity(this.clientWorldController);
@ -1127,7 +1127,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
/**
* Initiates a new explosion (sound, particles, drop spawn) for the affected blocks indicated by the packet.
*/
public void handleExplosion(S27PacketExplosion packetIn)
public void handleExplosion(SPacketExplosion packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Explosion explosion = new Explosion(this.gameController.world, (Entity)null, packetIn.getX(), packetIn.getY(), packetIn.getZ(), packetIn.getStrength(), packetIn.getAffectedBlockPositions());
@ -1141,7 +1141,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
* Displays a GUI by ID. In order starting from id 0: Chest, Workbench, Furnace, Dispenser, Enchanting table,
* Brewing stand, Villager merchant, Beacon, Anvil, Hopper, Dropper, Horse
*/
public void handleOpenWindow(S2DPacketOpenWindow packetIn)
public void handleOpenWindow(SPacketOpenWindow packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
EntityNPC entityplayersp = this.gameController.player;
@ -1190,7 +1190,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
/**
* Handles pickin up an ItemStack or dropping one in your inventory or an open container
*/
public void handleSetSlot(S2FPacketSetSlot packetIn)
public void handleSetSlot(SPacketSetSlot packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
EntityNPC entityplayer = this.gameController.player;
@ -1231,7 +1231,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
* Verifies that the server and client are synchronized with respect to the inventory/container opened by the player
* and confirms if it is the case.
*/
public void handleConfirmTransaction(S32PacketConfirmTransaction packetIn)
public void handleConfirmTransaction(SPacketConfirmTransaction packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Container container = null;
@ -1255,7 +1255,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
/**
* Handles the placement of a specified ItemStack in a specified container/inventory slot
*/
public void handleWindowItems(S30PacketWindowItems packetIn)
public void handleWindowItems(SPacketWindowItems packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
EntityNPC entityplayer = this.gameController.player;
@ -1273,7 +1273,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
/**
* Creates a sign in the specified location if it didn't exist and opens the GUI to edit its text
*/
public void handleSignEditorOpen(S36PacketSignEditorOpen packetIn)
public void handleSignEditorOpen(SPacketSignEditorOpen packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
TileEntity tileentity = this.clientWorldController.getTileEntity(packetIn.getSignPosition());
@ -1296,7 +1296,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
/**
* Updates a specified sign with the specified text lines
*/
public void handleUpdateSign(S33PacketUpdateSign packetIn)
public void handleUpdateSign(SPacketUpdateSign packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
// boolean flag = false;
@ -1331,7 +1331,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
* Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
* beacons, skulls, flowerpot
*/
public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn)
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
@ -1350,7 +1350,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
/**
* Sets the progressbar of the opened window to the specified value
*/
public void handleWindowProperty(S31PacketWindowProperty packetIn)
public void handleWindowProperty(SPacketWindowProperty packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
EntityNPC entityplayer = this.gameController.player;
@ -1375,7 +1375,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
/**
* Resets the ItemStack held in hand and closes the window that is opened
*/
public void handleCloseWindow(S2EPacketCloseWindow packetIn)
public void handleCloseWindow(SPacketCloseWindow packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
// this.gameController.thePlayer.closeScreenAndDropStack();
@ -1423,7 +1423,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
}
}
public void handleChangeGameState(S2BPacketChangeGameState packetIn)
public void handleChangeGameState(SPacketChangeGameState packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
switch(packetIn.getAction()) {
@ -1448,7 +1448,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
}
}
public void handleEffect(S28PacketEffect packetIn)
public void handleEffect(SPacketEffect packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
@ -1513,7 +1513,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
// }
// }
public void handleEntityEffect(S1DPacketEntityEffect packetIn)
public void handleEntityEffect(SPacketEntityEffect packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
@ -1590,7 +1590,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
//// }
// }
public void handleRemoveEntityEffect(S1EPacketRemoveEntityEffect packetIn)
public void handleRemoveEntityEffect(SPacketRemoveEntityEffect packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
@ -1602,7 +1602,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
}
public void handlePlayerListItem(S38PacketPlayerListItem packetIn)
public void handlePlayerListItem(SPacketPlayerListItem packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController);
@ -1649,7 +1649,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
this.addToSendQueue(new CPacketKeepAlive(packetIn.getValue()));
}
public void handlePlayerAbilities(S39PacketPlayerAbilities packetIn)
public void handlePlayerAbilities(SPacketPlayerAbilities packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
EntityNPC entityplayer = this.gameController.player;
@ -1662,7 +1662,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
/**
* Displays the available command-completion options the server knows of
*/
public void handleTabComplete(S3APacketTabComplete packetIn)
public void handleTabComplete(SPacketTabComplete packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
String[] astring = packetIn.func_149630_c();
@ -1674,7 +1674,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
}
}
public void handleSoundEffect(S29PacketSoundEffect packetIn)
public void handleSoundEffect(SPacketSoundEffect packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
if(packetIn.getSound() == null) {
@ -1711,7 +1711,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
//// }
// }
public void handleEntityNBT(S43PacketUpdateEntityNBT packetIn)
public void handleEntityNBT(SPacketUpdateEntityNBT packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = packetIn.getEntity(this.clientWorldController);
@ -1835,7 +1835,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
* Spawns a specified number of particles at the specified location with a randomized displacement according to
* specified bounds
*/
public void handleParticles(S2APacketParticles packetIn)
public void handleParticles(SPacketParticles packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
@ -1885,7 +1885,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
* sprinting, animals fleeing, baby speed), weapon/tool attackDamage, hostiles followRange randomization, zombie
* maxHealth and knockback resistance as well as reinforcement spawning chance.
*/
public void handleEntityProperties(S20PacketEntityProperties packetIn)
public void handleEntityProperties(SPacketEntityProperties packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
@ -1900,7 +1900,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
{
AttributeMap baseattributemap = ((EntityLiving)entity).getAttributeMap();
for (S20PacketEntityProperties.Snapshot s20packetentityproperties$snapshot : packetIn.func_149441_d())
for (SPacketEntityProperties.Snapshot s20packetentityproperties$snapshot : packetIn.func_149441_d())
{
AttributeInstance iattributeinstance = baseattributemap.getAttributeInstanceByName(s20packetentityproperties$snapshot.func_151409_a());