コード例 #1
0
        public ForestFloorSystem(ICoreServerAPI api)
        {
            this.sapi          = api;
            this.worldAccessor = sapi.World;

            genPatchesSystem = sapi.ModLoader.GetModSystem <GenVegetationAndPatches>();
        }
コード例 #2
0
        public void Resolve(IServerWorldAccessor world, string sourceForErrorLogging)
        {
            for (int i = 0; i < Ingredients.Length; i++)
            {
                Ingredients[i].Resolve(world, sourceForErrorLogging);
            }

            //  CanBeServedInto.Resolve(world, sourceForErrorLogging);
        }
コード例 #3
0
        private static object CreateServerThread(IServerWorldAccessor world, string name,
                                                 IEnumerable <ServerSystem> systems)
        {
            var instance = ServerThread.CreateInstance();

            instance.SetField("server", world as ServerMain);
            instance.SetField("threadName", name);
            instance.SetField("serversystems", systems.ToArray());
            instance.SetField("lastFramePassedTime", new Stopwatch());
            instance.SetField("totalPassedTime", new Stopwatch());
            instance.SetField("paused", false);
            instance.SetField("alive", true);
            return(instance);
        }
コード例 #4
0
        public static void InjectServerThread(this IServerWorldAccessor world, string name,
                                              params ServerSystem[] systems)
        {
            var instance       = CreateServerThread(world, name, systems);
            var serverThreads  = world.GetServerThreads();
            var vanillaSystems = world.GetVanillaSystems();

            foreach (var system in systems)
            {
                vanillaSystems.Push(system);
            }

            (world as ServerMain).SetField("Systems", vanillaSystems.ToArray());

            var thread = new Thread(() => instance.CallMethod("Process"))
            {
                IsBackground = true, Name = name
            };

            serverThreads.Add(thread);
        }
コード例 #5
0
 public override void OnSuccessfullyCrafted(IServerWorldAccessor world, IPlayer player, ItemSlot slot)
 {
     SetTargetPos(slot.Itemstack, player.Entity.Pos.AsBlockPos);
 }
コード例 #6
0
 public static Stack <ServerSystem> GetVanillaSystems(this IServerWorldAccessor world)
 {
     return(new((world as ServerMain).GetField <ServerSystem[]>("Systems")));
 }
コード例 #7
0
 public static List <Thread> GetServerThreads(this IServerWorldAccessor world)
 {
     return((world as ServerMain).GetField <List <Thread> >("Serverthreads"));
 }