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

@ -15,7 +15,9 @@ public class Config {
public static int tracingDistance = 128;
public static Set<String> blockEntityWhitelist = new HashSet<>(Arrays.asList("minecraft:beacon"));
public static int SleepDuration = 10;
public static int hitboxLimit = 50;
public static int hitboxLimit = 50;
public static int protocolVersion = 107;
public static boolean disableAlpha() {
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 net.hoosiertransfer.Config;
import net.lax1dude.eaglercraft.v1_8.ArrayUtils;
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
import net.lax1dude.eaglercraft.v1_8.EaglerOutputStream;
@ -79,7 +80,7 @@ public class ConnectionHandshake {
d.writeShort(protocolV3); // client supports v3
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;
d.writeByte(clientBrand.length());
@ -126,7 +127,7 @@ public class ConnectionHandshake {
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: {}", games);
@ -149,7 +150,7 @@ public class ConnectionHandshake {
}
int gameVers = di.readShort();
if (gameVers != 47) {
if (gameVers != Config.protocolVersion) {
logger.info("Incompatible minecraft protocol version: {}", gameVers);
mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed",
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;
while (this.gameSettings.keyBindInventory.isPressed()) {
this.getNetHandler().addToSendQueue(
new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));
if (this.playerController.isRidingHorse()) {
this.thePlayer.sendHorseInventory();
} else {
this.getNetHandler().addToSendQueue(
new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));
this.displayGuiScreen(new GuiInventory(this.thePlayer));
}
}

View File

@ -271,7 +271,7 @@ public class GuiChat extends GuiScreen {
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;
}
}

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.C10PacketCreativeInventoryAction;
import net.minecraft.network.play.client.C11PacketEnchantItem;
import net.minecraft.network.play.client.CPacketUseItem;
import net.minecraft.stats.StatFileWriter;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
@ -389,8 +390,7 @@ public class PlayerControllerMP {
}
}
this.netClientHandler.addToSendQueue(new C08PacketPlayerBlockPlacement(hitPos, side.getIndex(),
player.inventory.getCurrentItem(), f, f1, f2));
this.netClientHandler.addToSendQueue(new C08PacketPlayerBlockPlacement(hitPos, side, f, f1, f2));
if (!flag && this.currentGameType != WorldSettings.GameType.SPECTATOR) {
if (heldStack == null) {
return false;
@ -419,8 +419,9 @@ public class PlayerControllerMP {
return false;
} else {
this.syncCurrentPlayItem();
// TODO: implement offhand
this.netClientHandler
.addToSendQueue(new C08PacketPlayerBlockPlacement(playerIn.inventory.getCurrentItem()));
.addToSendQueue(new CPacketUseItem());
int i = itemStackIn.stackSize;
ItemStack itemstack = itemStackIn.useItemRightClick(worldIn, playerIn);
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.JSONObject;
import net.hoosiertransfer.Config;
import net.lax1dude.eaglercraft.v1_8.internal.IServerQuery;
import net.lax1dude.eaglercraft.v1_8.internal.QueryResponse;
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
*/
public long pingToServer = -1l;
public int version = 47;
public int version = Config.protocolVersion;
/**
* +
* 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.settings.GameSettings;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLeashKnot;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EntityTracker;
import net.minecraft.entity.IMerchant;
import net.minecraft.entity.NpcMerchant;
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.C17PacketCustomPayload;
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.S01PacketJoinGame;
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.S48PacketResourcePackSend;
import net.minecraft.network.play.server.S49PacketUpdateEntityNBT;
import net.minecraft.network.play.server.SPacketUnloadChunk;
import net.minecraft.potion.PotionEffect;
import net.minecraft.scoreboard.IScoreObjectiveCriteria;
import net.minecraft.scoreboard.Score;
@ -336,9 +340,9 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
* and sets its position and momentum
*/
public void handleSpawnObject(S0EPacketSpawnObject packetIn) {
double d0 = (double) packetIn.getX() / 32.0D;
double d1 = (double) packetIn.getY() / 32.0D;
double d2 = (double) packetIn.getZ() / 32.0D;
double d1 = packetIn.getY();
double d0 = packetIn.getX();
double d2 = packetIn.getZ();
Object object = null;
if (packetIn.getType() == 10) {
object = EntityMinecart.func_180458_a(this.clientWorldController, d0, d1, d2,
@ -409,9 +413,7 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
}
if (object != null) {
((Entity) object).serverPosX = packetIn.getX();
((Entity) object).serverPosY = packetIn.getY();
((Entity) object).serverPosZ = packetIn.getZ();
EntityTracker.updateServerPosition((Entity) object, d0, d1, d2);
((Entity) object).rotationPitch = (float) (packetIn.getPitch() * 360) / 256.0F;
((Entity) object).rotationYaw = (float) (packetIn.getYaw() * 360) / 256.0F;
Entity[] aentity = ((Entity) object).getParts();
@ -424,6 +426,7 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
}
((Entity) object).setEntityId(packetIn.getEntityID());
((Entity) object).setUniqueId(packetIn.getUniqueId());
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), (Entity) object);
if (packetIn.func_149009_m() > 0) {
if (packetIn.getType() == 60) {
@ -445,15 +448,15 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
* Spawns an experience orb and sets its value (amount of XP)
*/
public void handleSpawnExperienceOrb(S11PacketSpawnExperienceOrb packetIn) {
EntityXPOrb entityxporb = new EntityXPOrb(this.clientWorldController, (double) packetIn.getX() / 32.0D,
(double) packetIn.getY() / 32.0D, (double) packetIn.getZ() / 32.0D, packetIn.getXPValue());
entityxporb.serverPosX = packetIn.getX();
entityxporb.serverPosY = packetIn.getY();
entityxporb.serverPosZ = packetIn.getZ();
entityxporb.rotationYaw = 0.0F;
entityxporb.rotationPitch = 0.0F;
entityxporb.setEntityId(packetIn.getEntityID());
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entityxporb);
double d0 = packetIn.getX();
double d1 = packetIn.getY();
double d2 = packetIn.getZ();
Entity entity = new EntityXPOrb(this.clientWorldController, d0, d1, d2, packetIn.getXPValue());
EntityTracker.updateServerPosition(entity, d0, d1, d2);
entity.rotationYaw = 0.0F;
entity.rotationPitch = 0.0F;
entity.setEntityId(packetIn.getEntityID());
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entity);
}
/**
@ -462,24 +465,22 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
* lightning bolts
*/
public void handleSpawnGlobalEntity(S2CPacketSpawnGlobalEntity packetIn) {
double d0 = (double) packetIn.func_149051_d() / 32.0D;
double d1 = (double) packetIn.func_149050_e() / 32.0D;
double d2 = (double) packetIn.func_149049_f() / 32.0D;
EntityLightningBolt entitylightningbolt = null;
if (packetIn.func_149053_g() == 1) {
entitylightningbolt = new EntityLightningBolt(this.clientWorldController, d0, d1, d2);
double d0 = packetIn.getX();
double d1 = packetIn.getY();
double d2 = packetIn.getZ();
Entity entity = null;
if (packetIn.getType() == 1) {
entity = new EntityLightningBolt(this.clientWorldController, d0, d1, d2);
}
if (entitylightningbolt != null) {
entitylightningbolt.serverPosX = packetIn.func_149051_d();
entitylightningbolt.serverPosY = packetIn.func_149050_e();
entitylightningbolt.serverPosZ = packetIn.func_149049_f();
entitylightningbolt.rotationYaw = 0.0F;
entitylightningbolt.rotationPitch = 0.0F;
entitylightningbolt.setEntityId(packetIn.func_149052_c());
this.clientWorldController.addWeatherEffect(entitylightningbolt);
if (entity != null) {
EntityTracker.updateServerPosition(entity, d0, d1, d2);
entity.rotationYaw = 0.0F;
entity.rotationPitch = 0.0F;
entity.setEntityId(packetIn.getEntityId());
this.clientWorldController.addWeatherEffect(entity);
}
}
/**
@ -525,30 +526,20 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
* position and held item
*/
public void handleSpawnPlayer(S0CPacketSpawnPlayer packetIn) {
double d0 = (double) packetIn.getX() / 32.0D;
double d1 = (double) packetIn.getY() / 32.0D;
double d2 = (double) packetIn.getZ() / 32.0D;
double d0 = packetIn.getX();
double d1 = packetIn.getY();
double d2 = packetIn.getZ();
float f = (float) (packetIn.getYaw() * 360) / 256.0F;
float f1 = (float) (packetIn.getPitch() * 360) / 256.0F;
EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(this.gameController.theWorld,
this.getPlayerInfo(packetIn.getPlayer()).getGameProfile());
entityotherplayermp.prevPosX = entityotherplayermp.lastTickPosX = (double) (entityotherplayermp.serverPosX = packetIn
.getX());
entityotherplayermp.prevPosY = entityotherplayermp.lastTickPosY = (double) (entityotherplayermp.serverPosY = packetIn
.getY());
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);
}
this.getPlayerInfo(packetIn.getUniqueId()).getGameProfile());
entityotherplayermp.prevPosX = entityotherplayermp.lastTickPosX = d0;
entityotherplayermp.prevPosY = entityotherplayermp.lastTickPosY = d1;
entityotherplayermp.prevPosZ = entityotherplayermp.lastTickPosZ = d2;
EntityTracker.updateServerPosition(entityotherplayermp, d0, d1, d2);
entityotherplayermp.setPositionAndRotation(d0, d1, d2, f, f1);
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entityotherplayermp);
List list = packetIn.func_148944_c();
List<DataWatcher.WatchableObject> list = packetIn.func_148944_c();
if (list != null) {
entityotherplayermp.getDataWatcher().updateWatchedObjectsFromList(list);
}
@ -563,12 +554,10 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
public void handleEntityTeleport(S18PacketEntityTeleport packetIn) {
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
if (entity != null) {
entity.serverPosX = packetIn.getX();
entity.serverPosY = packetIn.getY();
entity.serverPosZ = packetIn.getZ();
double d0 = (double) entity.serverPosX / 32.0D;
double d1 = (double) entity.serverPosY / 32.0D;
double d2 = (double) entity.serverPosZ / 32.0D;
double d0 = packetIn.getX();
double d1 = packetIn.getY();
double d2 = packetIn.getZ();
EntityTracker.updateServerPosition(entity, d0, d1, d2);
float f = (float) (packetIn.getYaw() * 360) / 256.0F;
float f1 = (float) (packetIn.getPitch() * 360) / 256.0F;
if (Math.abs(entity.posX - d0) < 0.03125D && Math.abs(entity.posY - d1) < 0.015625D
@ -604,14 +593,14 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
public void handleEntityMovement(S14PacketEntity packetIn) {
Entity entity = packetIn.getEntity(this.clientWorldController);
if (entity != null) {
entity.serverPosX += packetIn.func_149062_c();
entity.serverPosY += packetIn.func_149061_d();
entity.serverPosZ += packetIn.func_149064_e();
double d0 = (double) entity.serverPosX / 32.0D;
double d1 = (double) entity.serverPosY / 32.0D;
double d2 = (double) entity.serverPosZ / 32.0D;
float f = packetIn.func_149060_h() ? (float) (packetIn.func_149066_f() * 360) / 256.0F : entity.rotationYaw;
float f1 = packetIn.func_149060_h() ? (float) (packetIn.func_149063_g() * 360) / 256.0F
entity.serverPosX += packetIn.getX();
entity.serverPosY += packetIn.getY();
entity.serverPosZ += packetIn.getZ();
double d0 = (double) entity.serverPosX / 4096.0D;
double d1 = (double) entity.serverPosY / 4096.0D;
double d2 = (double) entity.serverPosZ / 4096.0D;
float f = packetIn.isRotating() ? (float) (packetIn.getYaw() * 360) / 256.0F : entity.rotationYaw;
float f1 = packetIn.isRotating() ? (float) (packetIn.getPitch() * 360) / 256.0F
: entity.rotationPitch;
entity.setPositionAndRotation2(d0, d1, d2, f, f1, 3, false);
entity.onGround = packetIn.getOnGround();
@ -688,6 +677,7 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
}
entityplayersp.setPositionAndRotation(d0, d1, d2, f, f1);
this.netManager.sendPacket(new CPacketConfirmTeleport(packetIn.getTeleportId()));
this.netManager.sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(entityplayersp.posX,
entityplayersp.getEntityBoundingBox().minY, entityplayersp.posZ, entityplayersp.rotationYaw,
entityplayersp.rotationPitch, false));
@ -870,19 +860,18 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
* Datawatchers with the entity metadata specified in the packet
*/
public void handleSpawnMob(S0FPacketSpawnMob packetIn) {
double d0 = (double) packetIn.getX() / 32.0D;
double d1 = (double) packetIn.getY() / 32.0D;
double d2 = (double) packetIn.getZ() / 32.0D;
double d0 = packetIn.getX();
double d1 = packetIn.getY();
double d2 = packetIn.getZ();
float f = (float) (packetIn.getYaw() * 360) / 256.0F;
float f1 = (float) (packetIn.getPitch() * 360) / 256.0F;
EntityLivingBase entitylivingbase = (EntityLivingBase) EntityList.createEntityByID(packetIn.getEntityType(),
this.gameController.theWorld);
entitylivingbase.serverPosX = packetIn.getX();
entitylivingbase.serverPosY = packetIn.getY();
entitylivingbase.serverPosZ = packetIn.getZ();
EntityTracker.updateServerPosition(entitylivingbase, d0, d1, d2);
entitylivingbase.renderYawOffset = entitylivingbase.rotationYawHead = (float) (packetIn.getHeadPitch() * 360)
/ 256.0F;
Entity[] aentity = entitylivingbase.getParts();
if (aentity != null) {
int i = packetIn.getEntityID() - entitylivingbase.getEntityId();
@ -892,12 +881,13 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
}
entitylivingbase.setEntityId(packetIn.getEntityID());
entitylivingbase.setUniqueId(packetIn.getUniqueId());
entitylivingbase.setPositionAndRotation(d0, d1, d2, f, f1);
entitylivingbase.motionX = (double) ((float) packetIn.getVelocityX() / 8000.0F);
entitylivingbase.motionY = (double) ((float) packetIn.getVelocityY() / 8000.0F);
entitylivingbase.motionZ = (double) ((float) packetIn.getVelocityZ() / 8000.0F);
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitylivingbase);
List list = packetIn.func_149027_c();
List<DataWatcher.WatchableObject> list = packetIn.func_149027_c();
if (list != null) {
entitylivingbase.getDataWatcher().updateWatchedObjectsFromList(list);
}
@ -915,42 +905,16 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
}
public void handleEntityAttach(S1BPacketEntityAttach packetIn) {
Object object = this.clientWorldController.getEntityByID(packetIn.getEntityId());
Entity entity = 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);
}
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
Entity entity1 = this.clientWorldController.getEntityByID(packetIn.getVehicleEntityId());
flag = ((Entity) object).ridingEntity == null && entity != null;
} else if (entity instanceof EntityBoat) {
((EntityBoat) entity).setIsBoatEmpty(true);
}
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);
if (entity instanceof EntityLiving) {
if (entity1 != null) {
((EntityLiving) entity).setLeashedToEntity(entity1, false);
} else {
((EntityLiving) object).clearLeashed(false, false);
((EntityLiving) entity).clearLeashed(false, false);
}
}
}
/**
@ -970,6 +934,7 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
if (packetIn.getOpCode() == 21) {
this.gameController.getSoundHandler().playSound(new GuardianSound((EntityGuardian) entity));
} else {
// TODO: implement permission levels
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

View File

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

View File

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

View File

@ -144,9 +144,9 @@ public abstract class Entity implements ICommandSender {
public int chunkCoordX;
public int chunkCoordY;
public int chunkCoordZ;
public int serverPosX;
public int serverPosY;
public int serverPosZ;
public long serverPosX;
public long serverPosY;
public long serverPosZ;
public boolean ignoreFrustumCheck;
public boolean isAirBorne;
public int timeUntilPortal;
@ -206,6 +206,10 @@ public abstract class Entity implements ICommandSender {
this.entityId = id;
}
public void setUniqueId(EaglercraftUUID uniqueIdIn) {
this.entityUniqueID = uniqueIdIn;
}
/**
* +
* Called by the /kill command.
@ -402,9 +406,7 @@ public abstract class Entity implements ICommandSender {
}
}
if (this.timeUntilPortal > 0) {
--this.timeUntilPortal;
}
this.decrementTimeUntilPortal();
this.worldObj.theProfiler.endSection();
}
@ -445,6 +447,16 @@ public abstract class Entity implements ICommandSender {
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

View File

@ -1082,7 +1082,7 @@ public abstract class EntityLiving extends EntityLivingBase {
if (!this.worldObj.isRemote && sendPacket && this.worldObj instanceof WorldServer) {
((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;
if (!this.worldObj.isRemote && sendAttachNotification && this.worldObj instanceof WorldServer) {
((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.network.Packet;
import net.minecraft.util.IntHashMap;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ReportedException;
import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk;
@ -91,6 +92,16 @@ public class EntityTracker {
.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) {
if (parEntity instanceof EntityPlayerMP) {
this.trackEntity(parEntity, 512, 2);

View File

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

View File

@ -54,6 +54,14 @@ public class SharedMonsterAttributes {
0.699999988079071D, 0.0D, 1024.0D)).setDescription("Movement Speed").setShouldWatch(true);
public static final IAttribute attackDamage = new RangedAttribute((IAttribute) null, "generic.attackDamage", 2.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.List;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.block.Block;
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
@ -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.

View File

@ -187,6 +187,8 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
public boolean playerConqueredTheEnd;
public byte[] updateCertificate = null;
private boolean invulnerableDimensionChange;
public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile,
ItemInWorldManager interactionManager) {
super(worldIn, profile);
@ -346,7 +348,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
if (!arraylist.isEmpty()) {
for (int k = 0; k < arraylist.size(); ++k) {
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) {
@ -517,6 +519,10 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
this.getCombatTracker().reset();
}
public boolean isEntityInvulnerable(DamageSource source) {
return super.isEntityInvulnerable(source) || this.isInvulnerableDimensionChange();
}
/**
* +
* Called when the entity is attacked.
@ -568,6 +574,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
* number to teleport to
*/
public void travelToDimension(int dimensionId) {
this.invulnerableDimensionChange = true;
if (this.dimension == 1 && dimensionId == 1) {
this.triggerAchievement(AchievementList.theEnd2);
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) {
return player.isSpectator() ? this.getSpectatingEntity() == this
: (this.isSpectator() ? false : super.isSpectatedByPlayer(player));
@ -659,7 +672,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
Entity entity1 = this.ridingEntity;
super.mountEntity(entity);
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.rotationPitch);
}
@ -1204,6 +1217,14 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
return null;
}
public boolean isInvulnerableDimensionChange() {
return this.invulnerableDimensionChange;
}
public void clearInvulnerableDimensionChange() {
this.invulnerableDimensionChange = false;
}
public void setElytraFlying() {
this.setFlag(7, true);
}

View File

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

View File

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

View File

@ -258,7 +258,7 @@ public class ItemMap extends ItemMapBase {
if (mapdata1.scale > 4) {
mapdata1.scale = 4;
}
mapdata1.trackingPosition = true;
mapdata1.calculateMapCenter((double) mapdata.xCenter, (double) mapdata.zCenter, mapdata1.scale);
mapdata1.dimension = mapdata.dimension;
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.C18PacketSpectate;
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.S01PacketJoinGame;
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.S48PacketResourcePackSend;
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;
/**
@ -145,106 +161,117 @@ public enum EnumConnectionState {
},
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, S11PacketSpawnExperienceOrb.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2CPacketSpawnGlobalEntity.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0FPacketSpawnMob.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S10PacketSpawnPainting.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S11PacketSpawnExperienceOrb.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S12PacketEntityVelocity.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S13PacketDestroyEntities.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, S0CPacketSpawnPlayer.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0BPacketAnimation.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S37PacketStatistics.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S25PacketBlockBreakAnim.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, new PlaceholderPacket().getClass());
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S27PacketExplosion.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S28PacketEffect.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S29PacketSoundEffect.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2APacketParticles.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2BPacketChangeGameState.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2CPacketSpawnGlobalEntity.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2DPacketOpenWindow.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S35PacketUpdateTileEntity.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S24PacketBlockAction.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S23PacketBlockChange.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, SPacketBossBar.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S41PacketServerDifficulty.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3APacketTabComplete.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S02PacketChat.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S22PacketMultiBlockChange.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S32PacketConfirmTransaction.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, S31PacketWindowProperty.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S32PacketConfirmTransaction.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S33PacketUpdateSign.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, S2FPacketSetSlot.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, SPacketSetCooldown.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3FPacketCustomPayload.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S29PacketSoundEffect.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, S43PacketCamera.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S44PacketWorldBorder.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S45PacketTitle.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S46PacketSetCompressionLevel.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S47PacketPlayerListHeaderFooter.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S38PacketPlayerListItem.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S08PacketPlayerPosLook.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0APacketUseBed.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S13PacketDestroyEntities.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1EPacketRemoveEntityEffect.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.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, 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, 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.C04PacketPlayerPosition.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.C05PacketPlayerLook.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.C06PacketPlayerPosLook.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, CPacketVehicleMove.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, CPacketSteerBoat.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C13PacketPlayerAbilities.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, 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, 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) {

View File

@ -3,6 +3,8 @@ package net.minecraft.network;
import com.google.common.collect.Lists;
import com.google.common.primitives.Doubles;
import com.google.common.primitives.Floats;
import com.logisticscraft.occlusionculling.util.Vec3d;
import net.lax1dude.eaglercraft.v1_8.netty.Unpooled;
import java.io.IOException;
import java.util.ArrayList;
@ -13,6 +15,7 @@ import java.util.concurrent.Callable;
import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerMinecraftServer;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.command.server.CommandBlockLogic;
import net.minecraft.crash.CrashReport;
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.C18PacketSpectate;
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.S02PacketChat;
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.EnumChatFormatting;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.ITickable;
import net.minecraft.util.IntHashMap;
import net.minecraft.util.ReportedException;
import net.minecraft.util.Vec3;
import net.minecraft.world.WorldServer;
import net.lax1dude.eaglercraft.v1_8.sp.server.socket.IntegratedServerPlayerNetworkManager;
import net.lax1dude.eaglercraft.v1_8.sp.server.voice.IntegratedVoiceService;
@ -150,6 +157,16 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable {
private double lastPosZ;
private boolean hasMoved = true;
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,
EntityPlayerMP playerIn) {
@ -236,189 +253,201 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable {
WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
this.field_147366_g = true;
if (!this.playerEntity.playerConqueredTheEnd) {
double d0 = this.playerEntity.posX;
double d1 = this.playerEntity.posY;
double d2 = this.playerEntity.posZ;
double d3 = 0.0D;
double d4 = c03packetplayer.getPositionX() - this.lastPosX;
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;
if (this.targetPos != null) {
if (this.networkTickCount - this.lastPositionUpdate > 20) {
this.lastPositionUpdate = this.networkTickCount;
this.setPlayerLocation(this.targetPos.xCoord, this.targetPos.yCoord, this.targetPos.zCoord,
this.playerEntity.rotationYaw, this.playerEntity.rotationPitch);
}
}
if (this.hasMoved) {
this.field_175090_f = this.networkTickCount;
if (this.playerEntity.ridingEntity != null) {
float f4 = this.playerEntity.rotationYaw;
float f = this.playerEntity.rotationPitch;
this.playerEntity.ridingEntity.updateRiderPosition();
double d16 = this.playerEntity.posX;
double d17 = this.playerEntity.posY;
double d18 = this.playerEntity.posZ;
if (c03packetplayer.getRotating()) {
f4 = c03packetplayer.getYaw();
f = c03packetplayer.getPitch();
} else {
this.lastPositionUpdate = this.networkTickCount;
double d0 = this.playerEntity.posX;
double d1 = this.playerEntity.posY;
double d2 = this.playerEntity.posZ;
double d3 = 0.0D;
double d4 = c03packetplayer.getPositionX() - this.lastPosX;
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;
}
}
this.playerEntity.onGround = c03packetplayer.isOnGround();
this.playerEntity.onUpdateEntity();
this.playerEntity.setPositionAndRotation(d16, d17, d18, f4, f);
if (this.hasMoved) {
this.field_175090_f = this.networkTickCount;
if (this.playerEntity.ridingEntity != null) {
float f4 = this.playerEntity.rotationYaw;
float f = this.playerEntity.rotationPitch;
this.playerEntity.ridingEntity.updateRiderPosition();
}
this.serverController.getConfigurationManager()
.serverUpdateMountedMovingPlayer(this.playerEntity);
if (this.playerEntity.ridingEntity != null) {
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);
double d16 = this.playerEntity.posX;
double d17 = this.playerEntity.posY;
double d18 = this.playerEntity.posZ;
if (c03packetplayer.getRotating()) {
f4 = c03packetplayer.getYaw();
f = c03packetplayer.getPitch();
}
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.lastPosX = this.playerEntity.posX;
this.lastPosY = this.playerEntity.posY;
this.lastPosZ = this.playerEntity.posZ;
}
this.serverController.getConfigurationManager()
.serverUpdateMountedMovingPlayer(this.playerEntity);
if (this.playerEntity.ridingEntity != null) {
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);
return;
}
this.playerEntity.ridingEntity.isAirBorne = true;
}
if (this.playerEntity.isPlayerSleeping()) {
this.playerEntity.onUpdateEntity();
this.playerEntity.setPositionAndRotation(this.lastPosX, this.lastPosY, this.lastPosZ,
this.playerEntity.rotationYaw, this.playerEntity.rotationPitch);
worldserver.updateEntity(this.playerEntity);
return;
}
if (this.hasMoved) {
this.lastPosX = this.playerEntity.posX;
this.lastPosY = this.playerEntity.posY;
this.lastPosZ = this.playerEntity.posZ;
}
double d7 = this.playerEntity.posY;
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");
worldserver.updateEntity(this.playerEntity);
return;
}
}
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);
if (this.playerEntity.isPlayerSleeping()) {
this.playerEntity.onUpdateEntity();
this.playerEntity.setPositionAndRotation(this.lastPosX, this.lastPosY, this.lastPosZ,
this.playerEntity.rotationYaw, this.playerEntity.rotationPitch);
worldserver.updateEntity(this.playerEntity);
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");
double d7 = this.playerEntity.posY;
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;
}
}
} 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,
Set<S08PacketPlayerPosLook.EnumFlags> relativeSet) {
this.hasMoved = false;
this.lastPosX = x;
this.lastPosY = y;
this.lastPosZ = z;
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;
}
double d0 = relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.X) ? this.playerEntity.posX : 0.0D;
double d1 = relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.Y) ? this.playerEntity.posY : 0.0D;
double d2 = relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.Z) ? this.playerEntity.posZ : 0.0D;
this.targetPos = new Vec3(x + d0, y + d1, z + d2);
float f = yaw;
float f1 = pitch;
if (relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.Y_ROT)) {
f = yaw + this.playerEntity.rotationYaw;
}
@ -455,9 +473,15 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable {
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
.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,
* furnace, etc.)
*/
public void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement c08packetplayerblockplacement) {
public void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement packetIn) {
// TODO: implement offhand
WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
EnumHand enumhand = packetIn.getHand();
ItemStack itemstack = this.playerEntity.inventory.getCurrentItem();
boolean flag = false;
BlockPos blockpos = c08packetplayerblockplacement.getPosition();
EnumFacing enumfacing = EnumFacing.getFront(c08packetplayerblockplacement.getPlacedBlockDirection());
BlockPos blockpos = packetIn.getPos();
EnumFacing enumfacing = packetIn.getDirection();
this.playerEntity.markPlayerActive();
if (c08packetplayerblockplacement.getPlacedBlockDirection() == 255) {
if (itemstack == null) {
return;
}
this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack);
} else if (blockpos.getY() < this.serverController.getBuildLimit() - 1
if (blockpos.getY() < this.serverController.getBuildLimit() - 1
|| 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,
(double) blockpos.getZ() + 0.5D) < 64.0D
&& !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity)
&& worldserver.getWorldBorder().contains(blockpos)) {
this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver,
itemstack, blockpos, enumfacing, c08packetplayerblockplacement.getPlacedBlockOffsetX(),
c08packetplayerblockplacement.getPlacedBlockOffsetY(),
c08packetplayerblockplacement.getPlacedBlockOffsetZ());
itemstack, blockpos, enumfacing, packetIn.getFacingX(), packetIn.getFacingY(),
packetIn.getFacingZ());
}
flag = true;
} else {
ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("build.tooHigh",
ChatComponentTranslation textcomponenttranslation = new ChatComponentTranslation("build.tooHigh",
new Object[] { Integer.valueOf(this.serverController.getBuildLimit()) });
chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
this.playerEntity.playerNetServerHandler.sendPacket(new S02PacketChat(chatcomponenttranslation));
flag = true;
}
if (flag) {
this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos));
this.playerEntity.playerNetServerHandler
.sendPacket(new S23PacketBlockChange(worldserver, blockpos.offset(enumfacing)));
textcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
this.playerEntity.playerNetServerHandler.sendPacket(new S02PacketChat(textcomponenttranslation));
}
this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos));
this.playerEntity.playerNetServerHandler
.sendPacket(new S23PacketBlockChange(worldserver, blockpos.offset(enumfacing)));
itemstack = this.playerEntity.inventory.getCurrentItem();
if (itemstack != null && itemstack.stackSize == 0) {
this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = null;
this.playerEntity.setHeldItem((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) {
@ -796,7 +794,7 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable {
break;
case STOP_SLEEPING:
this.playerEntity.wakeUpPlayer(false, true, true);
this.hasMoved = false;
this.targetPos = new Vec3(this.playerEntity.posX, this.playerEntity.posY, this.playerEntity.posZ);
break;
case RIDING_JUMP:
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
@ -1054,28 +1070,27 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable {
this.playerEntity.markPlayerActive();
WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
BlockPos blockpos = c12packetupdatesign.getPosition();
if (worldserver.isBlockLoaded(blockpos)) {
TileEntity tileentity = worldserver.getTileEntity(blockpos);
if (!(tileentity instanceof TileEntitySign)) {
return;
}
TileEntitySign tileentitysign = (TileEntitySign) tileentity;
if (!tileentitysign.getIsEditable() || tileentitysign.getPlayer() != this.playerEntity) {
this.serverController.logWarning(
"Player " + this.playerEntity.getName() + " just tried to change non-editable sign");
return;
}
IChatComponent[] aichatcomponent = c12packetupdatesign.getLines();
String[] astring = c12packetupdatesign.getLines();
for (int i = 0; i < aichatcomponent.length; ++i) {
String s = EnumChatFormatting.getTextWithoutFormattingCodes(aichatcomponent[i].getUnformattedText());
if (this.serverController.worldServers[0].getWorldInfo().getGameRulesInstance()
.getBoolean("colorCodes")) {
s = net.minecraft.util.StringUtils.translateControlCodesAlternate(s);
}
tileentitysign.signText[i] = new ChatComponentText(s);
for (int i = 0; i < astring.length; ++i) {
tileentitysign.signText[i] = new ChatComponentText(
EnumChatFormatting.getTextWithoutFormattingCodes(astring[i]));
}
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
@ -1116,7 +1147,7 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable {
*/
public void processTabComplete(C14PacketTabComplete c14packettabcomplete) {
List<String> lst = this.serverController.getTabCompletions(this.playerEntity, c14packettabcomplete.getMessage(),
c14packettabcomplete.getTargetBlock());
c14packettabcomplete.getTargetBlock(), c14packettabcomplete.hasTargetBlock());
String[] fuckOff = new String[lst.size()];
for (int i = 0; i < fuckOff.length; ++i) {
fuckOff[i] = lst.get(i);

View File

@ -940,4 +940,10 @@ public class PacketBuffer extends ByteBuf {
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.S48PacketResourcePackSend;
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 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.C18PacketSpectate;
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 processUseItem(CPacketUseItem var1);
void handleSpectate(C18PacketSpectate 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.play.INetHandlerPlayServer;
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> {
private static final BlockPos field_179726_a = new BlockPos(-1, -1, -1);
private BlockPos position;
private int placedBlockDirection;
private ItemStack stack;
private EnumFacing placedBlockDirection;
private EnumHand hand;
private float facingX;
private float facingY;
private float facingZ;
@ -49,18 +51,16 @@ public class C08PacketPlayerBlockPlacement implements Packet<INetHandlerPlayServ
public C08PacketPlayerBlockPlacement() {
}
public C08PacketPlayerBlockPlacement(ItemStack stackIn) {
this(field_179726_a, 255, stackIn, 0.0F, 0.0F, 0.0F);
}
public C08PacketPlayerBlockPlacement(BlockPos positionIn, int placedBlockDirectionIn, ItemStack stackIn,
public C08PacketPlayerBlockPlacement(BlockPos positionIn, EnumFacing placedBlockDirectionIn,
float facingXIn, float facingYIn, float facingZIn) {
this.position = positionIn;
this.placedBlockDirection = placedBlockDirectionIn;
this.stack = stackIn != null ? stackIn.copy() : null;
this.facingX = facingXIn;
this.facingY = facingYIn;
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 {
this.position = parPacketBuffer.readBlockPos();
this.placedBlockDirection = parPacketBuffer.readUnsignedByte();
this.stack = parPacketBuffer.readItemStackFromBuffer();
this.placedBlockDirection = (EnumFacing) parPacketBuffer.readEnumValue(EnumFacing.class);
this.hand = (EnumHand) parPacketBuffer.readEnumValue(EnumHand.class);
this.facingX = (float) parPacketBuffer.readUnsignedByte() / 16.0F;
this.facingY = (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 {
parPacketBuffer.writeBlockPos(this.position);
parPacketBuffer.writeByte(this.placedBlockDirection);
parPacketBuffer.writeItemStackToBuffer(this.stack);
parPacketBuffer.writeEnumValue(this.placedBlockDirection);
parPacketBuffer.writeEnumValue(this.hand);
parPacketBuffer.writeByte((int) (this.facingX * 16.0F));
parPacketBuffer.writeByte((int) (this.facingY * 16.0F));
parPacketBuffer.writeByte((int) (this.facingZ * 16.0F));
@ -97,42 +97,27 @@ public class C08PacketPlayerBlockPlacement implements Packet<INetHandlerPlayServ
inethandlerplayserver.processPlayerBlockPlacement(this);
}
public BlockPos getPosition() {
public BlockPos getPos() {
return this.position;
}
public int getPlacedBlockDirection() {
public EnumFacing getDirection() {
return this.placedBlockDirection;
}
public ItemStack getStack() {
return this.stack;
public EnumHand getHand() {
return this.hand;
}
/**
* +
* Returns the offset from xPosition where the actual click took
* place.
*/
public float getPlacedBlockOffsetX() {
public float getFacingX() {
return this.facingX;
}
/**
* +
* Returns the offset from yPosition where the actual click took
* place.
*/
public float getPlacedBlockOffsetY() {
public float getFacingY() {
return this.facingY;
}
/**
* +
* Returns the offset from zPosition where the actual click took
* place.
*/
public float getPlacedBlockOffsetZ() {
public float getFacingZ() {
return this.facingZ;
}
}

View File

@ -5,6 +5,7 @@ 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;
/**
* +
@ -36,11 +37,23 @@ import net.minecraft.network.play.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.
*/
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.
*/
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 {
START_SNEAKING, STOP_SNEAKING, STOP_SLEEPING, START_SPRINTING, STOP_SPRINTING, RIDING_JUMP, OPEN_INVENTORY,
NOTHING,
START_SNEAKING, STOP_SNEAKING, STOP_SLEEPING, START_SPRINTING, STOP_SPRINTING, RIDING_JUMP, STOP_RIDING_JUMP,
OPEN_INVENTORY,
START_FALL_FLYING;
}
}

View File

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

View File

@ -41,15 +41,12 @@ import net.minecraft.util.BlockPos;
public class C14PacketTabComplete implements Packet<INetHandlerPlayServer> {
private String message;
private BlockPos targetBlock;
private boolean hasTargetBlock;
public C14PacketTabComplete() {
}
public C14PacketTabComplete(String msg) {
this(msg, (BlockPos) null);
}
public C14PacketTabComplete(String msg, BlockPos target) {
public C14PacketTabComplete(String msg, BlockPos target, boolean hasTargetBlockIn) {
this.message = msg;
this.targetBlock = target;
}
@ -60,6 +57,7 @@ public class C14PacketTabComplete implements Packet<INetHandlerPlayServer> {
*/
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.message = parPacketBuffer.readStringFromBuffer(32767);
this.hasTargetBlock = parPacketBuffer.readBoolean();
boolean flag = parPacketBuffer.readBoolean();
if (flag) {
this.targetBlock = parPacketBuffer.readBlockPos();
@ -73,6 +71,7 @@ public class C14PacketTabComplete implements Packet<INetHandlerPlayServer> {
*/
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeString(StringUtils.substring(this.message, 0, 32767));
parPacketBuffer.writeBoolean(this.hasTargetBlock);
boolean flag = this.targetBlock != null;
parPacketBuffer.writeBoolean(flag);
if (flag) {
@ -96,4 +95,8 @@ public class C14PacketTabComplete implements Packet<INetHandlerPlayServer> {
public BlockPos getTargetBlock() {
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.PacketBuffer;
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> {
private String lang;
// this is supposed to be an enum
private int view;
private EntityPlayer.EnumChatVisibility chatVisibility;
private boolean enableColors;
private int modelPartFlags;
private EnumHandSide mainHand;
public C15PacketClientSettings() {
}
@ -52,6 +55,7 @@ public class C15PacketClientSettings implements Packet<INetHandlerPlayServer> {
this.chatVisibility = chatVisibilityIn;
this.enableColors = enableColorsIn;
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 {
this.lang = parPacketBuffer.readStringFromBuffer(7);
this.view = parPacketBuffer.readByte();
this.view = parPacketBuffer.readVarIntFromBuffer();
this.chatVisibility = EntityPlayer.EnumChatVisibility.getEnumChatVisibility(parPacketBuffer.readByte());
this.enableColors = parPacketBuffer.readBoolean();
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 {
parPacketBuffer.writeString(this.lang);
parPacketBuffer.writeByte(this.view);
parPacketBuffer.writeVarIntToBuffer(this.view);
parPacketBuffer.writeByte(this.chatVisibility.getChatVisibility());
parPacketBuffer.writeBoolean(this.enableColors);
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> {
private int entityID;
// this should be an enum
private int equipmentSlot;
private ItemStack itemStack;
public S04PacketEntityEquipment() {
}
// TODO: implement offhand
public S04PacketEntityEquipment(int entityIDIn, int parInt1, ItemStack itemStackIn) {
this.entityID = entityIDIn;
this.equipmentSlot = parInt1;
@ -57,6 +59,9 @@ public class S04PacketEntityEquipment implements Packet<INetHandlerPlayClient> {
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.entityID = parPacketBuffer.readVarIntFromBuffer();
this.equipmentSlot = parPacketBuffer.readShort();
if (this.equipmentSlot > 0) {
this.equipmentSlot--;
}
this.itemStack = parPacketBuffer.readItemStackFromBuffer();
}
@ -66,7 +71,7 @@ public class S04PacketEntityEquipment implements Packet<INetHandlerPlayClient> {
*/
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeVarIntToBuffer(this.entityID);
parPacketBuffer.writeShort(this.equipmentSlot);
parPacketBuffer.writeShort(this.equipmentSlot > 0 ? this.equipmentSlot + 1 : this.equipmentSlot);
parPacketBuffer.writeItemStackToBuffer(this.itemStack);
}

View File

@ -44,18 +44,20 @@ public class S08PacketPlayerPosLook implements Packet<INetHandlerPlayClient> {
private float yaw;
private float pitch;
private Set<S08PacketPlayerPosLook.EnumFlags> field_179835_f;
private int teleportId;
public S08PacketPlayerPosLook() {
}
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.y = yIn;
this.z = zIn;
this.yaw = yawIn;
this.pitch = pitchIn;
this.field_179835_f = parSet;
this.teleportId = teleportIdIn;
}
/**
@ -69,6 +71,7 @@ public class S08PacketPlayerPosLook implements Packet<INetHandlerPlayClient> {
this.yaw = parPacketBuffer.readFloat();
this.pitch = parPacketBuffer.readFloat();
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.pitch);
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;
}
public int getTeleportId() {
return this.teleportId;
}
public static enum EnumFlags {
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> {
private int entityId;
private EaglercraftUUID playerId;
private int x;
private int y;
private int z;
private double x;
private double y;
private double z;
private byte yaw;
private byte pitch;
private int currentItem;
private DataWatcher watcher;
private List<DataWatcher.WatchableObject> field_148958_j;
@ -60,13 +59,11 @@ public class S0CPacketSpawnPlayer implements Packet<INetHandlerPlayClient> {
public S0CPacketSpawnPlayer(EntityPlayer player) {
this.entityId = player.getEntityId();
this.playerId = player.getGameProfile().getId();
this.x = MathHelper.floor_double(player.posX * 32.0D);
this.y = MathHelper.floor_double(player.posY * 32.0D);
this.z = MathHelper.floor_double(player.posZ * 32.0D);
this.x = player.posX;
this.z = player.posZ;
this.y = player.posY;
this.yaw = (byte) ((int) (player.rotationYaw * 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();
}
@ -77,12 +74,11 @@ public class S0CPacketSpawnPlayer implements Packet<INetHandlerPlayClient> {
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.entityId = parPacketBuffer.readVarIntFromBuffer();
this.playerId = parPacketBuffer.readUuid();
this.x = parPacketBuffer.readInt();
this.y = parPacketBuffer.readInt();
this.z = parPacketBuffer.readInt();
this.x = parPacketBuffer.readDouble();
this.y = parPacketBuffer.readDouble();
this.z = parPacketBuffer.readDouble();
this.yaw = parPacketBuffer.readByte();
this.pitch = parPacketBuffer.readByte();
this.currentItem = parPacketBuffer.readShort();
this.field_148958_j = DataWatcher.readWatchedListFromPacketBuffer(parPacketBuffer);
}
@ -93,12 +89,11 @@ public class S0CPacketSpawnPlayer implements Packet<INetHandlerPlayClient> {
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeVarIntToBuffer(this.entityId);
parPacketBuffer.writeUuid(this.playerId);
parPacketBuffer.writeInt(this.x);
parPacketBuffer.writeInt(this.y);
parPacketBuffer.writeInt(this.z);
parPacketBuffer.writeDouble(this.x);
parPacketBuffer.writeDouble(this.y);
parPacketBuffer.writeDouble(this.z);
parPacketBuffer.writeByte(this.yaw);
parPacketBuffer.writeByte(this.pitch);
parPacketBuffer.writeShort(this.currentItem);
this.watcher.writeTo(parPacketBuffer);
}
@ -122,19 +117,19 @@ public class S0CPacketSpawnPlayer implements Packet<INetHandlerPlayClient> {
return this.entityId;
}
public EaglercraftUUID getPlayer() {
public EaglercraftUUID getUniqueId() {
return this.playerId;
}
public int getX() {
public double getX() {
return this.x;
}
public int getY() {
public double getY() {
return this.y;
}
public int getZ() {
public double getZ() {
return this.z;
}
@ -145,8 +140,4 @@ public class S0CPacketSpawnPlayer implements Packet<INetHandlerPlayClient> {
public byte getPitch() {
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 net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.entity.Entity;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
@ -39,9 +40,10 @@ import net.minecraft.util.MathHelper;
*/
public class S0EPacketSpawnObject implements Packet<INetHandlerPlayClient> {
private int entityId;
private int x;
private int y;
private int z;
private EaglercraftUUID uniqueId;
private double x;
private double y;
private double z;
private int speedX;
private int speedY;
private int speedZ;
@ -59,47 +61,17 @@ public class S0EPacketSpawnObject implements Packet<INetHandlerPlayClient> {
public S0EPacketSpawnObject(Entity entityIn, int typeIn, int parInt1) {
this.entityId = entityIn.getEntityId();
this.x = MathHelper.floor_double(entityIn.posX * 32.0D);
this.y = MathHelper.floor_double(entityIn.posY * 32.0D);
this.z = MathHelper.floor_double(entityIn.posZ * 32.0D);
this.uniqueId = entityIn.getUniqueID();
this.y = entityIn.posY;
this.x = entityIn.posX;
this.z = entityIn.posZ;
this.pitch = MathHelper.floor_float(entityIn.rotationPitch * 256.0F / 360.0F);
this.yaw = MathHelper.floor_float(entityIn.rotationYaw * 256.0F / 360.0F);
this.type = typeIn;
this.field_149020_k = parInt1;
if (parInt1 > 0) {
double d0 = entityIn.motionX;
double d1 = entityIn.motionY;
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);
}
this.speedX = (int) (MathHelper.clamp_double(entityIn.motionX, -3.9D, 3.9D) * 8000.0D);
this.speedY = (int) (MathHelper.clamp_double(entityIn.motionY, -3.9D, 3.9D) * 8000.0D);
this.speedZ = (int) (MathHelper.clamp_double(entityIn.motionZ, -3.9D, 3.9D) * 8000.0D);
}
/**
@ -108,19 +80,17 @@ public class S0EPacketSpawnObject implements Packet<INetHandlerPlayClient> {
*/
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.entityId = parPacketBuffer.readVarIntFromBuffer();
this.uniqueId = parPacketBuffer.readUuid();
this.type = parPacketBuffer.readByte();
this.x = parPacketBuffer.readInt();
this.y = parPacketBuffer.readInt();
this.z = parPacketBuffer.readInt();
this.x = parPacketBuffer.readDouble();
this.y = parPacketBuffer.readDouble();
this.z = parPacketBuffer.readDouble();
this.pitch = parPacketBuffer.readByte();
this.yaw = parPacketBuffer.readByte();
this.field_149020_k = parPacketBuffer.readInt();
if (this.field_149020_k > 0) {
this.speedX = parPacketBuffer.readShort();
this.speedY = parPacketBuffer.readShort();
this.speedZ = parPacketBuffer.readShort();
}
this.speedX = parPacketBuffer.readShort();
this.speedY = parPacketBuffer.readShort();
this.speedZ = parPacketBuffer.readShort();
}
/**
@ -129,19 +99,17 @@ public class S0EPacketSpawnObject implements Packet<INetHandlerPlayClient> {
*/
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeVarIntToBuffer(this.entityId);
parPacketBuffer.writeUuid(this.uniqueId);
parPacketBuffer.writeByte(this.type);
parPacketBuffer.writeInt(this.x);
parPacketBuffer.writeInt(this.y);
parPacketBuffer.writeInt(this.z);
parPacketBuffer.writeDouble(this.x);
parPacketBuffer.writeDouble(this.y);
parPacketBuffer.writeDouble(this.z);
parPacketBuffer.writeByte(this.pitch);
parPacketBuffer.writeByte(this.yaw);
parPacketBuffer.writeInt(this.field_149020_k);
if (this.field_149020_k > 0) {
parPacketBuffer.writeShort(this.speedX);
parPacketBuffer.writeShort(this.speedY);
parPacketBuffer.writeShort(this.speedZ);
}
parPacketBuffer.writeShort(this.speedX);
parPacketBuffer.writeShort(this.speedY);
parPacketBuffer.writeShort(this.speedZ);
}
/**
@ -156,15 +124,19 @@ public class S0EPacketSpawnObject implements Packet<INetHandlerPlayClient> {
return this.entityId;
}
public int getX() {
public EaglercraftUUID getUniqueId() {
return this.uniqueId;
}
public double getX() {
return this.x;
}
public int getY() {
public double getY() {
return this.y;
}
public int getZ() {
public double getZ() {
return this.z;
}

View File

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

View File

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

View File

@ -1,51 +1,21 @@
package net.minecraft.network.play.server;
import java.io.IOException;
import net.minecraft.entity.Entity;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
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> {
protected int entityId;
protected byte posX;
protected byte posY;
protected byte posZ;
protected int posX;
protected int posY;
protected int posZ;
protected byte yaw;
protected byte pitch;
protected boolean onGround;
protected boolean field_149069_g;
protected boolean rotating;
public S14PacketEntity() {
}
@ -55,27 +25,24 @@ public class S14PacketEntity implements Packet<INetHandlerPlayClient> {
}
/**
* +
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.entityId = parPacketBuffer.readVarIntFromBuffer();
public void readPacketData(PacketBuffer buf) throws IOException {
this.entityId = buf.readVarIntFromBuffer();
}
/**
* +
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeVarIntToBuffer(this.entityId);
public void writePacketData(PacketBuffer buf) throws IOException {
buf.writeVarIntToBuffer(this.entityId);
}
/**
* +
* Passes this Packet on to the NetHandler for processing.
*/
public void processPacket(INetHandlerPlayClient inethandlerplayclient) {
inethandlerplayclient.handleEntityMovement(this);
public void processPacket(INetHandlerPlayClient handler) {
handler.handleEntityMovement(this);
}
public String toString() {
@ -86,28 +53,28 @@ public class S14PacketEntity implements Packet<INetHandlerPlayClient> {
return worldIn.getEntityByID(this.entityId);
}
public byte func_149062_c() {
public int getX() {
return this.posX;
}
public byte func_149061_d() {
public int getY() {
return this.posY;
}
public byte func_149064_e() {
public int getZ() {
return this.posZ;
}
public byte func_149066_f() {
public byte getYaw() {
return this.yaw;
}
public byte func_149063_g() {
public byte getPitch() {
return this.pitch;
}
public boolean func_149060_h() {
return this.field_149069_g;
public boolean isRotating() {
return this.rotating;
}
public boolean getOnGround() {
@ -118,118 +85,94 @@ public class S14PacketEntity implements Packet<INetHandlerPlayClient> {
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);
this.posX = x;
this.posY = y;
this.posZ = z;
this.posX = (int) xIn;
this.posY = (int) yIn;
this.posZ = (int) zIn;
this.onGround = onGroundIn;
}
/**
* +
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
super.readPacketData(parPacketBuffer);
this.posX = parPacketBuffer.readByte();
this.posY = parPacketBuffer.readByte();
this.posZ = parPacketBuffer.readByte();
this.onGround = parPacketBuffer.readBoolean();
public void readPacketData(PacketBuffer buf) throws IOException {
super.readPacketData(buf);
this.posX = buf.readShort();
this.posY = buf.readShort();
this.posZ = buf.readShort();
this.onGround = buf.readBoolean();
}
/**
* +
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
super.writePacketData(parPacketBuffer);
parPacketBuffer.writeByte(this.posX);
parPacketBuffer.writeByte(this.posY);
parPacketBuffer.writeByte(this.posZ);
parPacketBuffer.writeBoolean(this.onGround);
public void writePacketData(PacketBuffer buf) throws IOException {
super.writePacketData(buf);
buf.writeShort(this.posX);
buf.writeShort(this.posY);
buf.writeShort(this.posZ);
buf.writeBoolean(this.onGround);
}
}
public static class S16PacketEntityLook extends S14PacketEntity {
public S16PacketEntityLook() {
this.field_149069_g = true;
this.rotating = true;
}
public S16PacketEntityLook(int entityIdIn, byte yawIn, byte pitchIn, boolean onGroundIn) {
super(entityIdIn);
this.yaw = yawIn;
this.pitch = pitchIn;
this.field_149069_g = true;
this.rotating = true;
this.onGround = onGroundIn;
}
/**
* +
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
super.readPacketData(parPacketBuffer);
this.yaw = parPacketBuffer.readByte();
this.pitch = parPacketBuffer.readByte();
this.onGround = parPacketBuffer.readBoolean();
public void readPacketData(PacketBuffer buf) throws IOException {
super.readPacketData(buf);
this.yaw = buf.readByte();
this.pitch = buf.readByte();
this.onGround = buf.readBoolean();
}
/**
* +
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
super.writePacketData(parPacketBuffer);
parPacketBuffer.writeByte(this.yaw);
parPacketBuffer.writeByte(this.pitch);
parPacketBuffer.writeBoolean(this.onGround);
public void writePacketData(PacketBuffer buf) throws IOException {
super.writePacketData(buf);
buf.writeByte(this.yaw);
buf.writeByte(this.pitch);
buf.writeBoolean(this.onGround);
}
}
public static class S17PacketEntityLookMove extends S14PacketEntity {
public S17PacketEntityLookMove() {
this.field_149069_g = true;
this.rotating = true;
}
public S17PacketEntityLookMove(int parInt1, byte parByte1, byte parByte2, byte parByte3, byte parByte4,
byte parByte5, boolean parFlag) {
super(parInt1);
this.posX = parByte1;
this.posY = parByte2;
this.posZ = parByte3;
this.yaw = parByte4;
this.pitch = parByte5;
this.onGround = parFlag;
this.field_149069_g = true;
public S17PacketEntityLookMove(int entityIdIn, long xIn, long yIn, long zIn, byte yawIn, byte pitchIn,
boolean onGroundIn) {
super(entityIdIn);
this.posX = (int) xIn;
this.posY = (int) yIn;
this.posZ = (int) zIn;
this.yaw = yawIn;
this.pitch = pitchIn;
this.onGround = onGroundIn;
this.rotating = true;
}
/**
* +
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
super.readPacketData(parPacketBuffer);
this.posX = parPacketBuffer.readByte();
this.posY = parPacketBuffer.readByte();
this.posZ = parPacketBuffer.readByte();
this.yaw = parPacketBuffer.readByte();
this.pitch = parPacketBuffer.readByte();
this.onGround = parPacketBuffer.readBoolean();
public void readPacketData(PacketBuffer buf) throws IOException {
super.readPacketData(buf);
this.posX = buf.readShort();
this.posY = buf.readShort();
this.posZ = buf.readShort();
this.yaw = buf.readByte();
this.pitch = buf.readByte();
this.onGround = buf.readBoolean();
}
/**
* +
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
super.writePacketData(parPacketBuffer);
parPacketBuffer.writeByte(this.posX);
parPacketBuffer.writeByte(this.posY);
parPacketBuffer.writeByte(this.posZ);
parPacketBuffer.writeByte(this.yaw);
parPacketBuffer.writeByte(this.pitch);
parPacketBuffer.writeBoolean(this.onGround);
public void writePacketData(PacketBuffer buf) throws IOException {
super.writePacketData(buf);
buf.writeShort(this.posX);
buf.writeShort(this.posY);
buf.writeShort(this.posZ);
buf.writeByte(this.yaw);
buf.writeByte(this.pitch);
buf.writeBoolean(this.onGround);
}
}
}
}

View File

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

View File

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

View File

@ -59,10 +59,10 @@ public class S21PacketChunkData implements Packet<INetHandlerPlayClient> {
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.chunkZ = p_i47124_1_.zPosition;
this.loadChunk = loaded;
this.loadChunk = p_i47124_2_ == 65535;
boolean flag = !p_i47124_1_.getWorld().provider.getHasNoSky();
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,
@ -86,7 +86,9 @@ public class S21PacketChunkData implements Packet<INetHandlerPlayClient> {
this.chunkZ = buf.readInt();
this.loadChunk = buf.readBoolean();
this.availableSections = buf.readVarIntFromBuffer();
System.out.println("Was able to read first varint");
int i = buf.readVarIntFromBuffer();
System.out.println("Was able to read second varint");
if (i > 2097152) {
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];
buf.readBytes(this.buffer);
int j = buf.readVarIntFromBuffer();
System.out.println("Was able to read third varint");
this.field_189557_e = Lists.<NBTTagCompound>newArrayList();
for (int k = 0; k < j; ++k) {

View File

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

View File

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

View File

@ -41,6 +41,7 @@ import net.minecraft.world.storage.MapData;
public class S34PacketMaps implements Packet<INetHandlerPlayClient> {
private int mapId;
private byte mapScale;
private boolean trackingPosition;
private Vec4b[] mapVisiblePlayersVec4b;
private int mapMinX;
private int mapMinY;
@ -51,10 +52,12 @@ public class S34PacketMaps implements Packet<INetHandlerPlayClient> {
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) {
this.mapId = mapIdIn;
this.mapScale = scale;
this.trackingPosition = trackingPositionIn;
this.mapVisiblePlayersVec4b = (Vec4b[]) visiblePlayers.toArray(new Vec4b[visiblePlayers.size()]);
this.mapMinX = minX;
this.mapMinY = minY;
@ -77,6 +80,7 @@ public class S34PacketMaps implements Packet<INetHandlerPlayClient> {
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.mapId = parPacketBuffer.readVarIntFromBuffer();
this.mapScale = parPacketBuffer.readByte();
this.trackingPosition = parPacketBuffer.readBoolean();
this.mapVisiblePlayersVec4b = new Vec4b[parPacketBuffer.readVarIntFromBuffer()];
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 {
parPacketBuffer.writeVarIntToBuffer(this.mapId);
parPacketBuffer.writeByte(this.mapScale);
parPacketBuffer.writeBoolean(this.trackingPosition);
parPacketBuffer.writeVarIntToBuffer(this.mapVisiblePlayersVec4b.length);
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_179816_e;
private int field_179815_f;
private String collisionRule;
private Collection<String> field_149317_e;
private int field_149314_f;
private int field_149315_g;
@ -69,6 +70,8 @@ public class S3EPacketTeams implements Packet<INetHandlerPlayClient> {
this.field_149316_d = parScorePlayerTeam.getColorSuffix();
this.field_149315_g = parScorePlayerTeam.func_98299_i();
this.field_179816_e = parScorePlayerTeam.getNameTagVisibility().field_178830_e;
// TODO: implement collision rule
this.collisionRule = "always";
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_149315_g = parPacketBuffer.readByte();
this.field_179816_e = parPacketBuffer.readStringFromBuffer(32);
this.collisionRule = parPacketBuffer.readStringFromBuffer(32);
this.field_179815_f = parPacketBuffer.readByte();
}
@ -132,6 +136,7 @@ public class S3EPacketTeams implements Packet<INetHandlerPlayClient> {
parPacketBuffer.writeString(this.field_149316_d);
parPacketBuffer.writeByte(this.field_149315_g);
parPacketBuffer.writeString(this.field_179816_e);
parPacketBuffer.writeString(this.collisionRule);
parPacketBuffer.writeByte(this.field_179815_f);
}
@ -188,4 +193,8 @@ public class S3EPacketTeams implements Packet<INetHandlerPlayClient> {
public String func_179814_i() {
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.play.INetHandlerPlayClient;
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_179775_c;
public int field_179772_d;
public String deathMessage;
public IChatComponent deathMessage;
public S42PacketCombatEvent() {
}
@ -58,7 +59,7 @@ public class S42PacketCombatEvent implements Packet<INetHandlerPlayClient> {
case ENTITY_DIED:
this.field_179774_b = combatTrackerIn.getFighter().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) {
this.field_179774_b = parPacketBuffer.readVarIntFromBuffer();
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) {
parPacketBuffer.writeVarIntToBuffer(this.field_179774_b);
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.
*
*/
@Deprecated
public class S46PacketSetCompressionLevel implements Packet<INetHandlerPlayClient> {
private int field_179761_a;

View File

@ -38,6 +38,8 @@ import net.minecraft.world.World;
* POSSIBILITY OF SUCH DAMAGE.
*
*/
@Deprecated
public class S49PacketUpdateEntityNBT implements Packet<INetHandlerPlayClient> {
private int entityId;
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.concurrent.Callable;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.lax1dude.eaglercraft.v1_8.futures.FutureTask;
@ -680,36 +682,41 @@ public abstract class MinecraftServer implements Runnable, ICommandSender, IThre
return crashreport;
}
public List<String> getTabCompletions(ICommandSender sender, String input, BlockPos pos) {
ArrayList arraylist = Lists.newArrayList();
if (input.startsWith("/")) {
public List<String> getTabCompletions(ICommandSender sender, String input, @Nullable BlockPos pos,
boolean hasTargetBlock) {
List<String> list = Lists.<String>newArrayList();
boolean flag = input.startsWith("/");
if (flag) {
input = input.substring(1);
boolean flag = !input.contains(" ");
List<String> list = this.commandManager.getTabCompletionOptions(sender, input, pos);
if (list != null) {
for (int i = 0, l = list.size(); i < l; ++i) {
String s2 = list.get(i);
if (flag) {
arraylist.add("/" + s2);
}
if (!flag && !hasTargetBlock) {
String[] astring = input.split(" ", -1);
String s2 = astring[astring.length - 1];
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 {
arraylist.add(s2);
list.add(s);
}
}
}
return arraylist;
} 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;
return list;
}
}

View File

@ -15,6 +15,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.world.ILockableContainer;
import net.minecraft.world.World;
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.

View File

@ -8,6 +8,7 @@ import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S21PacketChunkData;
import net.minecraft.network.play.server.S22PacketMultiBlockChange;
import net.minecraft.network.play.server.S23PacketBlockChange;
import net.minecraft.network.play.server.SPacketUnloadChunk;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.LongHashMap;
@ -392,7 +393,8 @@ public class PlayerManager {
Chunk chunk = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos,
this.chunkCoords.chunkZPos);
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);
@ -475,7 +477,7 @@ public class PlayerManager {
new S21PacketChunkData(
PlayerManager.this.theWorldServer.getChunkFromChunkCoords(
this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos),
false, this.flagsYAreasToUpdate));
this.flagsYAreasToUpdate));
for (int i2 = 0; i2 < 16; ++i2) {
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 zCenter;
public byte dimension;
public boolean trackingPosition;
public byte scale;
/**
* +
@ -89,6 +90,13 @@ public class MapData extends WorldSavedData {
this.zCenter = nbttagcompound.getInteger("zCenter");
this.scale = nbttagcompound.getByte("scale");
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 short2 = nbttagcompound.getShort("height");
if (short1 == 128 && short2 == 128) {
@ -127,6 +135,7 @@ public class MapData extends WorldSavedData {
nbttagcompound.setShort("width", (short) 128);
nbttagcompound.setShort("height", (short) 128);
nbttagcompound.setByteArray("colors", this.colors);
nbttagcompound.setBoolean("trackingPosition", this.trackingPosition);
}
/**
@ -150,7 +159,8 @@ public class MapData extends WorldSavedData {
if (!mapdata$mapinfo1.entityplayerObj.isDead
&& (mapdata$mapinfo1.entityplayerObj.inventory.hasItemStack(mapStack)
|| 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,
mapdata$mapinfo1.entityplayerObj.getName(), mapdata$mapinfo1.entityplayerObj.posX,
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();
BlockPos blockpos = entityitemframe.getHangingPosition();
this.updateDecorations(1, player.worldObj, "frame-" + entityitemframe.getEntityId(),
@ -271,12 +281,15 @@ public class MapData extends WorldSavedData {
public Packet getPacket(ItemStack stack) {
if (this.field_176105_d) {
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,
this.maxY + 1 - this.minY);
} else {
return this.field_176109_i++ % 5 == 0 ? new S34PacketMaps(stack.getMetadata(), MapData.this.scale,
MapData.this.mapDecorations.values(), MapData.this.colors, 0, 0, 0, 0) : null;
return this.field_176109_i++ % 5 == 0
? new S34PacketMaps(stack.getMetadata(), MapData.this.scale, MapData.this.trackingPosition,
MapData.this.mapDecorations.values(), MapData.this.colors, 0, 0, 0, 0)
: null;
}
}