Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.16.4] How i can put my strucnures in to FlatGenerationSettings.STRUCTURES
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
Klarks

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

By Klarks, January 17 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Klarks    0

Klarks

Klarks    0

  • Stone Miner
  • Klarks
  • Members
  • 0
  • 95 posts
Posted January 17

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);
  • Quote

Share this post


Link to post
Share on other sites

ChampionAsh5357    165

ChampionAsh5357

ChampionAsh5357    165

  • World Shaper
  • ChampionAsh5357
  • Members
  • 165
  • 1038 posts
Posted January 17
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.

  • Quote

Share this post


Link to post
Share on other sites

Klarks    0

Klarks

Klarks    0

  • Stone Miner
  • Klarks
  • Members
  • 0
  • 95 posts
Posted January 17

But where i can get the instance
 

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

Share this post


Link to post
Share on other sites

ChampionAsh5357    165

ChampionAsh5357

ChampionAsh5357    165

  • World Shaper
  • ChampionAsh5357
  • Members
  • 165
  • 1038 posts
Posted January 17

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

  • Quote

Share this post


Link to post
Share on other sites

Klarks    0

Klarks

Klarks    0

  • Stone Miner
  • Klarks
  • Members
  • 0
  • 95 posts
Posted January 17

 forge-bot?

  • Quote

Share this post


Link to post
Share on other sites

Klarks    0

Klarks

Klarks    0

  • Stone Miner
  • Klarks
  • Members
  • 0
  • 95 posts
Posted January 17

I don't quite understand

  • Quote

Share this post


Link to post
Share on other sites

ChampionAsh5357    165

ChampionAsh5357

ChampionAsh5357    165

  • World Shaper
  • ChampionAsh5357
  • Members
  • 165
  • 1038 posts
Posted January 17
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.

  • Quote

Share this post


Link to post
Share on other sites

Klarks    0

Klarks

Klarks    0

  • Stone Miner
  • Klarks
  • Members
  • 0
  • 95 posts
Posted January 18 (edited)

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

Share this post


Link to post
Share on other sites

Klarks    0

Klarks

Klarks    0

  • Stone Miner
  • Klarks
  • Members
  • 0
  • 95 posts
Posted January 18

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

  • Quote

Share this post


Link to post
Share on other sites

ChampionAsh5357    165

ChampionAsh5357

ChampionAsh5357    165

  • World Shaper
  • ChampionAsh5357
  • Members
  • 165
  • 1038 posts
Posted January 18
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.

  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Aviator737
      [1.16.5] Apply transformation to obj model

      By Aviator737 · Posted 1 minute ago

      Edited the post, made the question clearer as it seems to me.
    • GenElectrovise
      [Answered, not solved] Automated testing in Forge

      By GenElectrovise · Posted 30 minutes ago

      There'd also be a small startup time tradeoff but I don't know how much of a difference that would make. Interesting idea with running tests later on... I hadn't thought of that... Might try that out just to satisfy curiosity!
    • troublemaker_47
      Custom Ore Generation help

      By troublemaker_47 · Posted 53 minutes ago

      now i get it. Tank you so much you have really made my day  
    • samjviana
      Custom Ore Generation help

      By samjviana · Posted 54 minutes ago

      As from the integer "6" you asked ... it represent the vein size that the ore will try to generate.
    • troublemaker_47
      Custom Ore Generation help

      By troublemaker_47 · Posted 55 minutes ago

      Thank you so much
  • Topics

    • Aviator737
      1
      [1.16.5] Apply transformation to obj model

      By Aviator737
      Started Friday at 02:43 PM

    • GenElectrovise
      3
      [Answered, not solved] Automated testing in Forge

      By GenElectrovise
      Started Thursday at 08:34 AM

    • troublemaker_47
      17
      Custom Ore Generation help

      By troublemaker_47
      Started Yesterday at 12:31 PM

    • CommandCore
      3
      Projectile Entity is Invisible

      By CommandCore
      Started February 26

    • ChocoCookies33
      1
      Description: Exception in server tick loop

      By ChocoCookies33
      Started 3 hours ago

  • Who's Online (See full list)

    • Aviator737
    • Aecht_Rob
    • samjviana
    • diesieben07
    • JDL
    • Luis_ST
    • XcreepzioX
    • Tavi007
    • Choonster
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.16.4] How i can put my strucnures in to FlatGenerationSettings.STRUCTURES
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community