1
0
Fork 0

1.9 protocol part 1

This commit is contained in:
HoosierTransfer 2024-05-11 11:09:18 -04:00
parent 62252503f3
commit 08bc055e4f
65 changed files with 1276 additions and 906 deletions

View File

@ -17,6 +17,8 @@ public class Config {
public static int SleepDuration = 10; public static int SleepDuration = 10;
public static int hitboxLimit = 50; public static int hitboxLimit = 50;
public static int protocolVersion = 107;
public static boolean disableAlpha() { public static boolean disableAlpha() {
return Minecraft.getMinecraft().gameSettings.disableAlpha && !Minecraft.getMinecraft().gameSettings.shaders; return Minecraft.getMinecraft().gameSettings.disableAlpha && !Minecraft.getMinecraft().gameSettings.shaders;
} }

View File

@ -7,6 +7,7 @@ import java.nio.charset.StandardCharsets;
import org.teavm.jso.JSBody; import org.teavm.jso.JSBody;
import net.hoosiertransfer.Config;
import net.lax1dude.eaglercraft.v1_8.ArrayUtils; import net.lax1dude.eaglercraft.v1_8.ArrayUtils;
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream; import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
import net.lax1dude.eaglercraft.v1_8.EaglerOutputStream; import net.lax1dude.eaglercraft.v1_8.EaglerOutputStream;
@ -79,7 +80,7 @@ public class ConnectionHandshake {
d.writeShort(protocolV3); // client supports v3 d.writeShort(protocolV3); // client supports v3
d.writeShort(1); // supported game protocols count d.writeShort(1); // supported game protocols count
d.writeShort(47); // client supports 1.8 protocol d.writeShort(Config.protocolVersion); // client supports 1.8 protocol
String clientBrand = EaglercraftVersion.projectForkName; String clientBrand = EaglercraftVersion.projectForkName;
d.writeByte(clientBrand.length()); d.writeByte(clientBrand.length());
@ -126,7 +127,7 @@ public class ConnectionHandshake {
games.append("mc").append(di.readShort()); games.append("mc").append(di.readShort());
} }
logger.info("Incompatible client: v2 & mc47"); logger.info("Incompatible client: v2 & mc" + Config.protocolVersion);
logger.info("Server supports: {}", protocols); logger.info("Server supports: {}", protocols);
logger.info("Server supports: {}", games); logger.info("Server supports: {}", games);
@ -149,7 +150,7 @@ public class ConnectionHandshake {
} }
int gameVers = di.readShort(); int gameVers = di.readShort();
if (gameVers != 47) { if (gameVers != Config.protocolVersion) {
logger.info("Incompatible minecraft protocol version: {}", gameVers); logger.info("Incompatible minecraft protocol version: {}", gameVers);
mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed", mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed",
new ChatComponentText("This server does not support 1.8!"))); new ChatComponentText("This server does not support 1.8!")));

View File

@ -1602,11 +1602,11 @@ public class Minecraft implements IThreadListener {
boolean flag = this.gameSettings.chatVisibility != EntityPlayer.EnumChatVisibility.HIDDEN; boolean flag = this.gameSettings.chatVisibility != EntityPlayer.EnumChatVisibility.HIDDEN;
while (this.gameSettings.keyBindInventory.isPressed()) { while (this.gameSettings.keyBindInventory.isPressed()) {
this.getNetHandler().addToSendQueue(
new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));
if (this.playerController.isRidingHorse()) { if (this.playerController.isRidingHorse()) {
this.thePlayer.sendHorseInventory(); this.thePlayer.sendHorseInventory();
} else { } else {
this.getNetHandler().addToSendQueue(
new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));
this.displayGuiScreen(new GuiInventory(this.thePlayer)); this.displayGuiScreen(new GuiInventory(this.thePlayer));
} }
} }

View File

@ -271,7 +271,7 @@ public class GuiChat extends GuiScreen {
blockpos = this.mc.objectMouseOver.getBlockPos(); blockpos = this.mc.objectMouseOver.getBlockPos();
} }
this.mc.thePlayer.sendQueue.addToSendQueue(new C14PacketTabComplete(parString1, blockpos)); this.mc.thePlayer.sendQueue.addToSendQueue(new C14PacketTabComplete(parString1, blockpos, false));
this.waitingOnAutocomplete = true; this.waitingOnAutocomplete = true;
} }
} }

View File

