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

Well hello everyone. I'm new to Forge modding and relative new to Java, But i understand enough to program a mod.

 

But i have problems with a adding ore with custom drops. it doesn't seems to recognize my custom drop. And i have no idea what i have to paste, I will paste just the code i have so far.

 

Also before hand, i will say sorry for not using the "Insert code" option, but it didn't work.

EDIT: N.V.M, it worked in a other browser.

 

The main .java:

package ianno.worldgenplus;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid="WorldGenPlus", name="WorldGenPlus", version="0.0.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class WorldGenPlus {

public final static Block carbyneOre = new carbyneOre(500, Material.rock);

public final static Item carbyneCompound = new CarbyneCompound(5000);



        // The instance of your mod that Forge uses.
        @Instance("WorldGenPlus")
        public static WorldGenPlus instance;
       
        // Says where the client and server 'proxy' code is loaded.
        @SidedProxy(clientSide="ianno.worldgenplus.client.ClientProxy", serverSide="ianno.worldgenplus.CommonProxy")
        public static CommonProxy proxy;
       
        @EventHandler
        public void preInit(FMLPreInitializationEvent event) {
                // Stub Method
        }
       
        @EventHandler
        public void load(FMLInitializationEvent event) {
                proxy.registerRenderers();
                
                GameRegistry.registerBlock(carbyneOre, "carbyneOre");
                LanguageRegistry.addName(carbyneOre, "Carbyne Ore");
                MinecraftForge.setBlockHarvestLevel(carbyneOre, "pickaxe", 3);
                
                GameRegistry.registerItem(carbyneCompound, "carbyneCompound");
                LanguageRegistry.addName(carbyneCompound,"Carbyne Compound");
        }
       
        @EventHandler
        public void postInit(FMLPostInitializationEvent event) {
                // Stub Method
        }
       
}

 

 

 

The Ore.java:

package ianno.worldgenplus;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid="WorldGenPlus", name="WorldGenPlus", version="0.0.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class WorldGenPlus {

public final static Block carbyneOre = new carbyneOre(500, Material.rock);

public final static Item carbyneCompound = new CarbyneCompound(5000);



        // The instance of your mod that Forge uses.
        @Instance("WorldGenPlus")
        public static WorldGenPlus instance;
       
        // Says where the client and server 'proxy' code is loaded.
        @SidedProxy(clientSide="ianno.worldgenplus.client.ClientProxy", serverSide="ianno.worldgenplus.CommonProxy")
        public static CommonProxy proxy;
       
        @EventHandler
        public void preInit(FMLPreInitializationEvent event) {
                // Stub Method
        }
       
        @EventHandler
        public void load(FMLInitializationEvent event) {
                proxy.registerRenderers();
                
                GameRegistry.registerBlock(carbyneOre, "carbyneOre");
                LanguageRegistry.addName(carbyneOre, "Carbyne Ore");
                MinecraftForge.setBlockHarvestLevel(carbyneOre, "pickaxe", 3);
                
                GameRegistry.registerItem(carbyneCompound, "carbyneCompound");
                LanguageRegistry.addName(carbyneCompound,"Carbyne Compound");
        }
       
        @EventHandler
        public void postInit(FMLPostInitializationEvent event) {
                // Stub Method
        }
       
}

 

 

 

The OreDrop.java:

package ianno.worldgenplus;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;

public class CarbyneCompound extends Item {

public CarbyneCompound(int id) {
	super(id);
	setMaxStackSize(64);
	setCreativeTab(CreativeTabs.tabMaterials);
	setUnlocalizedName("carbyneCompound");


}

}

 

 

Thanks for spending time to watch this. and i hope you are able to help me.

 

 

Also IF you have a better option to this, i will change my post.

 

Greetings,

The Dutch Guy

 

Guest
This topic is now closed to further replies.

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.