I've looked at the DefaultBiomeFeatures class of the vanilla code and created this class in the mod folder in the world.gen packages:
package com.SkySibe.testmod.world.gen;
import com.SkySibe.testmod.init.BlockInit;
import net.minecraft.block.BlockState;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
import net.minecraft.world.biome.DefaultBiomeFeatures;
import net.minecraft.world.gen.GenerationStage;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
import net.minecraft.world.gen.placement.CountRangeConfig;
import net.minecraft.world.gen.placement.Placement;
import net.minecraftforge.registries.ForgeRegistries;
public class genOre extends DefaultBiomeFeatures{
private static final BlockState RUBY_ORE = BlockInit.ruby_ore.getDefaultState();
public static void addRubyOre() {
for (Biome biomeIn : ForgeRegistries.BIOMES) {
if (biomeIn == Biomes.DARK_FOREST || biomeIn == Biomes.DARK_FOREST_HILLS) {
biomeIn.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, RUBY_ORE, 12)).withPlacement(Placement.COUNT_RANGE.configure(new CountRangeConfig(0, 3, 9, 40))));
} else {
biomeIn.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, RUBY_ORE, 9)).withPlacement(Placement.COUNT_RANGE.configure(new CountRangeConfig(0, 1, 6, 40))));
}
}
}
}
In the mod folder in the main mod class I've created the function 'loadCompleteEvent':
package com.SkySibe.testmod;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.SkySibe.testmod.world.gen.genOre;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
// The value here should match an entry in the META-INF/mods.toml file
@Mod("testmod")
public class TestMod
{
// Directly reference a log4j logger.
private static final Logger LOGGER = LogManager.getLogger();
public static final String MOD_ID = "testmod";
public static TestMod instance;
public TestMod() {
// Register the setup method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
// Register the doClientStuff method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
instance = this;
// Register ourselves for server and other game events we are interested in
MinecraftForge.EVENT_BUS.register(this);
}
private void setup(final FMLCommonSetupEvent event)
{
}
private void doClientStuff(final FMLClientSetupEvent event) {
}
@SubscribeEvent
public static void loadCompleteEvent() {
genOre.addRubyOre();
}
}
I would like some help I'm pretty new to this although I've some experience with Java.
btw I need help with adding xp to the ore mining, if you can tell me where do I find the vanilla class that doing it and how to modify it, it will help a lot.
Thank.