Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.15.2] I can't find updated documentation on ore generation


Nyanar
 Share

Recommended Posts

Hi, I am new to modding and was testing a very basic mod where a custom ore drops a custom item. However, I can't find a way to make it generate naturally in the overworld. Some posts I have been looking into point to the following method:

@SubscribeEvent
    public static void onInitBiomesGen(WorldTypeEvent.BiomeSize event) {
        for (Biome biome : ForgeRegistries.BIOMES) {
            biome.addFeature(
                    GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.func_225566_b_(
                            new OreFeatureConfig(
                                    OreFeatureConfig.FillerBlockType.NATURAL_STONE, ModBlocks.LYNITE_ORE, 8
                            )
                    )
                    .func_227228_a_(Placement.COUNT_RANGE.func_227446_a_(new CountRangeConfig(1, 0, 0, 16))
                )
            );
        }
    }

However, the function

func_225566_b_

and the function

func_227446_a_

don't seem to exist for Forge. They might have gotten a proper name in the last updates, but I can't find any way to know which. What I'm asking for is somewhere to find updated documentation and some help with ore generation. Thank you.

 

PS.: I know that my code is terrible; I'm not new to Java but I know nothing about modding.

 

Edited by Nyanar
Link to comment
Share on other sites

Thank you; I had also tried that, but Forge 1.15.2 (latest) does not recognise the method 

Biome.createDecoratedFeature(Feature, OreFeatureConfig)

in net.minecraft.world.biome.Biome. I'm guessing it has been changed in the 1.15 update, but can't find any info on that.

Link to comment
Share on other sites

This is my take now, IntelliJ desn't point out any syntax errors, but it is still not working for some reason:

    @SubscribeEvent
    public static void onInitBiomesGen(WorldTypeEvent.BiomeSize event) {
        for (Biome biome : ForgeRegistries.BIOMES) {
            biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, ModBlocks.LYNITE_ORE.getDefaultState(), 17)).withPlacement(Placement.COUNT_RANGE.configure(new CountRangeConfig(20, 0, 0, 128))));
        }
    }

I have taken a look at Minecraft's source code and can't figure out what's wrong in the above code.

Link to comment
Share on other sites

Oh, yes, sure. This is my GitHub Repository. Plus, I have managed to solve it (by solving it I mean that the ore does generate as intended without any issue) by changing WorldTypeEvent.BiomeSize to FMLLoadCompleteEvent, but I still don't know why the former did not work. Also, what I meant by not working was that everything ran fine, except the ore did not generate at all. I'm sorry for being so vague.

However all that, I have two questions: why does WorldTypeEvent.BiomeSize not work and what do the values for bottomOffset and topOffset (the two zeroes in the WorldFeatures class) mean?

Link to comment
Share on other sites

So even if it is generating I think that is still the wrong way to do it. I showed you my code on how to use deferredworkqueue. It can cause trouble if you load it immediately. 

 

If you take a look at the BiomeSize event, it tells you it is for modifying the biome size, so not at all what you need.

 

 

For the offset my best guess is that they limit the distance between ground level and the ore? Not sure tbh...

Link to comment
Share on other sites

/**
 * BiomeSize is fired when vanilla Minecraft attempts to generate biomes.<br>
 * This event is fired during biome generation in
 * {@link GenLayer#initializeAllBiomeGenerators(long, WorldType, ChunkProviderSettings)}. <br>
 * <br>
 * {@link #originalSize} the original size of the Biome. <br>
 * {@link #newSize} the new size of the biome. Initially set to the {@link #originalSize}. <br>
 * If {@link #newSize} is set to a new value, that value will be used for the Biome size. <br>
 * <br>
 * This event is not {@link Cancelable}.<br>
 * <br>
 * This event does not have a result. {@link HasResult} <br>
 * <br>
 * This event is fired on the {@link MinecraftForge#TERRAIN_GEN_BUS}.<br>
 **/

This is the comment on the event on net.minecraftforge.event.terraingen.WorldTypeEvent.BiomeSize. To me it does seem like the proper event to go with, but again I feel that I'm missing something...

Link to comment
Share on other sites

Would need someone else to confirm but with their size definition it seems that Forge intends this event only for changing biome size.

Using deferredWorkQueue will ensure that other mods will have properly done their stuff before the features are added. I don't know the details but it's basically a let forge handle it case.

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hey,   Is it already possible to login and authenticate when your account has been migrated? Currently I just get the error Migrated.
    • Amplifier is like the strength of the effect, for example movement speed boost with amplifier 0 will be Speed I, and 1 will be Speed II, 2 will be Speed III. Effect is just an...effect type, EffectInstance contains all information for the actual effect being applied to the entity (duration, amplifier...etc). For example there's only an effect type "Speed", but for an EffectInstance it could be: "Level 2 Speed for 10 seconds" "Level 4 Speed for 2 seconds"...   The first method applyEffectTick is called when a effect is impacting the entity, the first arg is the entity that has the effect/is affected by the effect, and amplifier is the strength of the effect. The second method isDurationEFfectTick is to check whether the effect should impact/affect the entity this tick (the effects usually don't trigger every tick!), if true, then the first method is called.  
    • Hi, I have enchantment named "Stun" that can be applied to weapon and that has 3 levels: Level 1 - 10% chance to stun mob for 1 sec Level 2 - 20% chance to stun mob for 2 secs Level 3 - 30% chance to stun mob for 3 secs Plan is to apply MobEffect named StunnedMobEffect on doPostAttack in enchantment. StunnedMobEffect should have variable duration based on the level of enchantment that was applied on weapon. I am trying to find an example on how to do the following: How can I set duration of effect dynamically? How can I track whether duration has expired? I have found these two methods that can be overriden:   public void applyEffectTick(LivingEntity pLivingEntity, int pAmplifier) { public boolean isDurationEffectTick(int pDuration, int pAmplifier) { But looking at the source code of MobEffect class, I can't figure out what pAmplifier is? Any hints / samples on this would be appreciated.          
    • 2022-01-22 07:41:00,800 main WARN Advanced terminal features are not available in this environment [07:41:00] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmlserver, --fml.forgeVersion, 36.2.23, --fml.mcpVersion, 20210115.111550, --fml.mcVersion, 1.16.5, --fml.forgeGroup, net.minecraftforge, nogui] [07:41:00] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 8.0.9+86+master.3cf110c starting: java version 17.0.2 by Oracle Corporation Exception in thread "main" java.lang.IllegalAccessError: class cpw.mods.modlauncher.SecureJarHandler (in unnamed module @0x7ff95560) cannot access class sun.security.util.ManifestEntryVerifier (in module java.base) because module java.base does not export sun.security.util to unnamed module @0x7ff95560         at cpw.mods.modlauncher.SecureJarHandler.lambda$static$1(SecureJarHandler.java:41)         at cpw.mods.modlauncher.api.LamdbaExceptionUtils.uncheck(LamdbaExceptionUtils.java:95)         at cpw.mods.modlauncher.SecureJarHandler.<clinit>(SecureJarHandler.java:41)         at cpw.mods.modlauncher.Launcher.lambda$new$6(Launcher.java:55)         at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)         at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(TypesafeMap.java:52)         at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(TypesafeMap.java:47)         at cpw.mods.modlauncher.Environment.computePropertyIfAbsent(Environment.java:62)         at cpw.mods.modlauncher.Launcher.<init>(Launcher.java:55)         at cpw.mods.modlauncher.Launcher.main(Launcher.java:66)         at net.minecraftforge.server.ServerMain$Runner.runLauncher(ServerMain.java:63)         at net.minecraftforge.server.ServerMain$Runner.access$100(ServerMain.java:60)         at net.minecraftforge.server.ServerMain.main(ServerMain.java:57) i have the same how do i fix it  
    • Hi, I'm facing an issue that a custom datapack is always loaded before the mod's datapack. Means the users/players are not able to override mod's configurations/data at all. I've tried to alternate the order of datapack by using the /datapack commands, however the actual loading order does not change at all. (I can confirm that both datapacks are working as usual by disabling one of them at a time, the correspond data is loaded correctly), is it the mod's problem or...? Thanks.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.