public Rotations getWatchableObjectRotations(int id) { return (Rotations)this.getWatchedObject(id).getObject(); }
/** * Writes a watchable object (entity attribute of type {byte, short, int, float, string, ItemStack, * ChunkCoordinates}) to the specified PacketBuffer */ private static void writeWatchableObjectToPacketBuffer(PacketBuffer buffer, DataWatcher.WatchableObject object) throws IOException { int i = (object.getObjectType() << 5 | object.getDataValueId() & 31) & 255; buffer.writeByte(i); switch (object.getObjectType()) { case 0: buffer.writeByte(((Byte)object.getObject()).byteValue()); break; case 1: buffer.writeShort(((Short)object.getObject()).shortValue()); break; case 2: buffer.writeInt(((Integer)object.getObject()).intValue()); break; case 3: buffer.writeFloat(((Float)object.getObject()).floatValue()); break; case 4: buffer.writeString((String)object.getObject()); break; case 5: ItemStack itemstack = (ItemStack)object.getObject(); buffer.writeItemStackToBuffer(itemstack); break; case 6: BlockPos blockpos = (BlockPos)object.getObject(); buffer.writeInt(blockpos.getX()); buffer.writeInt(blockpos.getY()); buffer.writeInt(blockpos.getZ()); break; case 7: Rotations rotations = (Rotations)object.getObject(); buffer.writeFloat(rotations.getX()); buffer.writeFloat(rotations.getY()); buffer.writeFloat(rotations.getZ()); } }
public static List<DataWatcher.WatchableObject> readWatchedListFromPacketBuffer(PacketBuffer buffer) throws IOException { List<DataWatcher.WatchableObject> list = null; for (int i = buffer.readByte(); i != 127; i = buffer.readByte()) { if (list == null) { list = Lists.<DataWatcher.WatchableObject>newArrayList(); } int j = (i & 224) >> 5; int k = i & 31; DataWatcher.WatchableObject datawatcher$watchableobject = null; switch (j) { case 0: datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, Byte.valueOf(buffer.readByte())); break; case 1: datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, Short.valueOf(buffer.readShort())); break; case 2: datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, Integer.valueOf(buffer.readInt())); break; case 3: datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, Float.valueOf(buffer.readFloat())); break; case 4: datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, buffer.readStringFromBuffer(32767)); break; case 5: datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, buffer.readItemStackFromBuffer()); break; case 6: int l = buffer.readInt(); int i1 = buffer.readInt(); int j1 = buffer.readInt(); datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, new BlockPos(l, i1, j1)); break; case 7: float f = buffer.readFloat(); float f1 = buffer.readFloat(); float f2 = buffer.readFloat(); datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, new Rotations(f, f1, f2)); } list.add(datawatcher$watchableobject); } return list; }
/** * Saves the pose to an NBTTagCompound. */ private void writePoseToNBT(NBTTagCompound tagCompound) { NBTTagList nbttaglist = tagCompound.getTagList("Head", 5); if (nbttaglist.tagCount() > 0) { this.setHeadRotation(new Rotations(nbttaglist)); } else { this.setHeadRotation(DEFAULT_HEAD_ROTATION); } NBTTagList nbttaglist1 = tagCompound.getTagList("Body", 5); if (nbttaglist1.tagCount() > 0) { this.setBodyRotation(new Rotations(nbttaglist1)); } else { this.setBodyRotation(DEFAULT_BODY_ROTATION); } NBTTagList nbttaglist2 = tagCompound.getTagList("LeftArm", 5); if (nbttaglist2.tagCount() > 0) { this.setLeftArmRotation(new Rotations(nbttaglist2)); } else { this.setLeftArmRotation(DEFAULT_LEFTARM_ROTATION); } NBTTagList nbttaglist3 = tagCompound.getTagList("RightArm", 5); if (nbttaglist3.tagCount() > 0) { this.setRightArmRotation(new Rotations(nbttaglist3)); } else { this.setRightArmRotation(DEFAULT_RIGHTARM_ROTATION); } NBTTagList nbttaglist4 = tagCompound.getTagList("LeftLeg", 5); if (nbttaglist4.tagCount() > 0) { this.setLeftLegRotation(new Rotations(nbttaglist4)); } else { this.setLeftLegRotation(DEFAULT_LEFTLEG_ROTATION); } NBTTagList nbttaglist5 = tagCompound.getTagList("RightLeg", 5); if (nbttaglist5.tagCount() > 0) { this.setRightLegRotation(new Rotations(nbttaglist5)); } else { this.setRightLegRotation(DEFAULT_RIGHTLEG_ROTATION); } }
/** * Called to update the entity's position/logic. */ public void onUpdate() { super.onUpdate(); Rotations rotations = this.dataWatcher.getWatchableObjectRotations(11); if (!this.headRotation.equals(rotations)) { this.setHeadRotation(rotations); } Rotations rotations1 = this.dataWatcher.getWatchableObjectRotations(12); if (!this.bodyRotation.equals(rotations1)) { this.setBodyRotation(rotations1); } Rotations rotations2 = this.dataWatcher.getWatchableObjectRotations(13); if (!this.leftArmRotation.equals(rotations2)) { this.setLeftArmRotation(rotations2); } Rotations rotations3 = this.dataWatcher.getWatchableObjectRotations(14); if (!this.rightArmRotation.equals(rotations3)) { this.setRightArmRotation(rotations3); } Rotations rotations4 = this.dataWatcher.getWatchableObjectRotations(15); if (!this.leftLegRotation.equals(rotations4)) { this.setLeftLegRotation(rotations4); } Rotations rotations5 = this.dataWatcher.getWatchableObjectRotations(16); if (!this.rightLegRotation.equals(rotations5)) { this.setRightLegRotation(rotations5); } boolean flag = this.func_181026_s(); if (!this.field_181028_bj && flag) { this.func_181550_a(false); } else { if (!this.field_181028_bj || flag) { return; } this.func_181550_a(true); } this.field_181028_bj = flag; }
public void setHeadRotation(Rotations p_175415_1_) { this.headRotation = p_175415_1_; this.dataWatcher.updateObject(11, p_175415_1_); }
public void setBodyRotation(Rotations p_175424_1_) { this.bodyRotation = p_175424_1_; this.dataWatcher.updateObject(12, p_175424_1_); }
public void setLeftArmRotation(Rotations p_175405_1_) { this.leftArmRotation = p_175405_1_; this.dataWatcher.updateObject(13, p_175405_1_); }
public void setRightArmRotation(Rotations p_175428_1_) { this.rightArmRotation = p_175428_1_; this.dataWatcher.updateObject(14, p_175428_1_); }
public void setLeftLegRotation(Rotations p_175417_1_) { this.leftLegRotation = p_175417_1_; this.dataWatcher.updateObject(15, p_175417_1_); }
public void setRightLegRotation(Rotations p_175427_1_) { this.rightLegRotation = p_175427_1_; this.dataWatcher.updateObject(16, p_175427_1_); }
public Rotations getHeadRotation() { return this.headRotation; }
public Rotations getBodyRotation() { return this.bodyRotation; }
public Rotations getLeftArmRotation() { return this.leftArmRotation; }
public Rotations getRightArmRotation() { return this.rightArmRotation; }
public Rotations getLeftLegRotation() { return this.leftLegRotation; }
public Rotations getRightLegRotation() { return this.rightLegRotation; }