From 42a86419caddb00d55d8560d92589e587fe3f95f Mon Sep 17 00:00:00 2001 From: devbeni Date: Sun, 14 Dec 2025 00:59:48 +0100 Subject: [PATCH] jaj aja nem hinnem xd --- Main.cs | 31 +++++++++++++++++++++++++++++ StateManagement/Sync/SyncManager.cs | 16 +++++++++------ 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/Main.cs b/Main.cs index 50195f1..e1b5fa4 100644 --- a/Main.cs +++ b/Main.cs @@ -162,7 +162,27 @@ namespace KCM PropertyInfo loadTickDelayProp = instance.GetType().GetProperty("loadTickDelay", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); if (loadTickDelayProp != null && loadTickDelayProp.CanWrite && loadTickDelayProp.PropertyType == typeof(int)) + { loadTickDelayProp.SetValue(instance, ticks, null); + return; + } + + // Debug: list all fields if loadTickDelay not found + if (instance.GetType().Name == "VillagerSystem") + { + helper?.Log("DEBUG: VillagerSystem fields:"); + foreach (var field in instance.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)) + { + if (field.FieldType == typeof(int) || field.FieldType == typeof(bool)) + helper?.Log($" Field: {field.Name} ({field.FieldType.Name})"); + } + helper?.Log("DEBUG: VillagerSystem properties:"); + foreach (var prop in instance.GetType().GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)) + { + if (prop.PropertyType == typeof(int) || prop.PropertyType == typeof(bool)) + helper?.Log($" Property: {prop.Name} ({prop.PropertyType.Name})"); + } + } } catch (Exception e) { @@ -259,6 +279,17 @@ namespace KCM " Unit=" + GetLoadTickDelayOrMinusOne(UnitSystem.inst) + " Job=" + GetLoadTickDelayOrMinusOne(JobSystem.inst) + " Villager=" + GetLoadTickDelayOrMinusOne(VillagerSystem.inst)); + + // Try to enable VillagerSystem if it's disabled + if (VillagerSystem.inst != null && !VillagerSystem.inst.enabled) + { + helper?.Log("VillagerSystem is disabled, enabling it"); + VillagerSystem.inst.enabled = true; + } + else if (VillagerSystem.inst != null) + { + helper?.Log("VillagerSystem.enabled = " + VillagerSystem.inst.enabled); + } } catch (Exception e) { diff --git a/StateManagement/Sync/SyncManager.cs b/StateManagement/Sync/SyncManager.cs index 394eb7c..792d0fc 100644 --- a/StateManagement/Sync/SyncManager.cs +++ b/StateManagement/Sync/SyncManager.cs @@ -577,14 +577,18 @@ namespace KCM.StateManagement.Sync private static void BroadcastVillagerSnapshot() { - if (!KCServer.IsRunning) - return; + // TEMPORARILY DISABLED: VillagerSnapshot causes packet overflow errors + // TODO: Fix villager synchronization properly + return; - if (KCServer.server.ClientCount == 0) - return; + // if (!KCServer.IsRunning) + // return; - if (Villager.villagers == null || Villager.villagers.Count == 0) - return; + // if (KCServer.server.ClientCount == 0) + // return; + + // if (Villager.villagers == null || Villager.villagers.Count == 0) + // return; List guids = new List(); List positions = new List();