Minecraft world importer for Gamecraft.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
972B

  1. using System.Reflection;
  2. using DataLoader;
  3. using HarmonyLib;
  4. using JetBrains.Annotations;
  5. using RobocraftX.Common;
  6. using RobocraftX.CR.MachineEditing;
  7. using RobocraftX.StateSync;
  8. using Svelto.ECS;
  9. using Unity.Entities;
  10. using UnityEngine;
  11. namespace GCMC
  12. {
  13. [HarmonyPatch]
  14. [UsedImplicitly]
  15. public class PlaceBlockPatch
  16. {
  17. static void Postfix(EnginesRoot enginesRoot, ref StateSyncRegistrationHelper stateSyncReg, bool isAuthoritative)
  18. {
  19. if (isAuthoritative)
  20. {
  21. stateSyncReg.AddDeterministicEngine(new CubePlacerEngine());
  22. Debug.Log($"Added Minecraft world import engine");
  23. }
  24. else
  25. Debug.Log("Not authoritative, not adding MC engine");
  26. }
  27. static MethodBase TargetMethod()
  28. {
  29. return typeof(MainEditingCompositionRoot).GetMethod("Compose",
  30. BindingFlags.Public | BindingFlags.Static);
  31. }
  32. }
  33. }