@ -23,6 +23,7 @@ import net.minecraft.network.play.client.C09PacketHeldItemChange;
import net.minecraft.network.play.client.C0EPacketClickWindow; import net.minecraft.network.play.client.C0EPacketClickWindow;
import net.minecraft.network.play.client.C10PacketCreativeInventoryAction; import net.minecraft.network.play.client.C10PacketCreativeInventoryAction;
import net.minecraft.network.play.client.C11PacketEnchantItem; import net.minecraft.network.play.client.C11PacketEnchantItem;
import net.minecraft.network.play.client.CPacketUseItem;
import net.minecraft.stats.StatFileWriter; import net.minecraft.stats.StatFileWriter;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
@ -389,8 +390,7 @@ public class PlayerControllerMP {
} }
} }
this.netClientHandler.addToSendQueue(new C08PacketPlayerBlockPlacement(hitPos, side.getIndex(), this.netClientHandler.addToSendQueue(new C08PacketPlayerBlockPlacement(hitPos, side, f, f1, f2));
player.inventory.getCurrentItem(), f, f1, f2));
if (!flag && this.currentGameType != WorldSettings.GameType.SPECTATOR) { if (!flag && this.currentGameType != WorldSettings.GameType.SPECTATOR) {
if (heldStack == null) { if (heldStack == null) {
return false; return false;
@ -419,8 +419,9 @@ public class PlayerControllerMP {
return false; return false;
} else { } else {
this.syncCurrentPlayItem(); this.syncCurrentPlayItem();
// TODO: implement offhand
this.netClientHandler this.netClientHandler
.addToSendQueue(new C08PacketPlayerBlockPlacement(playerIn.inventory.getCurrentItem())); .addToSendQueue(new CPacketUseItem());
int i = itemStackIn.stackSize; int i = itemStackIn.stackSize;
ItemStack itemstack = itemStackIn.useItemRightClick(worldIn, playerIn); ItemStack itemstack = itemStackIn.useItemRightClick(worldIn, playerIn);
if (itemstack != itemStackIn || itemstack != null && itemstack.stackSize != i) { if (itemstack != itemStackIn || itemstack != null && itemstack.stackSize != i) {

View File

@ -5,6 +5,7 @@ import java.io.IOException;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import net.hoosiertransfer.Config;
import net.lax1dude.eaglercraft.v1_8.internal.IServerQuery; import net.lax1dude.eaglercraft.v1_8.internal.IServerQuery;
import net.lax1dude.eaglercraft.v1_8.internal.QueryResponse; import net.lax1dude.eaglercraft.v1_8.internal.QueryResponse;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
@ -66,7 +67,7 @@ public class ServerData {
* last server ping that showed up in the server browser * last server ping that showed up in the server browser
*/ */
public long pingToServer = -1l; public long pingToServer = -1l;
public int version = 47; public int version = Config.protocolVersion;
/** /**
* + * +
* Game version for this server. * Game version for this server.

View File

@ -55,11 +55,13 @@ import net.minecraft.client.player.inventory.LocalBlockIntercommunication;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.GameSettings;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLeashKnot; import net.minecraft.entity.EntityLeashKnot;
import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EntityTracker;
import net.minecraft.entity.IMerchant; import net.minecraft.entity.IMerchant;
import net.minecraft.entity.NpcMerchant; import net.minecraft.entity.NpcMerchant;
import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.ai.attributes.AttributeModifier;
@ -110,6 +112,7 @@ import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.network.play.client.C0FPacketConfirmTransaction; import net.minecraft.network.play.client.C0FPacketConfirmTransaction;
import net.minecraft.network.play.client.C17PacketCustomPayload; import net.minecraft.network.play.client.C17PacketCustomPayload;
import net.minecraft.network.play.client.C19PacketResourcePackStatus; import net.minecraft.network.play.client.C19PacketResourcePackStatus;
import net.minecraft.network.play.client.CPacketConfirmTeleport;
import net.minecraft.network.play.server.S00PacketKeepAlive; import net.minecraft.network.play.server.S00PacketKeepAlive;
import net.minecraft.network.play.server.S01PacketJoinGame; import net.minecraft.network.play.server.S01PacketJoinGame;
import net.minecraft.network.play.server.S02PacketChat; import net.minecraft.network.play.server.S02PacketChat;
@ -183,6 +186,7 @@ import net.minecraft.network.play.server.S46PacketSetCompressionLevel;
import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter; import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter;
import net.minecraft.network.play.server.S48PacketResourcePackSend; import net.minecraft.network.play.server.S48PacketResourcePackSend;
import net.minecraft.network.play.server.S49PacketUpdateEntityNBT; import net.minecraft.network.play.server.S49PacketUpdateEntityNBT;
import net.minecraft.network.play.server.SPacketUnloadChunk;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraft.scoreboard.IScoreObjectiveCriteria; import net.minecraft.scoreboard.IScoreObjectiveCriteria;
import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.Score;
@ -336,9 +340,9 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
* and sets its position and momentum * and sets its position and momentum
*/ */
public void handleSpawnObject(S0EPacketSpawnObject packetIn) { public void handleSpawnObject(S0EPacketSpawnObject packetIn) {
double d0 = (double) packetIn.getX() / 32.0D; double d1 = packetIn.getY();
double d1 = (double) packetIn.getY() / 32.0D; double d0 = packetIn.getX();
double d2 = (double) packetIn.getZ() / 32.0D; double d2 = packetIn.getZ();
Object object = null; Object object = null;
if (packetIn.getType() == 10) { if (packetIn.getType() == 10) {
object = EntityMinecart.func_180458_a(this.clientWorldController, d0, d1, d2, object = EntityMinecart.func_180458_a(this.clientWorldController, d0, d1, d2,
@ -409,9 +413,7 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
} }
if (object != null) { if (object != null) {
((Entity) object).serverPosX = packetIn.getX(); EntityTracker.updateServerPosition((Entity) object, d0, d1, d2);
((Entity) object).serverPosY = packetIn.getY();
((Entity) object).serverPosZ = packetIn.getZ();
((Entity) object).rotationPitch = (float) (packetIn.getPitch() * 360) / 256.0F; ((Entity) object).rotationPitch = (float) (packetIn.getPitch() * 360) / 256.0F;
((Entity) object).rotationYaw = (float) (packetIn.getYaw() * 360) / 256.0F; ((Entity) object).rotationYaw = (float) (packetIn.getYaw() * 360) / 256.0F;
Entity[] aentity = ((Entity) object).getParts(); Entity[] aentity = ((Entity) object).getParts();
@ -424,6 +426,7 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
} }
((Entity) object).setEntityId(packetIn.getEntityID()); ((Entity) object).setEntityId(packetIn.getEntityID());
((Entity) object).setUniqueId(packetIn.getUniqueId());
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), (Entity) object); this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), (Entity) object);
if (packetIn.func_149009_m() > 0) { if (packetIn.func_149009_m() > 0) {
if (packetIn.getType() == 60) { if (packetIn.getType() == 60) {
@ -445,15 +448,15 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
* Spawns an experience orb and sets its value (amount of XP) * Spawns an experience orb and sets its value (amount of XP)
*/ */
public void handleSpawnExperienceOrb(S11PacketSpawnExperienceOrb packetIn) { public void handleSpawnExperienceOrb(S11PacketSpawnExperienceOrb packetIn) {
EntityXPOrb entityxporb = new EntityXPOrb(this.clientWorldController, (double) packetIn.getX() / 32.0D, double d0 = packetIn.getX();
(double) packetIn.getY() / 32.0D, (double) packetIn.getZ() / 32.0D, packetIn.getXPValue()); double d1 = packetIn.getY();
entityxporb.serverPosX = packetIn.getX(); double d2 = packetIn.getZ();
entityxporb.serverPosY = packetIn.getY(); Entity entity = new EntityXPOrb(this.clientWorldController, d0, d1, d2, packetIn.getXPValue());
entityxporb.serverPosZ = packetIn.getZ(); EntityTracker.updateServerPosition(entity, d0, d1, d2);
entityxporb.rotationYaw = 0.0F; entity.rotationYaw = 0.0F;
entityxporb.rotationPitch = 0.0F; entity.rotationPitch = 0.0F;
entityxporb.setEntityId(packetIn.getEntityID()); entity.setEntityId(packetIn.getEntityID());
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entityxporb); this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entity);
} }
/** /**
@ -462,24 +465,22 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
* lightning bolts * lightning bolts
*/ */
public void handleSpawnGlobalEntity(S2CPacketSpawnGlobalEntity packetIn) { public void handleSpawnGlobalEntity(S2CPacketSpawnGlobalEntity packetIn) {
double d0 = (double) packetIn.func_149051_d() / 32.0D; double d0 = packetIn.getX();
double d1 = (double) packetIn.func_149050_e() / 32.0D; double d1 = packetIn.getY();
double d2 = (double) packetIn.func_149049_f() / 32.0D; double d2 = packetIn.getZ();
EntityLightningBolt entitylightningbolt = null; Entity entity = null;
if (packetIn.func_149053_g() == 1) {
entitylightningbolt = new EntityLightningBolt(this.clientWorldController, d0, d1, d2); if (packetIn.getType() == 1) {
entity = new EntityLightningBolt(this.clientWorldController, d0, d1, d2);
} }
if (entitylightningbolt != null) { if (entity != null) {
entitylightningbolt.serverPosX = packetIn.func_149051_d(); EntityTracker.updateServerPosition(entity, d0, d1, d2);
entitylightningbolt.serverPosY = packetIn.func_149050_e(); entity.rotationYaw = 0.0F;
entitylightningbolt.serverPosZ = packetIn.func_149049_f(); entity.rotationPitch = 0.0F;
entitylightningbolt.rotationYaw = 0.0F; entity.setEntityId(packetIn.getEntityId());
entitylightningbolt.rotationPitch = 0.0F; this.clientWorldController.addWeatherEffect(entity);
entitylightningbolt.setEntityId(packetIn.func_149052_c());
this.clientWorldController.addWeatherEffect(entitylightningbolt);
} }
} }
/** /**
@ -525,30 +526,20 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
* position and held item * position and held item
*/ */
public void handleSpawnPlayer(S0CPacketSpawnPlayer packetIn) { public void handleSpawnPlayer(S0CPacketSpawnPlayer packetIn) {
double d0 = (double) packetIn.getX() / 32.0D; double d0 = packetIn.getX();
double d1 = (double) packetIn.getY() / 32.0D; double d1 = packetIn.getY();
double d2 = (double) packetIn.getZ() / 32.0D; double d2 = packetIn.getZ();
float f = (float) (packetIn.getYaw() * 360) / 256.0F; float f = (float) (packetIn.getYaw() * 360) / 256.0F;
float f1 = (float) (packetIn.getPitch() * 360) / 256.0F; float f1 = (float) (packetIn.getPitch() * 360) / 256.0F;
EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(this.gameController.theWorld, EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(this.gameController.theWorld,
this.getPlayerInfo(packetIn.getPlayer()).getGameProfile()); this.getPlayerInfo(packetIn.getUniqueId()).getGameProfile());
entityotherplayermp.prevPosX = entityotherplayermp.lastTickPosX = (double) (entityotherplayermp.serverPosX = packetIn entityotherplayermp.prevPosX = entityotherplayermp.lastTickPosX = d0;
.getX()); entityotherplayermp.prevPosY = entityotherplayermp.lastTickPosY = d1;
entityotherplayermp.prevPosY = entityotherplayermp.lastTickPosY = (double) (entityotherplayermp.serverPosY = packetIn entityotherplayermp.prevPosZ = entityotherplayermp.lastTickPosZ = d2;
.getY()); EntityTracker.updateServerPosition(entityotherplayermp, d0, d1, d2);
entityotherplayermp.prevPosZ = entityotherplayermp.lastTickPosZ = (double) (entityotherplayermp.serverPosZ = packetIn
.getZ());
int i = packetIn.getCurrentItemID();
if (i == 0) {
entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = null;
} else {
entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = new ItemStack(
Item.getItemById(i), 1, 0);
}
entityotherplayermp.setPositionAndRotation(d0, d1, d2, f, f1); entityotherplayermp.setPositionAndRotation(d0, d1, d2, f, f1);
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entityotherplayermp); this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entityotherplayermp);
List list = packetIn.func_148944_c(); List<DataWatcher.WatchableObject> list = packetIn.func_148944_c();
if (list != null) { if (list != null) {
entityotherplayermp.getDataWatcher().updateWatchedObjectsFromList(list); entityotherplayermp.getDataWatcher().updateWatchedObjectsFromList(list);
} }
@ -563,12 +554,10 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
public void handleEntityTeleport(S18PacketEntityTeleport packetIn) { public void handleEntityTeleport(S18PacketEntityTeleport packetIn) {
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId()); Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
if (entity != null) { if (entity != null) {
entity.serverPosX = packetIn.getX(); double d0 = packetIn.getX();
entity.serverPosY = packetIn.getY(); double d1 = packetIn.getY();
entity.serverPosZ = packetIn.getZ(); double d2 = packetIn.getZ();
double d0 = (double) entity.serverPosX / 32.0D; EntityTracker.updateServerPosition(entity, d0, d1, d2);
double d1 = (double) entity.serverPosY / 32.0D;
double d2 = (double) entity.serverPosZ / 32.0D;
float f = (float) (packetIn.getYaw() * 360) / 256.0F; float f = (float) (packetIn.getYaw() * 360) / 256.0F;
float f1 = (float) (packetIn.getPitch() * 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 if (Math.abs(entity.posX - d0) < 0.03125D && Math.abs(entity.posY - d1) < 0.015625D
@ -604,14 +593,14 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
public void handleEntityMovement(S14PacketEntity packetIn) { public void handleEntityMovement(S14PacketEntity packetIn) {
Entity entity = packetIn.getEntity(this.clientWorldController); Entity entity = packetIn.getEntity(this.clientWorldController);
if (entity != null) { if (entity != null) {
entity.serverPosX += packetIn.func_149062_c(); entity.serverPosX += packetIn.getX();
entity.serverPosY += packetIn.func_149061_d(); entity.serverPosY += packetIn.getY();
entity.serverPosZ += packetIn.func_149064_e(); entity.serverPosZ += packetIn.getZ();
double d0 = (double) entity.serverPosX / 32.0D; double d0 = (double) entity.serverPosX / 4096.0D;
double d1 = (double) entity.serverPosY / 32.0D; double d1 = (double) entity.serverPosY / 4096.0D;
double d2 = (double) entity.serverPosZ / 32.0D; double d2 = (double) entity.serverPosZ / 4096.0D;
float f = packetIn.func_149060_h() ? (float) (packetIn.func_149066_f() * 360) / 256.0F : entity.rotationYaw; float f = packetIn.isRotating() ? (float) (packetIn.getYaw() * 360) / 256.0F : entity.rotationYaw;
float f1 = packetIn.func_149060_h() ? (float) (packetIn.func_149063_g() * 360) / 256.0F float f1 = packetIn.isRotating() ? (float) (packetIn.getPitch() * 360) / 256.0F
: entity.rotationPitch; : entity.rotationPitch;
entity.setPositionAndRotation2(d0, d1, d2, f, f1, 3, false); entity.setPositionAndRotation2(d0, d1, d2, f, f1, 3, false);
entity.onGround = packetIn.getOnGround(); entity.onGround = packetIn.getOnGround();
@ -688,6 +677,7 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
} }
entityplayersp.setPositionAndRotation(d0, d1, d2, f, f1); entityplayersp.setPositionAndRotation(d0, d1, d2, f, f1);
this.netManager.sendPacket(new CPacketConfirmTeleport(packetIn.getTeleportId()));
this.netManager.sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(entityplayersp.posX, this.netManager.sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(entityplayersp.posX,
entityplayersp.getEntityBoundingBox().minY, entityplayersp.posZ, entityplayersp.rotationYaw, entityplayersp.getEntityBoundingBox().minY, entityplayersp.posZ, entityplayersp.rotationYaw,
entityplayersp.rotationPitch, false)); entityplayersp.rotationPitch, false));
@ -870,19 +860,18 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
* Datawatchers with the entity metadata specified in the packet * Datawatchers with the entity metadata specified in the packet
*/ */
public void handleSpawnMob(S0FPacketSpawnMob packetIn) { public void handleSpawnMob(S0FPacketSpawnMob packetIn) {
double d0 = (double) packetIn.getX() / 32.0D; double d0 = packetIn.getX();
double d1 = (double) packetIn.getY() / 32.0D; double d1 = packetIn.getY();
double d2 = (double) packetIn.getZ() / 32.0D; double d2 = packetIn.getZ();
float f = (float) (packetIn.getYaw() * 360) / 256.0F; float f = (float) (packetIn.getYaw() * 360) / 256.0F;
float f1 = (float) (packetIn.getPitch() * 360) / 256.0F; float f1 = (float) (packetIn.getPitch() * 360) / 256.0F;
EntityLivingBase entitylivingbase = (EntityLivingBase) EntityList.createEntityByID(packetIn.getEntityType(), EntityLivingBase entitylivingbase = (EntityLivingBase) EntityList.createEntityByID(packetIn.getEntityType(),
this.gameController.theWorld); this.gameController.theWorld);
entitylivingbase.serverPosX = packetIn.getX(); EntityTracker.updateServerPosition(entitylivingbase, d0, d1, d2);
entitylivingbase.serverPosY = packetIn.getY();
entitylivingbase.serverPosZ = packetIn.getZ();
entitylivingbase.renderYawOffset = entitylivingbase.rotationYawHead = (float) (packetIn.getHeadPitch() * 360) entitylivingbase.renderYawOffset = entitylivingbase.rotationYawHead = (float) (packetIn.getHeadPitch() * 360)
/ 256.0F; / 256.0F;
Entity[] aentity = entitylivingbase.getParts(); Entity[] aentity = entitylivingbase.getParts();
if (aentity != null) { if (aentity != null) {
int i = packetIn.getEntityID() - entitylivingbase.getEntityId(); int i = packetIn.getEntityID() - entitylivingbase.getEntityId();
@ -892,12 +881,13 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
} }
entitylivingbase.setEntityId(packetIn.getEntityID()); entitylivingbase.setEntityId(packetIn.getEntityID());
entitylivingbase.setUniqueId(packetIn.getUniqueId());
entitylivingbase.setPositionAndRotation(d0, d1, d2, f, f1); entitylivingbase.setPositionAndRotation(d0, d1, d2, f, f1);
entitylivingbase.motionX = (double) ((float) packetIn.getVelocityX() / 8000.0F); entitylivingbase.motionX = (double) ((float) packetIn.getVelocityX() / 8000.0F);
entitylivingbase.motionY = (double) ((float) packetIn.getVelocityY() / 8000.0F); entitylivingbase.motionY = (double) ((float) packetIn.getVelocityY() / 8000.0F);
entitylivingbase.motionZ = (double) ((float) packetIn.getVelocityZ() / 8000.0F); entitylivingbase.motionZ = (double) ((float) packetIn.getVelocityZ() / 8000.0F);
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitylivingbase); this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitylivingbase);
List list = packetIn.func_149027_c(); List<DataWatcher.WatchableObject> list = packetIn.func_149027_c();
if (list != null) { if (list != null) {
entitylivingbase.getDataWatcher().updateWatchedObjectsFromList(list); entitylivingbase.getDataWatcher().updateWatchedObjectsFromList(list);
} }
@ -915,42 +905,16 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
} }
public void handleEntityAttach(S1BPacketEntityAttach packetIn) { public void handleEntityAttach(S1BPacketEntityAttach packetIn) {
Object object = this.clientWorldController.getEntityByID(packetIn.getEntityId()); Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
Entity entity = this.clientWorldController.getEntityByID(packetIn.getVehicleEntityId()); Entity entity1 = this.clientWorldController.getEntityByID(packetIn.getVehicleEntityId());
if (packetIn.getLeash() == 0) {
boolean flag = false;
if (packetIn.getEntityId() == this.gameController.thePlayer.getEntityId()) {
object = this.gameController.thePlayer;
if (entity instanceof EntityBoat) {
((EntityBoat) entity).setIsBoatEmpty(false);
}
flag = ((Entity) object).ridingEntity == null && entity != null; if (entity instanceof EntityLiving) {
} else if (entity instanceof EntityBoat) { if (entity1 != null) {
((EntityBoat) entity).setIsBoatEmpty(true); ((EntityLiving) entity).setLeashedToEntity(entity1, false);
}
if (object == null) {
return;
}
((Entity) object).mountEntity(entity);
if (flag) {
GameSettings gamesettings = this.gameController.gameSettings;
this.gameController.ingameGUI.setRecordPlaying(
I18n.format("mount.onboard",
new Object[] {
GameSettings.getKeyDisplayString(gamesettings.keyBindSneak.getKeyCode()) }),
false);
}
} else if (packetIn.getLeash() == 1 && object instanceof EntityLiving) {
if (entity != null) {
((EntityLiving) object).setLeashedToEntity(entity, false);
} else { } else {
((EntityLiving) object).clearLeashed(false, false); ((EntityLiving) entity).clearLeashed(false, false);
} }
} }
} }
/** /**
@ -970,6 +934,7 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
if (packetIn.getOpCode() == 21) { if (packetIn.getOpCode() == 21) {
this.gameController.getSoundHandler().playSound(new GuardianSound((EntityGuardian) entity)); this.gameController.getSoundHandler().playSound(new GuardianSound((EntityGuardian) entity));
} else { } else {
// TODO: implement permission levels
entity.handleStatusUpdate(packetIn.getOpCode()); entity.handleStatusUpdate(packetIn.getOpCode());
} }
} }
@ -1823,6 +1788,10 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
} }
} }
public void handleUnloadChunk(SPacketUnloadChunk packetIn) {
this.clientWorldController.doPreChunk(packetIn.getX(), packetIn.getZ(), false);
}
/** /**
* + * +
* Returns this the NetworkManager instance registered with this * Returns this the NetworkManager instance registered with this

View File

@ -124,7 +124,6 @@ public class CommandPlaySound extends CommandBase {
d3 = d5; d3 = d5;
} }
entityplayermp.playerNetServerHandler entityplayermp.playerNetServerHandler
.sendPacket(new S29PacketSoundEffect(s, d0, d1, d2, (float) d3, (float) d4)); .sendPacket(new S29PacketSoundEffect(s, d0, d1, d2, (float) d3, (float) d4));
notifyOperators(parICommandSender, this, "commands.playsound.success", notifyOperators(parICommandSender, this, "commands.playsound.success",

View File

@ -275,7 +275,6 @@ public class DataWatcher {
buffer.writeFloat(rotations.getY()); buffer.writeFloat(rotations.getY());
buffer.writeFloat(rotations.getZ()); buffer.writeFloat(rotations.getZ());
} }
} }
/** /**

View File

@ -144,9 +144,9 @@ public abstract class Entity implements ICommandSender {
public int chunkCoordX; public int chunkCoordX;
public int chunkCoordY; public int chunkCoordY;
public int chunkCoordZ; public int chunkCoordZ;
public int serverPosX; public long serverPosX;
public int serverPosY; public long serverPosY;
public int serverPosZ; public long serverPosZ;
public boolean ignoreFrustumCheck; public boolean ignoreFrustumCheck;
public boolean isAirBorne; public boolean isAirBorne;
public int timeUntilPortal; public int timeUntilPortal;
@ -206,6 +206,10 @@ public abstract class Entity implements ICommandSender {
this.entityId = id; this.entityId = id;
} }
public void setUniqueId(EaglercraftUUID uniqueIdIn) {
this.entityUniqueID = uniqueIdIn;
}
/** /**
* + * +
* Called by the /kill command. * Called by the /kill command.
@ -402,9 +406,7 @@ public abstract class Entity implements ICommandSender {
} }
} }
if (this.timeUntilPortal > 0) { this.decrementTimeUntilPortal();
--this.timeUntilPortal;
}
this.worldObj.theProfiler.endSection(); this.worldObj.theProfiler.endSection();
} }
@ -445,6 +447,16 @@ public abstract class Entity implements ICommandSender {
this.worldObj.theProfiler.endSection(); this.worldObj.theProfiler.endSection();
} }
/**
* Decrements the counter for the remaining time until the entity may use a
* portal again.
*/
protected void decrementTimeUntilPortal() {
if (this.timeUntilPortal > 0) {
--this.timeUntilPortal;
}
}
/** /**
* + * +
* Return the amount of time this entity should stay in a portal * Return the amount of time this entity should stay in a portal

View File

@ -1082,7 +1082,7 @@ public abstract class EntityLiving extends EntityLivingBase {
if (!this.worldObj.isRemote && sendPacket && this.worldObj instanceof WorldServer) { if (!this.worldObj.isRemote && sendPacket && this.worldObj instanceof WorldServer) {
((WorldServer) this.worldObj).getEntityTracker().sendToAllTrackingEntity(this, ((WorldServer) this.worldObj).getEntityTracker().sendToAllTrackingEntity(this,
new S1BPacketEntityAttach(1, this, (Entity) null)); new S1BPacketEntityAttach(this, (Entity) null));
} }
} }
@ -1109,7 +1109,7 @@ public abstract class EntityLiving extends EntityLivingBase {
this.leashedToEntity = entityIn; this.leashedToEntity = entityIn;
if (!this.worldObj.isRemote && sendAttachNotification && this.worldObj instanceof WorldServer) { if (!this.worldObj.isRemote && sendAttachNotification && this.worldObj instanceof WorldServer) {
((WorldServer) this.worldObj).getEntityTracker().sendToAllTrackingEntity(this, ((WorldServer) this.worldObj).getEntityTracker().sendToAllTrackingEntity(this,
new S1BPacketEntityAttach(1, this, this.leashedToEntity)); new S1BPacketEntityAttach(this, this.leashedToEntity));
} }
} }

View File

@ -34,6 +34,7 @@ import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraft.entity.projectile.EntitySnowball; import net.minecraft.entity.projectile.EntitySnowball;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.util.IntHashMap; import net.minecraft.util.IntHashMap;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ReportedException; import net.minecraft.util.ReportedException;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
@ -91,6 +92,16 @@ public class EntityTracker {
.getEntityViewDistance(); .getEntityViewDistance();
} }
public static long getPositionLong(double value) {
return MathHelper.floor_double_long(value * 4096.0D);
}
public static void updateServerPosition(Entity entityIn, double x, double y, double z) {
entityIn.serverPosX = getPositionLong(x);
entityIn.serverPosY = getPositionLong(y);
entityIn.serverPosZ = getPositionLong(z);
}
public void trackEntity(Entity parEntity) { public void trackEntity(Entity parEntity) {
if (parEntity instanceof EntityPlayerMP) { if (parEntity instanceof EntityPlayerMP) {
this.trackEntity(parEntity, 512, 2); this.trackEntity(parEntity, 512, 2);

View File

@ -96,9 +96,9 @@ public class EntityTrackerEntry {
public Entity trackedEntity; public Entity trackedEntity;
public int trackingDistanceThreshold; public int trackingDistanceThreshold;
public int updateFrequency; public int updateFrequency;
public int encodedPosX; public long encodedPosX;
public int encodedPosY; public long encodedPosY;
public int encodedPosZ; public long encodedPosZ;
public int encodedRotationYaw; public int encodedRotationYaw;
public int encodedRotationPitch; public int encodedRotationPitch;
public int lastHeadMotion; public int lastHeadMotion;
@ -129,9 +129,9 @@ public class EntityTrackerEntry {
this.trackingDistanceThreshold = trackingDistanceThresholdIn; this.trackingDistanceThreshold = trackingDistanceThresholdIn;
this.updateFrequency = updateFrequencyIn; this.updateFrequency = updateFrequencyIn;
this.sendVelocityUpdates = sendVelocityUpdatesIn; this.sendVelocityUpdates = sendVelocityUpdatesIn;
this.encodedPosX = MathHelper.floor_double(trackedEntityIn.posX * 32.0D); this.encodedPosX = EntityTracker.getPositionLong(trackedEntityIn.posX);
this.encodedPosY = MathHelper.floor_double(trackedEntityIn.posY * 32.0D); this.encodedPosY = EntityTracker.getPositionLong(trackedEntityIn.posY);
this.encodedPosZ = MathHelper.floor_double(trackedEntityIn.posZ * 32.0D); this.encodedPosZ = EntityTracker.getPositionLong(trackedEntityIn.posZ);
this.encodedRotationYaw = MathHelper.floor_float(trackedEntityIn.rotationYaw * 256.0F / 360.0F); this.encodedRotationYaw = MathHelper.floor_float(trackedEntityIn.rotationYaw * 256.0F / 360.0F);
this.encodedRotationPitch = MathHelper.floor_float(trackedEntityIn.rotationPitch * 256.0F / 360.0F); this.encodedRotationPitch = MathHelper.floor_float(trackedEntityIn.rotationPitch * 256.0F / 360.0F);
this.lastHeadMotion = MathHelper.floor_float(trackedEntityIn.getRotationYawHead() * 256.0F / 360.0F); this.lastHeadMotion = MathHelper.floor_float(trackedEntityIn.getRotationYawHead() * 256.0F / 360.0F);
@ -164,7 +164,7 @@ public class EntityTrackerEntry {
|| this.trackedEntity.ridingEntity != null && this.updateCounter % 60 == 0) { || this.trackedEntity.ridingEntity != null && this.updateCounter % 60 == 0) {
this.field_85178_v = this.trackedEntity.ridingEntity; this.field_85178_v = this.trackedEntity.ridingEntity;
this.sendPacketToTrackedPlayers( this.sendPacketToTrackedPlayers(
new S1BPacketEntityAttach(0, this.trackedEntity, this.trackedEntity.ridingEntity)); new S1BPacketEntityAttach(this.trackedEntity, this.trackedEntity.ridingEntity));
} }
if (this.trackedEntity instanceof EntityItemFrame && this.updateCounter % 10 == 0) { if (this.trackedEntity instanceof EntityItemFrame && this.updateCounter % 10 == 0) {
@ -191,40 +191,41 @@ public class EntityTrackerEntry {
|| this.trackedEntity.getDataWatcher().hasObjectChanged()) { || this.trackedEntity.getDataWatcher().hasObjectChanged()) {
if (this.trackedEntity.ridingEntity == null) { if (this.trackedEntity.ridingEntity == null) {
++this.ticksSinceLastForcedTeleport; ++this.ticksSinceLastForcedTeleport;
int k = MathHelper.floor_double(this.trackedEntity.posX * 32.0D); long j1 = EntityTracker.getPositionLong(this.trackedEntity.posX);
int j1 = MathHelper.floor_double(this.trackedEntity.posY * 32.0D); long i2 = EntityTracker.getPositionLong(this.trackedEntity.posY);
int k1 = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D); long j2 = EntityTracker.getPositionLong(this.trackedEntity.posZ);
int l1 = MathHelper.floor_float(this.trackedEntity.rotationYaw * 256.0F / 360.0F); int k2 = MathHelper.floor_float(this.trackedEntity.rotationYaw * 256.0F / 360.0F);
int i2 = MathHelper.floor_float(this.trackedEntity.rotationPitch * 256.0F / 360.0F); int i = MathHelper.floor_float(this.trackedEntity.rotationPitch * 256.0F / 360.0F);
int j2 = k - this.encodedPosX; long j = j1 - this.encodedPosX;
int k2 = j1 - this.encodedPosY; long k = i2 - this.encodedPosY;
int i = k1 - this.encodedPosZ; long l = j2 - this.encodedPosZ;
Object object = null; Packet<?> packet1 = null;
boolean flag = Math.abs(j2) >= 4 || Math.abs(k2) >= 4 || Math.abs(i) >= 4 boolean flag = j * j + k * k + l * l >= 128L || this.updateCounter % 60 == 0;
|| this.updateCounter % 60 == 0; boolean flag1 = Math.abs(k2 - this.encodedRotationYaw) >= 1
boolean flag1 = Math.abs(l1 - this.encodedRotationYaw) >= 4 || Math.abs(i - this.encodedRotationPitch) >= 1;
|| Math.abs(i2 - this.encodedRotationPitch) >= 4;
if (this.updateCounter > 0 || this.trackedEntity instanceof EntityArrow) { if (this.updateCounter > 0 || this.trackedEntity instanceof EntityArrow) {
if (j2 >= -128 && j2 < 128 && k2 >= -128 && k2 < 128 && i >= -128 && i < 128 if (j >= -32768L && j < 32768L && k >= -32768L && k < 32768L && l >= -32768L && l < 32768L
&& this.ticksSinceLastForcedTeleport <= 400 && !this.ridingEntity && this.ticksSinceLastForcedTeleport <= 400 && !this.ridingEntity
&& this.onGround == this.trackedEntity.onGround) { && this.onGround == this.trackedEntity.onGround) {
if ((!flag || !flag1) && !(this.trackedEntity instanceof EntityArrow)) { if ((!flag || !flag1) && !(this.trackedEntity instanceof EntityArrow)) {
if (flag) { if (flag) {
object = new S14PacketEntity.S15PacketEntityRelMove(this.trackedEntity.getEntityId(), packet1 = new S14PacketEntity.S15PacketEntityRelMove(this.trackedEntity.getEntityId(),
(byte) j2, (byte) k2, (byte) i, this.trackedEntity.onGround); j,
k, l, this.trackedEntity.onGround);
} else if (flag1) { } else if (flag1) {
object = new S14PacketEntity.S16PacketEntityLook(this.trackedEntity.getEntityId(), packet1 = new S14PacketEntity.S16PacketEntityLook(this.trackedEntity.getEntityId(),
(byte) l1, (byte) i2, this.trackedEntity.onGround); (byte) k2, (byte) i, this.trackedEntity.onGround);
} }
} else { } else {
object = new S14PacketEntity.S17PacketEntityLookMove(this.trackedEntity.getEntityId(), packet1 = new S14PacketEntity.S17PacketEntityLookMove(this.trackedEntity.getEntityId(), j,
(byte) j2, (byte) k2, (byte) i, (byte) l1, (byte) i2, this.trackedEntity.onGround); k,
l, (byte) k2, (byte) i, this.trackedEntity.onGround);
} }
} else { } else {
this.onGround = this.trackedEntity.onGround; this.onGround = this.trackedEntity.onGround;
this.ticksSinceLastForcedTeleport = 0; this.ticksSinceLastForcedTeleport = 0;
object = new S18PacketEntityTeleport(this.trackedEntity.getEntityId(), k, j1, k1, (byte) l1, packet1 = new S18PacketEntityTeleport(this.trackedEntity);
(byte) i2, this.trackedEntity.onGround);
} }
} }
@ -241,7 +242,8 @@ public class EntityTrackerEntry {
double d2 = this.trackedEntity.motionZ - this.motionZ; double d2 = this.trackedEntity.motionZ - this.motionZ;
double d3 = 0.02D; double d3 = 0.02D;
double d4 = d0 * d0 + d1 * d1 + d2 * d2; double d4 = d0 * d0 + d1 * d1 + d2 * d2;
if (d4 > d3 * d3 || d4 > 0.0D && this.trackedEntity.motionX == 0.0D
if (d4 > 4.0E-4D || d4 > 0.0D && this.trackedEntity.motionX == 0.0D
&& this.trackedEntity.motionY == 0.0D && this.trackedEntity.motionZ == 0.0D) { && this.trackedEntity.motionY == 0.0D && this.trackedEntity.motionZ == 0.0D) {
this.lastTrackedEntityMotionX = this.trackedEntity.motionX; this.lastTrackedEntityMotionX = this.trackedEntity.motionX;
this.lastTrackedEntityMotionY = this.trackedEntity.motionY; this.lastTrackedEntityMotionY = this.trackedEntity.motionY;
@ -251,46 +253,49 @@ public class EntityTrackerEntry {
} }
} }
if (object != null) { if (packet1 != null) {
this.sendPacketToTrackedPlayers((Packet) object); this.sendPacketToTrackedPlayers(packet1);
} }
this.sendMetadataToAllAssociatedPlayers(); this.sendMetadataToAllAssociatedPlayers();
if (flag) { if (flag) {
this.encodedPosX = k; this.encodedPosX = j1;
this.encodedPosY = j1; this.encodedPosY = i2;
this.encodedPosZ = k1; this.encodedPosZ = j2;
} }
if (flag1) { if (flag1) {
this.encodedRotationYaw = l1; this.encodedRotationYaw = k2;
this.encodedRotationPitch = i2; this.encodedRotationPitch = i;
} }
this.ridingEntity = false; this.ridingEntity = false;
} else { } else {
int j = MathHelper.floor_float(this.trackedEntity.rotationYaw * 256.0F / 360.0F); int i1 = MathHelper.floor_float(this.trackedEntity.rotationYaw * 256.0F / 360.0F);
int i1 = MathHelper.floor_float(this.trackedEntity.rotationPitch * 256.0F / 360.0F); int l1 = MathHelper.floor_float(this.trackedEntity.rotationPitch * 256.0F / 360.0F);
boolean flag2 = Math.abs(j - this.encodedRotationYaw) >= 4 boolean flag3 = Math.abs(i1 - this.encodedRotationYaw) >= 1
|| Math.abs(i1 - this.encodedRotationPitch) >= 4; || Math.abs(l1 - this.encodedRotationPitch) >= 1;
if (flag2) {
if (flag3) {
this.sendPacketToTrackedPlayers(new S14PacketEntity.S16PacketEntityLook( this.sendPacketToTrackedPlayers(new S14PacketEntity.S16PacketEntityLook(
this.trackedEntity.getEntityId(), (byte) j, (byte) i1, this.trackedEntity.onGround)); this.trackedEntity.getEntityId(), (byte) i1, (byte) l1, this.trackedEntity.onGround));
this.encodedRotationYaw = j; this.encodedRotationYaw = i1;
this.encodedRotationPitch = i1; this.encodedRotationPitch = l1;
} }
this.encodedPosX = MathHelper.floor_double(this.trackedEntity.posX * 32.0D); this.encodedPosX = EntityTracker.getPositionLong(this.trackedEntity.posX);
this.encodedPosY = MathHelper.floor_double(this.trackedEntity.posY * 32.0D); this.encodedPosY = EntityTracker.getPositionLong(this.trackedEntity.posY);
this.encodedPosZ = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D); this.encodedPosZ = EntityTracker.getPositionLong(this.trackedEntity.posZ);
this.sendMetadataToAllAssociatedPlayers(); this.sendMetadataToAllAssociatedPlayers();
this.ridingEntity = true; this.ridingEntity = true;
} }
int l = MathHelper.floor_float(this.trackedEntity.getRotationYawHead() * 256.0F / 360.0F); int k1 = MathHelper.floor_float(this.trackedEntity.getRotationYawHead() * 256.0F / 360.0F);
if (Math.abs(l - this.lastHeadMotion) >= 4) {
this.sendPacketToTrackedPlayers(new S19PacketEntityHeadLook(this.trackedEntity, (byte) l)); if (Math.abs(k1 - this.lastHeadMotion) >= 1) {
this.lastHeadMotion = l; this.sendPacketToTrackedPlayers(new S19PacketEntityHeadLook(this.trackedEntity, (byte) k1));
this.lastHeadMotion = k1;
} }
this.trackedEntity.isAirBorne = false; this.trackedEntity.isAirBorne = false;
@ -365,7 +370,7 @@ public class EntityTrackerEntry {
public void updatePlayerEntity(EntityPlayerMP playerMP) { public void updatePlayerEntity(EntityPlayerMP playerMP) {
if (playerMP != this.trackedEntity) { if (playerMP != this.trackedEntity) {
if (this.func_180233_c(playerMP)) { if (this.isVisibleTo(playerMP)) {
if (!this.trackingPlayers.contains(playerMP) if (!this.trackingPlayers.contains(playerMP)
&& (this.isPlayerWatchingThisChunk(playerMP) || this.trackedEntity.forceSpawn)) { && (this.isPlayerWatchingThisChunk(playerMP) || this.trackedEntity.forceSpawn)) {
this.trackingPlayers.add(playerMP); this.trackingPlayers.add(playerMP);
@ -420,12 +425,12 @@ public class EntityTrackerEntry {
if (this.trackedEntity.ridingEntity != null) { if (this.trackedEntity.ridingEntity != null) {
playerMP.playerNetServerHandler.sendPacket( playerMP.playerNetServerHandler.sendPacket(
new S1BPacketEntityAttach(0, this.trackedEntity, this.trackedEntity.ridingEntity)); new S1BPacketEntityAttach(this.trackedEntity, this.trackedEntity.ridingEntity));
} }
if (this.trackedEntity instanceof EntityLiving if (this.trackedEntity instanceof EntityLiving
&& ((EntityLiving) this.trackedEntity).getLeashedToEntity() != null) { && ((EntityLiving) this.trackedEntity).getLeashedToEntity() != null) {
playerMP.playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(1, this.trackedEntity, playerMP.playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(this.trackedEntity,
((EntityLiving) this.trackedEntity).getLeashedToEntity())); ((EntityLiving) this.trackedEntity).getLeashedToEntity()));
} }
@ -464,9 +469,9 @@ public class EntityTrackerEntry {
} }
} }
public boolean func_180233_c(EntityPlayerMP playerMP) { public boolean isVisibleTo(EntityPlayerMP playerMP) {
double d0 = playerMP.posX - (double) (this.encodedPosX / 32); double d0 = playerMP.posX - (double) this.encodedPosX / 4096.0D;
double d1 = playerMP.posZ - (double) (this.encodedPosZ / 32); double d1 = playerMP.posZ - (double) this.encodedPosZ / 4096.0D;
return d0 >= (double) (-this.trackingDistanceThreshold) && d0 <= (double) this.trackingDistanceThreshold return d0 >= (double) (-this.trackingDistanceThreshold) && d0 <= (double) this.trackingDistanceThreshold
&& d1 >= (double) (-this.trackingDistanceThreshold) && d1 <= (double) this.trackingDistanceThreshold && d1 >= (double) (-this.trackingDistanceThreshold) && d1 <= (double) this.trackingDistanceThreshold
&& this.trackedEntity.isSpectatedByPlayer(playerMP); && this.trackedEntity.isSpectatedByPlayer(playerMP);
@ -559,21 +564,10 @@ public class EntityTrackerEntry {
return new S10PacketSpawnPainting((EntityPainting) this.trackedEntity); return new S10PacketSpawnPainting((EntityPainting) this.trackedEntity);
} else if (this.trackedEntity instanceof EntityItemFrame) { } else if (this.trackedEntity instanceof EntityItemFrame) {
EntityItemFrame entityitemframe = (EntityItemFrame) this.trackedEntity; EntityItemFrame entityitemframe = (EntityItemFrame) this.trackedEntity;
S0EPacketSpawnObject s0epacketspawnobject1 = new S0EPacketSpawnObject(this.trackedEntity, 71, return new S0EPacketSpawnObject(this.trackedEntity, 71,
entityitemframe.facingDirection.getHorizontalIndex()); entityitemframe.facingDirection.getHorizontalIndex());
BlockPos blockpos1 = entityitemframe.getHangingPosition();
s0epacketspawnobject1.setX(MathHelper.floor_float((float) (blockpos1.getX() * 32)));
s0epacketspawnobject1.setY(MathHelper.floor_float((float) (blockpos1.getY() * 32)));
s0epacketspawnobject1.setZ(MathHelper.floor_float((float) (blockpos1.getZ() * 32)));
return s0epacketspawnobject1;
} else if (this.trackedEntity instanceof EntityLeashKnot) { } else if (this.trackedEntity instanceof EntityLeashKnot) {
EntityLeashKnot entityleashknot = (EntityLeashKnot) this.trackedEntity; return new S0EPacketSpawnObject(this.trackedEntity, 77);
S0EPacketSpawnObject s0epacketspawnobject = new S0EPacketSpawnObject(this.trackedEntity, 77);
BlockPos blockpos = entityleashknot.getHangingPosition();
s0epacketspawnobject.setX(MathHelper.floor_float((float) (blockpos.getX() * 32)));
s0epacketspawnobject.setY(MathHelper.floor_float((float) (blockpos.getY() * 32)));
s0epacketspawnobject.setZ(MathHelper.floor_float((float) (blockpos.getZ() * 32)));
return s0epacketspawnobject;
} else if (this.trackedEntity instanceof EntityXPOrb) { } else if (this.trackedEntity instanceof EntityXPOrb) {
return new S11PacketSpawnExperienceOrb((EntityXPOrb) this.trackedEntity); return new S11PacketSpawnExperienceOrb((EntityXPOrb) this.trackedEntity);
} else { } else {

View File

@ -54,6 +54,14 @@ public class SharedMonsterAttributes {
0.699999988079071D, 0.0D, 1024.0D)).setDescription("Movement Speed").setShouldWatch(true); 0.699999988079071D, 0.0D, 1024.0D)).setDescription("Movement Speed").setShouldWatch(true);
public static final IAttribute attackDamage = new RangedAttribute((IAttribute) null, "generic.attackDamage", 2.0D, public static final IAttribute attackDamage = new RangedAttribute((IAttribute) null, "generic.attackDamage", 2.0D,
0.0D, 2048.0D); 0.0D, 2048.0D);
public static final IAttribute ATTACK_SPEED = (new RangedAttribute((IAttribute) null, "generic.attackSpeed", 4.0D,
0.0D, 1024.0D)).setShouldWatch(true);
public static final IAttribute ARMOR = (new RangedAttribute((IAttribute) null, "generic.armor", 0.0D, 0.0D, 30.0D))
.setShouldWatch(true);
public static final IAttribute field_189429_h = (new RangedAttribute((IAttribute) null, "generic.armorToughness",
0.0D, 0.0D, 20.0D)).setShouldWatch(true);
public static final IAttribute LUCK = (new RangedAttribute((IAttribute) null, "generic.luck", 0.0D, -1024.0D,
1024.0D)).setShouldWatch(true);
/** /**
* + * +

View File

@ -6,6 +6,9 @@ import net.lax1dude.eaglercraft.v1_8.mojang.authlib.GameProfile;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID; import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockBed; import net.minecraft.block.BlockBed;
@ -451,6 +454,11 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
} }
public boolean isHandActive() {
// TODO: implement offhand
return this.itemInUse != null;
}
/** /**
* + * +
* Used for when item use count runs out, ie: eating completed * Used for when item use count runs out, ie: eating completed
@ -1140,6 +1148,10 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
} }
} }
public void setHeldItem(@Nullable ItemStack stack) {
this.inventory.mainInventory[this.inventory.currentItem] = stack;
}
/** /**
* + * +
* Returns the currently being used item by the player. * Returns the currently being used item by the player.

View File

@ -187,6 +187,8 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
public boolean playerConqueredTheEnd; public boolean playerConqueredTheEnd;
public byte[] updateCertificate = null; public byte[] updateCertificate = null;
private boolean invulnerableDimensionChange;
public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile,
ItemInWorldManager interactionManager) { ItemInWorldManager interactionManager) {
super(worldIn, profile); super(worldIn, profile);
@ -346,7 +348,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
if (!arraylist.isEmpty()) { if (!arraylist.isEmpty()) {
for (int k = 0; k < arraylist.size(); ++k) { for (int k = 0; k < arraylist.size(); ++k) {
this.playerNetServerHandler this.playerNetServerHandler
.sendPacket(new S21PacketChunkData((Chunk) arraylist.get(k), true, '\uffff')); .sendPacket(new S21PacketChunkData((Chunk) arraylist.get(k), '\uffff'));
} }
for (int i = 0, l = arraylist1.size(); i < l; ++i) { for (int i = 0, l = arraylist1.size(); i < l; ++i) {
@ -517,6 +519,10 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
this.getCombatTracker().reset(); this.getCombatTracker().reset();
} }
public boolean isEntityInvulnerable(DamageSource source) {
return super.isEntityInvulnerable(source) || this.isInvulnerableDimensionChange();
}
/** /**
* + * +
* Called when the entity is attacked. * Called when the entity is attacked.
@ -568,6 +574,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
* number to teleport to * number to teleport to
*/ */
public void travelToDimension(int dimensionId) { public void travelToDimension(int dimensionId) {
this.invulnerableDimensionChange = true;
if (this.dimension == 1 && dimensionId == 1) { if (this.dimension == 1 && dimensionId == 1) {
this.triggerAchievement(AchievementList.theEnd2); this.triggerAchievement(AchievementList.theEnd2);
this.worldObj.removeEntity(this); this.worldObj.removeEntity(this);
@ -595,6 +602,12 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
} }
protected void decrementTimeUntilPortal() {
if (this.timeUntilPortal > 0 && !this.invulnerableDimensionChange) {
--this.timeUntilPortal;
}
}
public boolean isSpectatedByPlayer(EntityPlayerMP player) { public boolean isSpectatedByPlayer(EntityPlayerMP player) {
return player.isSpectator() ? this.getSpectatingEntity() == this return player.isSpectator() ? this.getSpectatingEntity() == this
: (this.isSpectator() ? false : super.isSpectatedByPlayer(player)); : (this.isSpectator() ? false : super.isSpectatedByPlayer(player));
@ -659,7 +672,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
Entity entity1 = this.ridingEntity; Entity entity1 = this.ridingEntity;
super.mountEntity(entity); super.mountEntity(entity);
if (entity != entity1) { if (entity != entity1) {
this.playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(0, this, this.ridingEntity)); this.playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(this, this.ridingEntity));
this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw,
this.rotationPitch); this.rotationPitch);
} }
@ -1204,6 +1217,14 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
return null; return null;
} }
public boolean isInvulnerableDimensionChange() {
return this.invulnerableDimensionChange;
}
public void clearInvulnerableDimensionChange() {
this.invulnerableDimensionChange = false;
}
public void setElytraFlying() { public void setElytraFlying() {
this.setFlag(7, true); this.setFlag(7, true);
} }

View File

@ -2,6 +2,8 @@ package net.minecraft.entity.player;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import javax.annotation.Nullable;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.crash.CrashReport; import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory; import net.minecraft.crash.CrashReportCategory;

View File

@ -54,6 +54,7 @@ public class ItemEmptyMap extends ItemMapBase {
mapdata.scale = 0; mapdata.scale = 0;
mapdata.calculateMapCenter(entityplayer.posX, entityplayer.posZ, mapdata.scale); mapdata.calculateMapCenter(entityplayer.posX, entityplayer.posZ, mapdata.scale);
mapdata.dimension = (byte) world.provider.getDimensionId(); mapdata.dimension = (byte) world.provider.getDimensionId();
mapdata.trackingPosition = true;
mapdata.markDirty(); mapdata.markDirty();
--itemstack.stackSize; --itemstack.stackSize;
if (itemstack.stackSize <= 0) { if (itemstack.stackSize <= 0) {

View File

@ -258,7 +258,7 @@ public class ItemMap extends ItemMapBase {
if (mapdata1.scale > 4) { if (mapdata1.scale > 4) {
mapdata1.scale = 4; mapdata1.scale = 4;
} }
mapdata1.trackingPosition = true;
mapdata1.calculateMapCenter((double) mapdata.xCenter, (double) mapdata.zCenter, mapdata1.scale); mapdata1.calculateMapCenter((double) mapdata.xCenter, (double) mapdata.zCenter, mapdata1.scale);
mapdata1.dimension = mapdata.dimension; mapdata1.dimension = mapdata.dimension;
mapdata1.markDirty(); mapdata1.markDirty();

View File

@ -36,6 +36,13 @@ import net.minecraft.network.play.client.C16PacketClientStatus;
import net.minecraft.network.play.client.C17PacketCustomPayload; import net.minecraft.network.play.client.C17PacketCustomPayload;
import net.minecraft.network.play.client.C18PacketSpectate; import net.minecraft.network.play.client.C18PacketSpectate;
import net.minecraft.network.play.client.C19PacketResourcePackStatus; import net.minecraft.network.play.client.C19PacketResourcePackStatus;
import net.minecraft.network.play.client.CPacketSteerBoat;
import net.minecraft.network.play.client.CPacketConfirmTeleport;
import net.minecraft.network.play.client.CPacketUseItem;
import net.minecraft.network.play.client.CPacketVehicleMove;
import net.minecraft.network.play.client.C03PacketPlayer.C04PacketPlayerPosition;
import net.minecraft.network.play.client.C03PacketPlayer.C05PacketPlayerLook;
import net.minecraft.network.play.client.C03PacketPlayer.C06PacketPlayerPosLook;
import net.minecraft.network.play.server.S00PacketKeepAlive; import net.minecraft.network.play.server.S00PacketKeepAlive;
import net.minecraft.network.play.server.S01PacketJoinGame; import net.minecraft.network.play.server.S01PacketJoinGame;
import net.minecraft.network.play.server.S02PacketChat; import net.minecraft.network.play.server.S02PacketChat;
@ -106,6 +113,15 @@ import net.minecraft.network.play.server.S46PacketSetCompressionLevel;
import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter; import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter;
import net.minecraft.network.play.server.S48PacketResourcePackSend; import net.minecraft.network.play.server.S48PacketResourcePackSend;
import net.minecraft.network.play.server.S49PacketUpdateEntityNBT; import net.minecraft.network.play.server.S49PacketUpdateEntityNBT;
import net.minecraft.network.play.server.SPacketBossBar;
import net.minecraft.network.play.server.SPacketSetCooldown;
import net.minecraft.network.play.server.SPacketSetPassengers;
import net.minecraft.network.play.server.SPacketSoundEffect;
import net.minecraft.network.play.server.SPacketUnloadChunk;
import net.minecraft.network.play.server.SPacketVehicleMove;
import net.minecraft.network.play.server.S14PacketEntity.S15PacketEntityRelMove;
import net.minecraft.network.play.server.S14PacketEntity.S16PacketEntityLook;
import net.minecraft.network.play.server.S14PacketEntity.S17PacketEntityLookMove;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
/** /**
@ -145,106 +161,117 @@ public enum EnumConnectionState {
}, },
PLAY(0) { PLAY(0) {
{ {
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S00PacketKeepAlive.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S01PacketJoinGame.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S02PacketChat.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S03PacketTimeUpdate.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S04PacketEntityEquipment.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S05PacketSpawnPosition.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S06PacketUpdateHealth.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S07PacketRespawn.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S08PacketPlayerPosLook.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S09PacketHeldItemChange.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0APacketUseBed.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0BPacketAnimation.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0CPacketSpawnPlayer.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0DPacketCollectItem.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0EPacketSpawnObject.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0EPacketSpawnObject.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S11PacketSpawnExperienceOrb.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2CPacketSpawnGlobalEntity.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0FPacketSpawnMob.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0FPacketSpawnMob.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S10PacketSpawnPainting.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S10PacketSpawnPainting.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S11PacketSpawnExperienceOrb.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0CPacketSpawnPlayer.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S12PacketEntityVelocity.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0BPacketAnimation.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S13PacketDestroyEntities.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S37PacketStatistics.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.S15PacketEntityRelMove.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.S16PacketEntityLook.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.S17PacketEntityLookMove.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S18PacketEntityTeleport.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S19PacketEntityHeadLook.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S19PacketEntityStatus.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1BPacketEntityAttach.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1CPacketEntityMetadata.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1DPacketEntityEffect.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1EPacketRemoveEntityEffect.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1FPacketSetExperience.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S20PacketEntityProperties.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S21PacketChunkData.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S22PacketMultiBlockChange.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S23PacketBlockChange.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S24PacketBlockAction.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S25PacketBlockBreakAnim.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S25PacketBlockBreakAnim.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, new PlaceholderPacket().getClass()); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S35PacketUpdateTileEntity.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S27PacketExplosion.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S24PacketBlockAction.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S28PacketEffect.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S23PacketBlockChange.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S29PacketSoundEffect.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, SPacketBossBar.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2APacketParticles.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S41PacketServerDifficulty.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2BPacketChangeGameState.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3APacketTabComplete.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2CPacketSpawnGlobalEntity.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S02PacketChat.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2DPacketOpenWindow.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S22PacketMultiBlockChange.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S32PacketConfirmTransaction.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2EPacketCloseWindow.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2EPacketCloseWindow.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2FPacketSetSlot.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2DPacketOpenWindow.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S30PacketWindowItems.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S30PacketWindowItems.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S31PacketWindowProperty.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S31PacketWindowProperty.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S32PacketConfirmTransaction.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2FPacketSetSlot.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S33PacketUpdateSign.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, SPacketSetCooldown.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S34PacketMaps.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S35PacketUpdateTileEntity.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S36PacketSignEditorOpen.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S37PacketStatistics.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S38PacketPlayerListItem.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S39PacketPlayerAbilities.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3APacketTabComplete.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3BPacketScoreboardObjective.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3CPacketUpdateScore.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3DPacketDisplayScoreboard.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3EPacketTeams.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3FPacketCustomPayload.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3FPacketCustomPayload.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S29PacketSoundEffect.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S40PacketDisconnect.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S40PacketDisconnect.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S41PacketServerDifficulty.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S19PacketEntityStatus.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S27PacketExplosion.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, SPacketUnloadChunk.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2BPacketChangeGameState.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S00PacketKeepAlive.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S21PacketChunkData.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S28PacketEffect.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2APacketParticles.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S01PacketJoinGame.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S34PacketMaps.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S15PacketEntityRelMove.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S17PacketEntityLookMove.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S16PacketEntityLook.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, SPacketVehicleMove.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S36PacketSignEditorOpen.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S39PacketPlayerAbilities.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S42PacketCombatEvent.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S42PacketCombatEvent.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S43PacketCamera.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S38PacketPlayerListItem.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S44PacketWorldBorder.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S08PacketPlayerPosLook.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S45PacketTitle.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0APacketUseBed.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S46PacketSetCompressionLevel.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S13PacketDestroyEntities.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S47PacketPlayerListHeaderFooter.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1EPacketRemoveEntityEffect.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S48PacketResourcePackSend.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S48PacketResourcePackSend.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S07PacketRespawn.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S19PacketEntityHeadLook.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S44PacketWorldBorder.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S43PacketCamera.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S09PacketHeldItemChange.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3DPacketDisplayScoreboard.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1CPacketEntityMetadata.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1BPacketEntityAttach.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S12PacketEntityVelocity.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S04PacketEntityEquipment.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1FPacketSetExperience.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S06PacketUpdateHealth.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3BPacketScoreboardObjective.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, SPacketSetPassengers.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3EPacketTeams.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3CPacketUpdateScore.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S05PacketSpawnPosition.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S03PacketTimeUpdate.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S45PacketTitle.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S33PacketUpdateSign.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, SPacketSoundEffect.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S47PacketPlayerListHeaderFooter.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0DPacketCollectItem.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S18PacketEntityTeleport.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S20PacketEntityProperties.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1DPacketEntityEffect.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S46PacketSetCompressionLevel.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S49PacketUpdateEntityNBT.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S49PacketUpdateEntityNBT.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C00PacketKeepAlive.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, CPacketConfirmTeleport.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C14PacketTabComplete.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C01PacketChatMessage.class); this.registerPacket(EnumPacketDirection.SERVERBOUND, C01PacketChatMessage.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C16PacketClientStatus.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C15PacketClientSettings.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0FPacketConfirmTransaction.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C11PacketEnchantItem.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0EPacketClickWindow.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0DPacketCloseWindow.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C17PacketCustomPayload.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C02PacketUseEntity.class); this.registerPacket(EnumPacketDirection.SERVERBOUND, C02PacketUseEntity.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C00PacketKeepAlive.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C04PacketPlayerPosition.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C06PacketPlayerPosLook.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C05PacketPlayerLook.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.class); this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.C04PacketPlayerPosition.class); this.registerPacket(EnumPacketDirection.SERVERBOUND, CPacketVehicleMove.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.C05PacketPlayerLook.class); this.registerPacket(EnumPacketDirection.SERVERBOUND, CPacketSteerBoat.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.C06PacketPlayerPosLook.class); this.registerPacket(EnumPacketDirection.SERVERBOUND, C13PacketPlayerAbilities.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C07PacketPlayerDigging.class); this.registerPacket(EnumPacketDirection.SERVERBOUND, C07PacketPlayerDigging.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C08PacketPlayerBlockPlacement.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C09PacketHeldItemChange.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0APacketAnimation.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0BPacketEntityAction.class); this.registerPacket(EnumPacketDirection.SERVERBOUND, C0BPacketEntityAction.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0CPacketInput.class); this.registerPacket(EnumPacketDirection.SERVERBOUND, C0CPacketInput.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0DPacketCloseWindow.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0EPacketClickWindow.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0FPacketConfirmTransaction.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C10PacketCreativeInventoryAction.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C11PacketEnchantItem.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C12PacketUpdateSign.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C13PacketPlayerAbilities.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C14PacketTabComplete.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C15PacketClientSettings.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C16PacketClientStatus.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C17PacketCustomPayload.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C18PacketSpectate.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C19PacketResourcePackStatus.class); this.registerPacket(EnumPacketDirection.SERVERBOUND, C19PacketResourcePackStatus.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C09PacketHeldItemChange.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C10PacketCreativeInventoryAction.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C12PacketUpdateSign.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C0APacketAnimation.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C18PacketSpectate.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C08PacketPlayerBlockPlacement.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, CPacketUseItem.class);
} }
}, },
LOGIN(2) { LOGIN(2) {

View File

@ -3,6 +3,8 @@ package net.minecraft.network;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.primitives.Doubles; import com.google.common.primitives.Doubles;
import com.google.common.primitives.Floats; import com.google.common.primitives.Floats;
import com.logisticscraft.occlusionculling.util.Vec3d;
import net.lax1dude.eaglercraft.v1_8.netty.Unpooled; import net.lax1dude.eaglercraft.v1_8.netty.Unpooled;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -13,6 +15,7 @@ import java.util.concurrent.Callable;
import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerMinecraftServer; import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerMinecraftServer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.command.server.CommandBlockLogic; import net.minecraft.command.server.CommandBlockLogic;
import net.minecraft.crash.CrashReport; import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory; import net.minecraft.crash.CrashReportCategory;
@ -62,6 +65,8 @@ import net.minecraft.network.play.client.C16PacketClientStatus;
import net.minecraft.network.play.client.C17PacketCustomPayload; import net.minecraft.network.play.client.C17PacketCustomPayload;
import net.minecraft.network.play.client.C18PacketSpectate; import net.minecraft.network.play.client.C18PacketSpectate;
import net.minecraft.network.play.client.C19PacketResourcePackStatus; import net.minecraft.network.play.client.C19PacketResourcePackStatus;
import net.minecraft.network.play.client.CPacketConfirmTeleport;
import net.minecraft.network.play.client.CPacketUseItem;
import net.minecraft.network.play.server.S00PacketKeepAlive; import net.minecraft.network.play.server.S00PacketKeepAlive;
import net.minecraft.network.play.server.S02PacketChat; import net.minecraft.network.play.server.S02PacketChat;
import net.minecraft.network.play.server.S07PacketRespawn; import net.minecraft.network.play.server.S07PacketRespawn;
@ -85,10 +90,12 @@ import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.IChatComponent; import net.minecraft.util.IChatComponent;
import net.minecraft.util.ITickable; import net.minecraft.util.ITickable;
import net.minecraft.util.IntHashMap; import net.minecraft.util.IntHashMap;
import net.minecraft.util.ReportedException; import net.minecraft.util.ReportedException;
import net.minecraft.util.Vec3;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import net.lax1dude.eaglercraft.v1_8.sp.server.socket.IntegratedServerPlayerNetworkManager; import net.lax1dude.eaglercraft.v1_8.sp.server.socket.IntegratedServerPlayerNetworkManager;
import net.lax1dude.eaglercraft.v1_8.sp.server.voice.IntegratedVoiceService; import net.lax1dude.eaglercraft.v1_8.sp.server.voice.IntegratedVoiceService;
@ -150,6 +157,16 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable {
private double lastPosZ; private double lastPosZ;
private boolean hasMoved = true; private boolean hasMoved = true;
private boolean hasDisconnected = false; private boolean hasDisconnected = false;
private int teleportId;
private double firstGoodX;
private double firstGoodY;
private double firstGoodZ;
private double lastGoodX;
private double lastGoodY;
private double lastGoodZ;
private int lastPositionUpdate;
private Vec3 targetPos;
public NetHandlerPlayServer(MinecraftServer server, IntegratedServerPlayerNetworkManager networkManagerIn, public NetHandlerPlayServer(MinecraftServer server, IntegratedServerPlayerNetworkManager networkManagerIn,
EntityPlayerMP playerIn) { EntityPlayerMP playerIn) {
@ -236,189 +253,201 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable {
WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
this.field_147366_g = true; this.field_147366_g = true;
if (!this.playerEntity.playerConqueredTheEnd) { if (!this.playerEntity.playerConqueredTheEnd) {
double d0 = this.playerEntity.posX; if (this.targetPos != null) {
double d1 = this.playerEntity.posY; if (this.networkTickCount - this.lastPositionUpdate > 20) {
double d2 = this.playerEntity.posZ; this.lastPositionUpdate = this.networkTickCount;
double d3 = 0.0D; this.setPlayerLocation(this.targetPos.xCoord, this.targetPos.yCoord, this.targetPos.zCoord,
double d4 = c03packetplayer.getPositionX() - this.lastPosX; this.playerEntity.rotationYaw, this.playerEntity.rotationPitch);
double d5 = c03packetplayer.getPositionY() - this.lastPosY;
double d6 = c03packetplayer.getPositionZ() - this.lastPosZ;
if (c03packetplayer.isMoving()) {
d3 = d4 * d4 + d5 * d5 + d6 * d6;
if (!this.hasMoved && d3 < 0.25D) {
this.hasMoved = true;
} }
} } else {
this.lastPositionUpdate = this.networkTickCount;
if (this.hasMoved) { double d0 = this.playerEntity.posX;
this.field_175090_f = this.networkTickCount; double d1 = this.playerEntity.posY;
if (this.playerEntity.ridingEntity != null) { double d2 = this.playerEntity.posZ;
float f4 = this.playerEntity.rotationYaw; double d3 = 0.0D;
float f = this.playerEntity.rotationPitch; double d4 = c03packetplayer.getPositionX() - this.lastPosX;
this.playerEntity.ridingEntity.updateRiderPosition(); double d5 = c03packetplayer.getPositionY() - this.lastPosY;
double d16 = this.playerEntity.posX; double d6 = c03packetplayer.getPositionZ() - this.lastPosZ;
double d17 = this.playerEntity.posY; if (c03packetplayer.isMoving()) {
double d18 = this.playerEntity.posZ; d3 = d4 * d4 + d5 * d5 + d6 * d6;
if (c03packetplayer.getRotating()) { if (!this.hasMoved && d3 < 0.25D) {
f4 = c03packetplayer.getYaw(); this.hasMoved = true;
f = c03packetplayer.getPitch();
} }
}
this.playerEntity.onGround = c03packetplayer.isOnGround(); if (this.hasMoved) {
this.playerEntity.onUpdateEntity(); this.field_175090_f = this.networkTickCount;
this.playerEntity.setPositionAndRotation(d16, d17, d18, f4, f);
if (this.playerEntity.ridingEntity != null) { if (this.playerEntity.ridingEntity != null) {
float f4 = this.playerEntity.rotationYaw;
float f = this.playerEntity.rotationPitch;
this.playerEntity.ridingEntity.updateRiderPosition(); this.playerEntity.ridingEntity.updateRiderPosition();
} double d16 = this.playerEntity.posX;
double d17 = this.playerEntity.posY;
this.serverController.getConfigurationManager() double d18 = this.playerEntity.posZ;
.serverUpdateMountedMovingPlayer(this.playerEntity); if (c03packetplayer.getRotating()) {
if (this.playerEntity.ridingEntity != null) { f4 = c03packetplayer.getYaw();
if (d3 > 4.0D) { f = c03packetplayer.getPitch();
Entity entity = this.playerEntity.ridingEntity;
this.playerEntity.playerNetServerHandler
.sendPacket(new S18PacketEntityTeleport(entity));
this.setPlayerLocation(this.playerEntity.posX, this.playerEntity.posY,
this.playerEntity.posZ, this.playerEntity.rotationYaw,
this.playerEntity.rotationPitch);
} }
this.playerEntity.ridingEntity.isAirBorne = true; this.playerEntity.onGround = c03packetplayer.isOnGround();
} this.playerEntity.onUpdateEntity();
this.playerEntity.setPositionAndRotation(d16, d17, d18, f4, f);
if (this.playerEntity.ridingEntity != null) {
this.playerEntity.ridingEntity.updateRiderPosition();
}
if (this.hasMoved) { this.serverController.getConfigurationManager()
this.lastPosX = this.playerEntity.posX; .serverUpdateMountedMovingPlayer(this.playerEntity);
this.lastPosY = this.playerEntity.posY; if (this.playerEntity.ridingEntity != null) {
this.lastPosZ = this.playerEntity.posZ; if (d3 > 4.0D) {
} Entity entity = this.playerEntity.ridingEntity;
this.playerEntity.playerNetServerHandler
.sendPacket(new S18PacketEntityTeleport(entity));
this.setPlayerLocation(this.playerEntity.posX, this.playerEntity.posY,
this.playerEntity.posZ, this.playerEntity.rotationYaw,
this.playerEntity.rotationPitch);
}
worldserver.updateEntity(this.playerEntity); this.playerEntity.ridingEntity.isAirBorne = true;
return; }
}
if (this.playerEntity.isPlayerSleeping()) { if (this.hasMoved) {
this.playerEntity.onUpdateEntity(); this.lastPosX = this.playerEntity.posX;
this.playerEntity.setPositionAndRotation(this.lastPosX, this.lastPosY, this.lastPosZ, this.lastPosY = this.playerEntity.posY;
this.playerEntity.rotationYaw, this.playerEntity.rotationPitch); this.lastPosZ = this.playerEntity.posZ;
worldserver.updateEntity(this.playerEntity); }
return;
}
double d7 = this.playerEntity.posY; worldserver.updateEntity(this.playerEntity);
this.lastPosX = this.playerEntity.posX;
this.lastPosY = this.playerEntity.posY;
this.lastPosZ = this.playerEntity.posZ;
double d8 = this.playerEntity.posX;
double d9 = this.playerEntity.posY;
double d10 = this.playerEntity.posZ;
float f1 = this.playerEntity.rotationYaw;
float f2 = this.playerEntity.rotationPitch;
if (c03packetplayer.isMoving() && c03packetplayer.getPositionY() == -999.0D) {
c03packetplayer.setMoving(false);
}
if (c03packetplayer.isMoving()) {
d8 = c03packetplayer.getPositionX();
d9 = c03packetplayer.getPositionY();
d10 = c03packetplayer.getPositionZ();
if (Math.abs(c03packetplayer.getPositionX()) > 3.0E7D
|| Math.abs(c03packetplayer.getPositionZ()) > 3.0E7D) {
this.kickPlayerFromServer("Illegal position");
return; return;
} }
}
if (c03packetplayer.getRotating()) { if (this.playerEntity.isPlayerSleeping()) {
f1 = c03packetplayer.getYaw(); this.playerEntity.onUpdateEntity();
f2 = c03packetplayer.getPitch(); this.playerEntity.setPositionAndRotation(this.lastPosX, this.lastPosY, this.lastPosZ,
} this.playerEntity.rotationYaw, this.playerEntity.rotationPitch);
worldserver.updateEntity(this.playerEntity);
this.playerEntity.onUpdateEntity();
this.playerEntity.setPositionAndRotation(this.lastPosX, this.lastPosY, this.lastPosZ, f1, f2);
if (!this.hasMoved) {
return;
}
double d11 = d8 - this.playerEntity.posX;
double d12 = d9 - this.playerEntity.posY;
double d13 = d10 - this.playerEntity.posZ;
double d14 = this.playerEntity.motionX * this.playerEntity.motionX
+ this.playerEntity.motionY * this.playerEntity.motionY
+ this.playerEntity.motionZ * this.playerEntity.motionZ;
double d15 = d11 * d11 + d12 * d12 + d13 * d13;
if ((d15 - d14 > 100.0D && (!this.serverController.isSinglePlayer()
||
!this.serverController.getServerOwner().equals(this.playerEntity.getName())))
&& !this.playerEntity.isElytraFlying()) {
logger.warn(this.playerEntity.getName() + " moved too quickly! " + d11 + ","
+ d12 + "," + d13
+ " (" + d11 + ", " + d12 + ", " + d13 + ")");
this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ,
this.playerEntity.rotationYaw, this.playerEntity.rotationPitch);
return;
}
float f3 = 0.0625F;
boolean flag = worldserver.getCollidingBoundingBoxes(this.playerEntity,
this.playerEntity.getEntityBoundingBox().contract((double) f3, (double) f3, (double) f3))
.isEmpty();
if (this.playerEntity.onGround && !c03packetplayer.isOnGround() && d12 > 0.0D) {
this.playerEntity.jump();
}
this.playerEntity.moveEntity(d11, d12, d13);
this.playerEntity.onGround = c03packetplayer.isOnGround();
d11 = d8 - this.playerEntity.posX;
d12 = d9 - this.playerEntity.posY;
if (d12 > -0.5D || d12 < 0.5D) {
d12 = 0.0D;
}
d13 = d10 - this.playerEntity.posZ;
d15 = d11 * d11 + d12 * d12 + d13 * d13;
boolean flag1 = false;
if (d15 > 0.0625D && !this.playerEntity.isPlayerSleeping()
&& !this.playerEntity.theItemInWorldManager.isCreative()) {
flag1 = true;
logger.warn(this.playerEntity.getName() + " moved wrongly!");
}
this.playerEntity.setPositionAndRotation(d8, d9, d10, f1, f2);
this.playerEntity.addMovementStat(this.playerEntity.posX - d0, this.playerEntity.posY - d1,
this.playerEntity.posZ - d2);
if (!this.playerEntity.noClip) {
boolean flag2 = worldserver.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity
.getEntityBoundingBox().contract((double) f3, (double) f3, (double) f3)).isEmpty();
if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping()) {
this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, f1, f2);
return; return;
} }
}
AxisAlignedBB axisalignedbb = this.playerEntity.getEntityBoundingBox() double d7 = this.playerEntity.posY;
.expand((double) f3, (double) f3, (double) f3).addCoord(0.0D, -0.55D, 0.0D); this.lastPosX = this.playerEntity.posX;
if (!this.serverController.isFlightAllowed() && !this.playerEntity.capabilities.allowFlying this.lastPosY = this.playerEntity.posY;
&& !worldserver.checkBlockCollision(axisalignedbb) && !this.playerEntity.isElytraFlying()) { this.lastPosZ = this.playerEntity.posZ;
if (d12 >= -0.03125D) { double d8 = this.playerEntity.posX;
++this.floatingTickCount; double d9 = this.playerEntity.posY;
if (this.floatingTickCount > 80) { double d10 = this.playerEntity.posZ;
logger.warn(this.playerEntity.getName() + " was kicked for floating too long!"); float f1 = this.playerEntity.rotationYaw;
this.kickPlayerFromServer("Flying is not enabled on this server"); float f2 = this.playerEntity.rotationPitch;
if (c03packetplayer.isMoving() && c03packetplayer.getPositionY() == -999.0D) {
c03packetplayer.setMoving(false);
}
if (c03packetplayer.isMoving()) {
d8 = c03packetplayer.getPositionX();
d9 = c03packetplayer.getPositionY();
d10 = c03packetplayer.getPositionZ();
if (Math.abs(c03packetplayer.getPositionX()) > 3.0E7D
|| Math.abs(c03packetplayer.getPositionZ()) > 3.0E7D) {
this.kickPlayerFromServer("Illegal position");
return; return;
} }
} }
} else {
this.floatingTickCount = 0; if (c03packetplayer.getRotating()) {
f1 = c03packetplayer.getYaw();
f2 = c03packetplayer.getPitch();
}
this.playerEntity.onUpdateEntity();
this.playerEntity.setPositionAndRotation(this.lastPosX, this.lastPosY, this.lastPosZ, f1, f2);
if (!this.hasMoved) {
return;
}
double d11 = d8 - this.playerEntity.posX;
double d12 = d9 - this.playerEntity.posY;
double d13 = d10 - this.playerEntity.posZ;
double d14 = this.playerEntity.motionX * this.playerEntity.motionX
+ this.playerEntity.motionY * this.playerEntity.motionY
+ this.playerEntity.motionZ * this.playerEntity.motionZ;
double d15 = d11 * d11 + d12 * d12 + d13 * d13;
if ((d15 - d14 > 100.0D && (!this.serverController.isSinglePlayer()
||
!this.serverController.getServerOwner().equals(this.playerEntity.getName())))
&& !this.playerEntity.isElytraFlying()) {
logger.warn(this.playerEntity.getName() + " moved too quickly! " + d11 + ","
+ d12 + "," + d13
+ " (" + d11 + ", " + d12 + ", " + d13 + ")");
this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ,
this.playerEntity.rotationYaw, this.playerEntity.rotationPitch);
return;
}
float f3 = 0.0625F;
boolean flag = worldserver.getCollidingBoundingBoxes(this.playerEntity,
this.playerEntity.getEntityBoundingBox().contract((double) f3, (double) f3,
(double) f3))
.isEmpty();
if (this.playerEntity.onGround && !c03packetplayer.isOnGround() && d12 > 0.0D) {
this.playerEntity.jump();
}
this.playerEntity.moveEntity(d11, d12, d13);
this.playerEntity.onGround = c03packetplayer.isOnGround();
d11 = d8 - this.playerEntity.posX;
d12 = d9 - this.playerEntity.posY;
if (d12 > -0.5D || d12 < 0.5D) {
d12 = 0.0D;
}
d13 = d10 - this.playerEntity.posZ;
d15 = d11 * d11 + d12 * d12 + d13 * d13;
boolean flag1 = false;
if (d15 > 0.0625D && !this.playerEntity.isPlayerSleeping()
&& !this.playerEntity.theItemInWorldManager.isCreative()) {
flag1 = true;
logger.warn(this.playerEntity.getName() + " moved wrongly!");
}
this.playerEntity.setPositionAndRotation(d8, d9, d10, f1, f2);
this.playerEntity.addMovementStat(this.playerEntity.posX - d0, this.playerEntity.posY - d1,
this.playerEntity.posZ - d2);
if (!this.playerEntity.noClip) {
boolean flag2 = worldserver.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity
.getEntityBoundingBox().contract((double) f3, (double) f3, (double) f3)).isEmpty();
if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping()) {
this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, f1, f2);
return;
}
}
AxisAlignedBB axisalignedbb = this.playerEntity.getEntityBoundingBox()
.expand((double) f3, (double) f3, (double) f3).addCoord(0.0D, -0.55D, 0.0D);
if (!this.serverController.isFlightAllowed() && !this.playerEntity.capabilities.allowFlying
&& !worldserver.checkBlockCollision(axisalignedbb)
&& !this.playerEntity.isElytraFlying()) {
if (d12 >= -0.03125D) {
++this.floatingTickCount;
if (this.floatingTickCount > 80) {
logger.warn(this.playerEntity.getName() + " was kicked for floating too long!");
this.kickPlayerFromServer("Flying is not enabled on this server");
return;
}
}
} else {
this.floatingTickCount = 0;
}
this.playerEntity.onGround = c03packetplayer.isOnGround();
this.serverController.getConfigurationManager()
.serverUpdateMountedMovingPlayer(this.playerEntity);
this.playerEntity.handleFalling(this.playerEntity.posY - d7, c03packetplayer.isOnGround());
} else if (this.networkTickCount - this.field_175090_f > 20) {
this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ,
this.playerEntity.rotationYaw,
this.playerEntity.rotationPitch);
} }
this.playerEntity.onGround = c03packetplayer.isOnGround();
this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity);
this.playerEntity.handleFalling(this.playerEntity.posY - d7, c03packetplayer.isOnGround());
} else if (this.networkTickCount - this.field_175090_f > 20) {
this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, this.playerEntity.rotationYaw,
this.playerEntity.rotationPitch);
} }
} }
} }
} }
@ -429,24 +458,13 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable {
public void setPlayerLocation(double x, double y, double z, float yaw, float pitch, public void setPlayerLocation(double x, double y, double z, float yaw, float pitch,
Set<S08PacketPlayerPosLook.EnumFlags> relativeSet) { Set<S08PacketPlayerPosLook.EnumFlags> relativeSet) {
this.hasMoved = false; double d0 = relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.X) ? this.playerEntity.posX : 0.0D;
this.lastPosX = x; double d1 = relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.Y) ? this.playerEntity.posY : 0.0D;
this.lastPosY = y; double d2 = relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.Z) ? this.playerEntity.posZ : 0.0D;
this.lastPosZ = z; this.targetPos = new Vec3(x + d0, y + d1, z + d2);
if (relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.X)) {
this.lastPosX += this.playerEntity.posX;
}
if (relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.Y)) {
this.lastPosY += this.playerEntity.posY;
}
if (relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.Z)) {
this.lastPosZ += this.playerEntity.posZ;
}
float f = yaw; float f = yaw;
float f1 = pitch; float f1 = pitch;
if (relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.Y_ROT)) { if (relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.Y_ROT)) {
f = yaw + this.playerEntity.rotationYaw; f = yaw + this.playerEntity.rotationYaw;
} }
@ -455,9 +473,15 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable {
f1 = pitch + this.playerEntity.rotationPitch; f1 = pitch + this.playerEntity.rotationPitch;
} }
this.playerEntity.setPositionAndRotation(this.lastPosX, this.lastPosY, this.lastPosZ, f, f1); if (++this.teleportId == Integer.MAX_VALUE) {
this.teleportId = 0;
}
this.lastPositionUpdate = this.networkTickCount;
this.playerEntity.setPositionAndRotation(this.targetPos.xCoord, this.targetPos.yCoord, this.targetPos.zCoord, f,
f1);
this.playerEntity.playerNetServerHandler this.playerEntity.playerNetServerHandler
.sendPacket(new S08PacketPlayerPosLook(x, y, z, yaw, pitch, relativeSet)); .sendPacket(new S08PacketPlayerPosLook(x, y, z, yaw, pitch, relativeSet, this.teleportId));
} }
/** /**
@ -535,68 +559,42 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable {
* Processes block placement and block activation (anvil, * Processes block placement and block activation (anvil,
* furnace, etc.) * furnace, etc.)
*/ */
public void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement c08packetplayerblockplacement) { public void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement packetIn) {
// TODO: implement offhand
WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
EnumHand enumhand = packetIn.getHand();
ItemStack itemstack = this.playerEntity.inventory.getCurrentItem(); ItemStack itemstack = this.playerEntity.inventory.getCurrentItem();
boolean flag = false; BlockPos blockpos = packetIn.getPos();
BlockPos blockpos = c08packetplayerblockplacement.getPosition(); EnumFacing enumfacing = packetIn.getDirection();
EnumFacing enumfacing = EnumFacing.getFront(c08packetplayerblockplacement.getPlacedBlockDirection());
this.playerEntity.markPlayerActive(); this.playerEntity.markPlayerActive();
if (c08packetplayerblockplacement.getPlacedBlockDirection() == 255) {
if (itemstack == null) {
return;
}
this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack); if (blockpos.getY() < this.serverController.getBuildLimit() - 1
} else if (blockpos.getY() < this.serverController.getBuildLimit() - 1
|| enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit()) { || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit()) {
if (this.hasMoved if (this.targetPos == null
&& this.playerEntity.getDistanceSq((double) blockpos.getX() + 0.5D, (double) blockpos.getY() + 0.5D, && this.playerEntity.getDistanceSq((double) blockpos.getX() + 0.5D, (double) blockpos.getY() + 0.5D,
(double) blockpos.getZ() + 0.5D) < 64.0D (double) blockpos.getZ() + 0.5D) < 64.0D
&& !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity)
&& worldserver.getWorldBorder().contains(blockpos)) { && worldserver.getWorldBorder().contains(blockpos)) {
this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver,
itemstack, blockpos, enumfacing, c08packetplayerblockplacement.getPlacedBlockOffsetX(), itemstack, blockpos, enumfacing, packetIn.getFacingX(), packetIn.getFacingY(),
c08packetplayerblockplacement.getPlacedBlockOffsetY(), packetIn.getFacingZ());
c08packetplayerblockplacement.getPlacedBlockOffsetZ());
} }
flag = true;
} else { } else {
ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("build.tooHigh", ChatComponentTranslation textcomponenttranslation = new ChatComponentTranslation("build.tooHigh",
new Object[] { Integer.valueOf(this.serverController.getBuildLimit()) }); new Object[] { Integer.valueOf(this.serverController.getBuildLimit()) });
chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); textcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
this.playerEntity.playerNetServerHandler.sendPacket(new S02PacketChat(chatcomponenttranslation)); this.playerEntity.playerNetServerHandler.sendPacket(new S02PacketChat(textcomponenttranslation));
flag = true;
}
if (flag) {
this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos));
this.playerEntity.playerNetServerHandler
.sendPacket(new S23PacketBlockChange(worldserver, blockpos.offset(enumfacing)));
} }
this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos));
this.playerEntity.playerNetServerHandler
.sendPacket(new S23PacketBlockChange(worldserver, blockpos.offset(enumfacing)));
itemstack = this.playerEntity.inventory.getCurrentItem(); itemstack = this.playerEntity.inventory.getCurrentItem();
if (itemstack != null && itemstack.stackSize == 0) { if (itemstack != null && itemstack.stackSize == 0) {
this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = null; this.playerEntity.setHeldItem((ItemStack) null);
itemstack = null; itemstack = null;
} }
if (itemstack == null || itemstack.getMaxItemUseDuration() == 0) {
this.playerEntity.isChangingQuantityOnly = true;
this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = ItemStack
.copyItemStack(this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem]);
Slot slot = this.playerEntity.openContainer.getSlotFromInventory(this.playerEntity.inventory,
this.playerEntity.inventory.currentItem);
this.playerEntity.openContainer.detectAndSendChanges();
this.playerEntity.isChangingQuantityOnly = false;
if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(),
c08packetplayerblockplacement.getStack())) {
this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber,
this.playerEntity.inventory.getCurrentItem()));
}
}
} }
public void handleSpectate(C18PacketSpectate c18packetspectate) { public void handleSpectate(C18PacketSpectate c18packetspectate) {
@ -796,7 +794,7 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable {
break; break;
case STOP_SLEEPING: case STOP_SLEEPING:
this.playerEntity.wakeUpPlayer(false, true, true); this.playerEntity.wakeUpPlayer(false, true, true);
this.hasMoved = false; this.targetPos = new Vec3(this.playerEntity.posX, this.playerEntity.posY, this.playerEntity.posZ);
break; break;
case RIDING_JUMP: case RIDING_JUMP:
if (this.playerEntity.ridingEntity instanceof EntityHorse) { if (this.playerEntity.ridingEntity instanceof EntityHorse) {
@ -865,6 +863,24 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable {
} }
public void processUseItem(CPacketUseItem packetIn) {
// TODO: implement offhand
WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
EnumHand enumhand = packetIn.getHand();
ItemStack itemstack = this.playerEntity.inventory.getCurrentItem();
this.playerEntity.markPlayerActive();
if (itemstack != null) {
this.playerEntity.theItemInWorldManager.processRightClick(playerEntity, worldserver, itemstack, enumhand);
itemstack = this.playerEntity.inventory.getCurrentItem();
if (itemstack != null && itemstack.stackSize == 0) {
this.playerEntity.setHeldItem((ItemStack) null);
itemstack = null;
}
}
}
/** /**
* + * +
* Processes the client status updates: respawn attempt from * Processes the client status updates: respawn attempt from
@ -1054,28 +1070,27 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable {
this.playerEntity.markPlayerActive(); this.playerEntity.markPlayerActive();
WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
BlockPos blockpos = c12packetupdatesign.getPosition(); BlockPos blockpos = c12packetupdatesign.getPosition();
if (worldserver.isBlockLoaded(blockpos)) { if (worldserver.isBlockLoaded(blockpos)) {
TileEntity tileentity = worldserver.getTileEntity(blockpos); TileEntity tileentity = worldserver.getTileEntity(blockpos);
if (!(tileentity instanceof TileEntitySign)) { if (!(tileentity instanceof TileEntitySign)) {
return; return;
} }
TileEntitySign tileentitysign = (TileEntitySign) tileentity; TileEntitySign tileentitysign = (TileEntitySign) tileentity;
if (!tileentitysign.getIsEditable() || tileentitysign.getPlayer() != this.playerEntity) { if (!tileentitysign.getIsEditable() || tileentitysign.getPlayer() != this.playerEntity) {
this.serverController.logWarning( this.serverController.logWarning(
"Player " + this.playerEntity.getName() + " just tried to change non-editable sign"); "Player " + this.playerEntity.getName() + " just tried to change non-editable sign");
return; return;
} }
IChatComponent[] aichatcomponent = c12packetupdatesign.getLines(); String[] astring = c12packetupdatesign.getLines();
for (int i = 0; i < aichatcomponent.length; ++i) { for (int i = 0; i < astring.length; ++i) {
String s = EnumChatFormatting.getTextWithoutFormattingCodes(aichatcomponent[i].getUnformattedText()); tileentitysign.signText[i] = new ChatComponentText(
if (this.serverController.worldServers[0].getWorldInfo().getGameRulesInstance() EnumChatFormatting.getTextWithoutFormattingCodes(astring[i]));
.getBoolean("colorCodes")) {
s = net.minecraft.util.StringUtils.translateControlCodesAlternate(s);
}
tileentitysign.signText[i] = new ChatComponentText(s);
} }
tileentitysign.markDirty(); tileentitysign.markDirty();
@ -1084,6 +1099,22 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable {
} }
public void processConfirmTeleport(CPacketConfirmTeleport packetIn) {
if (packetIn.getTeleportId() == this.teleportId) {
this.playerEntity.setPositionAndRotation(this.targetPos.xCoord, this.targetPos.yCoord,
this.targetPos.zCoord, this.playerEntity.rotationYaw, this.playerEntity.rotationPitch);
if (this.playerEntity.isInvulnerableDimensionChange()) {
this.lastGoodX = this.targetPos.xCoord;
this.lastGoodY = this.targetPos.yCoord;
this.lastGoodZ = this.targetPos.zCoord;
this.playerEntity.clearInvulnerableDimensionChange();
}
this.targetPos = null;
}
}
/** /**
* + * +
* Updates a players' ping statistics * Updates a players' ping statistics
@ -1116,7 +1147,7 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable {
*/ */
public void processTabComplete(C14PacketTabComplete c14packettabcomplete) { public void processTabComplete(C14PacketTabComplete c14packettabcomplete) {
List<String> lst = this.serverController.getTabCompletions(this.playerEntity, c14packettabcomplete.getMessage(), List<String> lst = this.serverController.getTabCompletions(this.playerEntity, c14packettabcomplete.getMessage(),
c14packettabcomplete.getTargetBlock()); c14packettabcomplete.getTargetBlock(), c14packettabcomplete.hasTargetBlock());
String[] fuckOff = new String[lst.size()]; String[] fuckOff = new String[lst.size()];
for (int i = 0; i < fuckOff.length; ++i) { for (int i = 0; i < fuckOff.length; ++i) {
fuckOff[i] = lst.get(i); fuckOff[i] = lst.get(i);

View File

@ -940,4 +940,10 @@ public class PacketBuffer extends ByteBuf {
return this.buf.toString(); return this.buf.toString();
} }
public void printBuffer() {
System.out.println(this.buf.toString());
for (int i = 0; i < this.buf.capacity(); i++) {
System.out.print(this.buf.getByte(i) + " ");
}
}
} }

View File

@ -0,0 +1,17 @@
package net.minecraft.network;
import net.minecraft.network.play.INetHandlerPlayServer;
public class PlaceholderPacketServerbound implements Packet<INetHandlerPlayServer> {
public PlaceholderPacketServerbound() {
}
public void readPacketData(PacketBuffer buf) {
}
public void writePacketData(PacketBuffer buf) {
}
public void processPacket(INetHandlerPlayServer handler) {
}
}

View File

@ -71,6 +71,7 @@ import net.minecraft.network.play.server.S46PacketSetCompressionLevel;
import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter; import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter;
import net.minecraft.network.play.server.S48PacketResourcePackSend; import net.minecraft.network.play.server.S48PacketResourcePackSend;
import net.minecraft.network.play.server.S49PacketUpdateEntityNBT; import net.minecraft.network.play.server.S49PacketUpdateEntityNBT;
import net.minecraft.network.play.server.SPacketUnloadChunk;
/** /**
* + * +
@ -500,4 +501,6 @@ public interface INetHandlerPlayClient extends INetHandler {
void handleResourcePack(S48PacketResourcePackSend var1); void handleResourcePack(S48PacketResourcePackSend var1);
void handleEntityNBT(S49PacketUpdateEntityNBT var1); void handleEntityNBT(S49PacketUpdateEntityNBT var1);
void handleUnloadChunk(SPacketUnloadChunk var1);
} }

View File

@ -24,6 +24,8 @@ import net.minecraft.network.play.client.C16PacketClientStatus;
import net.minecraft.network.play.client.C17PacketCustomPayload; import net.minecraft.network.play.client.C17PacketCustomPayload;
import net.minecraft.network.play.client.C18PacketSpectate; import net.minecraft.network.play.client.C18PacketSpectate;
import net.minecraft.network.play.client.C19PacketResourcePackStatus; import net.minecraft.network.play.client.C19PacketResourcePackStatus;
import net.minecraft.network.play.client.CPacketConfirmTeleport;
import net.minecraft.network.play.client.CPacketUseItem;
/** /**
* + * +
@ -201,7 +203,11 @@ public interface INetHandlerPlayServer extends INetHandler {
*/ */
void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement var1); void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement var1);
void processUseItem(CPacketUseItem var1);
void handleSpectate(C18PacketSpectate var1); void handleSpectate(C18PacketSpectate var1);
void handleResourcePackStatus(C19PacketResourcePackStatus var1); void handleResourcePackStatus(C19PacketResourcePackStatus var1);
void processConfirmTeleport(CPacketConfirmTeleport var1);
} }

View File

@ -7,6 +7,8 @@ import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayServer; import net.minecraft.network.play.INetHandlerPlayServer;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
/** /**
* + * +
@ -40,8 +42,8 @@ import net.minecraft.util.BlockPos;
public class C08PacketPlayerBlockPlacement implements Packet<INetHandlerPlayServer> { public class C08PacketPlayerBlockPlacement implements Packet<INetHandlerPlayServer> {
private static final BlockPos field_179726_a = new BlockPos(-1, -1, -1); private static final BlockPos field_179726_a = new BlockPos(-1, -1, -1);
private BlockPos position; private BlockPos position;
private int placedBlockDirection; private EnumFacing placedBlockDirection;
private ItemStack stack; private EnumHand hand;
private float facingX; private float facingX;
private float facingY; private float facingY;
private float facingZ; private float facingZ;
@ -49,18 +51,16 @@ public class C08PacketPlayerBlockPlacement implements Packet<INetHandlerPlayServ
public C08PacketPlayerBlockPlacement() { public C08PacketPlayerBlockPlacement() {
} }
public C08PacketPlayerBlockPlacement(ItemStack stackIn) { public C08PacketPlayerBlockPlacement(BlockPos positionIn, EnumFacing placedBlockDirectionIn,
this(field_179726_a, 255, stackIn, 0.0F, 0.0F, 0.0F);
}
public C08PacketPlayerBlockPlacement(BlockPos positionIn, int placedBlockDirectionIn, ItemStack stackIn,
float facingXIn, float facingYIn, float facingZIn) { float facingXIn, float facingYIn, float facingZIn) {
this.position = positionIn; this.position = positionIn;
this.placedBlockDirection = placedBlockDirectionIn; this.placedBlockDirection = placedBlockDirectionIn;
this.stack = stackIn != null ? stackIn.copy() : null;
this.facingX = facingXIn; this.facingX = facingXIn;
this.facingY = facingYIn; this.facingY = facingYIn;
this.facingZ = facingZIn; this.facingZ = facingZIn;
// TODO: implement offhand
this.hand = EnumHand.MAIN_HAND;
} }
/** /**
@ -69,8 +69,8 @@ public class C08PacketPlayerBlockPlacement implements Packet<INetHandlerPlayServ
*/ */
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.position = parPacketBuffer.readBlockPos(); this.position = parPacketBuffer.readBlockPos();
this.placedBlockDirection = parPacketBuffer.readUnsignedByte(); this.placedBlockDirection = (EnumFacing) parPacketBuffer.readEnumValue(EnumFacing.class);
this.stack = parPacketBuffer.readItemStackFromBuffer(); this.hand = (EnumHand) parPacketBuffer.readEnumValue(EnumHand.class);
this.facingX = (float) parPacketBuffer.readUnsignedByte() / 16.0F; this.facingX = (float) parPacketBuffer.readUnsignedByte() / 16.0F;
this.facingY = (float) parPacketBuffer.readUnsignedByte() / 16.0F; this.facingY = (float) parPacketBuffer.readUnsignedByte() / 16.0F;
this.facingZ = (float) parPacketBuffer.readUnsignedByte() / 16.0F; this.facingZ = (float) parPacketBuffer.readUnsignedByte() / 16.0F;
@ -82,8 +82,8 @@ public class C08PacketPlayerBlockPlacement implements Packet<INetHandlerPlayServ
*/ */
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeBlockPos(this.position); parPacketBuffer.writeBlockPos(this.position);
parPacketBuffer.writeByte(this.placedBlockDirection); parPacketBuffer.writeEnumValue(this.placedBlockDirection);
parPacketBuffer.writeItemStackToBuffer(this.stack); parPacketBuffer.writeEnumValue(this.hand);
parPacketBuffer.writeByte((int) (this.facingX * 16.0F)); parPacketBuffer.writeByte((int) (this.facingX * 16.0F));
parPacketBuffer.writeByte((int) (this.facingY * 16.0F)); parPacketBuffer.writeByte((int) (this.facingY * 16.0F));
parPacketBuffer.writeByte((int) (this.facingZ * 16.0F)); parPacketBuffer.writeByte((int) (this.facingZ * 16.0F));
@ -97,42 +97,27 @@ public class C08PacketPlayerBlockPlacement implements Packet<INetHandlerPlayServ
inethandlerplayserver.processPlayerBlockPlacement(this); inethandlerplayserver.processPlayerBlockPlacement(this);
} }
public BlockPos getPosition() { public BlockPos getPos() {
return this.position; return this.position;
} }
public int getPlacedBlockDirection() { public EnumFacing getDirection() {
return this.placedBlockDirection; return this.placedBlockDirection;
} }
public ItemStack getStack() { public EnumHand getHand() {
return this.stack; return this.hand;
} }
/** public float getFacingX() {
* +
* Returns the offset from xPosition where the actual click took
* place.
*/
public float getPlacedBlockOffsetX() {
return this.facingX; return this.facingX;
} }
/** public float getFacingY() {
* +
* Returns the offset from yPosition where the actual click took
* place.
*/
public float getPlacedBlockOffsetY() {
return this.facingY; return this.facingY;
} }
/** public float getFacingZ() {
* +
* Returns the offset from zPosition where the actual click took
* place.
*/
public float getPlacedBlockOffsetZ() {
return this.facingZ; return this.facingZ;
} }
} }

