Jump to content

wforte6

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by wforte6

  1. Luis I cannot thank you enough, I have been struggling with ore generation for like two weeks now just going through tutorial's and everything where I swear I had the same code. It really takes someone who is familiar with what they are looking at. I appreciate you and hope you have a great day. My ore has successfully generated. So excited for the future of modding!

    • Like 1
  2. 
    @Mod.EventBusSubscriber
    public class OreGeneration {
    
    	@SubscribeEvent(priority = EventPriority.HIGHEST)
    	public static void generateOres(BiomeLoadingEvent event) {
    		if(!(event.getCategory().equals(Biome.Category.NETHER) || !(event.getCategory().equals(Biome.Category.THEEND)))) {
    			generateOre(event.getGeneration(), OreFeatureConfig.FillerBlockType.NATURAL_STONE, ModBlocks.YELLOW_ORE.get().defaultBlockState(), 25, 5, 100, 10);
    			System.out.println("Ore Generation Called for spongebob");
    		}
    	}
    	
    	private static void generateOre(BiomeGenerationSettingsBuilder settings, RuleTest fillerType, BlockState stateContainer,
    			int veinSize, int minHeight, int maxHeight, int amount) {
    		settings.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.configured(new OreFeatureConfig(fillerType, stateContainer, veinSize))
    				.decorated(Placement.RANGE.configured(new TopSolidRangeConfig(minHeight, 0, maxHeight)))
    				.squared().count(amount).range(64));
    		System.out.println("Ore Generation Called for spongebob ore generated");
    	}
    	
    }

    I added the Subscribe event, trying to learn from other posts, still is being called even more frequently now but still no ore is found in the world

     

  3. So a little background I have been working with this for a while trying to troubleshoot this with print out's to see if it is called 

    I will provide the code below to show where I am at with ore gen, it seem's like it is being called but I cannot find the ore generated in the world

    It is showing my sys print out in the console

     

    import net.minecraft.world.gen.placement.Placement;
    import net.minecraft.world.gen.placement.TopSolidRangeConfig;
    import net.minecraftforge.common.world.BiomeGenerationSettingsBuilder;
    import net.minecraftforge.event.world.BiomeLoadingEvent;
    
    public class OreGeneration {
    
    	public static void generateOres(BiomeLoadingEvent event) {
    		if(!(event.getCategory().equals(Biome.Category.NETHER) || !(event.getCategory().equals(Biome.Category.THEEND)))) {
    			generateOre(event.getGeneration(), OreFeatureConfig.FillerBlockType.NATURAL_STONE, ModBlocks.YELLOW_ORE.get().defaultBlockState(), 5, 5, 70, 10000);
    			System.out.println("Ore Generation Called for spongebob");
    		}
    	}
    	
    	private static void generateOre(BiomeGenerationSettingsBuilder settings, RuleTest fillerType, BlockState stateContainer,
    			int veinSize, int minHeight, int maxHeight, int amount) {
    		settings.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.configured(new OreFeatureConfig(fillerType, stateContainer, veinSize))
    				.decorated(Placement.RANGE.configured(new TopSolidRangeConfig(minHeight, 0, maxHeight)))
    				.squared().count(amount).range(64));
    		System.out.println("Ore Generation Called for spongebob ore generated");
    	}
    	
    }

    Next class is where the Mod event bus is called 

    package com.example.examplemod;
    
    import org.apache.logging.log4j.LogManager;
    import org.apache.logging.log4j.Logger;
    
    import com.example.examplemod.registry.Registration;
    import com.example.examplemod.world.OreGeneration;
    
    import net.minecraft.block.Blocks;
    import net.minecraftforge.common.MinecraftForge;
    import net.minecraftforge.eventbus.api.EventPriority;
    import net.minecraftforge.fml.common.Mod;
    import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
    import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
    
    // The value here should match an entry in the META-INF/mods.toml file
    @Mod("spongebob")
    public class TestMod
    {
    	
    	public static final String MOD_ID = "spongebob";
        // Directly reference a log4j logger.
        private static final Logger LOGGER = LogManager.getLogger();
    
        public TestMod() {
        	
        	Registration.register();
            // Register the setup method for modloading
            FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
            
            MinecraftForge.EVENT_BUS.addListener(OreGeneration::generateOres);
    
            // Register ourselves for server and other game events we are interested in
            MinecraftForge.EVENT_BUS.register(this);
        }
    
        private void setup(final FMLCommonSetupEvent event)
        {
            // some print code
            LOGGER.info("HELLO FROM PREINIT");
            LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
        }
    
    }

    Please assist, I will love you forever

    Update:

    I am going to attach where they are getting printed out in the console

     

    sc.png

×
×
  • Create New...

Important Information

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