Posted January 17, 20214 yr How i can put my structures in to FlatGenerationSettings.STRUCTURES. The structures var is final so i cant put mine like that FlatGenerationSettings.STRUCTURES.put(MyStructure.RUN_DOWN_HOUSE.get(), CONFIGURED_RUN_DOWN_HOUSE);
January 17, 20214 yr 13 minutes ago, Klarks said: The structures var is final so i cant put mine like that The object itself is immutable, the data can be mutable. The issue is that the field accessor is private. ObfuscationReflectionHelper#getPrivateValue can be used to obtain the Map to which you can put the value during common setup.
January 17, 20214 yr Author But where i can get the instance Map<Structure<?>, StructureFeature<?, ?>> STR = ObfuscationReflectionHelper.getPrivateValue(FlatGenerationSettings.class,instance,"STRUCTURES");
January 17, 20214 yr How familiar are you with Java and reflection? Also, read the javadocs on the method, do not supply a mapped name and instead the associated srg name (which can be obtained from forge-bot via '!mcpf <mapped_name>).
January 17, 20214 yr 3 hours ago, Klarks said: forge-bot? Apologies, you have to be on the forge discord to access the bot for the commands. Now, if you wouldn't mind answering my question about your knowledge in Java and reflection.
January 18, 20214 yr Author I am a bigginer at Java and do not know much about reflection but I know it allows to get private var, methods, annotations and so Edited January 18, 20214 yr by Klarks
January 18, 20214 yr Author Is STRUCTURES a mapped name? forge-bot gave me this MC 1.16.3: net/minecraft/world/gen/FlatGenerationSettings.STRUCTURES Name: c => field_202247_j => STRUCTURES Comment: None Side: BOTH AT: public net.minecraft.world.gen.FlatGenerationSettings field_202247_j # STRUCTURES
January 18, 20214 yr 3 hours ago, Klarks said: Is STRUCTURES a mapped name? forge-bot gave me this Yes, as you can see it has the obfuscated name which translate to its unique srg name and then finally the mapped name. You will need the srg name as your parameter. 19 hours ago, Klarks said: But where i can get the instance The static keyword makes the field/method available at class level meaning you do not need an instance to grab the associated value. So, a null value can be passed in instead.
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.