Posted September 13, 20196 yr I have been following this YouTube series: https://www.youtube.com/watch?v=t_zr2onGhmQ&list=PLiDUvCGH5WEUcxyUKxHpQpDuinaiNp3it&index=14 and everything worked fine when I was running it through Eclipse. I noticed, however, that when I built the project, ore would not generate. Why is it different and how can I fix it?
September 13, 20196 yr 1 minute ago, EvanatorM said: Why is it different and how can I fix it? Post your code. I'm not gonna watch a YouTube video to see what potentially is your code. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
September 13, 20196 yr Author Ok. I'm not sure what I was thinking not putting the code initially. The ore generation spans across four of those videos, and it's kind of hard to follow. Sorry. I have a few files that go into ore generation. OreGeneration.java Spoiler package evanatorm.randomizedmod.world; import evanatorm.randomizedmod.config.OregenConfig; import evanatorm.randomizedmod.lists.BlockList; import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.GenerationStage.Decoration; import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.OreFeatureConfig; import net.minecraft.world.gen.feature.OreFeatureConfig.FillerBlockType; import net.minecraft.world.gen.placement.CountRangeConfig; import net.minecraft.world.gen.placement.Placement; import net.minecraftforge.registries.ForgeRegistries; public class OreGeneration { public static void setupOreGeneration() { for (Biome biome : ForgeRegistries.BIOMES) { biome.addFeature(Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(FillerBlockType.NATURAL_STONE, BlockList.test_block.getDefaultState(), OregenConfig.sorpiph_ore_chance.get()), Placement.COUNT_RANGE, new CountRangeConfig(10, 26, 0, 37))); biome.addFeature(Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(FillerBlockType.NATURAL_STONE, BlockList.test_block.getDefaultState(), OregenConfig.thoorth_ore_chance.get()), Placement.COUNT_RANGE, new CountRangeConfig(10, 7, 0, 44))); biome.addFeature(Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(FillerBlockType.NATURAL_STONE, BlockList.test_block.getDefaultState(), OregenConfig.sermur_ore_chance.get()), Placement.COUNT_RANGE, new CountRangeConfig(10, 10, 0, 36))); } } } OreGenConfig.java Spoiler package evanatorm.randomizedmod.config; import net.minecraftforge.common.ForgeConfigSpec; public class OregenConfig { public static ForgeConfigSpec.IntValue sorpiph_ore_chance; public static ForgeConfigSpec.IntValue thoorth_ore_chance; public static ForgeConfigSpec.IntValue sermur_ore_chance; public static ForgeConfigSpec.BooleanValue generate_overworld; public static void init(ForgeConfigSpec.Builder server, ForgeConfigSpec.Builder client) { server.comment("Oregen Config"); sorpiph_ore_chance = server.comment("Max number of ore veins that can spawn in one chunk.") .defineInRange("oregen.sorpiph_ore_chance", 100, 1, 1000); thoorth_ore_chance = server.comment("Max number of ore veins that can spawn in one chunk.") .defineInRange("oregen.thoorth_ore_chance", 100, 1, 1000); sermur_ore_chance = server.comment("Max number of ore veins that can spawn in one chunk.") .defineInRange("oregen.sermur_ore_chance", 100, 1, 1000); generate_overworld = server.comment("Decide if you want randomized ores to spawm in the overworld") .define("oregen.generate_overworld", true); } } Config.java Spoiler package evanatorm.randomizedmod.config; import java.io.File; import com.electronwill.nightconfig.core.file.CommentedFileConfig; import com.electronwill.nightconfig.core.io.WritingMode; import evanatorm.randomizedmod.RandomizedMod; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber public class Config { private static final ForgeConfigSpec.Builder server_builder = new ForgeConfigSpec.Builder(); private static final ForgeConfigSpec.Builder client_builder = new ForgeConfigSpec.Builder(); public static final ForgeConfigSpec server_config; public static final ForgeConfigSpec client_config; static { OregenConfig.init(server_builder, client_builder); server_config = server_builder.build(); client_config = client_builder.build(); } public static void loadConfig(ForgeConfigSpec config, String path) { RandomizedMod.logger.info("Loading config: " + path); final CommentedFileConfig file = CommentedFileConfig.builder(new File(path)).sync().autosave() .writingMode(WritingMode.REPLACE).build(); RandomizedMod.logger.info("Built config: " + path); file.load(); RandomizedMod.logger.info("Loaded config: " + path); config.setConfig(file); } } RandomizedMod.java (Main file) Spoiler package evanatorm.randomizedmod; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import evanatorm.randomizedmod.config.Config; import evanatorm.randomizedmod.items.ItemCustomAxe; import evanatorm.randomizedmod.items.ItemCustomPickaxe; import evanatorm.randomizedmod.lists.ArmorMaterialList; import evanatorm.randomizedmod.lists.BlockList; import evanatorm.randomizedmod.lists.ItemList; import evanatorm.randomizedmod.lists.ToolMaterialList; import evanatorm.randomizedmod.world.OreGeneration; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ArmorItem; import net.minecraft.item.BlockItem; import net.minecraft.item.HoeItem; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.ShovelItem; import net.minecraft.item.SwordItem; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fml.loading.FMLPaths; @Mod("randomizedmod") public class RandomizedMod { public static RandomizedMod instance; public static final String modid = "randomizedmod"; public static final Logger logger = LogManager.getLogger(modid); public static final ItemGroup randomized = new RandomizedItemGroup(); public RandomizedMod() { instance = this; ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, Config.server_config); ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, Config.client_config); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries); Config.loadConfig(Config.client_config, FMLPaths.CONFIGDIR.get().resolve("randomized-client.toml").toString()); Config.loadConfig(Config.server_config, FMLPaths.CONFIGDIR.get().resolve("randomized-server.toml").toString()); MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { OreGeneration.setupOreGeneration(); logger.info("Setup method registered."); } private void clientRegistries(final FMLClientSetupEvent event) { logger.info("ClientRegistries method registered."); } @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll( ItemList.test_item = new Item(new Item.Properties().group(randomized)) .setRegistryName(location("test_item")), ItemList.test_axe = new ItemCustomAxe(ToolMaterialList.test, -1.0f, 6.0f, new Item.Properties().group(randomized)).setRegistryName(location("test_axe")), ItemList.test_pickaxe = new ItemCustomPickaxe(ToolMaterialList.test, -2, 6.0f, new Item.Properties().group(randomized)).setRegistryName(location("test_pickaxe")), ItemList.test_shovel = new ShovelItem(ToolMaterialList.test, -3.0f, 6.0f, new Item.Properties().group(randomized)).setRegistryName(location("test_shovel")), ItemList.test_sword = new SwordItem(ToolMaterialList.test, 0, 6.0f, new Item.Properties().group(randomized)).setRegistryName(location("test_sword")), ItemList.test_hoe = new HoeItem(ToolMaterialList.test, 6.0f, new Item.Properties().group(randomized)).setRegistryName(location("test_hoe")), ItemList.test_helmet = new ArmorItem(ArmorMaterialList.test, EquipmentSlotType.HEAD, new Item.Properties().group(randomized)).setRegistryName(location("test_helmet")), ItemList.test_chestplate = new ArmorItem(ArmorMaterialList.test, EquipmentSlotType.CHEST, new Item.Properties().group(randomized)).setRegistryName(location("test_chestplate")), ItemList.test_leggings = new ArmorItem(ArmorMaterialList.test, EquipmentSlotType.LEGS, new Item.Properties().group(randomized)).setRegistryName(location("test_leggings")), ItemList.test_boots = new ArmorItem(ArmorMaterialList.test, EquipmentSlotType.FEET, new Item.Properties().group(randomized)).setRegistryName(location("test_boots")), ItemList.test_block = new BlockItem(BlockList.test_block, new Item.Properties().group(randomized)) .setRegistryName(BlockList.test_block.getRegistryName())); logger.info("Items registered."); } @SubscribeEvent public static void registerBlocks(final RegistryEvent.Register<Block> event) { event.getRegistry() .registerAll(BlockList.test_block = new Block(Block.Properties.create(Material.ROCK) .hardnessAndResistance(2.0f, 3.0f).lightValue(0).sound(SoundType.STONE)) .setRegistryName(location("test_block"))); logger.info("Blocks registered."); } private static ResourceLocation location(String name) { return new ResourceLocation(modid, name); } } } The part of the main file that should do it is: private void setup(final FMLCommonSetupEvent event) { OreGeneration.setupOreGeneration(); logger.info("Setup method registered."); } Thanks for your quick response!
September 13, 20196 yr 2 hours ago, EvanatorM said: Thanks for your quick response! I cant find anything obviously wrong at the moment. 2 hours ago, EvanatorM said: Placement.COUNT_RANGE Try changing this to Placement.RANDOM_COUNT_RANGE VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
September 13, 20196 yr Author Quote Try changing this to Placement.RANDOM_COUNT_RANGE Unfortunately, this didn't work.
September 23, 20195 yr Author I finally figured it out by looking at the source code of Simple Ores 2. I don't know what was wrong with the code that was in the video. All I know is that this code works. Instead of: Spoiler biome.addFeature(Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(FillerBlockType.NATURAL_STONE, BlockList.test_block.getDefaultState(), OregenConfig.sorpiph_ore_chance.get()), Placement.COUNT_RANGE, new CountRangeConfig(10, 26, 0, 37))); I put this in: Spoiler biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, BlockList.test_block.getDefaultState(), test_veinsize), Placement.COUNT_RANGE, test_cfg)); Also, there are two variables needed and they are put in the oregen file: Spoiler private static final CountRangeConfig test_cfg = new CountRangeConfig(10, 20, 0, 128); private static final int test_veinsize = 7; This worked fine for me!
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.