use of net.minecraft.item.ItemMap in project Charset by CharsetMC.
the class PacketRequestMapData method apply.
@Override
public void apply(INetHandler handler) {
EntityPlayer player = getPlayer(handler);
if (player instanceof EntityPlayerMP) {
ItemStack stack = new ItemStack(Items.FILLED_MAP, 1, mapId);
MapData data = Items.FILLED_MAP.getMapData(stack, player.getEntityWorld());
// this is probably wrong
ItemStack oldStack = player.inventory.getStackInSlot(0);
player.inventory.setInventorySlotContents(0, stack);
data.updateVisiblePlayers(player, stack);
player.inventory.setInventorySlotContents(0, oldStack);
net.minecraft.network.Packet<?> packet = ((ItemMap) Items.FILLED_MAP).createMapDataPacket(stack, player.getEntityWorld(), player);
if (packet != null) {
((EntityPlayerMP) player).connection.sendPacket(packet);
}
}
}
use of net.minecraft.item.ItemMap in project Charset by CharsetMC.
the class ProjectorHandlerMap method render.
@Override
@SideOnly(Side.CLIENT)
public void render(ItemStack stack, IProjector projector, IProjectorSurface surface) {
MapData mapData = ((ItemMap) stack.getItem()).getMapData(stack, surface.getWorld());
if (mapData != null && mapData.mapName != null) {
MapItemRenderer mapItemRenderer = Minecraft.getMinecraft().entityRenderer.getMapItemRenderer();
mapItemRenderer.updateMapTexture(mapData);
Object o = mapItemRenderer.getMapInstanceIfExists(mapData.mapName);
if (o != null) {
if (MAP_DATA_LOCATION_GETTER == null) {
MAP_DATA_LOCATION_GETTER = MethodHandleHelper.findFieldGetter(o.getClass(), "location", "field_148240_d");
}
try {
Minecraft.getMinecraft().getTextureManager().bindTexture((ResourceLocation) MAP_DATA_LOCATION_GETTER.invoke(o));
ProjectorHelper.INSTANCE.renderTexture(surface, 0, 256, 0, 256);
} catch (Throwable e) {
e.printStackTrace();
}
}
} else {
PacketRequestMapData.requestMap(stack);
}
}
use of net.minecraft.item.ItemMap in project Tropicraft by Tropicraft.
the class EntityBambooItemFrame method removeFrameFromMap.
/**
* Removes the dot representing this frame's position from the map when the item frame is broken.
*/
private void removeFrameFromMap(ItemStack stack) {
if (!stack.isEmpty()) {
if (stack.getItem() instanceof net.minecraft.item.ItemMap) {
MapData mapdata = ((ItemMap) stack.getItem()).getMapData(stack, this.world);
mapdata.mapDecorations.remove("frame-" + this.getEntityId());
}
stack.setItemFrame((EntityBambooItemFrame) null);
}
}
use of net.minecraft.item.ItemMap in project BloodMagic by WayofTime.
the class ClientUtils method renderPlayerArmourInPOV.
public static void renderPlayerArmourInPOV(EntityPlayer player, float partialTickTime) {
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
// this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * partialTickTime;
float f1 = 1.0f;
EntityClientPlayerMP entityclientplayermp = mc.thePlayer;
float f2 = entityclientplayermp.prevRotationPitch + (entityclientplayermp.rotationPitch - entityclientplayermp.prevRotationPitch) * partialTickTime;
// GL11.glPushMatrix();
GL11.glRotatef(180 - (entityclientplayermp.prevRotationYaw + (entityclientplayermp.rotationYaw - entityclientplayermp.prevRotationYaw) * partialTickTime), 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-f2, 1.0F, 0.0F, 0.0F);
RenderHelper.enableStandardItemLighting();
// GL11.glPopMatrix();
EntityPlayerSP entityplayersp = (EntityPlayerSP) entityclientplayermp;
float f3 = entityplayersp.prevRenderArmPitch + (entityplayersp.renderArmPitch - entityplayersp.prevRenderArmPitch) * partialTickTime;
float f4 = entityplayersp.prevRenderArmYaw + (entityplayersp.renderArmYaw - entityplayersp.prevRenderArmYaw) * partialTickTime;
GL11.glRotatef((entityclientplayermp.rotationPitch - f3) * 0.1F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef((entityclientplayermp.rotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F);
ItemStack itemstack = player.getCurrentEquippedItem();
if (itemstack != null && itemstack.getItem() instanceof ItemCloth) {
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
}
int i = mc.theWorld.getLightBrightnessForSkyBlocks(MathHelper.floor_double(entityclientplayermp.posX), MathHelper.floor_double(entityclientplayermp.posY), MathHelper.floor_double(entityclientplayermp.posZ), 0);
int j = i % 65536;
int k = i / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float f5;
float f6;
float f7;
if (itemstack != null) {
int l = itemstack.getItem().getColorFromItemStack(itemstack, 0);
f5 = (float) (l >> 16 & 255) / 255.0F;
f6 = (float) (l >> 8 & 255) / 255.0F;
f7 = (float) (l & 255) / 255.0F;
GL11.glColor4f(f5, f6, f7, 1.0F);
} else {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
float f8;
float f9;
float f10;
float f13;
Render render;
RenderPlayer renderplayer;
if (itemstack != null && itemstack.getItem() instanceof ItemMap) {
GL11.glPushMatrix();
f13 = 0.8F;
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
f6 = MathHelper.sin(f5 * (float) Math.PI);
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI);
GL11.glTranslatef(-f7 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI * 2.0F) * 0.2F, -f6 * 0.2F);
f5 = 1.0F - f2 / 45.0F + 0.1F;
if (f5 < 0.0F) {
f5 = 0.0F;
}
if (f5 > 1.0F) {
f5 = 1.0F;
}
f5 = -MathHelper.cos(f5 * (float) Math.PI) * 0.5F + 0.5F;
GL11.glTranslatef(0.0F, 0.0F * f13 - (1.0F - f1) * 1.2F - f5 * 0.5F + 0.04F, -0.9F * f13);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(f5 * -85.0F, 0.0F, 0.0F, 1.0F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
mc.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin());
for (int i1 = 0; i1 < 2; ++i1) {
int j1 = i1 * 2 - 1;
GL11.glPushMatrix();
GL11.glTranslatef(-0.0F, -0.6F, 1.1F * (float) j1);
GL11.glRotatef((float) (-45 * j1), 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(59.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef((float) (-65 * j1), 0.0F, 1.0F, 0.0F);
render = RenderManager.instance.getEntityRenderObject(mc.thePlayer);
renderplayer = (RenderPlayer) render;
f10 = 1.0F;
GL11.glScalef(f10, f10, f10);
renderFirstPersonArm(renderplayer, mc.thePlayer);
GL11.glPopMatrix();
}
f6 = entityclientplayermp.getSwingProgress(partialTickTime);
f7 = MathHelper.sin(f6 * f6 * (float) Math.PI);
f8 = MathHelper.sin(MathHelper.sqrt_float(f6) * (float) Math.PI);
GL11.glRotatef(-f7 * 20.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-f8 * 20.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-f8 * 80.0F, 1.0F, 0.0F, 0.0F);
f9 = 0.38F;
GL11.glScalef(f9, f9, f9);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-1.0F, -1.0F, 0.0F);
f10 = 0.015625F;
GL11.glScalef(f10, f10, f10);
mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND);
Tessellator tessellator = Tessellator.instance;
GL11.glNormal3f(0.0F, 0.0F, -1.0F);
tessellator.startDrawingQuads();
byte b0 = 7;
tessellator.addVertexWithUV((double) (0 - b0), (double) (128 + b0), 0.0D, 0.0D, 1.0D);
tessellator.addVertexWithUV((double) (128 + b0), (double) (128 + b0), 0.0D, 1.0D, 1.0D);
tessellator.addVertexWithUV((double) (128 + b0), (double) (0 - b0), 0.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV((double) (0 - b0), (double) (0 - b0), 0.0D, 0.0D, 0.0D);
tessellator.draw();
IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP);
MapData mapdata = ((ItemMap) itemstack.getItem()).getMapData(itemstack, mc.theWorld);
if (custom == null) {
if (mapdata != null) {
mc.entityRenderer.getMapItemRenderer().func_148250_a(mapdata, false);
}
} else {
custom.renderItem(FIRST_PERSON_MAP, itemstack, mc.thePlayer, mc.getTextureManager(), mapdata);
}
GL11.glPopMatrix();
} else if (itemstack != null) {
GL11.glPushMatrix();
f13 = 0.8F;
if (entityclientplayermp.getItemInUseCount() > 0) {
EnumAction enumaction = itemstack.getItemUseAction();
if (enumaction == EnumAction.eat || enumaction == EnumAction.drink) {
f6 = (float) entityclientplayermp.getItemInUseCount() - partialTickTime + 1.0F;
f7 = 1.0F - f6 / (float) itemstack.getMaxItemUseDuration();
f8 = 1.0F - f7;
f8 = f8 * f8 * f8;
f8 = f8 * f8 * f8;
f8 = f8 * f8 * f8;
f9 = 1.0F - f8;
GL11.glTranslatef(0.0F, MathHelper.abs(MathHelper.cos(f6 / 4.0F * (float) Math.PI) * 0.1F) * (float) ((double) f7 > 0.2D ? 1 : 0), 0.0F);
GL11.glTranslatef(f9 * 0.6F, -f9 * 0.5F, 0.0F);
GL11.glRotatef(f9 * 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(f9 * 10.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(f9 * 30.0F, 0.0F, 0.0F, 1.0F);
}
} else {
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
f6 = MathHelper.sin(f5 * (float) Math.PI);
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI);
GL11.glTranslatef(-f7 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI * 2.0F) * 0.2F, -f6 * 0.2F);
}
GL11.glTranslatef(0.7F * f13, -0.65F * f13 - (1.0F - f1) * 0.6F, -0.9F * f13);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
f6 = MathHelper.sin(f5 * f5 * (float) Math.PI);
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI);
GL11.glRotatef(-f6 * 20.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-f7 * 20.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-f7 * 80.0F, 1.0F, 0.0F, 0.0F);
f8 = 0.4F;
GL11.glScalef(f8, f8, f8);
float f11;
float f12;
if (entityclientplayermp.getItemInUseCount() > 0) {
EnumAction enumaction1 = itemstack.getItemUseAction();
if (enumaction1 == EnumAction.block) {
GL11.glTranslatef(-0.5F, 0.2F, 0.0F);
GL11.glRotatef(30.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-80.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F);
} else if (enumaction1 == EnumAction.bow) {
GL11.glRotatef(-18.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-12.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-8.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(-0.9F, 0.2F, 0.0F);
f10 = (float) itemstack.getMaxItemUseDuration() - ((float) entityclientplayermp.getItemInUseCount() - partialTickTime + 1.0F);
f11 = f10 / 20.0F;
f11 = (f11 * f11 + f11 * 2.0F) / 3.0F;
if (f11 > 1.0F) {
f11 = 1.0F;
}
if (f11 > 0.1F) {
GL11.glTranslatef(0.0F, MathHelper.sin((f10 - 0.1F) * 1.3F) * 0.01F * (f11 - 0.1F), 0.0F);
}
GL11.glTranslatef(0.0F, 0.0F, f11 * 0.1F);
GL11.glRotatef(-335.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.0F, 0.5F, 0.0F);
f12 = 1.0F + f11 * 0.2F;
GL11.glScalef(1.0F, 1.0F, f12);
GL11.glTranslatef(0.0F, -0.5F, 0.0F);
GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
}
}
if (itemstack.getItem().shouldRotateAroundWhenRendering()) {
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
}
if (itemstack.getItem().requiresMultipleRenderPasses()) {
RenderManager.instance.itemRenderer.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON);
for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) {
int k1 = itemstack.getItem().getColorFromItemStack(itemstack, x);
f10 = (float) (k1 >> 16 & 255) / 255.0F;
f11 = (float) (k1 >> 8 & 255) / 255.0F;
f12 = (float) (k1 & 255) / 255.0F;
GL11.glColor4f(1.0F * f10, 1.0F * f11, 1.0F * f12, 1.0F);
RenderManager.instance.itemRenderer.renderItem(entityclientplayermp, itemstack, x, EQUIPPED_FIRST_PERSON);
}
} else {
RenderManager.instance.itemRenderer.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON);
}
GL11.glPopMatrix();
} else if (!entityclientplayermp.isInvisible()) {
GL11.glPushMatrix();
f13 = 0.8F;
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
f6 = MathHelper.sin(f5 * (float) Math.PI);
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI);
GL11.glTranslatef(-f7 * 0.3F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI * 2.0F) * 0.4F, -f6 * 0.4F);
GL11.glTranslatef(0.8F * f13, -0.75F * f13 - (1.0F - f1) * 0.6F, -0.9F * f13);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
f6 = MathHelper.sin(f5 * f5 * (float) Math.PI);
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI);
GL11.glRotatef(f7 * 70.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-f6 * 20.0F, 0.0F, 0.0F, 1.0F);
mc.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin());
GL11.glTranslatef(-1.0F, 3.6F, 3.5F);
GL11.glRotatef(120.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(200.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glTranslatef(5.6F, 0.0F, 0.0F);
render = RenderManager.instance.getEntityRenderObject(mc.thePlayer);
renderplayer = (RenderPlayer) render;
f10 = 1.0F;
GL11.glScalef(f10, f10, f10);
renderFirstPersonArm(renderplayer, mc.thePlayer);
GL11.glPopMatrix();
}
if (itemstack != null && itemstack.getItem() instanceof ItemCloth) {
GL11.glDisable(GL11.GL_BLEND);
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
}
use of net.minecraft.item.ItemMap in project UtilityClient2 by Utility-Client.
the class EntityTrackerEntry method updatePlayerList.
public void updatePlayerList(List<EntityPlayer> p_73122_1_) {
this.playerEntitiesUpdated = false;
if (!this.firstUpdateDone || this.trackedEntity.getDistanceSq(this.lastTrackedEntityPosX, this.lastTrackedEntityPosY, this.lastTrackedEntityPosZ) > 16.0D) {
this.lastTrackedEntityPosX = this.trackedEntity.posX;
this.lastTrackedEntityPosY = this.trackedEntity.posY;
this.lastTrackedEntityPosZ = this.trackedEntity.posZ;
this.firstUpdateDone = true;
this.playerEntitiesUpdated = true;
this.updatePlayerEntities(p_73122_1_);
}
if (this.field_85178_v != this.trackedEntity.ridingEntity || 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));
}
if (this.trackedEntity instanceof EntityItemFrame && this.updateCounter % 10 == 0) {
EntityItemFrame entityitemframe = (EntityItemFrame) this.trackedEntity;
ItemStack itemstack = entityitemframe.getDisplayedItem();
if (itemstack != null && itemstack.getItem() instanceof ItemMap) {
MapData mapdata = Items.filled_map.getMapData(itemstack, this.trackedEntity.worldObj);
for (EntityPlayer entityplayer : p_73122_1_) {
EntityPlayerMP entityplayermp = (EntityPlayerMP) entityplayer;
mapdata.updateVisiblePlayers(entityplayermp, itemstack);
Packet packet = Items.filled_map.createMapDataPacket(itemstack, this.trackedEntity.worldObj, entityplayermp);
if (packet != null) {
entityplayermp.playerNetServerHandler.sendPacket(packet);
}
}
}
this.sendMetadataToAllAssociatedPlayers();
}
if (this.updateCounter % this.updateFrequency == 0 || this.trackedEntity.isAirBorne || 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;
Packet packet1 = 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;
if (this.updateCounter > 0 || this.trackedEntity instanceof EntityArrow) {
if (j2 >= -128 && j2 < 128 && k2 >= -128 && k2 < 128 && i >= -128 && i < 128 && this.ticksSinceLastForcedTeleport <= 400 && !this.ridingEntity && this.onGround == this.trackedEntity.onGround) {
if ((!flag || !flag1) && !(this.trackedEntity instanceof EntityArrow)) {
if (flag) {
packet1 = new S14PacketEntity.S15PacketEntityRelMove(this.trackedEntity.getEntityId(), (byte) j2, (byte) k2, (byte) i, this.trackedEntity.onGround);
} else if (flag1) {
packet1 = new S14PacketEntity.S16PacketEntityLook(this.trackedEntity.getEntityId(), (byte) l1, (byte) i2, this.trackedEntity.onGround);
}
} else {
packet1 = new S14PacketEntity.S17PacketEntityLookMove(this.trackedEntity.getEntityId(), (byte) j2, (byte) k2, (byte) i, (byte) l1, (byte) i2, this.trackedEntity.onGround);
}
} else {
this.onGround = this.trackedEntity.onGround;
this.ticksSinceLastForcedTeleport = 0;
packet1 = new S18PacketEntityTeleport(this.trackedEntity.getEntityId(), k, j1, k1, (byte) l1, (byte) i2, this.trackedEntity.onGround);
}
}
if (this.sendVelocityUpdates) {
double d0 = this.trackedEntity.motionX - this.lastTrackedEntityMotionX;
double d1 = this.trackedEntity.motionY - this.lastTrackedEntityMotionY;
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 && this.trackedEntity.motionY == 0.0D && this.trackedEntity.motionZ == 0.0D) {
this.lastTrackedEntityMotionX = this.trackedEntity.motionX;
this.lastTrackedEntityMotionY = this.trackedEntity.motionY;
this.motionZ = this.trackedEntity.motionZ;
this.sendPacketToTrackedPlayers(new S12PacketEntityVelocity(this.trackedEntity.getEntityId(), this.lastTrackedEntityMotionX, this.lastTrackedEntityMotionY, this.motionZ));
}
}
if (packet1 != null) {
this.sendPacketToTrackedPlayers(packet1);
}
this.sendMetadataToAllAssociatedPlayers();
if (flag) {
this.encodedPosX = k;
this.encodedPosY = j1;
this.encodedPosZ = k1;
}
if (flag1) {
this.encodedRotationYaw = l1;
this.encodedRotationPitch = i2;
}
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) {
this.sendPacketToTrackedPlayers(new S14PacketEntity.S16PacketEntityLook(this.trackedEntity.getEntityId(), (byte) j, (byte) i1, this.trackedEntity.onGround));
this.encodedRotationYaw = j;
this.encodedRotationPitch = i1;
}
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.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;
}
this.trackedEntity.isAirBorne = false;
}
++this.updateCounter;
if (this.trackedEntity.velocityChanged) {
this.func_151261_b(new S12PacketEntityVelocity(this.trackedEntity));
this.trackedEntity.velocityChanged = false;
}
}
Aggregations