Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Linky132

Members
  • Joined

  • Last visited

Everything posted by Linky132

  1. Okay, so using that information, I tried replacing the forge bus line with FMLJavaModLoadingContext.get().getModEventBus().register(new OreGen()); but it resulted in an error while loading the mod, basically just saying: java.lang.IllegalArgumentException: Method public void linky132.waywardcraft.OreGen.loadBiomes(net.minecraftforge.event.world.BiomeLoadingEvent) has @SubscribeEvent annotation, but takes an argument that is not a subtype of the base type interface net.minecraftforge.fml.event.lifecycle.IModBusEvent: class net.minecraftforge.event.world.BiomeLoadingEvent
  2. Aha, so that's the problem! the afterCommonSetup method is never called, which is probably due to the commonSetup method not being called either. I assume I did something wrong with the event bus or the listener?
  3. Huh, that's weird, apparently the list is empty. That doesn't make sense, though, since configuredFeature is being added to it, and looks to be valid. I can also confirm that it's not a problem with my block, as it also doesn't work with vanilla blocks. Any ideas?
  4. Thanks for replying. I just checked it by using a print method, and the funny thing is that the "loadBiomes" method is firing, but the contents of the for loop are never executed. Any idea why that could be?
  5. Hi, after my last thread, someone on the Forge Discord server gave me some code to generate ores. However, this code doesn't appear to be generating my block anywhere, and I was wondering if anyone could tell me why. Here is my code: OreGen class: package linky132.waywardcraft; import net.minecraft.block.BlockState; import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.WorldGenRegistries; import net.minecraft.world.gen.GenerationStage; import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.OreFeatureConfig; import net.minecraftforge.event.world.BiomeLoadingEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import java.util.ArrayList; public class OreGen { public static final ArrayList<ConfiguredFeature<?,?>> ORE_GENERATORS = new ArrayList<>(); public static void register() { registerOreGenerator(RegistryHandler.SALT_BLOCK.get().getDefaultState(),16,200,"salt_block"); } public static void registerOreGenerator(BlockState blockState, int patchSize, int maxHeight, String name) { Registry<ConfiguredFeature<?, ?>> registry = WorldGenRegistries.CONFIGURED_FEATURE; ConfiguredFeature<?,?> configuredFeature = Feature.ORE.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.BASE_STONE_OVERWORLD,blockState,patchSize)).range(maxHeight).square().func_242731_b(157); ORE_GENERATORS.add(configuredFeature); Registry.register(registry,WaywardCraft.MODID + name,configuredFeature); } @SubscribeEvent public void loadBiomes(BiomeLoadingEvent event) { for(ConfiguredFeature<?,?> feature : ORE_GENERATORS) { event.getGeneration().withFeature(GenerationStage.Decoration.UNDERGROUND_ORES,feature); } } } Main mod class: package linky132.waywardcraft; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; @Mod(WaywardCraft.MODID) public class WaywardCraft { public static final String MODID = "waywardcraft"; public WaywardCraft() { MinecraftForge.EVENT_BUS.register(this); RegistryHandler.init(); MinecraftForge.EVENT_BUS.register(new OreGen()); } void commonSetup(FMLCommonSetupEvent event) { event.enqueueWork(this::afterCommonSetup); } private void afterCommonSetup() { OreGen.register(); } } Thank you.
  6. Hi, I was wondering if anyone would be willing to give me some code that generates ores, or could just point me in the right direction, please? I've tried looking, I really have, but I can't find much. Thanks!
  7. Mod class: package cubicoder.tutorialmod; import cubicoder.tutorialmod.init.ModBlocks; import linky132.waywardcraft.WaywardCraft; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraftforge.event.RegistryEvent.Register; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @EventBusSubscriber(modid = WaywardCraft.MODID) public class RegistrationHandler { @SubscribeEvent public static void registerItems(Register<Item> event) { final Item[] itemBlocks = { new ItemBlock(ModBlocks.first_block).setRegistryName(ModBlocks.first_block.getRegistryName()) }; event.getRegistry().registerAll(itemBlocks); } @SubscribeEvent public static void registerBlocks(Register<Block> event) { final Block[] blocks = { new Block(Material.ROCK).setRegistryName(WaywardCraft.MODID, "first_block").setCreativeTab(CreativeTabs.MISC) }; event.getRegistry().registerAll(blocks); } } ModBlocks class: package cubicoder.tutorialmod.init; import linky132.waywardcraft.WaywardCraft; import net.minecraft.block.Block; import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; @ObjectHolder(WaywardCraft.MODID) public class ModBlocks { public static final Block first_block = null; } RegistrationHandler class: package cubicoder.tutorialmod; import cubicoder.tutorialmod.init.ModBlocks; import linky132.waywardcraft.WaywardCraft; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraftforge.event.RegistryEvent.Register; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @EventBusSubscriber(modid = WaywardCraft.MODID) public class RegistrationHandler { @SubscribeEvent public static void registerItems(Register<Item> event) { final Item[] itemBlocks = { new ItemBlock(ModBlocks.first_block).setRegistryName(ModBlocks.first_block.getRegistryName()) }; event.getRegistry().registerAll(itemBlocks); } @SubscribeEvent public static void registerBlocks(Register<Block> event) { final Block[] blocks = { new Block(Material.ROCK).setRegistryName(WaywardCraft.MODID, "first_block").setCreativeTab(CreativeTabs.MISC) }; event.getRegistry().registerAll(blocks); } } ModelRegistrationHandler class: package cubicoder.tutorialmod.client; import cubicoder.tutorialmod.init.ModBlocks; import linky132.waywardcraft.WaywardCraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; @EventBusSubscriber(value = Side.CLIENT, modid = WaywardCraft.MODID) public class ModelRegistrationHandler { @SubscribeEvent public static void registerModels(ModelRegistryEvent event) { registerModel(Item.getItemFromBlock(ModBlocks.first_block), 0); } private static void registerModel(Item item, int meta) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), "inventory")); } } Block JSON: { "textures": { "salt_line": "waywardcraft:blocks/salt_line" }, "display": { "gui": { "rotation": [ 30, 45, 0 ], "translation": [ 0, 0, 0 ], "scale": [ 0.625, 0.625, 0.625 ] }, "ground": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 3, 0 ], "scale": [ 0.25, 0.25, 0.25 ] }, "fixed": { "rotation": [ 0, 180, 0 ], "translation": [ 0, 0, 0 ], "scale": [ 1, 1, 1 ] }, "head": { "rotation": [ 0, 180, 0 ], "translation": [ 0, 0, 0 ], "scale": [ 1, 1, 1 ] }, "firstperson_righthand": { "rotation": [ 0, 315, 0 ], "translation": [ 0, 2.5, 0 ], "scale": [ 0.4, 0.4, 0.4 ] }, "thirdperson_righthand": { "rotation": [ 75, 315, 0 ], "translation": [ 0, 2.5, 0 ], "scale": [ 0.375, 0.375, 0.375 ] } }, "elements": [ { "name": "first_block", "from": [ 8, 0, 8 ], "to": [ 8.312, 0.03, 9 ], "faces": { "north": { "texture": "#salt_line", "uv": [ 0, 0, 14, 5 ] }, "east": { "texture": "#salt_line", "uv": [ 0, 0, 14, 5 ] }, "south": { "texture": "#salt_line", "uv": [ 0, 0, 14, 5 ] }, "west": { "texture": "#salt_line", "uv": [ 0, 0, 14, 5 ] }, "up": { "texture": "#salt_line", "uv": [ 0, 0, 16, 5 ], "rotation": 90 }, "down": { "texture": "#salt_line", "uv": [ 0, 0, 16, 5 ] } } } ] } Block State JSON: { "forge_marker": 1, "defaults": { "model": "waywardcraft:first_block" }, "variants": { "normal": [{}], "inventory": [{}] } } Item JSON: { "parent": "waywardcraft:block/first_block" } And the texture:
  8. Hi, so I very recently decided to get into modding, and I've managed to make a block using this tutorial. However, when I follow the part to add a model and texture to the block, only the ItemBlock (the block when it's in my inventory) has a model and texture. Does anyone know how I can give the actual block a model and a texture? Thanks!

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.