Beispiel #1
0
        public virtual void readFromNBT(NBTTagCompound nbttagcompound)
        {
            NBTTagList nbttaglist  = nbttagcompound.getTagList("Pos");
            NBTTagList nbttaglist1 = nbttagcompound.getTagList("Motion");
            NBTTagList nbttaglist2 = nbttagcompound.getTagList("Rotation");

            setPosition(0.0D, 0.0D, 0.0D);
            motionX = ((NBTTagDouble)nbttaglist1.tagAt(0)).doubleValue;
            motionY = ((NBTTagDouble)nbttaglist1.tagAt(1)).doubleValue;
            motionZ = ((NBTTagDouble)nbttaglist1.tagAt(2)).doubleValue;
            if (Math.abs(motionX) > 10D)
            {
                motionX = 0.0D;
            }
            if (Math.abs(motionY) > 10D)
            {
                motionY = 0.0D;
            }
            if (Math.abs(motionZ) > 10D)
            {
                motionZ = 0.0D;
            }
            prevPosX          = lastTickPosX = posX = ((NBTTagDouble)nbttaglist.tagAt(0)).doubleValue;
            prevPosY          = lastTickPosY = posY = ((NBTTagDouble)nbttaglist.tagAt(1)).doubleValue;
            prevPosZ          = lastTickPosZ = posZ = ((NBTTagDouble)nbttaglist.tagAt(2)).doubleValue;
            prevRotationYaw   = rotationYaw = ((NBTTagFloat)nbttaglist2.tagAt(0)).floatValue % 6.283185F;
            prevRotationPitch = rotationPitch = ((NBTTagFloat)nbttaglist2.tagAt(1)).floatValue % 6.283185F;
            fallDistance      = nbttagcompound.getFloat("FallDistance");
            fire     = nbttagcompound.getShort("Fire");
            air      = nbttagcompound.getShort("Air");
            onGround = nbttagcompound.getBoolean("OnGround");
            setPosition(posX, posY, posZ);
            readEntityFromNBT(nbttagcompound);
        }
Beispiel #2
0
        public override void readEntityFromNBT(NBTTagCompound nbttagcompound)
        {
            health = nbttagcompound.getShort("Health") & 0xff;
            age    = nbttagcompound.getShort("Age");
            NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Item");

            item = new ItemStack(nbttagcompound1);
        }
Beispiel #3
0
 public override void readEntityFromNBT(NBTTagCompound nbttagcompound)
 {
     xTile      = nbttagcompound.getShort("xTile");
     yTile      = nbttagcompound.getShort("yTile");
     zTile      = nbttagcompound.getShort("zTile");
     inTile     = nbttagcompound.getByte("inTile") & 0xff;
     arrowShake = nbttagcompound.getByte("shake") & 0xff;
     inGround   = nbttagcompound.getByte("inGround") == 1;
 }
Beispiel #4
0
 public override void readEntityFromNBT(NBTTagCompound nbttagcompound)
 {
     health = nbttagcompound.getShort("Health");
     if (!nbttagcompound.hasKey("Health"))
     {
         health = 10;
     }
     hurtTime   = nbttagcompound.getShort("HurtTime");
     deathTime  = nbttagcompound.getShort("DeathTime");
     attackTime = nbttagcompound.getShort("AttackTime");
 }
Beispiel #5
0
        public override void readEntityFromNBT(NBTTagCompound nbttagcompound)
        {
            base.readEntityFromNBT(nbttagcompound);
            NBTTagList nbttaglist = nbttagcompound.getTagList("Inventory");

            inventory.readFromNBT(nbttaglist);
            dimension  = nbttagcompound.getInteger("Dimension");
            sleeping   = nbttagcompound.getBoolean("Sleeping");
            sleepTimer = nbttagcompound.getShort("SleepTimer");
            if (sleeping)
            {
                playerLocation = new ChunkCoordinates(MathHelper.floor_double(posX), MathHelper.floor_double(posY),
                                                      MathHelper.floor_double(posZ));
                wakeUpPlayer(true, true);
            }
        }
Beispiel #6
0
 public override void readEntityFromNBT(NBTTagCompound nbttagcompound)
 {
     minecartType = nbttagcompound.getInteger("Type");
     if (minecartType == 2)
     {
         pushX = nbttagcompound.getDouble("PushX");
         pushZ = nbttagcompound.getDouble("PushZ");
         fuel  = nbttagcompound.getShort("Fuel");
     }
     else if (minecartType == 1)
     {
         NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
         cargoItems = new ItemStack[getSizeInventory()];
         for (int i = 0; i < nbttaglist.tagCount(); i++)
         {
             var nbttagcompound1 = (NBTTagCompound)nbttaglist.tagAt(i);
             int j = nbttagcompound1.getByte("Slot") & 0xff;
             if (j >= 0 && j < cargoItems.Length)
             {
                 cargoItems[j] = new ItemStack(nbttagcompound1);
             }
         }
     }
 }
