tcr/java/src/game/network/ClientPlayer.java

1906 lines
78 KiB
Java
Raw Normal View History

2025-03-11 00:23:54 +01:00
package game.network;
2025-03-27 17:54:03 +01:00
import java.util.Collection;
2025-03-11 00:23:54 +01:00
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
2025-03-16 17:45:08 +01:00
import java.util.Set;
2025-03-16 17:40:47 +01:00
import game.collect.Maps;
2025-03-16 17:40:47 +01:00
2025-03-11 00:23:54 +01:00
import game.Game;
import game.dimension.Dimension;
import game.entity.DataWatcher;
import game.entity.Entity;
import game.entity.animal.EntityHorse;
import game.entity.attributes.Attribute;
import game.entity.attributes.AttributeInstance;
import game.entity.attributes.AttributeMap;
import game.entity.attributes.AttributeModifier;
import game.entity.effect.EntityLightning;
import game.entity.item.EntityBoat;
import game.entity.item.EntityXp;
import game.entity.npc.EntityNPC;
2025-03-27 17:54:03 +01:00
import game.entity.npc.PlayerCharacter;
2025-03-11 00:23:54 +01:00
import game.entity.projectile.EntityProjectile;
import game.entity.types.EntityLiving;
import game.gui.Gui;
import game.gui.GuiConsole;
2025-03-27 23:14:26 +01:00
import game.gui.GuiChar;
2025-03-11 19:38:37 +01:00
import game.gui.container.GuiMachine;
import game.gui.container.GuiMerchant;
2025-03-11 00:23:54 +01:00
import game.init.EntityRegistry;
import game.init.ItemRegistry;
import game.init.SoundEvent;
import game.inventory.AnimalChest;
import game.inventory.Container;
import game.inventory.ContainerLocalMenu;
import game.inventory.InventoryBasic;
import game.inventory.InventoryPlayer;
import game.item.ItemStack;
import game.log.Log;
2025-03-11 00:23:54 +01:00
import game.packet.CPacketAction;
import game.packet.CPacketKeepAlive;
import game.packet.CPacketPlayer;
import game.packet.S14PacketEntity;
import game.packet.S18PacketEntityTeleport;
import game.packet.S19PacketEntityHeadLook;
import game.packet.S1APacketEntityStatus;
import game.packet.S1BPacketEntityAttach;
import game.packet.S1CPacketEntityMetadata;
import game.packet.S1DPacketEntityEffect;
import game.packet.S1EPacketRemoveEntityEffect;
import game.packet.S20PacketEntityProperties;
import game.packet.S27PacketExplosion;
import game.packet.S28PacketEffect;
import game.packet.S29PacketSoundEffect;
import game.packet.S2APacketParticles;
import game.packet.S2BPacketChangeGameState;
import game.packet.S2CPacketSpawnGlobalEntity;
import game.packet.S2DPacketOpenWindow;
import game.packet.S2EPacketCloseWindow;
import game.packet.S2FPacketSetSlot;
import game.packet.S30PacketWindowItems;
import game.packet.S31PacketWindowProperty;
import game.packet.S32PacketConfirmTransaction;
import game.packet.S33PacketUpdateSign;
import game.packet.S35PacketUpdateTileEntity;
import game.packet.S36PacketSignEditorOpen;
import game.packet.S38PacketPlayerListItem;
import game.packet.S39PacketPlayerAbilities;
import game.packet.S3APacketTabComplete;
import game.packet.S43PacketUpdateEntityNBT;
import game.packet.SPacketAnimation;
import game.packet.SPacketBiomes;
import game.packet.SPacketBlockAction;
import game.packet.SPacketBlockBreakAnim;
import game.packet.SPacketBlockChange;
import game.packet.SPacketCamera;
2025-03-27 17:54:03 +01:00
import game.packet.SPacketCharacterList;
2025-03-11 00:23:54 +01:00
import game.packet.SPacketChunkData;
import game.packet.SPacketCollectItem;
import game.packet.SPacketDestroyEntities;
import game.packet.SPacketDimensionName;
import game.packet.SPacketDisconnect;
import game.packet.SPacketEntityEquipment;
import game.packet.SPacketEntityVelocity;
import game.packet.SPacketHeldItemChange;
import game.packet.SPacketJoinGame;
import game.packet.SPacketKeepAlive;
import game.packet.SPacketMapChunkBulk;
import game.packet.SPacketMessage;
import game.packet.SPacketMultiBlockChange;
import game.packet.SPacketPlayerPosLook;
import game.packet.SPacketRespawn;
import game.packet.SPacketSetExperience;
import game.packet.SPacketSkin;
import game.packet.SPacketSpawnMob;
import game.packet.SPacketSpawnObject;
import game.packet.SPacketSpawnPlayer;
import game.packet.SPacketTimeUpdate;
import game.packet.SPacketTrades;
import game.packet.SPacketUpdateHealth;
import game.packet.SPacketWorld;
import game.potion.PotionEffect;
import game.renderer.particle.EntityPickupFX;
import game.renderer.particle.ParticleType;
import game.renderer.texture.EntityTexManager;
import game.rng.Random;
import game.tileentity.LocalBlockIntercommunication;
import game.tileentity.TileEntity;
import game.tileentity.TileEntityMachine;
import game.tileentity.TileEntitySign;
import game.village.MerchantRecipeList;
import game.world.Chunk;
import game.world.Explosion;
import game.world.Weather;
import game.world.WorldClient;
public class ClientPlayer extends NetHandler
2025-03-11 00:23:54 +01:00
{
/**
* The NetworkManager instance used to communicate with the server (used only by handlePlayerPosLook to update
* positioning and handleJoinGame to inform the server of the client distribution/mods)
*/
private final NetConnection netManager;
/**
* Reference to the Game instance, which many handler methods operate on
*/
private Game gameController;
/**
* Reference to the current ClientWorld instance, which many handler methods operate on
*/
private WorldClient clientWorldController;
/**
* True if the client has finished downloading terrain and may spawn. Set upon receipt of S08PacketPlayerPosLook,
* reset upon respawning
*/
private boolean doneLoadingTerrain;
// private boolean travelSound;
2025-03-11 00:23:54 +01:00
private final Map<String, Integer> playerList = Maps.<String, Integer>newTreeMap();
2025-03-27 17:54:03 +01:00
private final Map<Integer, PlayerCharacter> characterList = Maps.<Integer, PlayerCharacter>newHashMap();
2025-03-11 00:23:54 +01:00
// private final List<Entry<String, Integer>> players = Lists.newArrayList();
2025-03-27 17:54:03 +01:00
private int selectedCharacter = -1;
2025-03-11 00:23:54 +01:00
/**
* Just an ordinary random number generator, used to randomize audio pitch of item/orb pickup and randomize both
* particlespawn offset and velocity
*/
private final Random avRandomizer = new Random();
public ClientPlayer(Game gmIn, NetConnection p_i46300_3_)
2025-03-11 00:23:54 +01:00
{
this.gameController = gmIn;
this.netManager = p_i46300_3_;
}
/**
* Clears the WorldClient instance associated with this NetHandlerPlayClient
*/
public void cleanup()
{
this.clientWorldController = null;
// for(String user : this.playerInfoMap.keySet()) {
// DefaultPlayerSkin.setTexture(user, null);
// }
EntityTexManager.clearTextures();
// this.gameController.confirmSkin(false);
}
public void handleJoinGame(SPacketJoinGame packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController);
2025-03-27 17:54:03 +01:00
this.gameController.charEditor = packetIn.isInEditor();
2025-03-11 00:23:54 +01:00
this.gameController.controller = new PlayerController(this.gameController, this);
this.clientWorldController = new WorldClient(this.gameController.debugWorld, packetIn.getDimension());
// this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
this.gameController.loadWorld(this.clientWorldController, packetIn.getEntityType());
// this.gameController.thePlayer.dimension = this.clientWorldController.dimension.getDimensionId();
this.gameController.thePlayer.setId(packetIn.getEntityId());
2025-03-27 23:14:26 +01:00
this.gameController.displayGuiScreen(this.gameController.charEditor ? GuiChar.INSTANCE : null);
2025-03-11 00:23:54 +01:00
// this.currentServerMaxPlayers = packetIn.getMaxPlayers();
// this.gameController.controller.setCheat(packetIn.getCheat());
// this.gameController.updateViewDistance();
// this.gameController.sendPartsToServer();
// this.gameController.sendHeightToServer();
// this.netManager.sendPacket(new C25PacketBrand(Version.NAME));
// this.netManager.sendPacket(new CPacketSkin(this.gameController.getSkin()));
// if(this.gameController.getConnected() == null)
// this.netManager.sendPacket(new CPacketMessage(CPacketMessage.Type.DISPLAY,
// ChatFormat.replaceCodes(this.gameController.localName)));
}
/**
* Spawns an instance of the objecttype indicated by the packet and sets its position and momentum
*/
public void handleSpawnObject(SPacketSpawnObject packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
double d0 = (double)packetIn.getX() / 32.0D;
double d1 = (double)packetIn.getY() / 32.0D;
double d2 = (double)packetIn.getZ() / 32.0D;
Entity // entity = null;
// if (packetIn.getType() == 10)
// {
// entity = EntityMinecart.getMinecart(this.clientWorldController, d0, d1, d2, EntityMinecart.EnumMinecartType.byNetworkID(packetIn.getData()));
// }
// else
// if(packetIn.getType() == EntityRegistry.FISH_HOOK_OID)
// {
// Entity entity1 = this.clientWorldController.getEntityByID(packetIn.getData());
//
// if (entity1.isPlayer())
// {
// entity = new EntityFishHook(this.clientWorldController, d0, d1, d2, (EntityNPC)entity1);
// }
//
// packetIn.setData(0);
// }
// else {
entity = EntityRegistry.createEntityByID(packetIn.getType(), this.clientWorldController, d0, d1, d2, packetIn.getData());
// }
if(entity != null && entity.dead) {
entity = null;
}
// else if (packetIn.getType() == 60)
// {
// entity = new EntityArrow(this.clientWorldController, d0, d1, d2);
// }
// else if (packetIn.getType() == 61)
// {
// entity = new EntitySnowball(this.clientWorldController, d0, d1, d2);
// }
// else if (packetIn.getType() == 71)
// {
// entity = new EntityItemFrame(this.clientWorldController, new BlockPos(MathHelper.floor_double(d0), MathHelper.floor_double(d1), MathHelper.floor_double(d2)), EnumFacing.getHorizontal(packetIn.getData()));
// packetIn.setData(0);
// }
// else if (packetIn.getType() == 77)
// {
// entity = new EntityLeashKnot(this.clientWorldController, new BlockPos(MathHelper.floor_double(d0), MathHelper.floor_double(d1), MathHelper.floor_double(d2)));
// packetIn.setData(0);
// }
// else if (packetIn.getType() == 65)
// {
// entity = new EntityEnderPearl(this.clientWorldController, d0, d1, d2);
// }
// else if (packetIn.getType() == 72)
// {
// entity = new EntityEnderEye(this.clientWorldController, d0, d1, d2);
// }
// else if (packetIn.getType() == 76)
// {
// entity = new EntityFireworkRocket(this.clientWorldController, d0, d1, d2, (ItemStack)null);
// }
// else if (packetIn.getType() == 63)
// {
// entity = new EntityLargeFireball(this.clientWorldController, d0, d1, d2, (double)packetIn.getSpeedX() / 8000.0D, (double)packetIn.getSpeedY() / 8000.0D, (double)packetIn.getSpeedZ() / 8000.0D);
// packetIn.setData(0);
// }
// else if (packetIn.getType() == 64)
// {
// entity = new EntitySmallFireball(this.clientWorldController, d0, d1, d2, (double)packetIn.getSpeedX() / 8000.0D, (double)packetIn.getSpeedY() / 8000.0D, (double)packetIn.getSpeedZ() / 8000.0D);
// packetIn.setData(0);
// }
// else if (packetIn.getType() == 66)
// {
// entity = new EntityWitherSkull(this.clientWorldController, d0, d1, d2, (double)packetIn.getSpeedX() / 8000.0D, (double)packetIn.getSpeedY() / 8000.0D, (double)packetIn.getSpeedZ() / 8000.0D);
// packetIn.setData(0);
// }
// else if (packetIn.getType() == 62)
// {
// entity = new EntityEgg(this.clientWorldController, d0, d1, d2);
// }
// else if (packetIn.getType() == 73)
// {
// entity = new EntityPotion(this.clientWorldController, d0, d1, d2, packetIn.getData());
// packetIn.setData(0);
// }
// else if (packetIn.getType() == 75)
// {
// entity = new EntityExpBottle(this.clientWorldController, d0, d1, d2);
// packetIn.setData(0);
// }
// else if (packetIn.getType() == 1)
// {
// entity = new EntityBoat(this.clientWorldController, d0, d1, d2);
// }
// else if (packetIn.getType() == 50)
// {
// entity = new EntityTNTPrimed(this.clientWorldController, d0, d1, d2, (EntityLivingBase)null, packetIn.getData());
// packetIn.setData(0);
// }
// else if (packetIn.getType() == 78)
// {
// entity = new EntityArmorStand(this.clientWorldController, d0, d1, d2);
// }
// else if (packetIn.getType() == 51)
// {
// entity = new EntityEnderCrystal(this.clientWorldController, d0, d1, d2);
// }
// else if (packetIn.getType() == 2)
// {
// entity = new EntityItem(this.clientWorldController, d0, d1, d2);
// }
// else if (packetIn.getType() == 70)
// {
// entity = new EntityFallingBlock(this.clientWorldController, d0, d1, d2, BlockRegistry.getStateById(packetIn.getData() & 65535));
// packetIn.setData(0);
// }
//
// else if (packetIn.getType() == 100)
// {
// entity = new EntityDynamite(this.clientWorldController, d0, d1, d2, packetIn.getData());
// packetIn.setData(0);
// }
if (entity != null)
{
entity.serverPosX = packetIn.getX();
entity.serverPosY = packetIn.getY();
entity.serverPosZ = packetIn.getZ();
entity.rotPitch = (float)(packetIn.getPitch() * 360) / 256.0F;
entity.rotYaw = (float)(packetIn.getYaw() * 360) / 256.0F;
Entity[] aentity = entity.getParts();
if (aentity != null)
{
int i = packetIn.getEntityID() - entity.getId();
for (int j = 0; j < aentity.length; ++j)
{
aentity[j].setId(aentity[j].getId() + i);
}
}
entity.setId(packetIn.getEntityID());
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entity);
if(entity instanceof EntityProjectile) {
((EntityProjectile)entity).setAcceleration((double)packetIn.getSpeedX() / 8000.0D, (double)packetIn.getSpeedY() / 8000.0D, (double)packetIn.getSpeedZ() / 8000.0D);
}
else if (entity.hasSpawnVelocity()) // packetIn.getData() > 0)
{
// if (packetIn.getType() == 60)
// {
// Entity entity2 = this.clientWorldController.getEntityByID(packetIn.getData());
//
// if (entity2 instanceof EntityLivingBase && entity instanceof EntityArrow)
// {
// ((EntityArrow)entity).shootingEntity = entity2;
// }
// }
entity.setVelocity((double)packetIn.getSpeedX() / 8000.0D, (double)packetIn.getSpeedY() / 8000.0D, (double)packetIn.getSpeedZ() / 8000.0D);
}
}
}
// /**
// * Spawns an experience orb and sets its value (amount of XP)
// */
// public void handleSpawnExperienceOrb(SPacketSpawnExperienceOrb packetIn)
// {
// NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
// Entity entity = new EntityXPOrb(this.clientWorldController, (double)packetIn.getX() / 32.0D, (double)packetIn.getY() / 32.0D, (double)packetIn.getZ() / 32.0D, packetIn.getXPValue());
// entity.serverPosX = packetIn.getX();
// entity.serverPosY = packetIn.getY();
// entity.serverPosZ = packetIn.getZ();
// entity.rotYaw = 0.0F;
// entity.rotPitch = 0.0F;
// entity.setId(packetIn.getEntityID());
// this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entity);
// }
/**
* Handles globally visible entities. Used in vanilla for lightning bolts
*/
public void handleSpawnGlobalEntity(S2CPacketSpawnGlobalEntity packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
double d0 = (double)packetIn.getEncodedX() / 32.0D;
double d1 = (double)packetIn.getEncodedY() / 32.0D;
double d2 = (double)packetIn.getEncodedZ() / 32.0D;
Entity entity = null;
if (packetIn.getType() == 1)
{
entity = new EntityLightning(this.clientWorldController, d0, d1, d2, packetIn.getData(), 0, false, null);
}
if (entity != null)
{
entity.serverPosX = packetIn.getEncodedX();
entity.serverPosY = packetIn.getEncodedY();
entity.serverPosZ = packetIn.getEncodedZ();
entity.rotYaw = 0.0F;
entity.rotPitch = 0.0F;
entity.setId(packetIn.getEntityId());
this.clientWorldController.effects.add(entity);
}
}
// /**
// * Handles the spawning of a painting object
// */
// public void handleSpawnPainting(SPacketSpawnPainting packetIn)
// {
// NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
// EntityPainting entitypainting = new EntityPainting(this.clientWorldController, packetIn.getPosition(), packetIn.getFacing(), packetIn.getTitle());
// this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitypainting);
// }
/**
* Sets the velocity of the specified entity to the specified value
*/
public void handleEntityVelocity(SPacketEntityVelocity packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID());
if (entity != null)
{
entity.setVelocity((double)packetIn.getMotionX() / 8000.0D, (double)packetIn.getMotionY() / 8000.0D, (double)packetIn.getMotionZ() / 8000.0D);
}
}
/**
* 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)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
if (entity != null && packetIn.func_149376_c() != null)
{
entity.getDataWatcher().updateWatchedObjectsFromList(packetIn.func_149376_c());
2025-03-27 17:54:03 +01:00
2025-03-27 23:14:26 +01:00
if(entity == this.gameController.thePlayer && this.gameController.open instanceof GuiChar)
((GuiChar)this.gameController.open).checkReopen();
2025-03-11 00:23:54 +01:00
}
}
/**
* Handles the creation of a nearby player entity, sets the position and held item
*/
public void handleSpawnPlayer(SPacketSpawnPlayer packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
double x = (double)packetIn.getX() / 32.0D;
double y = (double)packetIn.getY() / 32.0D;
double z = (double)packetIn.getZ() / 32.0D;
float yaw = packetIn.getYaw();
float pitch = packetIn.getPitch();
EntityNPC player = (EntityNPC)EntityRegistry.createEntityByID(packetIn.getEntityType(), this.gameController.theWorld); // new EntityNPC(this.gameController.theWorld); // , /* this.getPlayerInfo( */ packetIn.getUser()); // ).getUser());
player.setOtherPlayer(this.gameController);
player.prevX = player.lastTickPosX = (double)(player.serverPosX = packetIn.getX());
player.prevY = player.lastTickPosY = (double)(player.serverPosY = packetIn.getY());
player.prevZ = player.lastTickPosZ = (double)(player.serverPosZ = packetIn.getZ());
player.yawOffset = player.headYaw = yaw;
int i = packetIn.getCurrentItemID();
if (i == 0)
{
player.inventory.mainInventory[player.inventory.currentItem] = null;
}
else
{
player.inventory.mainInventory[player.inventory.currentItem] = new ItemStack(ItemRegistry.getItemById(i), 1, 0);
}
player.setPositionAndRotation(x, y, z, yaw, pitch);
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), player);
List<DataWatcher.WatchableObject> list = packetIn.getData();
if (list != null)
{
player.getDataWatcher().updateWatchedObjectsFromList(list);
}
EntityTexManager.setTexture(packetIn.getEntityID(), packetIn.getTexture(), player.getModel());
}
/**
* Updates an entity's position and rotation as specified by the packet
*/
public void handleEntityTeleport(S18PacketEntityTeleport packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
if (entity != null)
{
entity.serverPosX = packetIn.getX();
entity.serverPosY = packetIn.getY();
entity.serverPosZ = packetIn.getZ();
double d0 = (double)entity.serverPosX / 32.0D;
double d1 = (double)entity.serverPosY / 32.0D;
double d2 = (double)entity.serverPosZ / 32.0D;
float f = (float)(packetIn.getYaw() * 360) / 256.0F;
float f1 = (float)(packetIn.getPitch() * 360) / 256.0F;
if (Math.abs(entity.posX - d0) < 0.03125D && Math.abs(entity.posY - d1) < 0.015625D && Math.abs(entity.posZ - d2) < 0.03125D)
{
entity.setPositionAndRotation2(entity.posX, entity.posY, entity.posZ, f, f1, 3, true);
}
else
{
entity.setPositionAndRotation2(d0, d1, d2, f, f1, 3, true);
}
entity.onGround = packetIn.getOnGround();
}
}
/**
* Updates which hotbar slot of the player is currently selected
*/
public void handleHeldItemChange(SPacketHeldItemChange packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
if (packetIn.getHeldItemHotbarIndex() >= 0 && packetIn.getHeldItemHotbarIndex() < InventoryPlayer.getHotbarSize())
{
this.gameController.thePlayer.inventory.currentItem = packetIn.getHeldItemHotbarIndex();
}
}
/**
* Updates the specified entity's position by the specified relative moment and absolute rotation. Note that
* 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)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = packetIn.getEntity(this.clientWorldController);
if (entity != null)
{
2025-03-20 00:29:25 +01:00
entity.serverPosX += packetIn.getPosX();
entity.serverPosY += packetIn.getPosY();
entity.serverPosZ += packetIn.getPosZ();
2025-03-11 00:23:54 +01:00
double d0 = (double)entity.serverPosX / 32.0D;
double d1 = (double)entity.serverPosY / 32.0D;
double d2 = (double)entity.serverPosZ / 32.0D;
2025-03-20 00:29:25 +01:00
float f = packetIn.hasRotations() ? (float)(packetIn.getYaw() * 360) / 256.0F : entity.rotYaw;
float f1 = packetIn.hasRotations() ? (float)(packetIn.getPitch() * 360) / 256.0F : entity.rotPitch;
2025-03-11 00:23:54 +01:00
entity.setPositionAndRotation2(d0, d1, d2, f, f1, 3, false);
entity.onGround = packetIn.getOnGround();
}
}
/**
* 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)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = packetIn.getEntity(this.clientWorldController);
if (entity != null)
{
float f = (float)(packetIn.getYaw() * 360) / 256.0F;
entity.setRotationYawHead(f);
}
}
/**
* Locally eliminates the entities. Invoked by the server when the items are in fact destroyed, or the player is no
* longer registered as required to monitor them. The latter happens when distance between the player and item
* increases beyond a certain treshold (typically the viewing distance)
*/
public void handleDestroyEntities(SPacketDestroyEntities packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
for (int i = 0; i < packetIn.getEntityIDs().length; ++i)
{
this.clientWorldController.removeEntityFromWorld(packetIn.getEntityIDs()[i]);
EntityTexManager.setTexture(packetIn.getEntityIDs()[i], null, null);
}
}
/**
* Handles changes in player positioning and rotation such as when travelling to a new dimension, (re)spawning,
* mounting horses etc. Seems to immediately reply to the server with the clients post-processing perspective on the
* player positioning
*/
public void handlePlayerPosLook(SPacketPlayerPosLook packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
EntityNPC entityplayer = this.gameController.thePlayer;
double d0 = packetIn.getX();
double d1 = packetIn.getY();
double d2 = packetIn.getZ();
float f = packetIn.getYaw();
float f1 = packetIn.getPitch();
if (packetIn.func_179834_f().contains(SPacketPlayerPosLook.EnumFlags.X))
{
d0 += entityplayer.posX;
}
else
{
entityplayer.motionX = 0.0D;
}
if (packetIn.func_179834_f().contains(SPacketPlayerPosLook.EnumFlags.Y))
{
d1 += entityplayer.posY;
}
else
{
entityplayer.motionY = 0.0D;
}
if (packetIn.func_179834_f().contains(SPacketPlayerPosLook.EnumFlags.Z))
{
d2 += entityplayer.posZ;
}
else
{
entityplayer.motionZ = 0.0D;
}
if (packetIn.func_179834_f().contains(SPacketPlayerPosLook.EnumFlags.X_ROT))
{
f1 += entityplayer.rotPitch;
}
if (packetIn.func_179834_f().contains(SPacketPlayerPosLook.EnumFlags.Y_ROT))
{
f += entityplayer.rotYaw;
}
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));
if (!this.doneLoadingTerrain)
{
this.gameController.thePlayer.prevX = this.gameController.thePlayer.posX;
this.gameController.thePlayer.prevY = this.gameController.thePlayer.posY;
this.gameController.thePlayer.prevZ = this.gameController.thePlayer.posZ;
this.doneLoadingTerrain = true;
// this.gameController.displayGuiScreen(null);
// if(this.travelSound) {
// this.gameController.getSoundManager().playSound(new PositionedSound(SoundEvent.TELEPORT));
//// this.clientWorldController.playSound(entityplayer.posX, entityplayer.posY + (double)entityplayer.getEyeHeight(), entityplayer.posZ, this.travelSound, 1.0F, 1.0F, false);
// this.travelSound = false;
// }
2025-03-11 00:23:54 +01:00
}
}
/**
* Received from the servers PlayerManager if between 1 and 64 blocks in a chunk are changed. If only one block
* requires an update, the server sends S23PacketBlockChange and if 64 or more blocks are changed, the server sends
* S21PacketChunkData
*/
public void handleMultiBlockChange(SPacketMultiBlockChange packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
for (SPacketMultiBlockChange.BlockUpdateData s22packetmultiblockchange$blockupdatedata : packetIn.getChangedBlocks())
{
this.clientWorldController.invalidateRegionAndSetBlock(s22packetmultiblockchange$blockupdatedata.getPos(), s22packetmultiblockchange$blockupdatedata.getBlockState());
}
}
/**
* Updates the specified chunk with the supplied data, marks it for re-rendering and lighting recalculation
*/
public void handleChunkData(SPacketChunkData packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
if (packetIn.hasBiomes())
{
if (packetIn.getExtractedSize() == 0)
{
this.clientWorldController.doPreChunk(packetIn.getChunkX(), packetIn.getChunkZ(), false);
return;
}
this.clientWorldController.doPreChunk(packetIn.getChunkX(), packetIn.getChunkZ(), true);
}
// this.clientWorldController.invalidateBlockReceiveRegion(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15);
Chunk chunk = this.clientWorldController.getChunk(packetIn.getChunkX(), packetIn.getChunkZ());
chunk.setData(packetIn.getExtractedDataBytes(), packetIn.getExtractedSize(), packetIn.hasBiomes());
this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15);
if (!packetIn.hasBiomes() || this.clientWorldController.dimension.hasNoLight()) // TODO: check
{
chunk.resetRelight();
}
}
public void handleBiomes(SPacketBiomes packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Chunk chunk = this.clientWorldController.getChunk(packetIn.getChunkX(), packetIn.getChunkZ());
chunk.setBiomes(packetIn.getBiomes());
this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15);
}
/**
* Updates the block and metadata and generates a blockupdate (and notify the clients)
*/
public void handleBlockChange(SPacketBlockChange packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
this.clientWorldController.invalidateRegionAndSetBlock(packetIn.getBlockPosition(), packetIn.getBlockState());
}
/**
* Closes the network channel
*/
public void handleDisconnect(SPacketDisconnect packetIn)
{
this.netManager.closeChannel("Getrennt");
}
public void onDisconnect(String reason)
{
this.gameController.disconnected(reason);
}
public void addToSendQueue(Packet p_147297_1_)
{
this.netManager.sendPacket(p_147297_1_);
}
public void handleCollectItem(SPacketCollectItem packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getCollectedItemEntityID());
EntityLiving entitylivingbase = (EntityLiving)this.clientWorldController.getEntityByID(packetIn.getEntityID());
if (entitylivingbase == null)
{
entitylivingbase = this.gameController.thePlayer;
}
if (entity != null)
{
if (entity instanceof EntityXp)
{
this.clientWorldController.playSoundAtEntity(entity, SoundEvent.ORB, 0.2F);
2025-03-11 00:23:54 +01:00
}
else
{
this.clientWorldController.playSoundAtEntity(entity, SoundEvent.POP, 0.2F);
2025-03-11 00:23:54 +01:00
}
this.gameController.effectRenderer.addEffect(new EntityPickupFX(this.clientWorldController, entity, entitylivingbase, 0.5F));
this.clientWorldController.removeEntityFromWorld(packetIn.getCollectedItemEntityID());
}
}
/**
* Prints a chatmessage in the chat GUI
*/
public void handleMessage(SPacketMessage packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController);
// if(this.gameController.chatVisibility == EnumChatVisibility.FULL ||
// (this.gameController.chatVisibility == EnumChatVisibility.SYSTEM && packetIn.isSystem()))
// {
switch(packetIn.getType()) {
case CONSOLE:
this.gameController.logConsole(packetIn.getMessage());
break;
case CHAT:
this.gameController.logChat(packetIn.getMessage());
break;
case FEED:
this.gameController.logFeed(packetIn.getMessage());
break;
case HOTBAR:
this.gameController.logHotbar(packetIn.getMessage());
break;
}
2025-03-11 00:23:54 +01:00
// }
}
// public void handleMessage(SPacketMessage packetIn)
// {
// NetHandler.checkThread(packetIn, this, this.gameController);
// this.gameController.ingameGui.printFeed(packetIn.getMessage());
// }
// public void handleNotify(SPacketNotify packetIn)
// {
// NetHandler.checkThread(packetIn, this, this.gameController);
//
// if(this.gameController.showNotifications)
// this.gameController.getNotifier().notify(packetIn.getStack(), packetIn.getMessage().getFormattedText(),
// packetIn.getDesciption().getFormattedText(), packetIn.getSound());
// }
/**
* Renders a specified animation: Waking up a player, a living entity swinging its currently held item, being hurt
* or receiving a critical hit by normal or magical means
*/
public void handleAnimation(SPacketAnimation packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID());
if (entity != null)
{
if (packetIn.getAnimationType() == 0)
{
EntityLiving entitylivingbase = (EntityLiving)entity;
entitylivingbase.swingItem();
}
else if (packetIn.getAnimationType() == 1)
{
entity.performHurtAnimation();
}
// else if (packetIn.getAnimationType() == 2)
// {
// EntityNPC entityplayer = (EntityNPC)entity;
// entityplayer.wakeUpPlayer();
// }
else if (packetIn.getAnimationType() == 4)
{
this.gameController.effectRenderer.emitParticleAtEntity(entity, ParticleType.CRIT);
}
else if (packetIn.getAnimationType() == 5)
{
this.gameController.effectRenderer.emitParticleAtEntity(entity, ParticleType.CRIT_MAGIC);
}
}
}
// /**
// * Retrieves the player identified by the packet, puts him to sleep if possible (and flags whether all players are
// * asleep)
// */
// public void handleUseBed(SPacketUseBed packetIn)
// {
// NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
// packetIn.getPlayer(this.clientWorldController).trySetSpawn(packetIn.getBedPosition());
// }
/**
* Spawns the mob entity at the specified location, with the specified rotation, momentum and type. Updates the
* entities Datawatchers with the entity metadata specified in the packet
*/
public void handleSpawnMob(SPacketSpawnMob packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
double d0 = (double)packetIn.getX() / 32.0D;
double d1 = (double)packetIn.getY() / 32.0D;
double d2 = (double)packetIn.getZ() / 32.0D;
float f = (float)(packetIn.getYaw() * 360) / 256.0F;
float f1 = (float)(packetIn.getPitch() * 360) / 256.0F;
EntityLiving entitylivingbase = (EntityLiving)EntityRegistry.createEntityByID(packetIn.getEntityType(), this.gameController.theWorld);
entitylivingbase.serverPosX = packetIn.getX();
entitylivingbase.serverPosY = packetIn.getY();
entitylivingbase.serverPosZ = packetIn.getZ();
entitylivingbase.yawOffset = entitylivingbase.headYaw = (float)(packetIn.getHeadPitch() * 360) / 256.0F;
Entity[] aentity = entitylivingbase.getParts();
if (aentity != null)
{
int i = packetIn.getEntityID() - entitylivingbase.getId();
for (int j = 0; j < aentity.length; ++j)
{
aentity[j].setId(aentity[j].getId() + i);
}
}
entitylivingbase.setId(packetIn.getEntityID());
entitylivingbase.setPositionAndRotation(d0, d1, d2, f, f1);
entitylivingbase.motionX = (double)((float)packetIn.getVelocityX() / 8000.0F);
entitylivingbase.motionY = (double)((float)packetIn.getVelocityY() / 8000.0F);
entitylivingbase.motionZ = (double)((float)packetIn.getVelocityZ() / 8000.0F);
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitylivingbase);
List<DataWatcher.WatchableObject> list = packetIn.getMetadata();
if (list != null)
{
entitylivingbase.getDataWatcher().updateWatchedObjectsFromList(list);
}
}
public void handleTimeUpdate(SPacketTimeUpdate packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
// this.gameController.theWorld.getWorldInfo().setTime(packetIn.getTotalWorldTime());
this.gameController.theWorld.setDayTime(packetIn.getWorldTime());
this.gameController.setTicked();
}
// public void handleCompass(SPacketCompass packetIn)
// {
// NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
// this.gameController.thePlayer.setSpawnPoint(packetIn.getSpawnPos(), true);
// }
public void handleEntityAttach(S1BPacketEntityAttach packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
Entity entity1 = this.clientWorldController.getEntityByID(packetIn.getVehicleEntityId());
if (packetIn.getLeash() == 0)
{
// boolean flag = false;
if (packetIn.getEntityId() == this.gameController.thePlayer.getId())
{
entity = this.gameController.thePlayer;
if (entity1 instanceof EntityBoat)
{
((EntityBoat)entity1).setIsBoatEmpty(false);
}
// flag = entity.vehicle == null && entity1 != null;
}
else if (entity1 instanceof EntityBoat)
{
((EntityBoat)entity1).setIsBoatEmpty(true);
}
if (entity == null)
{
return;
}
entity.mountEntity(entity1);
// if (flag)
// {
// this.gameController.ingameGui.displayHotbar(TextColor.LIGHT_GRAY + String.format("Drücke %s zum Verlassen", this.gameController.keyBindSneak.getKeyDisplay()));
// }
}
else if (packetIn.getLeash() == 1 && entity instanceof EntityLiving)
{
if (entity1 != null)
{
((EntityLiving)entity).setLeashedTo(entity1, false);
}
else
{
((EntityLiving)entity).clearLeashed(false, false);
}
}
}
/**
* Invokes the entities' handleUpdateHealth method which is implemented in LivingBase (hurt/death),
* MinecartMobSpawner (spawn delay), FireworkRocket & MinecartTNT (explosion), IronGolem (throwing,...), Witch
* (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)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = packetIn.getEntity(this.clientWorldController);
if (entity != null)
{
// if (packetIn.getOpCode() == 21)
// {
// this.gameController.getSoundHandler().playSound(new GuardianSound((EntityGuardian)entity));
// }
// else
// {
entity.handleStatusUpdate(packetIn.getOpCode());
// }
}
}
public void handleUpdateHealth(SPacketUpdateHealth packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
this.gameController.thePlayer.setPlayerSPHealth(packetIn.getHealth());
// this.gameController.thePlayer.getFoodStats().setFoodLevel(packetIn.getFoodLevel());
// this.gameController.thePlayer.getFoodStats().setFoodSaturationLevel(packetIn.getSaturationLevel());
}
public void handleSetExperience(SPacketSetExperience packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
this.gameController.thePlayer.setXPStats(packetIn.getProgress(), packetIn.getTotalExperience(), packetIn.getLevel());
}
public void handleRespawn(SPacketRespawn packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
2025-03-27 17:54:03 +01:00
this.gameController.charEditor = packetIn.isInEditor();
2025-03-11 00:23:54 +01:00
Dimension dim = packetIn.getDimension();
if (dim.getDimensionId() != this.clientWorldController.dimension.getDimensionId()) // this.gameController.thePlayer.dimension)
{
this.doneLoadingTerrain = false;
// if(dim.getDimensionId() < 0 && this.gameController.thePlayer.dimension >= 0) {
// this.travelSound = "portal.travel";
// }
// Scoreboard scoreboard = this.clientWorldController.getScoreboard();
this.clientWorldController = new WorldClient(this.gameController.debugWorld, dim);
// this.clientWorldController.setWorldScoreboard(scoreboard);
this.gameController.loadWorld(this.clientWorldController, packetIn.getEntityType());
// this.gameController.thePlayer.dimension = dim.getDimensionId();
}
2025-03-27 17:54:03 +01:00
// else if(this.gameController.charEditor) {
// this.gameController.displayGuiScreen(GuiSkin.INSTANCE);
// }
2025-03-11 00:23:54 +01:00
this.gameController.setDimensionAndSpawnPlayer(dim.getDimensionId(), packetIn.getEntityType());
2025-03-27 23:14:26 +01:00
this.gameController.displayGuiScreen(this.gameController.charEditor ? GuiChar.INSTANCE : null);
2025-03-11 00:23:54 +01:00
// this.gameController.controller.setCheat(packetIn.getCheat());
}
/**
* Initiates a new explosion (sound, particles, drop spawn) for the affected blocks indicated by the packet.
*/
public void handleExplosion(S27PacketExplosion packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Explosion explosion = new Explosion(this.gameController.theWorld, (Entity)null, packetIn.getX(), packetIn.getY(), packetIn.getZ(), packetIn.getStrength(), packetIn.getAffectedBlockPositions());
explosion.doExplosionB(true, packetIn.hasAltSound());
this.gameController.thePlayer.motionX += (double)packetIn.func_149149_c();
this.gameController.thePlayer.motionY += (double)packetIn.func_149144_d();
this.gameController.thePlayer.motionZ += (double)packetIn.func_149147_e();
}
/**
* 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)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
EntityNPC entityplayersp = this.gameController.thePlayer;
if ("container".equals(packetIn.getGuiId()))
{
entityplayersp.displayGUIChest(new InventoryBasic(packetIn.getWindowTitle(), packetIn.getSlotCount()));
entityplayersp.openContainer.windowId = packetIn.getWindowId();
}
else if ("trade".equals(packetIn.getGuiId()))
{
entityplayersp.displayTradeGui(packetIn.getWindowTitle());
entityplayersp.openContainer.windowId = packetIn.getWindowId();
}
else if ("EntityHorse".equals(packetIn.getGuiId()))
{
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
if (entity instanceof EntityHorse)
{
entityplayersp.displayGUIHorse((EntityHorse)entity, new AnimalChest(packetIn.getWindowTitle(), true, packetIn.getSlotCount()));
entityplayersp.openContainer.windowId = packetIn.getWindowId();
}
}
else if (!packetIn.hasSlots())
{
entityplayersp.displayGui(new LocalBlockIntercommunication(packetIn.getGuiId(), packetIn.getWindowTitle()));
entityplayersp.openContainer.windowId = packetIn.getWindowId();
}
else
{
ContainerLocalMenu containerlocalmenu = new ContainerLocalMenu(packetIn.getGuiId(), packetIn.getWindowTitle(), packetIn.getSlotCount());
if (packetIn.getGuiId().startsWith("machine_"))
{
TileEntity machine = this.clientWorldController.getTileEntity(packetIn.getTilePos());
if(machine instanceof TileEntityMachine)
this.gameController.displayGuiScreen(new GuiMachine(this.gameController.thePlayer.inventory, containerlocalmenu, (TileEntityMachine)machine));
}
else {
entityplayersp.displayGUIChest(containerlocalmenu);
}
entityplayersp.openContainer.windowId = packetIn.getWindowId();
}
}
/**
* Handles pickin up an ItemStack or dropping one in your inventory or an open container
*/
public void handleSetSlot(S2FPacketSetSlot packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
EntityNPC entityplayer = this.gameController.thePlayer;
if (packetIn.getWindowId() == -1)
{
entityplayer.inventory.setItemStack(packetIn.getStack());
}
else
{
// boolean flag = false;
//
// if (this.gameController.openGui instanceof GuiCheat)
// {
//// GuiCheat guicontainercreative = (GuiCheat)this.gameController.openGui;
// flag = true; // guicontainercreative.getSelectedTabIndex() != CheatTab.tabInventory.getIndex();
// }
if (packetIn.getWindowId() == 0 && packetIn.getSlot() >= 36 && packetIn.getSlot() < 45)
{
ItemStack itemstack = entityplayer.inventoryContainer.getSlot(packetIn.getSlot()).getStack();
// if (packetIn.getStack() != null && (itemstack == null || itemstack.stackSize < packetIn.getStack().stackSize))
// {
// packetIn.getStack().animationsToGo = 5;
// }
entityplayer.inventoryContainer.putStackInSlot(packetIn.getSlot(), packetIn.getStack());
}
else if (packetIn.getWindowId() == entityplayer.openContainer.windowId) // && (packetIn.getWindowId() != 0 || !flag))
{
entityplayer.openContainer.putStackInSlot(packetIn.getSlot(), packetIn.getStack());
}
}
}
/**
* 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)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Container container = null;
EntityNPC entityplayer = this.gameController.thePlayer;
if (packetIn.getWindowId() == 0)
{
container = entityplayer.inventoryContainer;
}
else if (packetIn.getWindowId() == entityplayer.openContainer.windowId)
{
container = entityplayer.openContainer;
}
if (container != null && !packetIn.isMatching())
{
this.addToSendQueue(new CPacketAction(CPacketAction.Action.CONFIRM_TRANSACTION, packetIn.getWindowId() | ((packetIn.getActionNumber() & 65535) << 8)));
}
}
/**
* Handles the placement of a specified ItemStack in a specified container/inventory slot
*/
public void handleWindowItems(S30PacketWindowItems packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
EntityNPC entityplayer = this.gameController.thePlayer;
if (packetIn.func_148911_c() == 0)
{
entityplayer.inventoryContainer.putStacksInSlots(packetIn.getItemStacks());
}
else if (packetIn.func_148911_c() == entityplayer.openContainer.windowId)
{
entityplayer.openContainer.putStacksInSlots(packetIn.getItemStacks());
}
}
/**
* 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)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
TileEntity tileentity = this.clientWorldController.getTileEntity(packetIn.getSignPosition());
if (!(tileentity instanceof TileEntitySign))
{
tileentity = new TileEntitySign();
tileentity.setWorldObj(this.clientWorldController);
tileentity.setPos(packetIn.getSignPosition());
}
this.gameController.thePlayer.openEditSign((TileEntitySign)tileentity);
}
/**
* Updates a specified sign with the specified text lines
*/
public void handleUpdateSign(S33PacketUpdateSign packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
// boolean flag = false;
if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos()))
{
TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
if (tileentity instanceof TileEntitySign)
{
TileEntitySign tileentitysign = (TileEntitySign)tileentity;
// if (tileentitysign.getIsEditable())
// {
System.arraycopy(packetIn.getLines(), 0, tileentitysign.signText, 0, 4);
// tileentitysign.command = packetIn.getCommand();
tileentitysign.markDirty();
// }
// flag = true;
}
}
// if (!flag) // && this.gameController.thePlayer != null)
// {
// Log.warn("Konnte kein Schild bei " + packetIn.getPos().getX() + ", " +
// packetIn.getPos().getY() + ", " + packetIn.getPos().getZ() + " finden");
// }
}
/**
* Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
* beacons, skulls, flowerpot
*/
public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos()))
{
TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
// int i = packetIn.getTileEntityType();
if (tileentity != null && packetIn.isTileEntityType(tileentity)) // i == 1 && tileentity instanceof TileEntityMobSpawner || /* i == 2 && tileentity instanceof TileEntityCommandBlock || */ i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || /* i == 5 && tileentity instanceof TileEntityFlowerPot || */ i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityMachine)
{
tileentity.readFromNBT(packetIn.getNbtCompound());
}
}
}
/**
* Sets the progressbar of the opened window to the specified value
*/
public void handleWindowProperty(S31PacketWindowProperty packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
EntityNPC entityplayer = this.gameController.thePlayer;
if (entityplayer.openContainer != null && entityplayer.openContainer.windowId == packetIn.getWindowId())
{
entityplayer.openContainer.updateProgressBar(packetIn.getVarIndex(), packetIn.getVarValue());
}
}
public void handleEntityEquipment(SPacketEntityEquipment packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID());
if (entity != null)
{
entity.setItem(packetIn.getEquipmentSlot(), packetIn.getItemStack());
}
}
/**
* Resets the ItemStack held in hand and closes the window that is opened
*/
public void handleCloseWindow(S2EPacketCloseWindow packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
// this.gameController.thePlayer.closeScreenAndDropStack();
this.gameController.displayGuiScreen(null);
}
/**
* Triggers Block.onBlockEventReceived, which is implemented in BlockPistonBase for extension/retraction, BlockNote
* for setting the instrument (including audiovisual feedback) and in BlockContainer to set the number of players
* accessing a (Ender)Chest
*/
public void handleBlockAction(SPacketBlockAction packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
this.gameController.theWorld.addBlockEvent(packetIn.getBlockPosition(), packetIn.getBlockType(), packetIn.getData1(), packetIn.getData2());
}
/**
* Updates all registered IWorldAccess instances with destroyBlockInWorldPartially
*/
public void handleBlockBreakAnim(SPacketBlockBreakAnim packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
this.gameController.theWorld.sendBlockBreakProgress(packetIn.getBreakerId(), packetIn.getPosition(), packetIn.getProgress());
}
public void handleMapChunkBulk(SPacketMapChunkBulk packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
for (int i = 0; i < packetIn.getChunkCount(); ++i)
{
int j = packetIn.getChunkX(i);
int k = packetIn.getChunkZ(i);
this.clientWorldController.doPreChunk(j, k, true);
// this.clientWorldController.invalidateBlockReceiveRegion(j << 4, 0, k << 4, (j << 4) + 15, 512, (k << 4) + 15);
Chunk chunk = this.clientWorldController.getChunk(j, k);
chunk.setData(packetIn.getChunkBytes(i), packetIn.getChunkSize(i), true);
this.clientWorldController.markBlockRangeForRenderUpdate(j << 4, 0, k << 4, (j << 4) + 15, 512, (k << 4) + 15);
if (this.clientWorldController.dimension.hasNoLight()) // TODO: check
{
chunk.resetRelight();
}
}
}
public void handleChangeGameState(S2BPacketChangeGameState packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
switch(packetIn.getAction()) {
// case SET_CHEAT:
// this.gameController.controller.setCheat(packetIn.getInt() == 1);
// break;
case SET_WEATHER:
this.clientWorldController.setWeather(Weather.getByID(packetIn.getInt()));
break;
case RAIN_STRENGTH:
this.clientWorldController.setRainStrength(packetIn.getFloat(true));
break;
case DARKNESS:
this.clientWorldController.setDarkness(packetIn.getFloat(true));
break;
case FOG_STRENGTH:
this.clientWorldController.setFogStrength(packetIn.getFloat(true));
break;
case TEMPERATURE:
this.clientWorldController.setTemperature(packetIn.getFloat(false));
break;
}
}
public void handleEffect(S28PacketEffect packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
// if (packetIn.isSoundServerwide())
// {
// this.gameController.theWorld.broadcastSound(packetIn.getSoundType(), packetIn.getSoundPos(), packetIn.getSoundData());
// }
// else
// {
this.gameController.theWorld.playAuxSFX(packetIn.getSoundType(), packetIn.getSoundPos(), packetIn.getSoundData());
// }
}
// /**
// * Updates the players statistics or achievements
// */
// public void handleStatistics(S37PacketStatistics packetIn)
// {
// NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
// boolean flag = false;
//
// for (Entry<StatBase, Integer> entry : packetIn.getStats().entrySet())
// {
// StatBase statbase = (StatBase)entry.getKey();
// int i = ((Integer)entry.getValue()).intValue();
//
//// if (statbase.isAchievement() && i > 0)
//// {
//// if (this.field_147308_k && this.gameController.thePlayer.getStatFileWriter().readStat(statbase) == 0)
//// {
//// Achievement achievement = (Achievement)statbase;
//// this.gameController.getNotifier().displayAchievement(achievement);
////
////// if (statbase == AchievementList.openInventory)
////// {
////// this.gameController.showInventoryAchievementHint = false;
////// this.gameController.saveOptions();
////// }
//// }
////
//// flag = true;
//// }
//
// this.gameController.stats.put(statbase, i);
// }
//
//// if (!this.field_147308_k && !flag && this.gameController.showInventoryAchievementHint)
//// {
//// this.gameController.getNotifier().displayUnformattedAchievement(AchievementList.openInventory);
//// }
//
//// this.field_147308_k = true;
//
//// if (this.gameController.openGui instanceof GuiAchievements)
//// {
//// ((GuiAchievements)this.gameController.openGui).doneLoading();
//// }
//// else
// if (this.gameController.openGui instanceof GuiStats)
// {
// ((GuiStats)this.gameController.openGui).doneLoading();
// }
// }
public void handleEntityEffect(S1DPacketEntityEffect packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
if (entity instanceof EntityLiving)
{
2025-03-26 21:07:23 +01:00
PotionEffect potioneffect = new PotionEffect(packetIn.getEffectId(), packetIn.getDuration(), packetIn.getAmplifier(), false, packetIn.hasParticles())
.setRemaining(packetIn.getRemaining());
2025-03-11 00:23:54 +01:00
((EntityLiving)entity).addEffect(potioneffect);
}
}
// public void handleCombatEvent(S42PacketCombatEvent packetIn)
// {
// PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
//
// }
// public void handleServerDifficulty(S3EPacketServerDifficulty packetIn)
// {
// NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
//// this.gameController.theWorld.setHardcore(packetIn.isHardcore());
//// this.gameController.theWorld.getWorldInfo().setLocked(packetIn.isDifficultyLocked());
// }
public void handleCamera(SPacketCamera packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = packetIn.getEntity(this.clientWorldController);
if (entity != null)
{
this.gameController.setRenderViewEntity(entity);
}
}
// public void handleTitle(S42PacketTitle packetIn)
// {
// NetHandler.checkThread(packetIn, this, this.gameController);
// this.gameController.ingameGui.displayTitle(packetIn.getTitle(), packetIn.getSubtitle());
// }
// public void handleSetCompressionLevel(S46PacketSetCompressionLevel packetIn)
// {
// if (!this.netManager.isLocalChannel())
// {
// this.netManager.setCompressionTreshold(packetIn.getThreshold());
// }
// }
// public void handlePlayerListHeaderFooter(S47PacketPlayerListHeaderFooter packetIn)
// {
// }
// public void handleDisplay(SPacketDisplay packetIn)
// {
//// switch(packetIn.getType()) {
//// case DISPLAY:
// this.gameController.nickname = packetIn.getName() == null ? "" : (packetIn.getName().length() > 48 ? packetIn.getName().substring(0, 48) : packetIn.getName());
//// this.gameController.nickChanged = true;
//// break;
//// case HEADER:
//// this.gameController.ingameGui.setHeader(packetIn.getList() == null ? null :
//// packetIn.getList().replace("${user}", this.gameController.getUser()));
//// break;
//// case FOOTER:
//// this.gameController.ingameGui.setFooter(packetIn.getList() == null ? null :
//// packetIn.getList().replace("${user}", this.gameController.getUser()));
//// break;
//// case SIDEBAR:
//// this.gameController.ingameGui.displaySidebar(packetIn.getList());
//// break;
//// }
// }
public void handleRemoveEntityEffect(S1EPacketRemoveEntityEffect packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
if (entity instanceof EntityLiving)
{
((EntityLiving)entity).removeEffectClient(packetIn.getEffectId());
}
}
public void handlePlayerListItem(S38PacketPlayerListItem packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController);
for(Entry<String, Integer> data : packetIn.getEntries()) {
if(data.getValue() < 0)
this.playerList.remove(data.getKey());
else
this.playerList.put(data.getKey(), data.getValue());
}
2025-03-11 16:18:06 +01:00
// String[] list = new String[this.playerList.size()];
// int[] data = new int[this.playerList.size()];
// int pos = 0;
// for(Entry<String, Integer> entry : this.playerList.entrySet()) {
// list[pos] = entry.getKey();
// data[pos++] = entry.getValue();
// }
// this.gameController.infolist(list, data);
2025-03-11 00:23:54 +01:00
}
2025-03-27 17:54:03 +01:00
public void handleCharacterList(SPacketCharacterList packet)
{
NetHandler.checkThread(packet, this, this.gameController);
for(Entry<Integer, PlayerCharacter> data : packet.getEntries()) {
if(data.getValue() == null)
this.characterList.remove(data.getKey());
else
this.characterList.put(data.getKey(), data.getValue());
}
this.selectedCharacter = packet.getSelected();
2025-03-28 14:30:37 +01:00
if(this.gameController.charEditor && this.selectedCharacter >= 0) {
this.gameController.charEditor = false;
this.gameController.displayGuiScreen(null);
}
2025-03-27 17:54:03 +01:00
}
2025-03-11 00:23:54 +01:00
public void handleKeepAlive(SPacketKeepAlive packetIn)
{
this.addToSendQueue(new CPacketKeepAlive(packetIn.getValue()));
}
public void handlePlayerAbilities(S39PacketPlayerAbilities packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
EntityNPC entityplayer = this.gameController.thePlayer;
entityplayer.flying = packetIn.isFlying();
entityplayer.noclip = packetIn.isNoclip();
// entityplayer.speed = packetIn.getSpeed();
// entityplayer.capabilities.setWalkSpeed(packetIn.getWalkSpeed());
}
/**
* Displays the available command-completion options the server knows of
*/
public void handleTabComplete(S3APacketTabComplete packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
String[] astring = packetIn.func_149630_c();
// this.gameController.complete(astring);
if (this.gameController.open instanceof GuiConsole)
{
GuiConsole guichat = (GuiConsole)this.gameController.open;
guichat.onAutocompleteResponse(astring);
}
}
public void handleSoundEffect(S29PacketSoundEffect packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
if(packetIn.getSound() == null) {
this.gameController.getSoundManager().stopSounds();
return;
}
// else if(packetIn.getSoundName().startsWith("music#")) {
// return;
// }
this.gameController.theWorld.playSound(packetIn.getX(), packetIn.getY(), packetIn.getZ(), packetIn.getSound(), packetIn.getVolume());
2025-03-11 00:23:54 +01:00
}
// public void handleDisplay(S48PacketDisplay packetIn)
// {
//// if(this.gameController.getConnected() == null)
//// {
//// File file1 = new File("saves");
//// File file2 = new File(file1, "resources.zip");
////
//// if (file2.isFile())
//// {
//// Futures.addCallback(this.gameController.getResourcePackRepository().setResourcePackInstance(file2), new FutureCallback<Object>()
//// {
//// public void onSuccess(Object p_onSuccess_1_)
//// {
////
//// }
//// public void onFailure(Throwable p_onFailure_1_)
//// {
////
//// }
//// });
//// }
//// }
// }
public void handleEntityNBT(S43PacketUpdateEntityNBT packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = packetIn.getEntity(this.clientWorldController);
if (entity != null)
{
entity.clientUpdateEntityNBT(packetIn.getTagCompound());
}
}
// public void handleDisplayList(S3BPacketDisplayList packetIn)
// {
// NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
//
// }
// /**
// * Either updates the score with a specified value or removes the score for an objective
// */
// public void handleUpdateScore(S3CPacketUpdateScore packetIn)
// {
// NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
// Scoreboard scoreboard = this.clientWorldController.getScoreboard();
// ScoreObjective scoreobjective = scoreboard.getObjective(packetIn.getObjectiveName());
//
// if (packetIn.getScoreAction() == S3CPacketUpdateScore.Action.CHANGE)
// {
// Score score = scoreboard.getValueFromObjective(packetIn.getPlayerName(), scoreobjective);
// score.setScorePoints(packetIn.getScoreValue());
// }
// else if (packetIn.getScoreAction() == S3CPacketUpdateScore.Action.REMOVE)
// {
// if (packetIn.getObjectiveName() == null || packetIn.getObjectiveName().isEmpty())
// {
// scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), (ScoreObjective)null);
// }
// else if (scoreobjective != null)
// {
// scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), scoreobjective);
// }
// }
// }
//
// /**
// * Removes or sets the ScoreObjective to be displayed at a particular scoreboard position (list, sidebar, below
// * name)
// */
// public void handleDisplayScoreboard(S3DPacketDisplayScoreboard packetIn)
// {
// NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
// Scoreboard scoreboard = this.clientWorldController.getScoreboard();
//
// if (packetIn.func_149370_d().length() == 0)
// {
// scoreboard.setObjectiveInDisplaySlot(packetIn.func_149371_c(), (ScoreObjective)null);
// }
// else
// {
// ScoreObjective scoreobjective = scoreboard.getObjective(packetIn.func_149370_d());
// scoreboard.setObjectiveInDisplaySlot(packetIn.func_149371_c(), scoreobjective);
// }
// }
// /**
// * Updates a team managed by the scoreboard: Create/Remove the team registration, Register/Remove the player-team-
// * memberships, Set team displayname/prefix/suffix and/or whether friendly fire is enabled
// */
// public void handleTeams(S3EPacketTeams packetIn)
// {
// NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
// Scoreboard scoreboard = this.clientWorldController.getScoreboard();
// Team scoreplayerteam;
//
// if (packetIn.getAction() == 0)
// {
// scoreplayerteam = scoreboard.createTeam(packetIn.getName());
// }
// else
// {
// scoreplayerteam = scoreboard.getTeam(packetIn.getName());
// }
//
//// if (packetIn.getAction() == 0 || packetIn.getAction() == 2)
//// {
//// scoreplayerteam.setTeamName(packetIn.getDisplayName());
//// scoreplayerteam.setNamePrefix(packetIn.getPrefix());
//// scoreplayerteam.setNameSuffix(packetIn.getSuffix());
//// scoreplayerteam.setChatFormat(ChatFormat.getByIndex(packetIn.getColor()));
//// scoreplayerteam.func_98298_a(packetIn.getFriendlyFlags());
//// Team.EnumVisible team$enumvisible = Team.EnumVisible.func_178824_a(packetIn.getNameTagVisibility());
////
//// if (team$enumvisible != null)
//// {
//// scoreplayerteam.setNameTagVisibility(team$enumvisible);
//// }
//// }
//
// if (packetIn.getAction() == 0 || packetIn.getAction() == 3)
// {
// for (String s : packetIn.getPlayers())
// {
// scoreboard.addPlayerToTeam(s, packetIn.getName());
// }
// }
//
// if (packetIn.getAction() == 4)
// {
// for (String s1 : packetIn.getPlayers())
// {
// scoreboard.removePlayerFromTeam(s1, scoreplayerteam);
// }
// }
//
// if (packetIn.getAction() == 1)
// {
// scoreboard.removeTeam(scoreplayerteam);
// }
// }
/**
* Spawns a specified number of particles at the specified location with a randomized displacement according to
* specified bounds
*/
public void handleParticles(S2APacketParticles packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
if (packetIn.getParticleCount() == 0)
{
double d0 = (double)(packetIn.getParticleSpeed() * packetIn.getXOffset());
double d2 = (double)(packetIn.getParticleSpeed() * packetIn.getYOffset());
double d4 = (double)(packetIn.getParticleSpeed() * packetIn.getZOffset());
try
{
ParticleType particle = packetIn.getParticleType();
this.clientWorldController.spawnEntityFX(particle, particle.getShouldIgnoreRange() | packetIn.isLongDistance(), packetIn.getXCoordinate(), packetIn.getYCoordinate(), packetIn.getZCoordinate(), d0, d2, d4, packetIn.getParticleArgs());
}
catch (Throwable var17)
{
Log.JNI.warn("Konnte Partikel-Effekt " + packetIn.getParticleType() + " nicht erzeugen");
}
}
else
{
for (int i = 0; i < packetIn.getParticleCount(); ++i)
{
double d1 = this.avRandomizer.gaussian() * (double)packetIn.getXOffset();
double d3 = this.avRandomizer.gaussian() * (double)packetIn.getYOffset();
double d5 = this.avRandomizer.gaussian() * (double)packetIn.getZOffset();
double d6 = this.avRandomizer.gaussian() * (double)packetIn.getParticleSpeed();
double d7 = this.avRandomizer.gaussian() * (double)packetIn.getParticleSpeed();
double d8 = this.avRandomizer.gaussian() * (double)packetIn.getParticleSpeed();
try
{
ParticleType particle = packetIn.getParticleType();
this.clientWorldController.spawnEntityFX(particle, particle.getShouldIgnoreRange() | packetIn.isLongDistance(), packetIn.getXCoordinate() + d1, packetIn.getYCoordinate() + d3, packetIn.getZCoordinate() + d5, d6, d7, d8, packetIn.getParticleArgs());
}
catch (Throwable var16)
{
Log.JNI.warn("Konnte Partikel-Effekt " + packetIn.getParticleType() + " nicht erzeugen");
return;
}
}
}
}
/**
* Updates en entity's attributes and their respective modifiers, which are used for speed bonusses (player
* 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)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
if (entity != null)
{
if (!(entity instanceof EntityLiving))
{
throw new IllegalStateException("Server tried to update attributes of a non-living entity (actually: " + entity + ")");
}
else
{
AttributeMap baseattributemap = ((EntityLiving)entity).getAttributeMap();
for (S20PacketEntityProperties.Snapshot s20packetentityproperties$snapshot : packetIn.func_149441_d())
{
AttributeInstance iattributeinstance = baseattributemap.getAttributeInstanceByName(s20packetentityproperties$snapshot.func_151409_a());
if (iattributeinstance == null)
{
iattributeinstance = baseattributemap.registerAttribute(Attribute.getAttribute(s20packetentityproperties$snapshot.func_151409_a()));
}
iattributeinstance.setBaseValue(s20packetentityproperties$snapshot.func_151410_b());
iattributeinstance.removeAllModifiers();
for (AttributeModifier attributemodifier : s20packetentityproperties$snapshot.func_151408_c())
{
iattributeinstance.applyModifier(attributemodifier);
}
}
}
}
}
public void handleSkin(SPacketSkin packetIn) {
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = packetIn.getEntity(this.clientWorldController);
if(entity != null && entity.isPlayer()) // {
EntityTexManager.setTexture(entity.getId(), packetIn.getTexture(), ((EntityNPC)entity).getModel());
// if(entity == this.gameController.thePlayer)
// this.gameController.confirmSkin(true);
// }
}
// public void handleCapes(SPacketCapes packetIn) {
// NetHandler.checkThread(packetIn, this, this.gameController);
// EntityTexManager.setCapeTextures(packetIn.getCapes());
// }
// public void handleBook(SPacketBook packetIn) {
// NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
//
// ItemStack itemstack = this.gameController.thePlayer.getCurrentEquippedItem();
//
// if (itemstack != null && itemstack.getItem() == Items.writable_book)
// {
// this.gameController.displayGuiScreen(new GuiBook(itemstack));
// }
// }
public void handleTrades(SPacketTrades packetIn) {
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
try
{
int i = packetIn.getWindowId();
Gui gui = this.gameController.open;
if (gui != null && gui instanceof GuiMerchant && i == this.gameController.thePlayer.openContainer.windowId)
{
// NpcMerchant imerchant = ((GuiMerchant)guiscreen).getMerchant();
MerchantRecipeList merchantrecipelist = packetIn.getTrades();
((GuiMerchant)gui).setRecipes(merchantrecipelist);
}
}
catch (Exception exception)
{
Log.JNI.error((Throwable)exception, (String)"Konnte Handel nicht laden");
}
}
public void handleWorld(SPacketWorld packetIn) {
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
this.clientWorldController.setGravity(this.gameController.gravity = packetIn.getGravity());
this.clientWorldController.setTimeFactor(this.gameController.timeFactor = packetIn.getTimeFactor());
// this.clientWorldController.setDifficulty(this.gameController.difficulty = packetIn.getDifficulty());
this.gameController.dayCycle = packetIn.hasDayCycle();
}
public void handleDimName(SPacketDimensionName packetIn) {
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
this.clientWorldController.dimension.setFullName(packetIn.getFullName());
this.clientWorldController.dimension.setCustomName(packetIn.getCustomName());
}
/**
* Returns this the NetworkManager instance registered with this NetworkHandlerPlayClient
*/
public NetConnection getNetworkManager()
{
return this.netManager;
}
2025-03-11 16:18:06 +01:00
public Set<Entry<String, Integer>> getPlayerList()
{
return this.playerList.entrySet();
}
2025-03-17 18:21:41 +01:00
2025-03-27 17:54:03 +01:00
public Collection<PlayerCharacter> getCharacterList()
{
return this.characterList.values();
}
public int getSelectedCharacter()
{
return this.selectedCharacter;
}
2025-03-17 18:21:41 +01:00
public Iterable<String> getPlayerNames()
{
return this.playerList.keySet();
}
2025-03-11 00:23:54 +01:00
}