View File

@ -5,6 +5,7 @@ import java.io.IOException;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayServer; import net.minecraft.network.play.INetHandlerPlayServer;
import net.minecraft.util.EnumHand;
/** /**
* + * +
@ -36,11 +37,23 @@ import net.minecraft.network.play.INetHandlerPlayServer;
* *
*/ */
public class C0APacketAnimation implements Packet<INetHandlerPlayServer> { public class C0APacketAnimation implements Packet<INetHandlerPlayServer> {
private EnumHand hand;
public C0APacketAnimation() {
// TODO: implement offhand
hand = EnumHand.MAIN_HAND;
}
public C0APacketAnimation(EnumHand hand) {
this.hand = hand;
}
/** /**
* + * +
* Reads the raw packet data from the data stream. * Reads the raw packet data from the data stream.
*/ */
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.hand = (EnumHand) parPacketBuffer.readEnumValue(EnumHand.class);
} }
/** /**
@ -48,6 +61,7 @@ public class C0APacketAnimation implements Packet<INetHandlerPlayServer> {
* Writes the raw packet data to the data stream. * Writes the raw packet data to the data stream.
*/ */
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeEnumValue(this.hand);
} }
/** /**

View File

@ -92,8 +92,8 @@ public class C0BPacketEntityAction implements Packet<INetHandlerPlayServer> {
} }
public static enum Action { public static enum Action {
START_SNEAKING, STOP_SNEAKING, STOP_SLEEPING, START_SPRINTING, STOP_SPRINTING, RIDING_JUMP, OPEN_INVENTORY, START_SNEAKING, STOP_SNEAKING, STOP_SLEEPING, START_SPRINTING, STOP_SPRINTING, RIDING_JUMP, STOP_RIDING_JUMP,
NOTHING, OPEN_INVENTORY,
START_FALL_FLYING; START_FALL_FLYING;
} }
} }

View File

@ -39,14 +39,15 @@ import net.minecraft.util.IChatComponent;
*/ */
public class C12PacketUpdateSign implements Packet<INetHandlerPlayServer> { public class C12PacketUpdateSign implements Packet<INetHandlerPlayServer> {
private BlockPos pos; private BlockPos pos;
private IChatComponent[] lines; private String[] lines;
public C12PacketUpdateSign() { public C12PacketUpdateSign() {
} }
public C12PacketUpdateSign(BlockPos pos, IChatComponent[] lines) { public C12PacketUpdateSign(BlockPos pos, IChatComponent[] lines) {
this.pos = pos; this.pos = pos;
this.lines = new IChatComponent[] { lines[0], lines[1], lines[2], lines[3] }; this.lines = new String[] { lines[0].getUnformattedText(), lines[1].getUnformattedText(),
lines[2].getUnformattedText(), lines[3].getUnformattedText() };
} }
/** /**
@ -55,29 +56,23 @@ public class C12PacketUpdateSign implements Packet<INetHandlerPlayServer> {
*/ */
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.pos = parPacketBuffer.readBlockPos(); this.pos = parPacketBuffer.readBlockPos();
this.lines = new IChatComponent[4]; this.lines = new String[4];
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
String s = parPacketBuffer.readStringFromBuffer(384); this.lines[i] = parPacketBuffer.readStringFromBuffer(384);
IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s);
this.lines[i] = ichatcomponent;
} }
} }
/** /**
* + * +
* Writes the raw packet data to the data stream. * Writes the raw packet data to the data stream.
*/ */
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { public void writePacketData(PacketBuffer buf) throws IOException {
parPacketBuffer.writeBlockPos(this.pos); buf.writeBlockPos(this.pos);
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
IChatComponent ichatcomponent = this.lines[i]; buf.writeString(this.lines[i]);
String s = IChatComponent.Serializer.componentToJson(ichatcomponent);
parPacketBuffer.writeString(s);
} }
} }
/** /**
@ -92,7 +87,7 @@ public class C12PacketUpdateSign implements Packet<INetHandlerPlayServer> {
return this.pos; return this.pos;
} }
public IChatComponent[] getLines() { public String[] getLines() {
return this.lines; return this.lines;
} }
} }

View File

@ -41,15 +41,12 @@ import net.minecraft.util.BlockPos;
public class C14PacketTabComplete implements Packet<INetHandlerPlayServer> { public class C14PacketTabComplete implements Packet<INetHandlerPlayServer> {
private String message; private String message;
private BlockPos targetBlock; private BlockPos targetBlock;
private boolean hasTargetBlock;
public C14PacketTabComplete() { public C14PacketTabComplete() {
} }
public C14PacketTabComplete(String msg) { public C14PacketTabComplete(String msg, BlockPos target, boolean hasTargetBlockIn) {
this(msg, (BlockPos) null);
}
public C14PacketTabComplete(String msg, BlockPos target) {
this.message = msg; this.message = msg;
this.targetBlock = target; this.targetBlock = target;
} }
@ -60,6 +57,7 @@ public class C14PacketTabComplete implements Packet<INetHandlerPlayServer> {
*/ */
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.message = parPacketBuffer.readStringFromBuffer(32767); this.message = parPacketBuffer.readStringFromBuffer(32767);
this.hasTargetBlock = parPacketBuffer.readBoolean();
boolean flag = parPacketBuffer.readBoolean(); boolean flag = parPacketBuffer.readBoolean();
if (flag) { if (flag) {
this.targetBlock = parPacketBuffer.readBlockPos(); this.targetBlock = parPacketBuffer.readBlockPos();
@ -73,6 +71,7 @@ public class C14PacketTabComplete implements Packet<INetHandlerPlayServer> {
*/ */
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeString(StringUtils.substring(this.message, 0, 32767)); parPacketBuffer.writeString(StringUtils.substring(this.message, 0, 32767));
parPacketBuffer.writeBoolean(this.hasTargetBlock);
boolean flag = this.targetBlock != null; boolean flag = this.targetBlock != null;
parPacketBuffer.writeBoolean(flag); parPacketBuffer.writeBoolean(flag);
if (flag) { if (flag) {
@ -96,4 +95,8 @@ public class C14PacketTabComplete implements Packet<INetHandlerPlayServer> {
public BlockPos getTargetBlock() { public BlockPos getTargetBlock() {
return this.targetBlock; return this.targetBlock;
} }
public boolean hasTargetBlock() {
return this.hasTargetBlock;
}
} }

View File

@ -5,6 +5,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayServer; import net.minecraft.network.play.INetHandlerPlayServer;
import net.minecraft.util.EnumHandSide;
/** /**
* + * +
@ -37,10 +38,12 @@ import net.minecraft.network.play.INetHandlerPlayServer;
*/ */
public class C15PacketClientSettings implements Packet<INetHandlerPlayServer> { public class C15PacketClientSettings implements Packet<INetHandlerPlayServer> {
private String lang; private String lang;
// this is supposed to be an enum
private int view; private int view;
private EntityPlayer.EnumChatVisibility chatVisibility; private EntityPlayer.EnumChatVisibility chatVisibility;
private boolean enableColors; private boolean enableColors;
private int modelPartFlags; private int modelPartFlags;
private EnumHandSide mainHand;
public C15PacketClientSettings() { public C15PacketClientSettings() {
} }
@ -52,6 +55,7 @@ public class C15PacketClientSettings implements Packet<INetHandlerPlayServer> {
this.chatVisibility = chatVisibilityIn; this.chatVisibility = chatVisibilityIn;
this.enableColors = enableColorsIn; this.enableColors = enableColorsIn;
this.modelPartFlags = modelPartFlagsIn; this.modelPartFlags = modelPartFlagsIn;
this.mainHand = EnumHandSide.RIGHT; // TODO: implement offhand
} }
/** /**
@ -60,10 +64,11 @@ public class C15PacketClientSettings implements Packet<INetHandlerPlayServer> {
*/ */
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.lang = parPacketBuffer.readStringFromBuffer(7); this.lang = parPacketBuffer.readStringFromBuffer(7);
this.view = parPacketBuffer.readByte(); this.view = parPacketBuffer.readVarIntFromBuffer();
this.chatVisibility = EntityPlayer.EnumChatVisibility.getEnumChatVisibility(parPacketBuffer.readByte()); this.chatVisibility = EntityPlayer.EnumChatVisibility.getEnumChatVisibility(parPacketBuffer.readByte());
this.enableColors = parPacketBuffer.readBoolean(); this.enableColors = parPacketBuffer.readBoolean();
this.modelPartFlags = parPacketBuffer.readUnsignedByte(); this.modelPartFlags = parPacketBuffer.readUnsignedByte();
this.mainHand = (EnumHandSide) parPacketBuffer.readEnumValue(EnumHandSide.class);
} }
/** /**
@ -72,10 +77,11 @@ public class C15PacketClientSettings implements Packet<INetHandlerPlayServer> {
*/ */
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeString(this.lang); parPacketBuffer.writeString(this.lang);
parPacketBuffer.writeByte(this.view); parPacketBuffer.writeVarIntToBuffer(this.view);
parPacketBuffer.writeByte(this.chatVisibility.getChatVisibility()); parPacketBuffer.writeByte(this.chatVisibility.getChatVisibility());
parPacketBuffer.writeBoolean(this.enableColors); parPacketBuffer.writeBoolean(this.enableColors);
parPacketBuffer.writeByte(this.modelPartFlags); parPacketBuffer.writeByte(this.modelPartFlags);
parPacketBuffer.writeEnumValue(this.mainHand);
} }
/** /**

View File

@ -0,0 +1,42 @@
package net.minecraft.network.play.client;
import java.io.IOException;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayServer;
public class CPacketConfirmTeleport implements Packet<INetHandlerPlayServer> {
private int telportId;
public CPacketConfirmTeleport() {
}
public CPacketConfirmTeleport(int teleportIdIn) {
this.telportId = teleportIdIn;
}
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException {
this.telportId = buf.readVarIntFromBuffer();
}
/**
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer buf) throws IOException {
buf.writeVarIntToBuffer(this.telportId);
}
/**
* Passes this Packet on to the NetHandler for processing.
*/
public void processPacket(INetHandlerPlayServer handler) {
handler.processConfirmTeleport(this);
}
public int getTeleportId() {
return this.telportId;
}
}

