jaj aja nem hinnem xd

This commit is contained in:
2025-12-14 00:59:48 +01:00
parent 2140fc3868
commit 42a86419ca
2 changed files with 41 additions and 6 deletions

31
Main.cs
View File

@@ -162,7 +162,27 @@ namespace KCM
PropertyInfo loadTickDelayProp = instance.GetType().GetProperty("loadTickDelay", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); PropertyInfo loadTickDelayProp = instance.GetType().GetProperty("loadTickDelay", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
if (loadTickDelayProp != null && loadTickDelayProp.CanWrite && loadTickDelayProp.PropertyType == typeof(int)) if (loadTickDelayProp != null && loadTickDelayProp.CanWrite && loadTickDelayProp.PropertyType == typeof(int))
{
loadTickDelayProp.SetValue(instance, ticks, null); 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) catch (Exception e)
{ {
@@ -259,6 +279,17 @@ namespace KCM
" Unit=" + GetLoadTickDelayOrMinusOne(UnitSystem.inst) + " Unit=" + GetLoadTickDelayOrMinusOne(UnitSystem.inst) +
" Job=" + GetLoadTickDelayOrMinusOne(JobSystem.inst) + " Job=" + GetLoadTickDelayOrMinusOne(JobSystem.inst) +
" Villager=" + GetLoadTickDelayOrMinusOne(VillagerSystem.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) catch (Exception e)
{ {

View File

@@ -577,14 +577,18 @@ namespace KCM.StateManagement.Sync
private static void BroadcastVillagerSnapshot() private static void BroadcastVillagerSnapshot()
{ {
if (!KCServer.IsRunning) // TEMPORARILY DISABLED: VillagerSnapshot causes packet overflow errors
return; // TODO: Fix villager synchronization properly
return;
if (KCServer.server.ClientCount == 0) // if (!KCServer.IsRunning)
return; // return;
if (Villager.villagers == null || Villager.villagers.Count == 0) // if (KCServer.server.ClientCount == 0)
return; // return;
// if (Villager.villagers == null || Villager.villagers.Count == 0)
// return;
List<Guid> guids = new List<Guid>(); List<Guid> guids = new List<Guid>();
List<Vector3> positions = new List<Vector3>(); List<Vector3> positions = new List<Vector3>();