public ForestFloorSystem(ICoreServerAPI api) { this.sapi = api; this.worldAccessor = sapi.World; genPatchesSystem = sapi.ModLoader.GetModSystem <GenVegetationAndPatches>(); }
public void Resolve(IServerWorldAccessor world, string sourceForErrorLogging) { for (int i = 0; i < Ingredients.Length; i++) { Ingredients[i].Resolve(world, sourceForErrorLogging); } // CanBeServedInto.Resolve(world, sourceForErrorLogging); }
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); }
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); }
public override void OnSuccessfullyCrafted(IServerWorldAccessor world, IPlayer player, ItemSlot slot) { SetTargetPos(slot.Itemstack, player.Entity.Pos.AsBlockPos); }
public static Stack <ServerSystem> GetVanillaSystems(this IServerWorldAccessor world) { return(new((world as ServerMain).GetField <ServerSystem[]>("Systems"))); }
public static List <Thread> GetServerThreads(this IServerWorldAccessor world) { return((world as ServerMain).GetField <List <Thread> >("Serverthreads")); }