示例#1
0
        public static FluidPair ReadFluidPair(this BinaryReader reader)
        {
            FluidPair pair = QSWorld.baseFluidPair.Clone();

            pair.Frequency = reader.ReadFrequency();
            pair.Handler.Read(reader);
            return(pair);
        }
示例#2
0
        internal static void ReceiveFluidFrequency(BinaryReader reader, int whoAmI)
        {
            Frequency frequency = reader.ReadFrequency();

            FluidPair handler = QSWorld.baseFluidPair.Clone();

            handler.Frequency = frequency;
            ModContent.GetInstance <QSWorld>().QEFluidHandlers.Add(handler);

            if (Main.netMode == NetmodeID.Server)
            {
                SendFluidFrequency(frequency, whoAmI);
            }
        }
示例#3
0
        internal static void ReceiveFluid(BinaryReader reader, int whoAmI)
        {
            Frequency frequency = reader.ReadFrequency();
            int       slot      = reader.ReadInt32();
            ModFluid  fluid     = reader.ReadFluid();

            FluidPair pair = ModContent.GetInstance <QSWorld>().QEFluidHandlers.FirstOrDefault(fluidPair => Equals(fluidPair.Frequency, frequency));

            pair?.Handler.SetFluidInSlot(slot, fluid);

            if (Main.netMode == NetmodeID.Server)
            {
                SendFluid(frequency, slot, whoAmI);
            }
        }
示例#4
0
        public QSWorld()
        {
            baseItemPair = new ItemPair
            {
                Handler = new ItemHandler(27)
            };
            baseItemPair.OnContentsChanged += (frequency, slot) => Net.SendItem(frequency, slot);

            baseFluidPair = new FluidPair
            {
                Handler = new FluidHandler()
            };
            baseFluidPair.OnContentsChanged    += (frequency, slot) => Net.SendFluid(frequency, slot);
            baseFluidPair.Handler.GetSlotLimit += slot => 255 * 4;

            QEItemHandlers  = new List <ItemPair>();
            QEFluidHandlers = new List <FluidPair>();
        }
示例#5
0
        public override void Initialize()
        {
            Instance = this;

            baseItemPair = new ItemPair
            {
                Handler = new ItemHandler(27)
            };
            baseItemPair.OnContentsChanged += (frequency, slot) => Net.SendItem(frequency, slot);

            baseFluidPair = new FluidPair
            {
                Handler = new FluidHandler()
            };
            baseFluidPair.OnContentsChanged    += (frequency, slot) => Net.SendFluid(frequency, slot);
            baseFluidPair.Handler.GetSlotLimit += slot => 255 * 4;

            QEItemHandlers  = new List <ItemPair>();
            QEFluidHandlers = new List <FluidPair>();
        }
示例#6
0
 public static void Write(this BinaryWriter writer, FluidPair pair)
 {
     writer.Write(pair.Frequency);
     pair.Handler.Write(writer);
 }