samjviana Posted August 27, 2020 Posted August 27, 2020 I've an Custom Ore that i want to add to World Gen to the whole Overworld, in previous versions of Minecraft I was able to use ForgeRegistries.BIOMES but that field doesn't exist on ForgeRegistries anymore I've done an googling but sadly i couldn't find an solution for this. Quote
ChampionAsh5357 Posted August 27, 2020 Posted August 27, 2020 1.16.2 has biomes/dimension now data-driven. The system is currently being implemented to allow for appending features/structures/spawns to them. 1 Quote
imacatlolol Posted August 27, 2020 Posted August 27, 2020 Version 33.0.22 has re-implemented the registry, but things obviously aren't expected to work quite right yet. Quote I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
samjviana Posted August 27, 2020 Author Posted August 27, 2020 So at this point it isn't possible? At least not by the usual way? Quote
imacatlolol Posted August 27, 2020 Posted August 27, 2020 8 minutes ago, samjviana said: So at this point it isn't possible? At least not by the usual way? I would recommend trying and seeing if it works anyways just for the heck of it. Forge is in beta right now for 1.16, so some issues are to be expected. They're working quite hard to get things figured out, but it may take a little while. 1 Quote I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
samjviana Posted August 28, 2020 Author Posted August 28, 2020 21 hours ago, imacatlolol said: I would recommend trying and seeing if it works anyways just for the heck of it. Forge is in beta right now for 1.16, so some issues are to be expected. They're working quite hard to get things figured out, but it may take a little while. i'll look into it, thanks. Any news i'll post here. 1 Quote
samjviana Posted August 28, 2020 Author Posted August 28, 2020 (edited) So, after a lot of digging around the forge/minecraft classes i managed to figure it out how the Ore Gen is working. The feature registering remains similar: public static void initGen() { Registry.register( WorldGenRegistries.field_243653_e /* Feature Registering */, ModBlocks.ADAMANTINE_ORE.getId() /* Resource Location */, Feature.field_236289_V_ /* no_surface_ore */.withConfiguration( new OreFeatureConfig( OreFeatureConfig.FillerBlockType.field_241882_a /* base_stone_overworld */, ModBlocks.ADAMANTINE_ORE.get().getDefaultState() */, 64 ) ).withPlacement(Placement.field_242910_o /* depth */ .configure( new DepthAverageConfig(12, 12) )).func_242728_a() /* spreadHorizontally */ .func_242731_b(1) /* repeat */ ); } The most trick part was adding that feature in the already configured features of an biome: public static void setupGen() { for (Map.Entry<RegistryKey<Biome>, Biome> biome : WorldGenRegistries.field_243657_i.func_239659_c_() /* Collection of Biome Entries */) { if (!biome.getValue().getCategory().equals(Biome.Category.NETHER) && !biome.getValue().getCategory().equals(Biome.Category.THEEND)) { addFeatureToBiome( biome.getValue(), GenerationStage.Decoration.UNDERGROUND_ORES, WorldGenRegistries.field_243653_e.getOrDefault(ModBlocks.ADAMANTINE_ORE.getId()) ); } } } public static void addFeatureToBiome(Biome biome, GenerationStage.Decoration decoration, ConfiguredFeature<?, ?> configuredFeature) { List<List<Supplier<ConfiguredFeature<?, ?>>>> biomeFeatures = new ArrayList<>( biome.func_242440_e().func_242498_c() /* List of Configured Features */ ); while (biomeFeatures.size() <= decoration.ordinal()) { biomeFeatures.add(Lists.newArrayList()); } List<Supplier<ConfiguredFeature<?, ?>>> features = new ArrayList<>(biomeFeatures.get(decoration.ordinal())); features.add(() -> configuredFeature); biomeFeatures.set(decoration.ordinal(), features); /* Change field_242484_f that contains the Configured Features of the Biome*/ ObfuscationReflectionHelper.setPrivateValue(BiomeGenerationSettings.class, biome.func_242440_e(), biomeFeatures, "field_242484_f"); }} Actually it seems that there's no proper way of doing this by now, since i needed to use the "setPrivateValue". It's not ideal ... but it works. Thanks a lot for the guidance. Edited August 28, 2020 by samjviana 1 Quote
Recommended Posts
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.