network code cleanup
This commit is contained in:
parent
1eefb197f0
commit
bd4b8d427a
116 changed files with 1541 additions and 2022 deletions
|
@ -56,10 +56,10 @@ import common.network.PacketSplitter;
|
|||
import common.network.NetHandler.ThreadQuickExitException;
|
||||
import common.packet.RPacketEnableCompression;
|
||||
import common.packet.RPacketLoginSuccess;
|
||||
import common.packet.S1DPacketEntityEffect;
|
||||
import common.packet.S2BPacketChangeGameState;
|
||||
import common.packet.S38PacketPlayerListItem;
|
||||
import common.packet.S39PacketPlayerAbilities;
|
||||
import common.packet.SPacketEntityEffect;
|
||||
import common.packet.SPacketChangeGameState;
|
||||
import common.packet.SPacketPlayerListItem;
|
||||
import common.packet.SPacketPlayerAbilities;
|
||||
import common.packet.SPacketDisconnect;
|
||||
import common.packet.SPacketHeldItemChange;
|
||||
import common.packet.SPacketJoinGame;
|
||||
|
@ -655,7 +655,7 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
this.networkTick();
|
||||
if(++this.pingTimer > 600) {
|
||||
this.sendPacket(new S38PacketPlayerListItem((List)this.getPlayers()));
|
||||
this.sendPacket(new SPacketPlayerListItem((List)this.getPlayers()));
|
||||
this.pingTimer = 0;
|
||||
}
|
||||
if(Config.saveInterval > 0 && ++this.saveTimer >= Config.saveInterval) {
|
||||
|
@ -867,22 +867,22 @@ public final class Server implements IThreadListener {
|
|||
conn.sendPacket(new SPacketWorld(WorldServer.clampGravity(),
|
||||
Config.dayCycle, Config.timeFlow));
|
||||
// conn.initializeStats();
|
||||
this.sendPacket(new S38PacketPlayerListItem(false, conn));
|
||||
this.sendPacket(new SPacketPlayerListItem(false, conn));
|
||||
|
||||
world.spawnEntityInWorld(player);
|
||||
this.preparePlayer(player, null);
|
||||
|
||||
for(int i = 0; i < this.players.size(); ++i) {
|
||||
Player other = this.players.get(i);
|
||||
conn.sendPacket(new S38PacketPlayerListItem(false, other));
|
||||
conn.sendPacket(new SPacketPlayerListItem(false, other));
|
||||
}
|
||||
conn.sendPacket(new SPacketSkin(player.getId(), player.getSkin())); // , player.getModel()));
|
||||
conn.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotYaw, player.rotPitch);
|
||||
this.updateTimeAndWeatherForPlayer(conn, world);
|
||||
for(PotionEffect effect : player.getEffects()) {
|
||||
conn.sendPacket(new S1DPacketEntityEffect(player.getId(), effect));
|
||||
conn.sendPacket(new SPacketEntityEffect(player.getId(), effect));
|
||||
}
|
||||
conn.sendPacket(new S39PacketPlayerAbilities(player));
|
||||
conn.sendPacket(new SPacketPlayerAbilities(player));
|
||||
conn.addSelfToInternalCraftingInventory();
|
||||
conn.onConnect();
|
||||
return null;
|
||||
|
@ -897,7 +897,7 @@ public final class Server implements IThreadListener {
|
|||
world.removePlayer(player);
|
||||
this.players.remove(conn);
|
||||
this.usermap.remove(conn.getUser());
|
||||
this.sendPacket(new S38PacketPlayerListItem(true, conn));
|
||||
this.sendPacket(new SPacketPlayerListItem(true, conn));
|
||||
}
|
||||
|
||||
private void preparePlayer(EntityNPC player, WorldServer oldWorld) {
|
||||
|
@ -1060,7 +1060,7 @@ public final class Server implements IThreadListener {
|
|||
this.updateTimeAndWeatherForPlayer(conn, world);
|
||||
this.syncPlayerInventory(nplayer);
|
||||
for(PotionEffect effect : nplayer.getEffects()) {
|
||||
conn.sendPacket(new S1DPacketEntityEffect(nplayer.getId(), effect));
|
||||
conn.sendPacket(new SPacketEntityEffect(nplayer.getId(), effect));
|
||||
}
|
||||
conn.sendPlayerAbilities();
|
||||
return oldTag;
|
||||
|
@ -1087,7 +1087,7 @@ public final class Server implements IThreadListener {
|
|||
this.updateTimeAndWeatherForPlayer((Player)player.connection, newWorld);
|
||||
this.syncPlayerInventory(player);
|
||||
for(PotionEffect effect : player.getEffects()) {
|
||||
player.connection.sendPacket(new S1DPacketEntityEffect(player.getId(), effect));
|
||||
player.connection.sendPacket(new SPacketEntityEffect(player.getId(), effect));
|
||||
}
|
||||
player.connection.sendPlayerAbilities();
|
||||
}
|
||||
|
@ -1171,11 +1171,11 @@ public final class Server implements IThreadListener {
|
|||
|
||||
private void updateTimeAndWeatherForPlayer(Player conn, WorldServer world) {
|
||||
conn.sendPacket(new SPacketTimeUpdate(world.getDayTime(), this.getInfo()));
|
||||
conn.sendPacket(new S2BPacketChangeGameState(S2BPacketChangeGameState.Action.SET_WEATHER, world.getWeather().getID()));
|
||||
conn.sendPacket(new S2BPacketChangeGameState(S2BPacketChangeGameState.Action.RAIN_STRENGTH, world.getRainStrength()));
|
||||
conn.sendPacket(new S2BPacketChangeGameState(S2BPacketChangeGameState.Action.DARKNESS, world.getDarkness()));
|
||||
conn.sendPacket(new S2BPacketChangeGameState(S2BPacketChangeGameState.Action.FOG_STRENGTH, world.getFogStrength()));
|
||||
conn.sendPacket(new S2BPacketChangeGameState(S2BPacketChangeGameState.Action.TEMPERATURE, world.getTempOffset()));
|
||||
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.SET_WEATHER, world.getWeather().getID()));
|
||||
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.RAIN_STRENGTH, world.getRainStrength()));
|
||||
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.DARKNESS, world.getDarkness()));
|
||||
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.FOG_STRENGTH, world.getFogStrength()));
|
||||
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.TEMPERATURE, world.getTempOffset()));
|
||||
}
|
||||
|
||||
public void syncPlayerInventory(EntityNPC player) {
|
||||
|
|
|
@ -48,13 +48,11 @@ import common.log.Log;
|
|||
import common.material.Material;
|
||||
import common.nbt.NBTTagCompound;
|
||||
import common.nbt.NBTTagList;
|
||||
import common.nbt.NBTTagString;
|
||||
import common.network.IPlayer;
|
||||
import common.network.NetConnection;
|
||||
import common.network.NetHandler;
|
||||
import common.network.Packet;
|
||||
import common.packet.CPacketAction;
|
||||
import common.packet.CPacketBook;
|
||||
import common.packet.CPacketBreak;
|
||||
import common.packet.CPacketCheat;
|
||||
import common.packet.CPacketClick;
|
||||
|
@ -67,21 +65,21 @@ import common.packet.CPacketPlace;
|
|||
import common.packet.CPacketPlayer;
|
||||
import common.packet.CPacketSign;
|
||||
import common.packet.CPacketSkin;
|
||||
import common.packet.S18PacketEntityTeleport;
|
||||
import common.packet.S1APacketEntityStatus;
|
||||
import common.packet.S1BPacketEntityAttach;
|
||||
import common.packet.S1DPacketEntityEffect;
|
||||
import common.packet.S1EPacketRemoveEntityEffect;
|
||||
import common.packet.S29PacketSoundEffect;
|
||||
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.S36PacketSignEditorOpen;
|
||||
import common.packet.S39PacketPlayerAbilities;
|
||||
import common.packet.S3APacketTabComplete;
|
||||
import common.packet.SPacketEntityTeleport;
|
||||
import common.packet.SPacketEntityStatus;
|
||||
import common.packet.SPacketEntityAttach;
|
||||
import common.packet.SPacketEntityEffect;
|
||||
import common.packet.SPacketRemoveEntityEffect;
|
||||
import common.packet.SPacketSoundEffect;
|
||||
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.SPacketSignEditorOpen;
|
||||
import common.packet.SPacketPlayerAbilities;
|
||||
import common.packet.SPacketTabComplete;
|
||||
import common.packet.SPacketAnimation;
|
||||
import common.packet.SPacketBlockChange;
|
||||
import common.packet.SPacketCharacterList;
|
||||
|
@ -429,7 +427,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
this.entity.openContainer.onCraftGuiOpened(this);
|
||||
IInventory iinventory = ((ContainerMerchant)this.entity.openContainer).getMerchantInventory();
|
||||
String ichatcomponent = npc.getName();
|
||||
this.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "trade", ichatcomponent, iinventory.getSizeInventory()));
|
||||
this.sendPacket(new SPacketOpenWindow(this.currentWindowId, "trade", ichatcomponent, iinventory.getSizeInventory()));
|
||||
MerchantRecipeList merchantrecipelist = npc.getTrades(this.entity);
|
||||
|
||||
if (merchantrecipelist != null)
|
||||
|
@ -445,7 +443,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
{
|
||||
if (!this.isChangingQuantityOnly)
|
||||
{
|
||||
this.sendPacket(new S2FPacketSetSlot(-1, -1, this.entity.inventory.getItemStack()));
|
||||
this.sendPacket(new SPacketSetSlot(-1, -1, this.entity.inventory.getItemStack()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -553,7 +551,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
{
|
||||
if (this.entity != null)
|
||||
{
|
||||
this.sendPacket(new S39PacketPlayerAbilities(this.entity));
|
||||
this.sendPacket(new SPacketPlayerAbilities(this.entity));
|
||||
this.entity.updateEffectMeta();
|
||||
}
|
||||
}
|
||||
|
@ -707,20 +705,20 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
|
||||
public void mountEntity(Entity entityIn)
|
||||
{
|
||||
this.sendPacket(new S1BPacketEntityAttach(0, this.entity, this.entity.vehicle));
|
||||
this.sendPacket(new SPacketEntityAttach(0, this.entity, this.entity.vehicle));
|
||||
this.setPlayerLocation(this.entity.posX, this.entity.posY, this.entity.posZ, this.entity.rotYaw, this.entity.rotPitch);
|
||||
}
|
||||
|
||||
public void openEditSign(TileEntitySign signTile)
|
||||
{
|
||||
signTile.setPlayer(this.entity);
|
||||
this.sendPacket(new S36PacketSignEditorOpen(signTile.getPos()));
|
||||
this.sendPacket(new SPacketSignEditorOpen(signTile.getPos()));
|
||||
}
|
||||
|
||||
public void displayGui(IInteractionObject guiOwner)
|
||||
{
|
||||
this.getNextWindowId();
|
||||
this.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, guiOwner.getGuiID(), guiOwner.getCommandName()));
|
||||
this.sendPacket(new SPacketOpenWindow(this.currentWindowId, guiOwner.getGuiID(), guiOwner.getCommandName()));
|
||||
this.entity.openContainer = guiOwner.createContainer(this.entity.inventory, this.entity);
|
||||
this.entity.openContainer.windowId = this.currentWindowId;
|
||||
this.entity.openContainer.onCraftGuiOpened(this);
|
||||
|
@ -740,7 +738,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
if (ilockablecontainer.isLocked() && !this.entity.canOpen(ilockablecontainer.getLockCode())) // && !this.isSpectator())
|
||||
{
|
||||
this.addHotbar(TextColor.RED + "%s ist verschlossen!", chestInventory.getCommandName());
|
||||
this.sendPacket(new S29PacketSoundEffect(SoundEvent.DOOR, this.entity.posX, this.entity.posY, this.entity.posZ, 1.0F));
|
||||
this.sendPacket(new SPacketSoundEffect(SoundEvent.DOOR, this.entity.posX, this.entity.posY, this.entity.posZ, 1.0F));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -749,18 +747,18 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
|
||||
if (chestInventory instanceof TileEntityMachine)
|
||||
{
|
||||
this.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "machine_" + ((IInteractionObject)chestInventory).getGuiID(), chestInventory.getCommandName(), chestInventory.getSizeInventory(),
|
||||
this.sendPacket(new SPacketOpenWindow(this.currentWindowId, "machine_" + ((IInteractionObject)chestInventory).getGuiID(), chestInventory.getCommandName(), chestInventory.getSizeInventory(),
|
||||
((TileEntityMachine)chestInventory).getPos()));
|
||||
this.entity.openContainer = ((IInteractionObject)chestInventory).createContainer(this.entity.inventory, this.entity);
|
||||
}
|
||||
else if (chestInventory instanceof IInteractionObject)
|
||||
{
|
||||
this.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, ((IInteractionObject)chestInventory).getGuiID(), chestInventory.getCommandName(), chestInventory.getSizeInventory()));
|
||||
this.sendPacket(new SPacketOpenWindow(this.currentWindowId, ((IInteractionObject)chestInventory).getGuiID(), chestInventory.getCommandName(), chestInventory.getSizeInventory()));
|
||||
this.entity.openContainer = ((IInteractionObject)chestInventory).createContainer(this.entity.inventory, this.entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "container", chestInventory.getCommandName(), chestInventory.getSizeInventory()));
|
||||
this.sendPacket(new SPacketOpenWindow(this.currentWindowId, "container", chestInventory.getCommandName(), chestInventory.getSizeInventory()));
|
||||
this.entity.openContainer = new ContainerChest(this.entity.inventory, chestInventory, this.entity);
|
||||
}
|
||||
|
||||
|
@ -776,7 +774,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
}
|
||||
|
||||
this.getNextWindowId();
|
||||
this.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "EntityHorse", horseInventory.getCommandName(), horseInventory.getSizeInventory(), horse.getId()));
|
||||
this.sendPacket(new SPacketOpenWindow(this.currentWindowId, "EntityHorse", horseInventory.getCommandName(), horseInventory.getSizeInventory(), horse.getId()));
|
||||
this.entity.openContainer = new ContainerHorseInventory(this.entity.inventory, horseInventory, horse, this.entity);
|
||||
this.entity.openContainer.windowId = this.currentWindowId;
|
||||
this.entity.openContainer.onCraftGuiOpened(this);
|
||||
|
@ -794,7 +792,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
|
||||
public void closeScreen()
|
||||
{
|
||||
this.sendPacket(new S2EPacketCloseWindow(this.entity.openContainer.windowId));
|
||||
this.sendPacket(new SPacketCloseWindow(this.entity.openContainer.windowId));
|
||||
this.closeContainer();
|
||||
}
|
||||
|
||||
|
@ -813,7 +811,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
|
||||
public void onItemUseFinish()
|
||||
{
|
||||
this.sendPacket(new S1APacketEntityStatus(this.entity, (byte)9));
|
||||
this.sendPacket(new SPacketEntityStatus(this.entity, (byte)9));
|
||||
}
|
||||
|
||||
// /**
|
||||
|
@ -831,17 +829,17 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
|
||||
public void onNewEffect(PotionEffect id)
|
||||
{
|
||||
this.sendPacket(new S1DPacketEntityEffect(this.entity.getId(), id));
|
||||
this.sendPacket(new SPacketEntityEffect(this.entity.getId(), id));
|
||||
}
|
||||
|
||||
public void onChangedEffect(PotionEffect id, boolean added)
|
||||
{
|
||||
this.sendPacket(new S1DPacketEntityEffect(this.entity.getId(), id));
|
||||
this.sendPacket(new SPacketEntityEffect(this.entity.getId(), id));
|
||||
}
|
||||
|
||||
public void onFinishedEffect(PotionEffect effect)
|
||||
{
|
||||
this.sendPacket(new S1EPacketRemoveEntityEffect(this.entity.getId(), effect));
|
||||
this.sendPacket(new SPacketRemoveEntityEffect(this.entity.getId(), effect));
|
||||
}
|
||||
|
||||
public void setPositionAndUpdate(double x, double y, double z)
|
||||
|
@ -866,7 +864,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
|
||||
public void playSound(SoundEvent name, float volume)
|
||||
{
|
||||
this.server.sendNearExcept(this.entity, this.entity.posX, this.entity.posY, this.entity.posZ, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, this.entity.worldObj.dimension.getDimensionId(), new S29PacketSoundEffect(name, this.entity.posX, this.entity.posY, this.entity.posZ, volume));
|
||||
this.server.sendNearExcept(this.entity, this.entity.posX, this.entity.posY, this.entity.posZ, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, this.entity.worldObj.dimension.getDimensionId(), new SPacketSoundEffect(name, this.entity.posX, this.entity.posY, this.entity.posZ, volume));
|
||||
}
|
||||
|
||||
|
||||
|
@ -886,7 +884,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
{
|
||||
if (!this.isChangingQuantityOnly)
|
||||
{
|
||||
this.sendPacket(new S2FPacketSetSlot(containerToSend.windowId, slotInd, stack));
|
||||
this.sendPacket(new SPacketSetSlot(containerToSend.windowId, slotInd, stack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -898,20 +896,20 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
|
||||
public void updateCraftingInventory(Container containerToSend, List<ItemStack> itemsList)
|
||||
{
|
||||
this.sendPacket(new S30PacketWindowItems(containerToSend.windowId, itemsList));
|
||||
this.sendPacket(new S2FPacketSetSlot(-1, -1, this.entity.inventory.getItemStack()));
|
||||
this.sendPacket(new SPacketWindowItems(containerToSend.windowId, itemsList));
|
||||
this.sendPacket(new SPacketSetSlot(-1, -1, this.entity.inventory.getItemStack()));
|
||||
}
|
||||
|
||||
public void sendProgressBarUpdate(Container containerIn, int varToUpdate, int newValue)
|
||||
{
|
||||
this.sendPacket(new S31PacketWindowProperty(containerIn.windowId, varToUpdate, newValue));
|
||||
this.sendPacket(new SPacketWindowProperty(containerIn.windowId, varToUpdate, newValue));
|
||||
}
|
||||
|
||||
public void sendAllWindowProperties(Container p_175173_1_, IInventory p_175173_2_)
|
||||
{
|
||||
for (int i = 0; i < p_175173_2_.getFieldCount(); ++i)
|
||||
{
|
||||
this.sendPacket(new S31PacketWindowProperty(p_175173_1_.windowId, i, p_175173_2_.getField(i)));
|
||||
this.sendPacket(new SPacketWindowProperty(p_175173_1_.windowId, i, p_175173_2_.getField(i)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2055,13 +2053,13 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
{
|
||||
NetHandler.checkThread(packetIn, this, this.server);
|
||||
if(this.charEditor || !this.isAdmin()) {
|
||||
this.entity.connection.sendPacket(new S3APacketTabComplete(new String[0]));
|
||||
this.entity.connection.sendPacket(new SPacketTabComplete(new String[0]));
|
||||
return;
|
||||
}
|
||||
this.pointedEntity = packetIn.getEntityId();
|
||||
this.pointedPosition = packetIn.getPosition();
|
||||
if(packetIn.getMessage().startsWith(" ")) {
|
||||
this.entity.connection.sendPacket(new S3APacketTabComplete(new String[0]));
|
||||
this.entity.connection.sendPacket(new SPacketTabComplete(new String[0]));
|
||||
return;
|
||||
}
|
||||
List<String> list = Lists.<String>newArrayList();
|
||||
|
@ -2074,7 +2072,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
list.add(s1);
|
||||
}
|
||||
list.addAll(this.completeCommand(packetIn.getMessage()));
|
||||
this.entity.connection.sendPacket(new S3APacketTabComplete(list.toArray(new String[list.size()])));
|
||||
this.entity.connection.sendPacket(new SPacketTabComplete(list.toArray(new String[list.size()])));
|
||||
}
|
||||
|
||||
private static boolean isFinite(double value) {
|
||||
|
@ -2154,7 +2152,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
if (d3 > 4.0D)
|
||||
{
|
||||
Entity entity = this.entity.vehicle;
|
||||
this.entity.connection.sendPacket(new S18PacketEntityTeleport(entity));
|
||||
this.entity.connection.sendPacket(new SPacketEntityTeleport(entity));
|
||||
this.setPlayerLocation(this.entity.posX, this.entity.posY, this.entity.posZ, this.entity.rotYaw, this.entity.rotPitch);
|
||||
}
|
||||
|
||||
|
@ -2480,7 +2478,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
|
||||
if (!ItemStack.areItemStacksEqual(this.entity.inventory.getCurrentItem(), packetIn.getStack()))
|
||||
{
|
||||
this.sendPacket(new S2FPacketSetSlot(this.entity.openContainer.windowId, slot.slotNumber, this.entity.inventory.getCurrentItem()));
|
||||
this.sendPacket(new SPacketSetSlot(this.entity.openContainer.windowId, slot.slotNumber, this.entity.inventory.getCurrentItem()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2943,7 +2941,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
|
||||
if (ItemStack.areItemStacksEqual(packetIn.getClickedItem(), itemstack))
|
||||
{
|
||||
this.entity.connection.sendPacket(new S32PacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true));
|
||||
this.entity.connection.sendPacket(new SPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true));
|
||||
this.isChangingQuantityOnly = true;
|
||||
this.entity.openContainer.detectAndSendChanges();
|
||||
this.updateHeldItem();
|
||||
|
@ -2952,7 +2950,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
else
|
||||
{
|
||||
this.transactions.addKey(this.entity.openContainer.windowId, Short.valueOf(packetIn.getActionNumber()));
|
||||
this.entity.connection.sendPacket(new S32PacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), false));
|
||||
this.entity.connection.sendPacket(new SPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), false));
|
||||
this.entity.openContainer.setCanCraft(this.entity, false);
|
||||
List<ItemStack> list1 = Lists.<ItemStack>newArrayList();
|
||||
|
||||
|
@ -3141,34 +3139,6 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
// this.lastSkinUpdate = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void processBook(CPacketBook packetIn) {
|
||||
NetHandler.checkThread(packetIn, this, this.server);
|
||||
if(this.charEditor)
|
||||
return;
|
||||
|
||||
String[] pages = packetIn.getPages();
|
||||
// if (!ItemWritableBook.isNBTValid(itemstack1.getTagCompound()))
|
||||
// throw new IOException("Fehlerhafter Buch-Tag!");
|
||||
ItemStack itemstack = this.entity.inventory.getCurrentItem();
|
||||
if (itemstack != null && itemstack.getItem() == Items.writable_book)
|
||||
{
|
||||
if(pages.length == 0) {
|
||||
if(itemstack.hasTagCompound()) {
|
||||
itemstack.getTagCompound().removeTag("pages");
|
||||
if(itemstack.getTagCompound().hasNoTags())
|
||||
itemstack.setTagCompound(null);
|
||||
}
|
||||
}
|
||||
else {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(String page : pages) {
|
||||
list.appendTag(new NBTTagString(page));
|
||||
}
|
||||
itemstack.setTagInfo("pages", list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void processForm(CPacketForm packet) {
|
||||
NetHandler.checkThread(packet, this, this.server);
|
||||
if(this.charEditor || this.form == null || packet.getId() != this.currentFormId)
|
||||
|
|
|
@ -47,13 +47,13 @@ import common.nbt.NBTTagInt;
|
|||
import common.nbt.NBTTagList;
|
||||
import common.network.IPlayer;
|
||||
import common.network.Packet;
|
||||
import common.packet.S1APacketEntityStatus;
|
||||
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.SPacketEntityStatus;
|
||||
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.SPacketBiome;
|
||||
import common.packet.SPacketBlockAction;
|
||||
import common.packet.SPacketBlockBreakAnim;
|
||||
|
@ -1113,7 +1113,7 @@ public final class WorldServer extends AWorldServer {
|
|||
EntityLightning entity = new EntityLightning(this, x, y, z, color, damage, fire, summoner);
|
||||
this.effects.add(entity);
|
||||
this.server.sendNear(entity.posX, entity.posY, entity.posZ, 512.0D, this.dimension.getDimensionId(),
|
||||
new S2CPacketSpawnGlobalEntity(entity, 1, entity.color));
|
||||
new SPacketSpawnGlobalEntity(entity, 1, entity.color));
|
||||
if(fire && Config.fire) {
|
||||
BlockPos pos = new BlockPos(entity);
|
||||
if(this.isAreaLoaded(pos, 10)) {
|
||||
|
@ -1129,7 +1129,7 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
|
||||
public void setEntityState(Entity entityIn, byte state) {
|
||||
this.sendToAllTrackingAndSelf(entityIn, new S1APacketEntityStatus(entityIn, state));
|
||||
this.sendToAllTrackingAndSelf(entityIn, new SPacketEntityStatus(entityIn, state));
|
||||
}
|
||||
|
||||
public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking, boolean altSound) {
|
||||
|
@ -1143,7 +1143,7 @@ public final class WorldServer extends AWorldServer {
|
|||
|
||||
for(EntityNPC entityplayer : this.players) {
|
||||
if(entityplayer.getDistanceSq(x, y, z) < 4096.0D) {
|
||||
entityplayer.connection.sendPacket(new S27PacketExplosion(x, y, z, strength, explosion.getAffectedBlockPositions(),
|
||||
entityplayer.connection.sendPacket(new SPacketExplosion(x, y, z, strength, explosion.getAffectedBlockPositions(),
|
||||
(Vec3)explosion.getPlayerKnockbackMap().get(entityplayer), altSound));
|
||||
}
|
||||
}
|
||||
|
@ -1196,7 +1196,7 @@ public final class WorldServer extends AWorldServer {
|
|||
public void setWeather(Weather weather) {
|
||||
this.weather = weather;
|
||||
// this.dataModified = true;
|
||||
this.server.sendPacket(new S2BPacketChangeGameState(S2BPacketChangeGameState.Action.SET_WEATHER,
|
||||
this.server.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.SET_WEATHER,
|
||||
weather.getID()), this.dimension.getDimensionId());
|
||||
}
|
||||
|
||||
|
@ -1268,15 +1268,15 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
|
||||
if(prevRain != this.rain || force) {
|
||||
this.server.sendPacket(new S2BPacketChangeGameState(S2BPacketChangeGameState.Action.RAIN_STRENGTH, this.rain), this.dimension.getDimensionId());
|
||||
this.server.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.RAIN_STRENGTH, this.rain), this.dimension.getDimensionId());
|
||||
}
|
||||
|
||||
if(prevDarkness != this.darkness || force) {
|
||||
this.server.sendPacket(new S2BPacketChangeGameState(S2BPacketChangeGameState.Action.DARKNESS, this.darkness), this.dimension.getDimensionId());
|
||||
this.server.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.DARKNESS, this.darkness), this.dimension.getDimensionId());
|
||||
}
|
||||
|
||||
if(prevFog != this.fog || force) {
|
||||
this.server.sendPacket(new S2BPacketChangeGameState(S2BPacketChangeGameState.Action.FOG_STRENGTH, this.fog), this.dimension.getDimensionId());
|
||||
this.server.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.FOG_STRENGTH, this.fog), this.dimension.getDimensionId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1292,7 +1292,7 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
|
||||
if(prevTemp != this.temp || force) {
|
||||
this.server.sendPacket(new S2BPacketChangeGameState(S2BPacketChangeGameState.Action.TEMPERATURE, this.temp), this.dimension.getDimensionId());
|
||||
this.server.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.TEMPERATURE, this.temp), this.dimension.getDimensionId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1308,7 +1308,7 @@ public final class WorldServer extends AWorldServer {
|
|||
|
||||
public void spawnParticle(ParticleType particleType, boolean longDistance, double xCoord, double yCoord, double zCoord,
|
||||
int numberOfParticles, double xOffset, double yOffset, double zOffset, double particleSpeed, int[] particleArguments) {
|
||||
Packet packet = new S2APacketParticles(particleType, longDistance, (float)xCoord, (float)yCoord, (float)zCoord, (float)xOffset,
|
||||
Packet packet = new SPacketParticles(particleType, longDistance, (float)xCoord, (float)yCoord, (float)zCoord, (float)xOffset,
|
||||
(float)yOffset, (float)zOffset, (float)particleSpeed, numberOfParticles, particleArguments);
|
||||
|
||||
for(int i = 0; i < this.players.size(); ++i) {
|
||||
|
@ -1719,15 +1719,15 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
for(EntityNPC player : this.players) {
|
||||
player.attackEntityFrom(DamageSource.causeExterminatusDamage(null), 5000);
|
||||
Packet packet = new S2APacketParticles(ParticleType.EXPLOSION_HUGE, true,
|
||||
Packet packet = new SPacketParticles(ParticleType.EXPLOSION_HUGE, true,
|
||||
(float)player.posX, (float)this.getSeaLevel() + 4.0f, (float)player.posZ, (float)128.0,
|
||||
(float)2.0, (float)128.0, (float)0.15, 1000, new int[0]);
|
||||
player.connection.sendPacket(packet);
|
||||
packet = new S2APacketParticles(ParticleType.CLOUD, true,
|
||||
packet = new SPacketParticles(ParticleType.CLOUD, true,
|
||||
(float)player.posX, (float)this.getSeaLevel() + 4.0f, (float)player.posZ, (float)128.0,
|
||||
(float)2.0, (float)128.0, (float)0.15, 1000, new int[0]);
|
||||
player.connection.sendPacket(packet);
|
||||
packet = new S28PacketEffect(1025, new BlockPos(player.posX, (double)this.getSeaLevel() + 4.0, player.posZ), 0);
|
||||
packet = new SPacketEffect(1025, new BlockPos(player.posX, (double)this.getSeaLevel() + 4.0, player.posZ), 0);
|
||||
player.connection.sendPacket(packet);
|
||||
}
|
||||
return true;
|
||||
|
@ -1803,7 +1803,7 @@ public final class WorldServer extends AWorldServer {
|
|||
|
||||
public void playSound(SoundEvent sound, double x, double y, double z, float volume)
|
||||
{
|
||||
this.server.sendNear(x, y, z, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, this.dimension.getDimensionId(), new S29PacketSoundEffect(sound, x, y, z, volume));
|
||||
this.server.sendNear(x, y, z, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, this.dimension.getDimensionId(), new SPacketSoundEffect(sound, x, y, z, volume));
|
||||
}
|
||||
|
||||
public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2)
|
||||
|
@ -1816,7 +1816,7 @@ public final class WorldServer extends AWorldServer {
|
|||
|
||||
public void playAuxSFX(EntityNPC player, int sfxType, BlockPos blockPosIn, int data)
|
||||
{
|
||||
this.server.sendNearExcept(player, (double)blockPosIn.getX(), (double)blockPosIn.getY(), (double)blockPosIn.getZ(), 64.0D, this.dimension.getDimensionId(), new S28PacketEffect(sfxType, blockPosIn, data));
|
||||
this.server.sendNearExcept(player, (double)blockPosIn.getX(), (double)blockPosIn.getY(), (double)blockPosIn.getZ(), 64.0D, this.dimension.getDimensionId(), new SPacketEffect(sfxType, blockPosIn, data));
|
||||
}
|
||||
|
||||
// public void broadcastSound(int soundID, BlockPos pos, int data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue