Jump to content

ore generation in 1.16.5, having problems with .withConfiguration and .configure


Recommended Posts

Posted
public class OreGeneration {
	
	public static final Feature<OreFeatureConfig> KUNZITE_ORE = new OreFeature(OreFeatureConfig.CODEC);
	
	public static final ConfiguredFeature <?,?> KUNZITE_FEATURE = new ConfiguredFeature<?, ?>((KUNZITE_ORE).withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, 
			BlockInit.KUNZITE_ORE.get().defaultBlockState(), 6)).range(20).square().func_242731_b(20));
	
	public static void generateOre(final BiomeLoadingEvent event) {
		if (event.getCategory() == Category.SAVANNA) {
			event.getGeneration().getFeatures(Decoration.UNDERGROUND_ORES).add(() -> KUNZITE_FEATURE);
			
		}
	}
}

I have used multiple ways of incorporating ore generation into the game and they all seem to require ".withConfiguration"

this one doesnt require ".configure" though but most others do, and I have no idea why there is an error. theres usually a replacement solution but i cant seem to figure anything out

let me know if im missing anything

 

also this code heavily inspired by Beethoven92's better end generation, but i've tried many different simple ways of generating

Posted (edited)
57 minutes ago, ianm1647 said:

and I have no idea why there is an error.

It'd be useful if  you could've told the error

public static final ConfiguredFeature <?,?> KUNZITE_FEATURE = new ConfiguredFeature<?, ?>((KUNZITE_ORE).withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, BlockInit.KUNZITE_ORE.get().defaultBlockState(), 6)).range(20).square().func_242731_b(20));

this should throw an error as you call RegistryObject#get before the objects have been registered (i.e.: in static initialization). I'd instantiate the ore features in the common setup event

Edited by kiou.23

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

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

Announcements



×
×
  • Create New...

Important Information

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