Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[1.16.4] How i can put my strucnures in to FlatGenerationSettings.STRUCTURES

Featured Replies

Posted

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);
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.

  • Author

But where i can get the instance
 

Map<Structure<?>, StructureFeature<?, ?>> STR = ObfuscationReflectionHelper.getPrivateValue(FlatGenerationSettings.class,instance,"STRUCTURES");

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>).

  • 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 by Klarks

  • 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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.