View File

@ -0,0 +1,7 @@
package net.minecraft.network.play.client;
import net.minecraft.network.PlaceholderPacketServerbound;
public class CPacketSteerBoat extends PlaceholderPacketServerbound {
}

View File

@ -0,0 +1,39 @@
package net.minecraft.network.play.client;
import java.io.IOException;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayServer;
import net.minecraft.util.EnumHand;
public class CPacketUseItem implements Packet<INetHandlerPlayServer> {
private EnumHand hand;
public CPacketUseItem() {
// TODO: implement offhand
this.hand = EnumHand.MAIN_HAND;
}
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException {
this.hand = (EnumHand) buf.readEnumValue(EnumHand.class);
}
/**
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer buf) throws IOException {
buf.writeEnumValue(this.hand);
}
public void processPacket(INetHandlerPlayServer handler) {
handler.processUseItem(this);
}
public EnumHand getHand() {
return this.hand;
}
}

View File

@ -0,0 +1,7 @@
package net.minecraft.network.play.client;
import net.minecraft.network.PlaceholderPacketServerbound;
public class CPacketVehicleMove extends PlaceholderPacketServerbound {
}

View File

@ -38,12 +38,14 @@ import net.minecraft.network.play.INetHandlerPlayClient;
*/ */
public class S04PacketEntityEquipment implements Packet<INetHandlerPlayClient> { public class S04PacketEntityEquipment implements Packet<INetHandlerPlayClient> {
private int entityID; private int entityID;
// this should be an enum
private int equipmentSlot; private int equipmentSlot;
private ItemStack itemStack; private ItemStack itemStack;
public S04PacketEntityEquipment() { public S04PacketEntityEquipment() {
} }
// TODO: implement offhand
public S04PacketEntityEquipment(int entityIDIn, int parInt1, ItemStack itemStackIn) { public S04PacketEntityEquipment(int entityIDIn, int parInt1, ItemStack itemStackIn) {
this.entityID = entityIDIn; this.entityID = entityIDIn;
this.equipmentSlot = parInt1; this.equipmentSlot = parInt1;
@ -57,6 +59,9 @@ public class S04PacketEntityEquipment implements Packet<INetHandlerPlayClient> {
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.entityID = parPacketBuffer.readVarIntFromBuffer(); this.entityID = parPacketBuffer.readVarIntFromBuffer();
this.equipmentSlot = parPacketBuffer.readShort(); this.equipmentSlot = parPacketBuffer.readShort();
if (this.equipmentSlot > 0) {
this.equipmentSlot--;
}
this.itemStack = parPacketBuffer.readItemStackFromBuffer(); this.itemStack = parPacketBuffer.readItemStackFromBuffer();
} }
@ -66,7 +71,7 @@ public class S04PacketEntityEquipment implements Packet<INetHandlerPlayClient> {
*/ */
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeVarIntToBuffer(this.entityID); parPacketBuffer.writeVarIntToBuffer(this.entityID);
parPacketBuffer.writeShort(this.equipmentSlot); parPacketBuffer.writeShort(this.equipmentSlot > 0 ? this.equipmentSlot + 1 : this.equipmentSlot);
parPacketBuffer.writeItemStackToBuffer(this.itemStack); parPacketBuffer.writeItemStackToBuffer(this.itemStack);
} }

View File

@ -44,18 +44,20 @@ public class S08PacketPlayerPosLook implements Packet<INetHandlerPlayClient> {
private float yaw; private float yaw;
private float pitch; private float pitch;
private Set<S08PacketPlayerPosLook.EnumFlags> field_179835_f; private Set<S08PacketPlayerPosLook.EnumFlags> field_179835_f;
private int teleportId;
public S08PacketPlayerPosLook() { public S08PacketPlayerPosLook() {
} }
public S08PacketPlayerPosLook(double xIn, double yIn, double zIn, float yawIn, float pitchIn, public S08PacketPlayerPosLook(double xIn, double yIn, double zIn, float yawIn, float pitchIn,
Set<S08PacketPlayerPosLook.EnumFlags> parSet) { Set<S08PacketPlayerPosLook.EnumFlags> parSet, int teleportIdIn) {
this.x = xIn; this.x = xIn;
this.y = yIn; this.y = yIn;
this.z = zIn; this.z = zIn;
this.yaw = yawIn; this.yaw = yawIn;
this.pitch = pitchIn; this.pitch = pitchIn;
this.field_179835_f = parSet; this.field_179835_f = parSet;
this.teleportId = teleportIdIn;
} }
/** /**
@ -69,6 +71,7 @@ public class S08PacketPlayerPosLook implements Packet<INetHandlerPlayClient> {
this.yaw = parPacketBuffer.readFloat(); this.yaw = parPacketBuffer.readFloat();
this.pitch = parPacketBuffer.readFloat(); this.pitch = parPacketBuffer.readFloat();
this.field_179835_f = S08PacketPlayerPosLook.EnumFlags.func_180053_a(parPacketBuffer.readUnsignedByte()); this.field_179835_f = S08PacketPlayerPosLook.EnumFlags.func_180053_a(parPacketBuffer.readUnsignedByte());
this.teleportId = parPacketBuffer.readVarIntFromBuffer();
} }
/** /**
@ -82,6 +85,7 @@ public class S08PacketPlayerPosLook implements Packet<INetHandlerPlayClient> {
parPacketBuffer.writeFloat(this.yaw); parPacketBuffer.writeFloat(this.yaw);
parPacketBuffer.writeFloat(this.pitch); parPacketBuffer.writeFloat(this.pitch);
parPacketBuffer.writeByte(S08PacketPlayerPosLook.EnumFlags.func_180056_a(this.field_179835_f)); parPacketBuffer.writeByte(S08PacketPlayerPosLook.EnumFlags.func_180056_a(this.field_179835_f));
parPacketBuffer.writeVarIntToBuffer(this.teleportId);
} }
/** /**
@ -116,6 +120,10 @@ public class S08PacketPlayerPosLook implements Packet<INetHandlerPlayClient> {
return this.field_179835_f; return this.field_179835_f;
} }
public int getTeleportId() {
return this.teleportId;
}
public static enum EnumFlags { public static enum EnumFlags {
X(0), Y(1), Z(2), Y_ROT(3), X_ROT(4); X(0), Y(1), Z(2), Y_ROT(3), X_ROT(4);

View File

@ -45,12 +45,11 @@ import net.minecraft.util.MathHelper;
public class S0CPacketSpawnPlayer implements Packet<INetHandlerPlayClient> { public class S0CPacketSpawnPlayer implements Packet<INetHandlerPlayClient> {
private int entityId; private int entityId;
private EaglercraftUUID playerId; private EaglercraftUUID playerId;
private int x; private double x;
private int y; private double y;
private int z; private double z;
private byte yaw; private byte yaw;
private byte pitch; private byte pitch;
private int currentItem;
private DataWatcher watcher; private DataWatcher watcher;
private List<DataWatcher.WatchableObject> field_148958_j; private List<DataWatcher.WatchableObject> field_148958_j;
@ -60,13 +59,11 @@ public class S0CPacketSpawnPlayer implements Packet<INetHandlerPlayClient> {
public S0CPacketSpawnPlayer(EntityPlayer player) { public S0CPacketSpawnPlayer(EntityPlayer player) {
this.entityId = player.getEntityId(); this.entityId = player.getEntityId();
this.playerId = player.getGameProfile().getId(); this.playerId = player.getGameProfile().getId();
this.x = MathHelper.floor_double(player.posX * 32.0D); this.x = player.posX;
this.y = MathHelper.floor_double(player.posY * 32.0D); this.z = player.posZ;
this.z = MathHelper.floor_double(player.posZ * 32.0D); this.y = player.posY;
this.yaw = (byte) ((int) (player.rotationYaw * 256.0F / 360.0F)); this.yaw = (byte) ((int) (player.rotationYaw * 256.0F / 360.0F));
this.pitch = (byte) ((int) (player.rotationPitch * 256.0F / 360.0F)); this.pitch = (byte) ((int) (player.rotationPitch * 256.0F / 360.0F));
ItemStack itemstack = player.inventory.getCurrentItem();
this.currentItem = itemstack == null ? 0 : Item.getIdFromItem(itemstack.getItem());
this.watcher = player.getDataWatcher(); this.watcher = player.getDataWatcher();
} }
@ -77,12 +74,11 @@ public class S0CPacketSpawnPlayer implements Packet<INetHandlerPlayClient> {
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.entityId = parPacketBuffer.readVarIntFromBuffer(); this.entityId = parPacketBuffer.readVarIntFromBuffer();
this.playerId = parPacketBuffer.readUuid(); this.playerId = parPacketBuffer.readUuid();
this.x = parPacketBuffer.readInt(); this.x = parPacketBuffer.readDouble();
this.y = parPacketBuffer.readInt(); this.y = parPacketBuffer.readDouble();
this.z = parPacketBuffer.readInt(); this.z = parPacketBuffer.readDouble();
this.yaw = parPacketBuffer.readByte(); this.yaw = parPacketBuffer.readByte();
this.pitch = parPacketBuffer.readByte(); this.pitch = parPacketBuffer.readByte();
this.currentItem = parPacketBuffer.readShort();
this.field_148958_j = DataWatcher.readWatchedListFromPacketBuffer(parPacketBuffer); this.field_148958_j = DataWatcher.readWatchedListFromPacketBuffer(parPacketBuffer);
} }
@ -93,12 +89,11 @@ public class S0CPacketSpawnPlayer implements Packet<INetHandlerPlayClient> {
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeVarIntToBuffer(this.entityId); parPacketBuffer.writeVarIntToBuffer(this.entityId);
parPacketBuffer.writeUuid(this.playerId); parPacketBuffer.writeUuid(this.playerId);
parPacketBuffer.writeInt(this.x); parPacketBuffer.writeDouble(this.x);
parPacketBuffer.writeInt(this.y); parPacketBuffer.writeDouble(this.y);
parPacketBuffer.writeInt(this.z); parPacketBuffer.writeDouble(this.z);
parPacketBuffer.writeByte(this.yaw); parPacketBuffer.writeByte(this.yaw);
parPacketBuffer.writeByte(this.pitch); parPacketBuffer.writeByte(this.pitch);
parPacketBuffer.writeShort(this.currentItem);
this.watcher.writeTo(parPacketBuffer); this.watcher.writeTo(parPacketBuffer);
} }
@ -122,19 +117,19 @@ public class S0CPacketSpawnPlayer implements Packet<INetHandlerPlayClient> {
return this.entityId; return this.entityId;
} }
public EaglercraftUUID getPlayer() { public EaglercraftUUID getUniqueId() {
return this.playerId; return this.playerId;
} }
public int getX() { public double getX() {
return this.x; return this.x;
} }
public int getY() { public double getY() {
return this.y; return this.y;
} }
public int getZ() { public double getZ() {
return this.z; return this.z;
} }
@ -145,8 +140,4 @@ public class S0CPacketSpawnPlayer implements Packet<INetHandlerPlayClient> {
public byte getPitch() { public byte getPitch() {
return this.pitch; return this.pitch;
} }
public int getCurrentItemID() {
return this.currentItem;
}
} }

View File

@ -2,6 +2,7 @@ package net.minecraft.network.play.server;
import java.io.IOException; import java.io.IOException;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
@ -39,9 +40,10 @@ import net.minecraft.util.MathHelper;
*/ */
public class S0EPacketSpawnObject implements Packet<INetHandlerPlayClient> { public class S0EPacketSpawnObject implements Packet<INetHandlerPlayClient> {
private int entityId; private int entityId;
private int x; private EaglercraftUUID uniqueId;
private int y; private double x;
private int z; private double y;
private double z;
private int speedX; private int speedX;
private int speedY; private int speedY;
private int speedZ; private int speedZ;
@ -59,47 +61,17 @@ public class S0EPacketSpawnObject implements Packet<INetHandlerPlayClient> {
public S0EPacketSpawnObject(Entity entityIn, int typeIn, int parInt1) { public S0EPacketSpawnObject(Entity entityIn, int typeIn, int parInt1) {
this.entityId = entityIn.getEntityId(); this.entityId = entityIn.getEntityId();
this.x = MathHelper.floor_double(entityIn.posX * 32.0D); this.uniqueId = entityIn.getUniqueID();
this.y = MathHelper.floor_double(entityIn.posY * 32.0D); this.y = entityIn.posY;
this.z = MathHelper.floor_double(entityIn.posZ * 32.0D); this.x = entityIn.posX;
this.z = entityIn.posZ;
this.pitch = MathHelper.floor_float(entityIn.rotationPitch * 256.0F / 360.0F); this.pitch = MathHelper.floor_float(entityIn.rotationPitch * 256.0F / 360.0F);
this.yaw = MathHelper.floor_float(entityIn.rotationYaw * 256.0F / 360.0F); this.yaw = MathHelper.floor_float(entityIn.rotationYaw * 256.0F / 360.0F);
this.type = typeIn; this.type = typeIn;
this.field_149020_k = parInt1; this.field_149020_k = parInt1;
if (parInt1 > 0) { this.speedX = (int) (MathHelper.clamp_double(entityIn.motionX, -3.9D, 3.9D) * 8000.0D);
double d0 = entityIn.motionX; this.speedY = (int) (MathHelper.clamp_double(entityIn.motionY, -3.9D, 3.9D) * 8000.0D);
double d1 = entityIn.motionY; this.speedZ = (int) (MathHelper.clamp_double(entityIn.motionZ, -3.9D, 3.9D) * 8000.0D);
double d2 = entityIn.motionZ;
double d3 = 3.9D;
if (d0 < -d3) {
d0 = -d3;
}
if (d1 < -d3) {
d1 = -d3;
}
if (d2 < -d3) {
d2 = -d3;
}
if (d0 > d3) {
d0 = d3;
}
if (d1 > d3) {
d1 = d3;
}
if (d2 > d3) {
d2 = d3;
}
this.speedX = (int) (d0 * 8000.0D);
this.speedY = (int) (d1 * 8000.0D);
this.speedZ = (int) (d2 * 8000.0D);
}
} }
/** /**
@ -108,19 +80,17 @@ public class S0EPacketSpawnObject implements Packet<INetHandlerPlayClient> {
*/ */
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.entityId = parPacketBuffer.readVarIntFromBuffer(); this.entityId = parPacketBuffer.readVarIntFromBuffer();
this.uniqueId = parPacketBuffer.readUuid();
this.type = parPacketBuffer.readByte(); this.type = parPacketBuffer.readByte();
this.x = parPacketBuffer.readInt(); this.x = parPacketBuffer.readDouble();
this.y = parPacketBuffer.readInt(); this.y = parPacketBuffer.readDouble();
this.z = parPacketBuffer.readInt(); this.z = parPacketBuffer.readDouble();
this.pitch = parPacketBuffer.readByte(); this.pitch = parPacketBuffer.readByte();
this.yaw = parPacketBuffer.readByte(); this.yaw = parPacketBuffer.readByte();
this.field_149020_k = parPacketBuffer.readInt(); this.field_149020_k = parPacketBuffer.readInt();
if (this.field_149020_k > 0) { this.speedX = parPacketBuffer.readShort();
this.speedX = parPacketBuffer.readShort(); this.speedY = parPacketBuffer.readShort();
this.speedY = parPacketBuffer.readShort(); this.speedZ = parPacketBuffer.readShort();
this.speedZ = parPacketBuffer.readShort();
}
} }
/** /**
@ -129,19 +99,17 @@ public class S0EPacketSpawnObject implements Packet<INetHandlerPlayClient> {
*/ */
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeVarIntToBuffer(this.entityId); parPacketBuffer.writeVarIntToBuffer(this.entityId);
parPacketBuffer.writeUuid(this.uniqueId);
parPacketBuffer.writeByte(this.type); parPacketBuffer.writeByte(this.type);
parPacketBuffer.writeInt(this.x); parPacketBuffer.writeDouble(this.x);
parPacketBuffer.writeInt(this.y); parPacketBuffer.writeDouble(this.y);
parPacketBuffer.writeInt(this.z); parPacketBuffer.writeDouble(this.z);
parPacketBuffer.writeByte(this.pitch); parPacketBuffer.writeByte(this.pitch);
parPacketBuffer.writeByte(this.yaw); parPacketBuffer.writeByte(this.yaw);
parPacketBuffer.writeInt(this.field_149020_k); parPacketBuffer.writeInt(this.field_149020_k);
if (this.field_149020_k > 0) { parPacketBuffer.writeShort(this.speedX);
parPacketBuffer.writeShort(this.speedX); parPacketBuffer.writeShort(this.speedY);
parPacketBuffer.writeShort(this.speedY); parPacketBuffer.writeShort(this.speedZ);
parPacketBuffer.writeShort(this.speedZ);
}
} }
/** /**
@ -156,15 +124,19 @@ public class S0EPacketSpawnObject implements Packet<INetHandlerPlayClient> {
return this.entityId; return this.entityId;
} }
public int getX() { public EaglercraftUUID getUniqueId() {
return this.uniqueId;
}
public double getX() {
return this.x; return this.x;
} }
public int getY() { public double getY() {
return this.y; return this.y;
} }
public int getZ() { public double getZ() {
return this.z; return this.z;
} }

View File

@ -3,6 +3,7 @@ package net.minecraft.network.play.server;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.entity.DataWatcher; import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
@ -42,10 +43,11 @@ import net.minecraft.util.MathHelper;
*/ */
public class S0FPacketSpawnMob implements Packet<INetHandlerPlayClient> { public class S0FPacketSpawnMob implements Packet<INetHandlerPlayClient> {
private int entityId; private int entityId;
private EaglercraftUUID uniqueId;
private int type; private int type;
private int x; private double x;
private int y; private double y;
private int z; private double z;
private int velocityX; private int velocityX;
private int velocityY; private int velocityY;
private int velocityZ; private int velocityZ;
@ -60,10 +62,11 @@ public class S0FPacketSpawnMob implements Packet<INetHandlerPlayClient> {
public S0FPacketSpawnMob(EntityLivingBase entityIn) { public S0FPacketSpawnMob(EntityLivingBase entityIn) {
this.entityId = entityIn.getEntityId(); this.entityId = entityIn.getEntityId();
this.uniqueId = entityIn.getUniqueID();
this.type = (byte) EntityList.getEntityID(entityIn); this.type = (byte) EntityList.getEntityID(entityIn);
this.x = MathHelper.floor_double(entityIn.posX * 32.0D); this.x = entityIn.posX;
this.y = MathHelper.floor_double(entityIn.posY * 32.0D); this.y = entityIn.posY;
this.z = MathHelper.floor_double(entityIn.posZ * 32.0D); this.z = entityIn.posZ;
this.yaw = (byte) ((int) (entityIn.rotationYaw * 256.0F / 360.0F)); this.yaw = (byte) ((int) (entityIn.rotationYaw * 256.0F / 360.0F));
this.pitch = (byte) ((int) (entityIn.rotationPitch * 256.0F / 360.0F)); this.pitch = (byte) ((int) (entityIn.rotationPitch * 256.0F / 360.0F));
this.headPitch = (byte) ((int) (entityIn.rotationYawHead * 256.0F / 360.0F)); this.headPitch = (byte) ((int) (entityIn.rotationYawHead * 256.0F / 360.0F));
@ -71,6 +74,7 @@ public class S0FPacketSpawnMob implements Packet<INetHandlerPlayClient> {
double d1 = entityIn.motionX; double d1 = entityIn.motionX;
double d2 = entityIn.motionY; double d2 = entityIn.motionY;
double d3 = entityIn.motionZ; double d3 = entityIn.motionZ;
if (d1 < -d0) { if (d1 < -d0) {
d1 = -d0; d1 = -d0;
} }
@ -108,9 +112,9 @@ public class S0FPacketSpawnMob implements Packet<INetHandlerPlayClient> {
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.entityId = parPacketBuffer.readVarIntFromBuffer(); this.entityId = parPacketBuffer.readVarIntFromBuffer();
this.type = parPacketBuffer.readByte() & 255; this.type = parPacketBuffer.readByte() & 255;
this.x = parPacketBuffer.readInt(); this.x = parPacketBuffer.readDouble();
this.y = parPacketBuffer.readInt(); this.y = parPacketBuffer.readDouble();
this.z = parPacketBuffer.readInt(); this.z = parPacketBuffer.readDouble();
this.yaw = parPacketBuffer.readByte(); this.yaw = parPacketBuffer.readByte();
this.pitch = parPacketBuffer.readByte(); this.pitch = parPacketBuffer.readByte();
this.headPitch = parPacketBuffer.readByte(); this.headPitch = parPacketBuffer.readByte();
@ -127,9 +131,9 @@ public class S0FPacketSpawnMob implements Packet<INetHandlerPlayClient> {
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeVarIntToBuffer(this.entityId); parPacketBuffer.writeVarIntToBuffer(this.entityId);
parPacketBuffer.writeByte(this.type & 255); parPacketBuffer.writeByte(this.type & 255);
parPacketBuffer.writeInt(this.x); parPacketBuffer.writeDouble(this.x);
parPacketBuffer.writeInt(this.y); parPacketBuffer.writeDouble(this.y);
parPacketBuffer.writeInt(this.z); parPacketBuffer.writeDouble(this.z);
parPacketBuffer.writeByte(this.yaw); parPacketBuffer.writeByte(this.yaw);
parPacketBuffer.writeByte(this.pitch); parPacketBuffer.writeByte(this.pitch);
parPacketBuffer.writeByte(this.headPitch); parPacketBuffer.writeByte(this.headPitch);
@ -159,19 +163,23 @@ public class S0FPacketSpawnMob implements Packet<INetHandlerPlayClient> {
return this.entityId; return this.entityId;
} }
public EaglercraftUUID getUniqueId() {
return this.uniqueId;
}
public int getEntityType() { public int getEntityType() {
return this.type; return this.type;
} }
public int getX() { public double getX() {
return this.x; return this.x;
} }
public int getY() { public double getY() {
return this.y; return this.y;
} }
public int getZ() { public double getZ() {
return this.z; return this.z;
} }

View File

@ -39,9 +39,9 @@ import net.minecraft.util.MathHelper;
*/ */
public class S11PacketSpawnExperienceOrb implements Packet<INetHandlerPlayClient> { public class S11PacketSpawnExperienceOrb implements Packet<INetHandlerPlayClient> {
private int entityID; private int entityID;
private int posX; private double posX;
private int posY; private double posY;
private int posZ; private double posZ;
private int xpValue; private int xpValue;
public S11PacketSpawnExperienceOrb() { public S11PacketSpawnExperienceOrb() {
@ -49,9 +49,9 @@ public class S11PacketSpawnExperienceOrb implements Packet<INetHandlerPlayClient
public S11PacketSpawnExperienceOrb(EntityXPOrb xpOrb) { public S11PacketSpawnExperienceOrb(EntityXPOrb xpOrb) {
this.entityID = xpOrb.getEntityId(); this.entityID = xpOrb.getEntityId();
this.posX = MathHelper.floor_double(xpOrb.posX * 32.0D); this.posZ = xpOrb.posZ;
this.posY = MathHelper.floor_double(xpOrb.posY * 32.0D); this.posX = xpOrb.posX;
this.posZ = MathHelper.floor_double(xpOrb.posZ * 32.0D); this.posY = xpOrb.posY;
this.xpValue = xpOrb.getXpValue(); this.xpValue = xpOrb.getXpValue();
} }
@ -61,9 +61,9 @@ public class S11PacketSpawnExperienceOrb implements Packet<INetHandlerPlayClient
*/ */
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.entityID = parPacketBuffer.readVarIntFromBuffer(); this.entityID = parPacketBuffer.readVarIntFromBuffer();
this.posX = parPacketBuffer.readInt(); this.posX = parPacketBuffer.readDouble();
this.posY = parPacketBuffer.readInt(); this.posY = parPacketBuffer.readDouble();
this.posZ = parPacketBuffer.readInt(); this.posZ = parPacketBuffer.readDouble();
this.xpValue = parPacketBuffer.readShort(); this.xpValue = parPacketBuffer.readShort();
} }
@ -73,9 +73,9 @@ public class S11PacketSpawnExperienceOrb implements Packet<INetHandlerPlayClient
*/ */
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeVarIntToBuffer(this.entityID); parPacketBuffer.writeVarIntToBuffer(this.entityID);
parPacketBuffer.writeInt(this.posX); parPacketBuffer.writeDouble(this.posX);
parPacketBuffer.writeInt(this.posY); parPacketBuffer.writeDouble(this.posY);
parPacketBuffer.writeInt(this.posZ); parPacketBuffer.writeDouble(this.posZ);
parPacketBuffer.writeShort(this.xpValue); parPacketBuffer.writeShort(this.xpValue);
} }
@ -91,15 +91,15 @@ public class S11PacketSpawnExperienceOrb implements Packet<INetHandlerPlayClient
return this.entityID; return this.entityID;
} }
public int getX() { public double getX() {
return this.posX; return this.posX;
} }
public int getY() { public double getY() {
return this.posY; return this.posY;
} }
public int getZ() { public double getZ() {
return this.posZ; return this.posZ;
} }

View File

@ -1,51 +1,21 @@
package net.minecraft.network.play.server; package net.minecraft.network.play.server;
import java.io.IOException; import java.io.IOException;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient; import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraft.world.World; import net.minecraft.world.World;
/**
* +
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
*
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
*
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, hoosiertransfer,
* ayunami2000. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public class S14PacketEntity implements Packet<INetHandlerPlayClient> { public class S14PacketEntity implements Packet<INetHandlerPlayClient> {
protected int entityId; protected int entityId;
protected byte posX; protected int posX;
protected byte posY; protected int posY;
protected byte posZ; protected int posZ;
protected byte yaw; protected byte yaw;
protected byte pitch; protected byte pitch;
protected boolean onGround; protected boolean onGround;
protected boolean field_149069_g; protected boolean rotating;
public S14PacketEntity() { public S14PacketEntity() {
} }
@ -55,27 +25,24 @@ public class S14PacketEntity implements Packet<INetHandlerPlayClient> {
} }
/** /**
* +
* Reads the raw packet data from the data stream. * Reads the raw packet data from the data stream.
*/ */
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { public void readPacketData(PacketBuffer buf) throws IOException {
this.entityId = parPacketBuffer.readVarIntFromBuffer(); this.entityId = buf.readVarIntFromBuffer();
} }
/** /**
* +
* Writes the raw packet data to the data stream. * Writes the raw packet data to the data stream.
*/ */
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { public void writePacketData(PacketBuffer buf) throws IOException {
parPacketBuffer.writeVarIntToBuffer(this.entityId); buf.writeVarIntToBuffer(this.entityId);
} }
/** /**
* +
* Passes this Packet on to the NetHandler for processing. * Passes this Packet on to the NetHandler for processing.
*/ */
public void processPacket(INetHandlerPlayClient inethandlerplayclient) { public void processPacket(INetHandlerPlayClient handler) {
inethandlerplayclient.handleEntityMovement(this); handler.handleEntityMovement(this);
} }
public String toString() { public String toString() {
@ -86,28 +53,28 @@ public class S14PacketEntity implements Packet<INetHandlerPlayClient> {
return worldIn.getEntityByID(this.entityId); return worldIn.getEntityByID(this.entityId);
} }
public byte func_149062_c() { public int getX() {
return this.posX; return this.posX;
} }
public byte func_149061_d() { public int getY() {
return this.posY; return this.posY;
} }
public byte func_149064_e() { public int getZ() {
return this.posZ; return this.posZ;
} }
public byte func_149066_f() { public byte getYaw() {
return this.yaw; return this.yaw;
} }
public byte func_149063_g() { public byte getPitch() {
return this.pitch; return this.pitch;
} }
public boolean func_149060_h() { public boolean isRotating() {
return this.field_149069_g; return this.rotating;
} }
public boolean getOnGround() { public boolean getOnGround() {
@ -118,118 +85,94 @@ public class S14PacketEntity implements Packet<INetHandlerPlayClient> {
public S15PacketEntityRelMove() { public S15PacketEntityRelMove() {
} }
public S15PacketEntityRelMove(int entityIdIn, byte x, byte y, byte z, boolean onGroundIn) { public S15PacketEntityRelMove(int entityIdIn, long xIn, long yIn, long zIn, boolean onGroundIn) {
super(entityIdIn); super(entityIdIn);
this.posX = x; this.posX = (int) xIn;
this.posY = y; this.posY = (int) yIn;
this.posZ = z; this.posZ = (int) zIn;
this.onGround = onGroundIn; this.onGround = onGroundIn;
} }
/** public void readPacketData(PacketBuffer buf) throws IOException {
* + super.readPacketData(buf);
* Reads the raw packet data from the data stream. this.posX = buf.readShort();
*/ this.posY = buf.readShort();
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { this.posZ = buf.readShort();
super.readPacketData(parPacketBuffer); this.onGround = buf.readBoolean();
this.posX = parPacketBuffer.readByte();
this.posY = parPacketBuffer.readByte();
this.posZ = parPacketBuffer.readByte();
this.onGround = parPacketBuffer.readBoolean();
} }
/** public void writePacketData(PacketBuffer buf) throws IOException {
* + super.writePacketData(buf);
* Writes the raw packet data to the data stream. buf.writeShort(this.posX);
*/ buf.writeShort(this.posY);
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { buf.writeShort(this.posZ);
super.writePacketData(parPacketBuffer); buf.writeBoolean(this.onGround);
parPacketBuffer.writeByte(this.posX);
parPacketBuffer.writeByte(this.posY);
parPacketBuffer.writeByte(this.posZ);
parPacketBuffer.writeBoolean(this.onGround);
} }
} }
public static class S16PacketEntityLook extends S14PacketEntity { public static class S16PacketEntityLook extends S14PacketEntity {
public S16PacketEntityLook() { public S16PacketEntityLook() {
this.field_149069_g = true; this.rotating = true;
} }
public S16PacketEntityLook(int entityIdIn, byte yawIn, byte pitchIn, boolean onGroundIn) { public S16PacketEntityLook(int entityIdIn, byte yawIn, byte pitchIn, boolean onGroundIn) {
super(entityIdIn); super(entityIdIn);
this.yaw = yawIn; this.yaw = yawIn;
this.pitch = pitchIn; this.pitch = pitchIn;
this.field_149069_g = true; this.rotating = true;
this.onGround = onGroundIn; this.onGround = onGroundIn;
} }
/** public void readPacketData(PacketBuffer buf) throws IOException {
* + super.readPacketData(buf);
* Reads the raw packet data from the data stream. this.yaw = buf.readByte();
*/ this.pitch = buf.readByte();
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { this.onGround = buf.readBoolean();
super.readPacketData(parPacketBuffer);
this.yaw = parPacketBuffer.readByte();
this.pitch = parPacketBuffer.readByte();
this.onGround = parPacketBuffer.readBoolean();
} }
/** public void writePacketData(PacketBuffer buf) throws IOException {
* + super.writePacketData(buf);
* Writes the raw packet data to the data stream. buf.writeByte(this.yaw);
*/ buf.writeByte(this.pitch);
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { buf.writeBoolean(this.onGround);
super.writePacketData(parPacketBuffer);
parPacketBuffer.writeByte(this.yaw);
parPacketBuffer.writeByte(this.pitch);
parPacketBuffer.writeBoolean(this.onGround);
} }
} }
public static class S17PacketEntityLookMove extends S14PacketEntity { public static class S17PacketEntityLookMove extends S14PacketEntity {
public S17PacketEntityLookMove() { public S17PacketEntityLookMove() {
this.field_149069_g = true; this.rotating = true;
} }
public S17PacketEntityLookMove(int parInt1, byte parByte1, byte parByte2, byte parByte3, byte parByte4, public S17PacketEntityLookMove(int entityIdIn, long xIn, long yIn, long zIn, byte yawIn, byte pitchIn,
byte parByte5, boolean parFlag) { boolean onGroundIn) {
super(parInt1); super(entityIdIn);
this.posX = parByte1; this.posX = (int) xIn;
this.posY = parByte2; this.posY = (int) yIn;
this.posZ = parByte3; this.posZ = (int) zIn;
this.yaw = parByte4; this.yaw = yawIn;
this.pitch = parByte5; this.pitch = pitchIn;
this.onGround = parFlag; this.onGround = onGroundIn;
this.field_149069_g = true; this.rotating = true;
} }
/** public void readPacketData(PacketBuffer buf) throws IOException {
* + super.readPacketData(buf);
* Reads the raw packet data from the data stream. this.posX = buf.readShort();
*/ this.posY = buf.readShort();
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { this.posZ = buf.readShort();
super.readPacketData(parPacketBuffer); this.yaw = buf.readByte();
this.posX = parPacketBuffer.readByte(); this.pitch = buf.readByte();
this.posY = parPacketBuffer.readByte(); this.onGround = buf.readBoolean();
this.posZ = parPacketBuffer.readByte();
this.yaw = parPacketBuffer.readByte();
this.pitch = parPacketBuffer.readByte();
this.onGround = parPacketBuffer.readBoolean();
} }
/** public void writePacketData(PacketBuffer buf) throws IOException {
* + super.writePacketData(buf);
* Writes the raw packet data to the data stream. buf.writeShort(this.posX);
*/ buf.writeShort(this.posY);
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { buf.writeShort(this.posZ);
super.writePacketData(parPacketBuffer); buf.writeByte(this.yaw);
parPacketBuffer.writeByte(this.posX); buf.writeByte(this.pitch);
parPacketBuffer.writeByte(this.posY); buf.writeBoolean(this.onGround);
parPacketBuffer.writeByte(this.posZ);
parPacketBuffer.writeByte(this.yaw);
parPacketBuffer.writeByte(this.pitch);
parPacketBuffer.writeBoolean(this.onGround);
} }
} }
} }

View File

@ -39,9 +39,9 @@ import net.minecraft.util.MathHelper;
*/ */
public class S18PacketEntityTeleport implements Packet<INetHandlerPlayClient> { public class S18PacketEntityTeleport implements Packet<INetHandlerPlayClient> {
private int entityId; private int entityId;
private int posX; private double posX;
private int posY; private double posY;
private int posZ; private double posZ;
private byte yaw; private byte yaw;
private byte pitch; private byte pitch;
private boolean onGround; private boolean onGround;
@ -51,34 +51,23 @@ public class S18PacketEntityTeleport implements Packet<INetHandlerPlayClient> {
public S18PacketEntityTeleport(Entity entityIn) { public S18PacketEntityTeleport(Entity entityIn) {
this.entityId = entityIn.getEntityId(); this.entityId = entityIn.getEntityId();
this.posX = MathHelper.floor_double(entityIn.posX * 32.0D); this.posX = entityIn.posX;
this.posY = MathHelper.floor_double(entityIn.posY * 32.0D); this.posY = entityIn.posY;
this.posZ = MathHelper.floor_double(entityIn.posZ * 32.0D); this.posZ = entityIn.posZ;
this.yaw = (byte) ((int) (entityIn.rotationYaw * 256.0F / 360.0F)); this.yaw = (byte) ((int) (entityIn.rotationYaw * 256.0F / 360.0F));
this.pitch = (byte) ((int) (entityIn.rotationPitch * 256.0F / 360.0F)); this.pitch = (byte) ((int) (entityIn.rotationPitch * 256.0F / 360.0F));
this.onGround = entityIn.onGround; this.onGround = entityIn.onGround;
} }
public S18PacketEntityTeleport(int entityIdIn, int posXIn, int posYIn, int posZIn, byte yawIn, byte pitchIn,
boolean onGroundIn) {
this.entityId = entityIdIn;
this.posX = posXIn;
this.posY = posYIn;
this.posZ = posZIn;
this.yaw = yawIn;
this.pitch = pitchIn;
this.onGround = onGroundIn;
}
/** /**
* + * +
* Reads the raw packet data from the data stream. * Reads the raw packet data from the data stream.
*/ */
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.entityId = parPacketBuffer.readVarIntFromBuffer(); this.entityId = parPacketBuffer.readVarIntFromBuffer();
this.posX = parPacketBuffer.readInt(); this.posX = parPacketBuffer.readDouble();
this.posY = parPacketBuffer.readInt(); this.posY = parPacketBuffer.readDouble();
this.posZ = parPacketBuffer.readInt(); this.posZ = parPacketBuffer.readDouble();
this.yaw = parPacketBuffer.readByte(); this.yaw = parPacketBuffer.readByte();
this.pitch = parPacketBuffer.readByte(); this.pitch = parPacketBuffer.readByte();
this.onGround = parPacketBuffer.readBoolean(); this.onGround = parPacketBuffer.readBoolean();
@ -90,9 +79,9 @@ public class S18PacketEntityTeleport implements Packet<INetHandlerPlayClient> {
*/ */
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeVarIntToBuffer(this.entityId); parPacketBuffer.writeVarIntToBuffer(this.entityId);
parPacketBuffer.writeInt(this.posX); parPacketBuffer.writeDouble(this.posX);
parPacketBuffer.writeInt(this.posY); parPacketBuffer.writeDouble(this.posY);
parPacketBuffer.writeInt(this.posZ); parPacketBuffer.writeDouble(this.posZ);
parPacketBuffer.writeByte(this.yaw); parPacketBuffer.writeByte(this.yaw);
parPacketBuffer.writeByte(this.pitch); parPacketBuffer.writeByte(this.pitch);
parPacketBuffer.writeBoolean(this.onGround); parPacketBuffer.writeBoolean(this.onGround);
@ -110,15 +99,15 @@ public class S18PacketEntityTeleport implements Packet<INetHandlerPlayClient> {
return this.entityId; return this.entityId;
} }
public int getX() { public double getX() {
return this.posX; return this.posX;
} }
public int getY() { public double getY() {
return this.posY; return this.posY;
} }
public int getZ() { public double getZ() {
return this.posZ; return this.posZ;
} }

View File

@ -37,15 +37,13 @@ import net.minecraft.network.play.INetHandlerPlayClient;
* *
*/ */
public class S1BPacketEntityAttach implements Packet<INetHandlerPlayClient> { public class S1BPacketEntityAttach implements Packet<INetHandlerPlayClient> {
private int leash;
private int entityId; private int entityId;
private int vehicleEntityId; private int vehicleEntityId;
public S1BPacketEntityAttach() { public S1BPacketEntityAttach() {
} }
public S1BPacketEntityAttach(int leashIn, Entity entityIn, Entity vehicle) { public S1BPacketEntityAttach(Entity entityIn, Entity vehicle) {
this.leash = leashIn;
this.entityId = entityIn.getEntityId(); this.entityId = entityIn.getEntityId();
this.vehicleEntityId = vehicle != null ? vehicle.getEntityId() : -1; this.vehicleEntityId = vehicle != null ? vehicle.getEntityId() : -1;
} }
@ -57,7 +55,6 @@ public class S1BPacketEntityAttach implements Packet<INetHandlerPlayClient> {
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.entityId = parPacketBuffer.readInt(); this.entityId = parPacketBuffer.readInt();
this.vehicleEntityId = parPacketBuffer.readInt(); this.vehicleEntityId = parPacketBuffer.readInt();
this.leash = parPacketBuffer.readUnsignedByte();
} }
/** /**
@ -67,7 +64,6 @@ public class S1BPacketEntityAttach implements Packet<INetHandlerPlayClient> {
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeInt(this.entityId); parPacketBuffer.writeInt(this.entityId);
parPacketBuffer.writeInt(this.vehicleEntityId); parPacketBuffer.writeInt(this.vehicleEntityId);
parPacketBuffer.writeByte(this.leash);
} }
/** /**
@ -78,10 +74,6 @@ public class S1BPacketEntityAttach implements Packet<INetHandlerPlayClient> {
inethandlerplayclient.handleEntityAttach(this); inethandlerplayclient.handleEntityAttach(this);
} }
public int getLeash() {
return this.leash;
}
public int getEntityId() { public int getEntityId() {
return this.entityId; return this.entityId;
} }

View File

@ -59,10 +59,10 @@ public class S21PacketChunkData implements Packet<INetHandlerPlayClient> {
public S21PacketChunkData() { public S21PacketChunkData() {
} }
public S21PacketChunkData(Chunk p_i47124_1_, boolean loaded, int p_i47124_2_) { public S21PacketChunkData(Chunk p_i47124_1_, int p_i47124_2_) {
this.chunkX = p_i47124_1_.xPosition; this.chunkX = p_i47124_1_.xPosition;
this.chunkZ = p_i47124_1_.zPosition; this.chunkZ = p_i47124_1_.zPosition;
this.loadChunk = loaded; this.loadChunk = p_i47124_2_ == 65535;
boolean flag = !p_i47124_1_.getWorld().provider.getHasNoSky(); boolean flag = !p_i47124_1_.getWorld().provider.getHasNoSky();
this.buffer = new byte[this.func_189556_a(p_i47124_1_, flag, p_i47124_2_)]; this.buffer = new byte[this.func_189556_a(p_i47124_1_, flag, p_i47124_2_)];
this.availableSections = this.func_189555_a(new PacketBuffer(this.getWriteBuffer()), p_i47124_1_, flag, this.availableSections = this.func_189555_a(new PacketBuffer(this.getWriteBuffer()), p_i47124_1_, flag,
@ -86,7 +86,9 @@ public class S21PacketChunkData implements Packet<INetHandlerPlayClient> {
this.chunkZ = buf.readInt(); this.chunkZ = buf.readInt();
this.loadChunk = buf.readBoolean(); this.loadChunk = buf.readBoolean();
this.availableSections = buf.readVarIntFromBuffer(); this.availableSections = buf.readVarIntFromBuffer();
System.out.println("Was able to read first varint");
int i = buf.readVarIntFromBuffer(); int i = buf.readVarIntFromBuffer();
System.out.println("Was able to read second varint");
if (i > 2097152) { if (i > 2097152) {
throw new RuntimeException("Chunk Packet trying to allocate too much memory on read."); throw new RuntimeException("Chunk Packet trying to allocate too much memory on read.");
@ -94,6 +96,7 @@ public class S21PacketChunkData implements Packet<INetHandlerPlayClient> {
this.buffer = new byte[i]; this.buffer = new byte[i];
buf.readBytes(this.buffer); buf.readBytes(this.buffer);
int j = buf.readVarIntFromBuffer(); int j = buf.readVarIntFromBuffer();
System.out.println("Was able to read third varint");
this.field_189557_e = Lists.<NBTTagCompound>newArrayList(); this.field_189557_e = Lists.<NBTTagCompound>newArrayList();
for (int k = 0; k < j; ++k) { for (int k = 0; k < j; ++k) {

View File

@ -4,6 +4,7 @@ import java.io.IOException;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import net.minecraft.client.audio.SoundCategory;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient; import net.minecraft.network.play.INetHandlerPlayClient;
@ -40,6 +41,7 @@ import net.minecraft.util.MathHelper;
*/ */
public class S29PacketSoundEffect implements Packet<INetHandlerPlayClient> { public class S29PacketSoundEffect implements Packet<INetHandlerPlayClient> {
private String soundName; private String soundName;
private SoundCategory category;
private int posX; private int posX;
private int posY = Integer.MAX_VALUE; private int posY = Integer.MAX_VALUE;
private int posZ; private int posZ;
@ -49,10 +51,12 @@ public class S29PacketSoundEffect implements Packet<INetHandlerPlayClient> {
public S29PacketSoundEffect() { public S29PacketSoundEffect() {
} }
// TODO: implement SoundCategory
public S29PacketSoundEffect(String soundNameIn, double soundX, double soundY, double soundZ, float volume, public S29PacketSoundEffect(String soundNameIn, double soundX, double soundY, double soundZ, float volume,
float pitch) { float pitch) {
Validate.notNull(soundNameIn, "name", new Object[0]); Validate.notNull(soundNameIn, "name", new Object[0]);
this.soundName = soundNameIn; this.soundName = soundNameIn;
this.category = SoundCategory.MASTER;
this.posX = (int) (soundX * 8.0D); this.posX = (int) (soundX * 8.0D);
this.posY = (int) (soundY * 8.0D); this.posY = (int) (soundY * 8.0D);
this.posZ = (int) (soundZ * 8.0D); this.posZ = (int) (soundZ * 8.0D);
@ -67,6 +71,7 @@ public class S29PacketSoundEffect implements Packet<INetHandlerPlayClient> {
*/ */
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.soundName = parPacketBuffer.readStringFromBuffer(256); this.soundName = parPacketBuffer.readStringFromBuffer(256);
this.category = (SoundCategory) parPacketBuffer.readEnumValue(SoundCategory.class);
this.posX = parPacketBuffer.readInt(); this.posX = parPacketBuffer.readInt();
this.posY = parPacketBuffer.readInt(); this.posY = parPacketBuffer.readInt();
this.posZ = parPacketBuffer.readInt(); this.posZ = parPacketBuffer.readInt();
@ -80,6 +85,7 @@ public class S29PacketSoundEffect implements Packet<INetHandlerPlayClient> {
*/ */
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeString(this.soundName); parPacketBuffer.writeString(this.soundName);
parPacketBuffer.writeEnumValue(this.category);
parPacketBuffer.writeInt(this.posX); parPacketBuffer.writeInt(this.posX);
parPacketBuffer.writeInt(this.posY); parPacketBuffer.writeInt(this.posY);
parPacketBuffer.writeInt(this.posZ); parPacketBuffer.writeInt(this.posZ);
@ -91,6 +97,10 @@ public class S29PacketSoundEffect implements Packet<INetHandlerPlayClient> {
return this.soundName; return this.soundName;
} }
public SoundCategory getCategory() {
return this.category;
}
public double getX() { public double getX() {
return (double) ((float) this.posX / 8.0F); return (double) ((float) this.posX / 8.0F);
} }

View File

@ -40,9 +40,9 @@ import net.minecraft.util.MathHelper;
*/ */
public class S2CPacketSpawnGlobalEntity implements Packet<INetHandlerPlayClient> { public class S2CPacketSpawnGlobalEntity implements Packet<INetHandlerPlayClient> {
private int entityId; private int entityId;
private int x; private double x;
private int y; private double y;
private int z; private double z;
private int type; private int type;
public S2CPacketSpawnGlobalEntity() { public S2CPacketSpawnGlobalEntity() {
@ -50,13 +50,12 @@ public class S2CPacketSpawnGlobalEntity implements Packet<INetHandlerPlayClient>
public S2CPacketSpawnGlobalEntity(Entity entityIn) { public S2CPacketSpawnGlobalEntity(Entity entityIn) {
this.entityId = entityIn.getEntityId(); this.entityId = entityIn.getEntityId();
this.x = MathHelper.floor_double(entityIn.posX * 32.0D); this.x = entityIn.posX;
this.y = MathHelper.floor_double(entityIn.posY * 32.0D); this.y = entityIn.posY;
this.z = MathHelper.floor_double(entityIn.posZ * 32.0D); this.z = entityIn.posZ;
if (entityIn instanceof EntityLightningBolt) { if (entityIn instanceof EntityLightningBolt) {
this.type = 1; this.type = 1;
} }
} }
/** /**
@ -66,9 +65,9 @@ public class S2CPacketSpawnGlobalEntity implements Packet<INetHandlerPlayClient>
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.entityId = parPacketBuffer.readVarIntFromBuffer(); this.entityId = parPacketBuffer.readVarIntFromBuffer();
this.type = parPacketBuffer.readByte(); this.type = parPacketBuffer.readByte();
this.x = parPacketBuffer.readInt(); this.x = parPacketBuffer.readDouble();
this.y = parPacketBuffer.readInt(); this.y = parPacketBuffer.readDouble();
this.z = parPacketBuffer.readInt(); this.z = parPacketBuffer.readDouble();
} }
/** /**
@ -78,9 +77,9 @@ public class S2CPacketSpawnGlobalEntity implements Packet<INetHandlerPlayClient>
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeVarIntToBuffer(this.entityId); parPacketBuffer.writeVarIntToBuffer(this.entityId);
parPacketBuffer.writeByte(this.type); parPacketBuffer.writeByte(this.type);
parPacketBuffer.writeInt(this.x); parPacketBuffer.writeDouble(this.x);
parPacketBuffer.writeInt(this.y); parPacketBuffer.writeDouble(this.y);
parPacketBuffer.writeInt(this.z); parPacketBuffer.writeDouble(this.z);
} }
/** /**
@ -91,23 +90,23 @@ public class S2CPacketSpawnGlobalEntity implements Packet<INetHandlerPlayClient>
inethandlerplayclient.handleSpawnGlobalEntity(this); inethandlerplayclient.handleSpawnGlobalEntity(this);
} }
public int func_149052_c() { public int getEntityId() {
return this.entityId; return this.entityId;
} }
public int func_149051_d() { public double getX() {
return this.x; return this.x;
} }
public int func_149050_e() { public double getY() {
return this.y; return this.y;
} }
public int func_149049_f() { public double getZ() {
return this.z; return this.z;
} }
public int func_149053_g() { public int getType() {
return this.type; return this.type;
} }
} }

View File

@ -41,6 +41,7 @@ import net.minecraft.world.storage.MapData;
public class S34PacketMaps implements Packet<INetHandlerPlayClient> { public class S34PacketMaps implements Packet<INetHandlerPlayClient> {
private int mapId; private int mapId;
private byte mapScale; private byte mapScale;
private boolean trackingPosition;
private Vec4b[] mapVisiblePlayersVec4b; private Vec4b[] mapVisiblePlayersVec4b;
private int mapMinX; private int mapMinX;
private int mapMinY; private int mapMinY;
@ -51,10 +52,12 @@ public class S34PacketMaps implements Packet<INetHandlerPlayClient> {
public S34PacketMaps() { public S34PacketMaps() {
} }
public S34PacketMaps(int mapIdIn, byte scale, Collection<Vec4b> visiblePlayers, byte[] colors, int minX, int minY, public S34PacketMaps(int mapIdIn, byte scale, boolean trackingPositionIn, Collection<Vec4b> visiblePlayers,
byte[] colors, int minX, int minY,
int maxX, int maxY) { int maxX, int maxY) {
this.mapId = mapIdIn; this.mapId = mapIdIn;
this.mapScale = scale; this.mapScale = scale;
this.trackingPosition = trackingPositionIn;
this.mapVisiblePlayersVec4b = (Vec4b[]) visiblePlayers.toArray(new Vec4b[visiblePlayers.size()]); this.mapVisiblePlayersVec4b = (Vec4b[]) visiblePlayers.toArray(new Vec4b[visiblePlayers.size()]);
this.mapMinX = minX; this.mapMinX = minX;
this.mapMinY = minY; this.mapMinY = minY;
@ -77,6 +80,7 @@ public class S34PacketMaps implements Packet<INetHandlerPlayClient> {
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException { public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.mapId = parPacketBuffer.readVarIntFromBuffer(); this.mapId = parPacketBuffer.readVarIntFromBuffer();
this.mapScale = parPacketBuffer.readByte(); this.mapScale = parPacketBuffer.readByte();
this.trackingPosition = parPacketBuffer.readBoolean();
this.mapVisiblePlayersVec4b = new Vec4b[parPacketBuffer.readVarIntFromBuffer()]; this.mapVisiblePlayersVec4b = new Vec4b[parPacketBuffer.readVarIntFromBuffer()];
for (int i = 0; i < this.mapVisiblePlayersVec4b.length; ++i) { for (int i = 0; i < this.mapVisiblePlayersVec4b.length; ++i) {
@ -102,6 +106,7 @@ public class S34PacketMaps implements Packet<INetHandlerPlayClient> {
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException { public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeVarIntToBuffer(this.mapId); parPacketBuffer.writeVarIntToBuffer(this.mapId);
parPacketBuffer.writeByte(this.mapScale); parPacketBuffer.writeByte(this.mapScale);
parPacketBuffer.writeBoolean(this.trackingPosition);
parPacketBuffer.writeVarIntToBuffer(this.mapVisiblePlayersVec4b.length); parPacketBuffer.writeVarIntToBuffer(this.mapVisiblePlayersVec4b.length);
for (int i = 0; i < this.mapVisiblePlayersVec4b.length; ++i) { for (int i = 0; i < this.mapVisiblePlayersVec4b.length; ++i) {

View File

@ -47,6 +47,7 @@ public class S3EPacketTeams implements Packet<INetHandlerPlayClient> {
private String field_149316_d = ""; private String field_149316_d = "";
private String field_179816_e; private String field_179816_e;
private int field_179815_f; private int field_179815_f;
private String collisionRule;
private Collection<String> field_149317_e; private Collection<String> field_149317_e;
private int field_149314_f; private int field_149314_f;
private int field_149315_g; private int field_149315_g;
@ -69,6 +70,8 @@ public class S3EPacketTeams implements Packet<INetHandlerPlayClient> {
this.field_149316_d = parScorePlayerTeam.getColorSuffix(); this.field_149316_d = parScorePlayerTeam.getColorSuffix();
this.field_149315_g = parScorePlayerTeam.func_98299_i(); this.field_149315_g = parScorePlayerTeam.func_98299_i();
this.field_179816_e = parScorePlayerTeam.getNameTagVisibility().field_178830_e; this.field_179816_e = parScorePlayerTeam.getNameTagVisibility().field_178830_e;
// TODO: implement collision rule
this.collisionRule = "always";
this.field_179815_f = parScorePlayerTeam.getChatFormat().getColorIndex(); this.field_179815_f = parScorePlayerTeam.getChatFormat().getColorIndex();
} }
@ -106,6 +109,7 @@ public class S3EPacketTeams implements Packet<INetHandlerPlayClient> {
this.field_149316_d = parPacketBuffer.readStringFromBuffer(16); this.field_149316_d = parPacketBuffer.readStringFromBuffer(16);
this.field_149315_g = parPacketBuffer.readByte(); this.field_149315_g = parPacketBuffer.readByte();
this.field_179816_e = parPacketBuffer.readStringFromBuffer(32); this.field_179816_e = parPacketBuffer.readStringFromBuffer(32);
this.collisionRule = parPacketBuffer.readStringFromBuffer(32);
this.field_179815_f = parPacketBuffer.readByte(); this.field_179815_f = parPacketBuffer.readByte();
} }
@ -132,6 +136,7 @@ public class S3EPacketTeams implements Packet<INetHandlerPlayClient> {
parPacketBuffer.writeString(this.field_149316_d); parPacketBuffer.writeString(this.field_149316_d);
parPacketBuffer.writeByte(this.field_149315_g); parPacketBuffer.writeByte(this.field_149315_g);
parPacketBuffer.writeString(this.field_179816_e); parPacketBuffer.writeString(this.field_179816_e);
parPacketBuffer.writeString(this.collisionRule);
parPacketBuffer.writeByte(this.field_179815_f); parPacketBuffer.writeByte(this.field_179815_f);
} }
@ -188,4 +193,8 @@ public class S3EPacketTeams implements Packet<INetHandlerPlayClient> {
public String func_179814_i() { public String func_179814_i() {
return this.field_179816_e; return this.field_179816_e;
} }
public String getCollisionRule() {
return this.collisionRule;
}
} }

View File

@ -7,6 +7,7 @@ import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient; import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraft.util.CombatTracker; import net.minecraft.util.CombatTracker;
import net.minecraft.util.IChatComponent;
/** /**
* + * +
@ -42,7 +43,7 @@ public class S42PacketCombatEvent implements Packet<INetHandlerPlayClient> {
public int field_179774_b; public int field_179774_b;
public int field_179775_c; public int field_179775_c;
public int field_179772_d; public int field_179772_d;
public String deathMessage; public IChatComponent deathMessage;
public S42PacketCombatEvent() { public S42PacketCombatEvent() {
} }
@ -58,7 +59,7 @@ public class S42PacketCombatEvent implements Packet<INetHandlerPlayClient> {
case ENTITY_DIED: case ENTITY_DIED:
this.field_179774_b = combatTrackerIn.getFighter().getEntityId(); this.field_179774_b = combatTrackerIn.getFighter().getEntityId();
this.field_179775_c = entitylivingbase == null ? -1 : entitylivingbase.getEntityId(); this.field_179775_c = entitylivingbase == null ? -1 : entitylivingbase.getEntityId();
this.deathMessage = combatTrackerIn.getDeathMessage().getUnformattedText(); this.deathMessage = combatTrackerIn.getDeathMessage();
} }
} }
@ -75,7 +76,7 @@ public class S42PacketCombatEvent implements Packet<INetHandlerPlayClient> {
} else if (this.eventType == S42PacketCombatEvent.Event.ENTITY_DIED) { } else if (this.eventType == S42PacketCombatEvent.Event.ENTITY_DIED) {
this.field_179774_b = parPacketBuffer.readVarIntFromBuffer(); this.field_179774_b = parPacketBuffer.readVarIntFromBuffer();
this.field_179775_c = parPacketBuffer.readInt(); this.field_179775_c = parPacketBuffer.readInt();
this.deathMessage = parPacketBuffer.readStringFromBuffer(32767); this.deathMessage = parPacketBuffer.readChatComponent();
} }
} }
@ -92,7 +93,7 @@ public class S42PacketCombatEvent implements Packet<INetHandlerPlayClient> {
} else if (this.eventType == S42PacketCombatEvent.Event.ENTITY_DIED) { } else if (this.eventType == S42PacketCombatEvent.Event.ENTITY_DIED) {
parPacketBuffer.writeVarIntToBuffer(this.field_179774_b); parPacketBuffer.writeVarIntToBuffer(this.field_179774_b);
parPacketBuffer.writeInt(this.field_179775_c); parPacketBuffer.writeInt(this.field_179775_c);
parPacketBuffer.writeString(this.deathMessage); parPacketBuffer.writeChatComponent(this.deathMessage);
} }
} }

View File

@ -35,6 +35,8 @@ import net.minecraft.network.play.INetHandlerPlayClient;
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
@Deprecated
public class S46PacketSetCompressionLevel implements Packet<INetHandlerPlayClient> { public class S46PacketSetCompressionLevel implements Packet<INetHandlerPlayClient> {
private int field_179761_a; private int field_179761_a;

View File

@ -38,6 +38,8 @@ import net.minecraft.world.World;
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
@Deprecated
public class S49PacketUpdateEntityNBT implements Packet<INetHandlerPlayClient> { public class S49PacketUpdateEntityNBT implements Packet<INetHandlerPlayClient> {
private int entityId; private int entityId;
private NBTTagCompound tagCompound; private NBTTagCompound tagCompound;

View File

@ -0,0 +1,6 @@
package net.minecraft.network.play.server;
import net.minecraft.network.PlaceholderPacket;
public class SPacketBossBar extends PlaceholderPacket {
}

View File

@ -0,0 +1,7 @@
package net.minecraft.network.play.server;
import net.minecraft.network.PlaceholderPacket;
public class SPacketSetCooldown extends PlaceholderPacket {
}

View File

@ -0,0 +1,7 @@
package net.minecraft.network.play.server;
import net.minecraft.network.PlaceholderPacket;
public class SPacketSetPassengers extends PlaceholderPacket {
}

View File

@ -0,0 +1,7 @@
package net.minecraft.network.play.server;
import net.minecraft.network.PlaceholderPacket;
public class SPacketSoundEffect extends PlaceholderPacket {
}

View File

@ -0,0 +1,42 @@
package net.minecraft.network.play.server;
import java.io.IOException;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
public class SPacketUnloadChunk implements Packet<INetHandlerPlayClient> {
private int x;
private int z;
public SPacketUnloadChunk() {
}
public SPacketUnloadChunk(int xIn, int zIn) {
this.x = xIn;
this.z = zIn;
}
public void readPacketData(PacketBuffer buf) throws IOException {
this.x = buf.readInt();
this.z = buf.readInt();
}
public void writePacketData(PacketBuffer buf) throws IOException {
buf.writeInt(this.x);
buf.writeInt(this.z);
}
public void processPacket(INetHandlerPlayClient handler) {
handler.handleUnloadChunk(this);
}
public int getX() {
return this.x;
}
public int getZ() {
return this.z;
}
}

View File

@ -0,0 +1,7 @@
package net.minecraft.network.play.server;
import net.minecraft.network.PlaceholderPacket;
public class SPacketVehicleMove extends PlaceholderPacket {
}

View File

@ -10,6 +10,8 @@ import java.util.List;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID; import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.lax1dude.eaglercraft.v1_8.futures.FutureTask; import net.lax1dude.eaglercraft.v1_8.futures.FutureTask;
@ -680,36 +682,41 @@ public abstract class MinecraftServer implements Runnable, ICommandSender, IThre
return crashreport; return crashreport;
} }
public List<String> getTabCompletions(ICommandSender sender, String input, BlockPos pos) { public List<String> getTabCompletions(ICommandSender sender, String input, @Nullable BlockPos pos,
ArrayList arraylist = Lists.newArrayList(); boolean hasTargetBlock) {
if (input.startsWith("/")) { List<String> list = Lists.<String>newArrayList();
boolean flag = input.startsWith("/");
if (flag) {
input = input.substring(1); input = input.substring(1);
boolean flag = !input.contains(" "); }
List<String> list = this.commandManager.getTabCompletionOptions(sender, input, pos);
if (list != null) { if (!flag && !hasTargetBlock) {
for (int i = 0, l = list.size(); i < l; ++i) { String[] astring = input.split(" ", -1);
String s2 = list.get(i); String s2 = astring[astring.length - 1];
if (flag) {
arraylist.add("/" + s2); for (String s1 : this.serverConfigManager.getAllUsernames()) {
if (CommandBase.doesStringStartWith(s2, s1)) {
list.add(s1);
}
}
return list;
} else {
boolean flag1 = !input.contains(" ");
List<String> list1 = this.commandManager.getTabCompletionOptions(sender, input, pos);
if (!list1.isEmpty()) {
for (String s : list1) {
if (flag1) {
list.add("/" + s);
} else { } else {
arraylist.add(s2); list.add(s);
} }
} }
} }
return arraylist; return list;
} else {
String[] astring = input.split(" ", -1);
String s = astring[astring.length - 1];
String[] unames = this.serverConfigManager.getAllUsernames();
for (int i = 0; i < unames.length; ++i) {
String s1 = unames[i];
if (CommandBase.doesStringStartWith(s, s1)) {
arraylist.add(s1);
}
}
return arraylist;
} }
} }

View File

@ -15,6 +15,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.world.ILockableContainer; import net.minecraft.world.ILockableContainer;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
@ -330,6 +331,44 @@ public class ItemInWorldManager {
} }
} }
// TODO: implement offhand and cooldown
public boolean processRightClick(EntityPlayer player, World worldIn, ItemStack stack, EnumHand hand) {
if (this.gameType == WorldSettings.GameType.SPECTATOR) {
return false;
// } else if (player.getCooldownTracker().hasCooldown(stack.getItem())) {
// return false;
} else {
int i = stack.stackSize;
int j = stack.getMetadata();
ItemStack itemstack = stack.useItemRightClick(worldIn, player);
if (itemstack == stack && itemstack.stackSize == i && itemstack.getMaxItemUseDuration() <= 0
&& itemstack.getMetadata() == j) {
return false;
} else {
player.setHeldItem(itemstack);
if (this.isCreative()) {
itemstack.stackSize = i;
if (itemstack.isItemStackDamageable()) {
itemstack.setItemDamage(j);
}
}
if (itemstack.stackSize == 0) {
player.setHeldItem((ItemStack) null);
}
if (!player.isHandActive()) {
((EntityPlayerMP) player).sendContainerToPlayer(player.inventoryContainer);
}
return true;
}
}
}
/** /**
* + * +
* Activate the clicked on block, otherwise use the held item. * Activate the clicked on block, otherwise use the held item.

View File

@ -8,6 +8,7 @@ import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S21PacketChunkData; import net.minecraft.network.play.server.S21PacketChunkData;
import net.minecraft.network.play.server.S22PacketMultiBlockChange; import net.minecraft.network.play.server.S22PacketMultiBlockChange;
import net.minecraft.network.play.server.S23PacketBlockChange; import net.minecraft.network.play.server.S23PacketBlockChange;
import net.minecraft.network.play.server.SPacketUnloadChunk;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.LongHashMap; import net.minecraft.util.LongHashMap;
@ -392,7 +393,8 @@ public class PlayerManager {
Chunk chunk = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, Chunk chunk = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos,
this.chunkCoords.chunkZPos); this.chunkCoords.chunkZPos);
if (chunk.isPopulated()) { if (chunk.isPopulated()) {
player.playerNetServerHandler.sendPacket(new S21PacketChunkData(chunk, true, 0)); player.playerNetServerHandler.sendPacket(new SPacketUnloadChunk(this.chunkCoords.chunkXPos,
this.chunkCoords.chunkZPos));
} }
this.playersWatchingChunk.remove(player); this.playersWatchingChunk.remove(player);
@ -475,7 +477,7 @@ public class PlayerManager {
new S21PacketChunkData( new S21PacketChunkData(
PlayerManager.this.theWorldServer.getChunkFromChunkCoords( PlayerManager.this.theWorldServer.getChunkFromChunkCoords(
this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos),
false, this.flagsYAreasToUpdate)); this.flagsYAreasToUpdate));
for (int i2 = 0; i2 < 16; ++i2) { for (int i2 = 0; i2 < 16; ++i2) {
if ((this.flagsYAreasToUpdate & 1 << i2) != 0) { if ((this.flagsYAreasToUpdate & 1 << i2) != 0) {

View File

@ -0,0 +1,6 @@
package net.minecraft.util;
public enum EnumHand {
MAIN_HAND,
OFF_HAND;
}

View File

@ -0,0 +1,20 @@
package net.minecraft.util;
public enum EnumHandSide {
LEFT(new ChatComponentTranslation("options.mainHand.left", new Object[0])),
RIGHT(new ChatComponentTranslation("options.mainHand.right", new Object[0]));
private final IChatComponent handName;
private EnumHandSide(IChatComponent nameIn) {
this.handName = nameIn;
}
public EnumHandSide opposite() {
return this == LEFT ? RIGHT : LEFT;
}
public String toString() {
return this.handName.getUnformattedText();
}
}

View File

@ -0,0 +1,47 @@
package net.minecraft.util;
import com.google.common.collect.Maps;
import java.util.Map;
import java.util.Set;
public enum SoundCategory {
MASTER("master"),
MUSIC("music"),
RECORDS("record"),
WEATHER("weather"),
BLOCKS("block"),
HOSTILE("hostile"),
NEUTRAL("neutral"),
PLAYERS("player"),
AMBIENT("ambient"),
VOICE("voice");
private static final Map<String, SoundCategory> SOUND_CATEGORIES = Maps.<String, SoundCategory>newHashMap();
private final String name;
private SoundCategory(String nameIn) {
this.name = nameIn;
}
public String getName() {
return this.name;
}
public static SoundCategory getByName(String categoryName) {
return (SoundCategory) SOUND_CATEGORIES.get(categoryName);
}
public static Set<String> getSoundCategoryNames() {
return SOUND_CATEGORIES.keySet();
}
static {
for (SoundCategory soundcategory : values()) {
if (SOUND_CATEGORIES.containsKey(soundcategory.getName())) {
throw new Error("Clash in Sound Category name pools! Cannot insert " + soundcategory);
}
SOUND_CATEGORIES.put(soundcategory.getName(), soundcategory);
}
}
}

View File

@ -52,6 +52,7 @@ public class MapData extends WorldSavedData {
public int xCenter; public int xCenter;
public int zCenter; public int zCenter;
public byte dimension; public byte dimension;
public boolean trackingPosition;
public byte scale; public byte scale;
/** /**
* + * +
@ -89,6 +90,13 @@ public class MapData extends WorldSavedData {
this.zCenter = nbttagcompound.getInteger("zCenter"); this.zCenter = nbttagcompound.getInteger("zCenter");
this.scale = nbttagcompound.getByte("scale"); this.scale = nbttagcompound.getByte("scale");
this.scale = (byte) MathHelper.clamp_int(this.scale, 0, 4); this.scale = (byte) MathHelper.clamp_int(this.scale, 0, 4);
if (nbttagcompound.hasKey("trackingPosition", 1)) {
this.trackingPosition = nbttagcompound.getBoolean("trackingPosition");
} else {
this.trackingPosition = true;
}
short short1 = nbttagcompound.getShort("width"); short short1 = nbttagcompound.getShort("width");
short short2 = nbttagcompound.getShort("height"); short short2 = nbttagcompound.getShort("height");
if (short1 == 128 && short2 == 128) { if (short1 == 128 && short2 == 128) {
@ -127,6 +135,7 @@ public class MapData extends WorldSavedData {
nbttagcompound.setShort("width", (short) 128); nbttagcompound.setShort("width", (short) 128);
nbttagcompound.setShort("height", (short) 128); nbttagcompound.setShort("height", (short) 128);
nbttagcompound.setByteArray("colors", this.colors); nbttagcompound.setByteArray("colors", this.colors);
nbttagcompound.setBoolean("trackingPosition", this.trackingPosition);
} }
/** /**
@ -150,7 +159,8 @@ public class MapData extends WorldSavedData {
if (!mapdata$mapinfo1.entityplayerObj.isDead if (!mapdata$mapinfo1.entityplayerObj.isDead
&& (mapdata$mapinfo1.entityplayerObj.inventory.hasItemStack(mapStack) && (mapdata$mapinfo1.entityplayerObj.inventory.hasItemStack(mapStack)
|| mapStack.isOnItemFrame())) { || mapStack.isOnItemFrame())) {
if (!mapStack.isOnItemFrame() && mapdata$mapinfo1.entityplayerObj.dimension == this.dimension) { if (!mapStack.isOnItemFrame() && mapdata$mapinfo1.entityplayerObj.dimension == this.dimension
&& this.trackingPosition) {
this.updateDecorations(0, mapdata$mapinfo1.entityplayerObj.worldObj, this.updateDecorations(0, mapdata$mapinfo1.entityplayerObj.worldObj,
mapdata$mapinfo1.entityplayerObj.getName(), mapdata$mapinfo1.entityplayerObj.posX, mapdata$mapinfo1.entityplayerObj.getName(), mapdata$mapinfo1.entityplayerObj.posX,
mapdata$mapinfo1.entityplayerObj.posZ, mapdata$mapinfo1.entityplayerObj.posZ,
@ -162,7 +172,7 @@ public class MapData extends WorldSavedData {
} }
} }
if (mapStack.isOnItemFrame()) { if (mapStack.isOnItemFrame() && this.trackingPosition) {
EntityItemFrame entityitemframe = mapStack.getItemFrame(); EntityItemFrame entityitemframe = mapStack.getItemFrame();
BlockPos blockpos = entityitemframe.getHangingPosition(); BlockPos blockpos = entityitemframe.getHangingPosition();
this.updateDecorations(1, player.worldObj, "frame-" + entityitemframe.getEntityId(), this.updateDecorations(1, player.worldObj, "frame-" + entityitemframe.getEntityId(),
@ -271,12 +281,15 @@ public class MapData extends WorldSavedData {
public Packet getPacket(ItemStack stack) { public Packet getPacket(ItemStack stack) {
if (this.field_176105_d) { if (this.field_176105_d) {
this.field_176105_d = false; this.field_176105_d = false;
return new S34PacketMaps(stack.getMetadata(), MapData.this.scale, MapData.this.mapDecorations.values(), return new S34PacketMaps(stack.getMetadata(), MapData.this.scale, MapData.this.trackingPosition,
MapData.this.mapDecorations.values(),
MapData.this.colors, this.minX, this.minY, this.maxX + 1 - this.minX, MapData.this.colors, this.minX, this.minY, this.maxX + 1 - this.minX,
this.maxY + 1 - this.minY); this.maxY + 1 - this.minY);
} else { } else {
return this.field_176109_i++ % 5 == 0 ? new S34PacketMaps(stack.getMetadata(), MapData.this.scale, return this.field_176109_i++ % 5 == 0
MapData.this.mapDecorations.values(), MapData.this.colors, 0, 0, 0, 0) : null; ? new S34PacketMaps(stack.getMetadata(), MapData.this.scale, MapData.this.trackingPosition,
MapData.this.mapDecorations.values(), MapData.this.colors, 0, 0, 0, 0)
: null;
} }
} }