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.

Featured Replies

Posted

Hi,

my mod uses an ore distribution to determine with which block it should replace.

Currently I use as a default this table where each entry in the matrix is probability adding to 100% for each y-lvl except where my mod does not replace the block::stone

y - level | coal | iron | gold | lapis | redstone | diamond

>110     0    0     0     0      0       0

>60      1    0     0     0      0       0

>30     50   50     0     0      0       0

>15     25   50    15     10      0       0

>5      20   40    15     7      13       5

>0       0    0     0     0      0       0

 

For my config I want to be able to edit this matrix where the y-level border is, the blocks and the probability linked to them.

Using nightconfig and ForgeConfigSpec (.define(String path/name, T defaultValue, Predicate<Object> validator))

I would implement my Data Structure T as an

HashMap<Integer,List<HashMap<String,Float>>>

with

HashMap<y-level,List<HashMap<ResourceLocationofBlock,probability>>>

(ResourceLocationofBlock as "namespace:block" like "minecraft:coal_ore")

,a custom Supplier giving the table above and a custom Predicate checking the ResourceLocationofBlock, the probabilty and wether all y-values are coverd.

 

My Questions:

  1. Can I use a HashMap? in other words do I need to use a HashTable for thread safety
  2. Can I use ResourceLocation.isResouceNameValid(String) when my Config loads? (Using CLIENT_BUILDER since @OnlyIn(Dist.CLIENT))
  3. Is there another way to allow an user to add custom blocks to my config? (My way would be an Array/List which is typed in the Config)
  4. Is this ForgeConfigSpec the way to do Config in Forge 1.15?

 

Edit: changed y-level to Integer instead of String

Edited by DrunkBlood

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.