Ejemplo n.º 1
0
 public void FromBytes(BinaryReader reader, IClassRegistryAPI instancer)
 {
     Type              = (EnumTransitionType)reader.ReadUInt16();
     FreshHours        = NatFloat.createFromBytes(reader);
     TransitionHours   = NatFloat.createFromBytes(reader);
     TransitionedStack = new JsonItemStack();
     TransitionedStack.FromBytes(reader, instancer);
     TransitionRatio = reader.ReadSingle();
 }
        public void FromBytes(BinaryReader reader, IWorldAccessor resolver)
        {
            basePos = new Vec3d(reader.ReadDouble(), reader.ReadDouble(), reader.ReadDouble());

            DieInAir      = reader.ReadBoolean();
            DieInLiquid   = reader.ReadBoolean();
            SwimOnLiquid  = reader.ReadBoolean();
            HsvaColor     = new NatFloat[] { NatFloat.createFromBytes(reader), NatFloat.createFromBytes(reader), NatFloat.createFromBytes(reader), NatFloat.createFromBytes(reader) };
            GravityEffect = NatFloat.createFromBytes(reader);
            LifeLength    = NatFloat.createFromBytes(reader);
            PosOffset     = new NatFloat[] { NatFloat.createFromBytes(reader), NatFloat.createFromBytes(reader), NatFloat.createFromBytes(reader) };
            Quantity      = NatFloat.createFromBytes(reader);
            Size          = NatFloat.createFromBytes(reader);
            Velocity      = new NatFloat[] { NatFloat.createFromBytes(reader), NatFloat.createFromBytes(reader), NatFloat.createFromBytes(reader) };
            ParticleModel = (EnumParticleModel)reader.ReadByte();
            VertexFlags   = reader.ReadInt32();

            if (!reader.ReadBoolean())
            {
                OpacityEvolve = EvolvingNatFloat.CreateFromBytes(reader);
            }

            if (!reader.ReadBoolean())
            {
                RedEvolve = EvolvingNatFloat.CreateFromBytes(reader);
            }

            if (!reader.ReadBoolean())
            {
                GreenEvolve = EvolvingNatFloat.CreateFromBytes(reader);
            }

            if (!reader.ReadBoolean())
            {
                BlueEvolve = EvolvingNatFloat.CreateFromBytes(reader);
            }

            SizeEvolve.FromBytes(reader);
            SelfPropelled    = reader.ReadBoolean();
            TerrainCollision = reader.ReadBoolean();
            ColorByBlock     = reader.ReadBoolean();

            if (reader.ReadBoolean())
            {
                VelocityEvolve = new EvolvingNatFloat[]
                {
                    EvolvingNatFloat.createIdentical(0),
                    EvolvingNatFloat.createIdentical(0),
                    EvolvingNatFloat.createIdentical(0),
                };

                VelocityEvolve[0].FromBytes(reader);
                VelocityEvolve[1].FromBytes(reader);
                VelocityEvolve[2].FromBytes(reader);
            }
            SecondarySpawnInterval = NatFloat.createFromBytes(reader);
            int secondaryPropCount = reader.ReadInt32();

            if (secondaryPropCount > 0)
            {
                SecondaryParticles = new AdvancedParticleProperties[secondaryPropCount];
                for (int i = 0; i < secondaryPropCount; i++)
                {
                    SecondaryParticles[i] = AdvancedParticleProperties.createFromBytes(reader, resolver);
                }
            }

            int deathPropCount = reader.ReadInt32();

            if (deathPropCount > 0)
            {
                DeathParticles = new AdvancedParticleProperties[deathPropCount];
                for (int i = 0; i < deathPropCount; i++)
                {
                    DeathParticles[i] = AdvancedParticleProperties.createFromBytes(reader, resolver);
                }
            }

            WindAffectednes = reader.ReadSingle();
        }