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.

Featured Replies

Posted

Trying to start off with modding. Can't figure out how to solve this error.

 

Full crash log attached.

My code:

 

Spoiler

 

package Blocks;

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraftforge.registries.IForgeRegistry;

public class ModBlocks {

    public static BlockOre oreCopper = new BlockOre("ore_copper").setCreativeTab(CreativeTabs.MATERIALS);

    public static void register(IForgeRegistry<Block> registry)
    {
        registry.registerAll
        (
                oreCopper
        );
    }
    
    public static void registerItemBlocks(IForgeRegistry<Item> registry)
    {
        registry.registerAll
        (
                oreCopper.createItemBlock()
        );
    }
    
    public static void registerItemModels()
    {
        oreCopper.registerItemModel(Item.getItemFromBlock(oreCopper));
    }

}

 

 

Thanks in advance!

 

crash-2017-08-03_16.21.21-client.txt

Edited by Buudeluu

  • Author

Am I not doing this here?

 

Spoiler

 

package Blocks;

import buudeluu.quantumfarming.QuantumFarming;
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;

public class BlockBase extends Block
{
  // ...
    public Item createItemBlock()
    {
        return new ItemBlock(this);
    }

//...
}

 


 

 

  • Author

Right, I think this is where I'm setting it. Java gives me some headaches. :D


 

Spoiler

 

package buudeluu.quantumfarming;

import Blocks.ModBlocks;
import Items.ModItems;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import proxy.CommonProxy;

@Mod(modid = QuantumFarming.modId, name = QuantumFarming.name, version = QuantumFarming.version)

public class QuantumFarming
{
//...
    @Mod.EventBusSubscriber
    public static class RegistrationHandler
    {
        @SubscribeEvent
        public static void registerBlocks(RegistryEvent.Register<Block> event)
        {
            ModBlocks.register(event.getRegistry());
        }
        
        @SubscribeEvent
        public static void registerItems(RegistryEvent.Register<Item> event)
        {
            ModItems.register(event.getRegistry());
            ModBlocks.registerItemBlocks(event.getRegistry());
        }
        
        @SubscribeEvent
        public static void registerModels(ModelRegistryEvent event)
        {
            ModItems.registerItemModels();
            ModBlocks.registerItemModels();
        }
    }
}

 

 

  • Author

I am looking for what I'm doing wrong. I'm new at java and modding and I would appreciate it if someone with more experience could help me out here since I can't resolve this issue myself.

 

But thanks for your replies already.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

6 hours ago, Buudeluu said:

I'm new at java

Admitting that here is just begging to get your thread locked (see Draco's signature). Go find yourself some Java resources and lean on them until nobody here can detect a lack of Java awareness in your work or questions. Do the same for Eclipse if that's new too.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

If you are still lost, maybe this method will be a bit more helpfull. Take all your blocks, put them in a list. When registering itemblocks, take that list and by using for put "setRegistryName()" on the end.

This is how it should look like. I hope really this helps ;-)

public class BlockHandler {
    public static List<Block> BLOCKS = new ArrayList<Block>();
    public static Block test_block = new BlockTestBlock(Material.ROCK, "test_block", CreativeTabHandler.tabMW, 5f, 15f, 3, "pickaxe");
    
    @SubscribeEvent
    public static void registerBlocks(RegistryEvent.Register<Block> event){
        BLOCKS.add(test_block);

        for(Block block : BLOCKS){
            event.getRegistry().register(block);
        }
    }
  
    @SubscribeEvent
    public static void registerItemBlocks(RegistryEvent.Register<Item> event){

        for(Block block: BLOCKS){
            event.getRegistry().register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
        }
    }
}

 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.