Posted January 11, 20232 yr Hi! I have made a custom boolean gamerule. After restating the game though the gamerule is not synced between server and client. Am I registring my gamerule correctly? And how to sync it? Thanks. @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public class ModGameRules { public static final GameRules.Key<GameRules.BooleanValue> REAL_DAYLIGHT = GameRules.register("realDaylight", GameRules.Category.UPDATES, create(true)); @SuppressWarnings("unchecked") public static Type<GameRules.BooleanValue> create(boolean defaultValue) { try { Method createGameruleMethod = ObfuscationReflectionHelper.findMethod(GameRules.BooleanValue.class, "m_46250_", boolean.class); createGameruleMethod.setAccessible(true); return (Type<GameRules.BooleanValue>) createGameruleMethod.invoke(GameRules.BooleanValue.class, defaultValue); } catch (Exception e) { e.printStackTrace(); } return null; } } Edited March 2, 20232 yr by RInventor7
January 11, 20232 yr GameRules are not automatically synched to the client. Most game rules are only for server side behaviour. The only one I can see (from a quick check the of the ClientLevel class) vanilla sends to the client is RULE_DAYLIGHT which has its own special network packet. See ClientBoundSetTimePacket which calls ClientLevel.setDayTime() Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.