Beispiel #7
0
 public override void readEntityFromNBT(NBTTagCompound nbttagcompound)
 {
     health = nbttagcompound.getShort("Health") & 0xff;
     age = nbttagcompound.getShort("Age");
     NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Item");
     item = new ItemStack(nbttagcompound1);
 }
Beispiel #8
0
 public override void readEntityFromNBT(NBTTagCompound nbttagcompound)
 {
     base.readEntityFromNBT(nbttagcompound);
     angerLevel = nbttagcompound.getShort("Anger");
 }
Beispiel #9
0
 public override void readEntityFromNBT(NBTTagCompound nbttagcompound)
 {
     base.readEntityFromNBT(nbttagcompound);
     NBTTagList nbttaglist = nbttagcompound.getTagList("Inventory");
     inventory.readFromNBT(nbttaglist);
     dimension = nbttagcompound.getInteger("Dimension");
     sleeping = nbttagcompound.getBoolean("Sleeping");
     sleepTimer = nbttagcompound.getShort("SleepTimer");
     if (sleeping)
     {
         playerLocation = new ChunkCoordinates(MathHelper.floor_double(posX), MathHelper.floor_double(posY),
                                               MathHelper.floor_double(posZ));
         wakeUpPlayer(true, true);
     }
 }
Beispiel #10
0
 public void readFromNBT(NBTTagCompound nbttagcompound)
 {
     itemID = nbttagcompound.getShort("id");
     stackSize = nbttagcompound.getByte("Count");
     itemDamage = nbttagcompound.getShort("Damage");
 }
Beispiel #11
0
 public override void readEntityFromNBT(NBTTagCompound nbttagcompound)
 {
     xTileSnowball = nbttagcompound.getShort("xTile");
     yTileSnowball = nbttagcompound.getShort("yTile");
     zTileSnowball = nbttagcompound.getShort("zTile");
     inTileSnowball = nbttagcompound.getByte("inTile") & 0xff;
     shakeSnowball = nbttagcompound.getByte("shake") & 0xff;
     inGroundSnowball = nbttagcompound.getByte("inGround") == 1;
 }
Beispiel #12
0
 public virtual void readFromNBT(NBTTagCompound nbttagcompound)
 {
     NBTTagList nbttaglist = nbttagcompound.getTagList("Pos");
     NBTTagList nbttaglist1 = nbttagcompound.getTagList("Motion");
     NBTTagList nbttaglist2 = nbttagcompound.getTagList("Rotation");
     setPosition(0.0D, 0.0D, 0.0D);
     motionX = ((NBTTagDouble) nbttaglist1.tagAt(0)).doubleValue;
     motionY = ((NBTTagDouble) nbttaglist1.tagAt(1)).doubleValue;
     motionZ = ((NBTTagDouble) nbttaglist1.tagAt(2)).doubleValue;
     if (Math.abs(motionX) > 10D)
     {
         motionX = 0.0D;
     }
     if (Math.abs(motionY) > 10D)
     {
         motionY = 0.0D;
     }
     if (Math.abs(motionZ) > 10D)
     {
         motionZ = 0.0D;
     }
     prevPosX = lastTickPosX = posX = ((NBTTagDouble) nbttaglist.tagAt(0)).doubleValue;
     prevPosY = lastTickPosY = posY = ((NBTTagDouble) nbttaglist.tagAt(1)).doubleValue;
     prevPosZ = lastTickPosZ = posZ = ((NBTTagDouble) nbttaglist.tagAt(2)).doubleValue;
     prevRotationYaw = rotationYaw = ((NBTTagFloat) nbttaglist2.tagAt(0)).floatValue%6.283185F;
     prevRotationPitch = rotationPitch = ((NBTTagFloat) nbttaglist2.tagAt(1)).floatValue%6.283185F;
     fallDistance = nbttagcompound.getFloat("FallDistance");
     fire = nbttagcompound.getShort("Fire");
     air = nbttagcompound.getShort("Air");
     onGround = nbttagcompound.getBoolean("OnGround");
     setPosition(posX, posY, posZ);
     readEntityFromNBT(nbttagcompound);
 }
Beispiel #13
0
 public override void readEntityFromNBT(NBTTagCompound nbttagcompound)
 {
     minecartType = nbttagcompound.getInteger("Type");
     if (minecartType == 2)
     {
         pushX = nbttagcompound.getDouble("PushX");
         pushZ = nbttagcompound.getDouble("PushZ");
         fuel = nbttagcompound.getShort("Fuel");
     }
     else if (minecartType == 1)
     {
         NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
         cargoItems = new ItemStack[getSizeInventory()];
         for (int i = 0; i < nbttaglist.tagCount(); i++)
         {
             var nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i);
             int j = nbttagcompound1.getByte("Slot") & 0xff;
             if (j >= 0 && j < cargoItems.Length)
             {
                 cargoItems[j] = new ItemStack(nbttagcompound1);
             }
         }
     }
 }
Beispiel #14
0
 public void readFromNBT(NBTTagCompound nbttagcompound)
 {
     itemID     = nbttagcompound.getShort("id");
     stackSize  = nbttagcompound.getByte("Count");
     itemDamage = nbttagcompound.getShort("Damage");
 }