Jump to content

Recommended Posts

Posted

Hey guys, I recently tried out a shaped crafting recipe and I get a crash

 

---- Minecraft Crash Report ----

// I let you down. Sorry :(

 

Time: 7/17/14 8:42 PM

Description: Initializing game

 

java.lang.NullPointerException

at net.minecraft.item.ItemStack.<init>(ItemStack.java:82)

at com.TehHaloTree.halotechmod.recipes.CraftingHandler.registerRecipes(CraftingHandler.java:41)

at com.TehHaloTree.halotechmod.recipes.CraftingHandler.init(CraftingHandler.java:34)

at com.TehHaloTree.halotechmod.halotech.load(halotech.java:160)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:545)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:201)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:181)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:112)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:699)

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:249)

at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:509)

at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:808)

at net.minecraft.client.main.Main.main(SourceFile:101)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)

at net.minecraft.launchwrapper.Launch.main(Launch.java:27)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:214)

at org.multimc.EntryPoint.listen(EntryPoint.java:139)

at org.multimc.EntryPoint.main(EntryPoint.java:53)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at net.minecraft.item.ItemStack.<init>(ItemStack.java:82)

at com.TehHaloTree.halotechmod.recipes.CraftingHandler.registerRecipes(CraftingHandler.java:41)

at com.TehHaloTree.halotechmod.recipes.CraftingHandler.init(CraftingHandler.java:34)

at com.TehHaloTree.halotechmod.halotech.load(halotech.java:160)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:545)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:201)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:181)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:112)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:699)

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:249)

at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:509)

 

-- Initialization --

Details:

Stacktrace:

at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:808)

at net.minecraft.client.main.Main.main(SourceFile:101)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)

at net.minecraft.launchwrapper.Launch.main(Launch.java:27)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:214)

at org.multimc.EntryPoint.listen(EntryPoint.java:139)

at org.multimc.EntryPoint.main(EntryPoint.java:53)

 

-- System Details --

Details:

Minecraft Version: 1.6.4

Operating System: Windows 8.1 (amd64) version 6.3

Java Version: 1.7.0_60, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 301739192 bytes (287 MB) / 655360000 bytes (625 MB) up to 954728448 bytes (910 MB)

JVM Flags: 4 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xms512m -Xmx1024m -XX:PermSize=64m

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Suspicious classes: FML and Forge are installed

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v8.11 FML v6.4.49.965 Minecraft Forge 9.11.1.965 6 mods loaded, 6 mods active

mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized

FML{6.4.49.965} [Forge Mod Loader] (minecraftforge-9.11.1.965.jar) Unloaded->Constructed->Pre-initialized->Initialized

Forge{9.11.1.965} [Minecraft Forge] (minecraftforge-9.11.1.965.jar) Unloaded->Constructed->Pre-initialized->Initialized

IC2{2.0.397-experimental} [industrialCraft 2] (industrialcraft-2_2.0.397-experimental.jar) Unloaded->Constructed->Pre-initialized->Initialized

gregtech_addon{MC162} [GregTech-Addon] (gregtechmod.zip) Unloaded->Constructed->Pre-initialized->Initialized

HaloTech{v1} [HaloTech] (HaloTech-1.0.jar) Unloaded->Constructed->Pre-initialized->Errored

Launched Version: 1.6.4

LWJGL: 2.9.0

OpenGL: AMD Radeon HD 7700 Series GL version 4.3.12618 Compatibility Profile Context 13.251.9001.0, ATI Technologies Inc.

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Pack: Default

Current Language: English (US)

Profiler Position: N/A (disabled)

Vec3 Pool Size: ~~ERROR~~ NullPointerException: null

 

 

Here's my Main mod class:

 

package com.TehHaloTree.halotechmod;

 

import ic2.api.item.Items;

import ic2.api.recipe.RecipeInputItemStack;

import ic2.api.recipe.Recipes;

 

import java.io.File;

import java.util.ArrayList;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.client.Minecraft;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraftforge.common.Configuration;

import net.minecraft.item.crafting.CraftingManager;

import net.minecraftforge.oredict.OreDictionary;

 

import com.TehHaloTree.halotechmod.blocks.AdvancedPlateBender;

import com.TehHaloTree.halotechmod.blocks.CitrineOre;

import com.TehHaloTree.halotechmod.blocks.DarkOre;

import com.TehHaloTree.halotechmod.blocks.Element115Ore;

import com.TehHaloTree.halotechmod.blocks.EridiumOre;

import com.TehHaloTree.halotechmod.blocks.FluoriteOre;

import com.TehHaloTree.halotechmod.blocks.FluxOre;

import com.TehHaloTree.halotechmod.blocks.MysteriousOre;

import com.TehHaloTree.halotechmod.blocks.RadiumOre;

import com.TehHaloTree.halotechmod.items.CitrineDust;

import com.TehHaloTree.halotechmod.items.CitrineIngot;

import com.TehHaloTree.halotechmod.items.DarkDust;

import com.TehHaloTree.halotechmod.items.DarkIngot;

import com.TehHaloTree.halotechmod.items.Element115Dust;

import com.TehHaloTree.halotechmod.items.Element115Ingot;

import com.TehHaloTree.halotechmod.items.EridiumDust;

import com.TehHaloTree.halotechmod.items.EridiumIngot;

import com.TehHaloTree.halotechmod.items.FluoriteDust;

import com.TehHaloTree.halotechmod.items.FluoriteIngot;

import com.TehHaloTree.halotechmod.items.FluxDust;

import com.TehHaloTree.halotechmod.items.FluxIngot;

import com.TehHaloTree.halotechmod.items.MysteriousDust;

import com.TehHaloTree.halotechmod.items.MysteriousIngot;

import com.TehHaloTree.halotechmod.items.RadiumDust;

import com.TehHaloTree.halotechmod.items.RadiumIngot;

import com.TehHaloTree.halotechmod.lib.References;

import com.TehHaloTree.halotechmod.proxy.ProxyCommon;

import com.TehHaloTree.halotechmod.recipes.CraftingHandler;

import com.TehHaloTree.halotechmod.tile.TileEntityAdvancedPlateBender;

import com.TehHaloTree.halotechmod.worldgeneration.EventManager;

 

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.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

import cpw.mods.fml.relauncher.Side;

 

@Mod(modid = References.MODID, version = References.VERSION, name = References.NAME)

 

public class halotech {

 

@Instance(References.MODID)

public static halotech modInstance;

 

@EventHandler

public void prinit(FMLInitializationEvent event) {

if (event.getSide() == Side.CLIENT)

Minecraft.getMinecraft().refreshResources();

 

}

 

@SidedProxy(clientSide = "com.TehHaloTree.halotechmod.proxy.ProxyClient", serverSide = "com.TehHaloTree.halotechmod.proxy.ProxyCommon")

public static ProxyCommon proxy;

 

public static final String modid = "HaloTech";

 

//CreativeTabs

public static CreativeTabs HaloTechCreativeTab = new CreativeTab(CreativeTabs.getNextID(), "HaloTech Mod");

 

//WorldGeneration

EventManager eventmanager = new EventManager();

 

//Recipes

 

//Blocks

//World Generation

public static Block EridiumOre;

public static Block CitrineOre;

public static Block RadiumOre;

public static Block FluoriteOre;

public static Block FluxOre;

public static Block DarkOre;

public static Block Element115Ore;

public static Block MysteriousOre;

 

public static int EridiumOreID;

public static int CitrineOreID;

public static int RadiumOreID;

public static int FluoriteOreID;

public static int FluxOreID;

public static int DarkOreID;

public static int Element115OreID;

public static int MysteriousOreID;

//Machines

public static Block AdvancedPlateBender;

public static int AdvancedPlateBenderID;

 

 

//Items

//Dusts

public static Item EridiumDust;

public static Item CitrineDust;

public static Item RadiumDust;

public static Item FluoriteDust;

public static Item FluxDust;

public static Item DarkDust;

public static Item Element115Dust;

public static Item MysteriousDust;

 

public static int EridiumDustID;

public static int CitrineDustID;

public static int RadiumDustID;

public static int FluoriteDustID;

public static int FluxDustID;

public static int DarkDustID;

public static int Element115DustID;

public static int MysteriousDustID;

//Ingots

public static Item EridiumIngot;

public static Item CitrineIngot;

public static Item RadiumIngot;

public static Item FluoriteIngot;

public static Item FluxIngot;

public static Item DarkIngot;

public static Item Element115Ingot;

public static Item MysteriousIngot;

 

public static int EridiumIngotID;

public static int CitrineIngotID;

public static int RadiumIngotID;

public static int FluoriteIngotID;

public static int FluxIngotID;

public static int DarkIngotID;

public static int Element115IngotID;

public static int MysteriousIngotID;

 

ItemStack iridiumPlate = Items.getItem("iridiumPlate");

ItemStack lapotronCrystal = Items.getItem("lapotronCrystal");

ArrayList<ItemStack> gearElectrum = OreDictionary.getOres("gearElectrum");

ArrayList<ItemStack> circuitElite = OreDictionary.getOres("circuitElite");

ArrayList<ItemStack> bender = OreDictionary.getOres("bender");

 

 

 

@EventHandler

public void load(FMLInitializationEvent event) {

 

CraftingHandler.init();

 

//Configuration

Configuration config = new Configuration(new File("config/HaloTech.cfg"));

 

//World Generator

GameRegistry.registerWorldGenerator(eventmanager);

 

config.load();

//Blocks

EridiumOreID = config.get("Blocks", "Eridium Ore", 500).getInt();

CitrineOreID = config.get("Blocks", "Citrine Ore", 501).getInt();

RadiumOreID = config.get("Blocks", "Radium Ore", 502).getInt();

FluoriteOreID = config.get("Blocks", "Fluorite Ore", 503).getInt();

FluxOreID = config.get("Blocks", "Flux Ore", 504).getInt();

DarkOreID = config.get("Blocks", "Dark Ore", 505).getInt();

Element115OreID = config.get("Blocks", "Element 115 Ore", 506).getInt();

MysteriousOreID = config.get("Blocks", "Mysterious Ore", 507).getInt();

 

//Machines

AdvancedPlateBenderID = config.get("Machines", "Advanced Plate Bender", 508).getInt();

 

//Items

EridiumDustID = config.get("Dusts", "Eridium Dust", 5000).getInt();

CitrineDustID = config.get("Dusts", "Citrine Dust", 5001).getInt();

RadiumDustID = config.get("Dusts", "Radium Dust", 5002).getInt();

FluoriteDustID = config.get("Dusts", "Fluorite Dust", 5003).getInt();

FluxDustID = config.get("Dusts", "Flux Dust", 5004).getInt();

DarkDustID = config.get("Dusts", "Dark Dust", 5005).getInt();

Element115DustID = config.get("Dusts", "Element 115 Dust", 5006).getInt();

MysteriousDustID = config.get("Dusts", "Mysterious Dust", 5007).getInt();

 

EridiumIngotID = config.get("Ingots", "Eridium Ingot", 5008).getInt();

CitrineIngotID = config.get("Ingots", "Citrine Ingot", 5009).getInt();

RadiumIngotID = config.get("Ingots", "Radium Ingot", 5010).getInt();

FluoriteIngotID = config.get("Ingots", "Fluorite Ingot", 5011).getInt();

FluxIngotID = config.get("Ingots", "Flux Ingot", 5012).getInt();

DarkIngotID = config.get("Ingots", "Dark Ingot", 5013).getInt();

Element115IngotID = config.get("Ingots", "Element 115 Ingot", 5014).getInt();

MysteriousIngotID = config.get("Ingots", "Mysterious Ingot", 5015).getInt();

 

config.save();

 

proxy.RenderInformation();

 

//Block Registry

//World Generation

//Ore~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

EridiumOre = new EridiumOre(EridiumOreID, Material.rock).setUnlocalizedName("EridiumOre");

GameRegistry.registerBlock(EridiumOre, modid+EridiumOre.getUnlocalizedName().substring(5));

LanguageRegistry.addName(EridiumOre, "Eridium Ore");

 

CitrineOre = new CitrineOre(CitrineOreID, Material.rock).setUnlocalizedName("CitrineOre");

GameRegistry.registerBlock(CitrineOre, modid+CitrineOre.getUnlocalizedName().substring(5));

LanguageRegistry.addName(CitrineOre, "Citrine Ore");

 

RadiumOre = new RadiumOre(RadiumOreID, Material.rock).setUnlocalizedName("RadiumOre");

GameRegistry.registerBlock(RadiumOre, modid+RadiumOre.getUnlocalizedName().substring(5));

LanguageRegistry.addName(RadiumOre, "Radium Ore");

 

FluoriteOre = new FluoriteOre(FluoriteOreID, Material.rock).setUnlocalizedName("FluoriteOre");

GameRegistry.registerBlock(FluoriteOre, modid+FluoriteOre.getUnlocalizedName().substring(5));

LanguageRegistry.addName(FluoriteOre,  "FluoriteOre");

 

FluxOre = new FluxOre(FluxOreID, Material.rock).setUnlocalizedName("FluxOre");

GameRegistry.registerBlock(FluxOre, modid+FluxOre.getUnlocalizedName().substring(5));

LanguageRegistry.addName(FluxOre, "Flux Ore");

 

DarkOre = new DarkOre(DarkOreID, Material.rock).setUnlocalizedName("DarkOre");

GameRegistry.registerBlock(DarkOre,  modid+DarkOre.getUnlocalizedName().substring(5));

LanguageRegistry.addName(DarkOre, "Dark Ore");

 

MysteriousOre = new MysteriousOre(MysteriousOreID, Material.rock).setUnlocalizedName("MysteriousOre");

GameRegistry.registerBlock(MysteriousOre, modid+MysteriousOre.getUnlocalizedName().substring(5));

LanguageRegistry.addName(MysteriousOre, "Mysterious Ore");

 

Element115Ore = new Element115Ore(Element115OreID, Material.rock).setUnlocalizedName("Element115Ore");

GameRegistry.registerBlock(Element115Ore, modid+Element115Ore.getUnlocalizedName().substring(5));

LanguageRegistry.addName(Element115Ore, "Element 115 Ore");

 

//Machine Registry~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

AdvancedPlateBender = new AdvancedPlateBender(AdvancedPlateBenderID, Material.iron).setUnlocalizedName("AdvancedPlateBender");

GameRegistry.registerBlock(AdvancedPlateBender, modid+AdvancedPlateBender.getUnlocalizedName().substring(5));

LanguageRegistry.addName(AdvancedPlateBender, "Advanced Plate Bender");

 

//Item Registry

//Dusts~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

EridiumDust = new EridiumDust(EridiumOreID).setUnlocalizedName("EridiumDust");

GameRegistry.registerItem(EridiumDust, modid+EridiumDust.getUnlocalizedName().substring(5));

LanguageRegistry.addName(EridiumDust, "Eridium Dust");

 

CitrineDust = new CitrineDust(CitrineDustID).setUnlocalizedName("CitrineDust");

GameRegistry.registerItem(CitrineDust, modid+CitrineDust.getUnlocalizedName().substring(5));

LanguageRegistry.addName(CitrineDust, "Citrine Dust");

 

RadiumDust = new RadiumDust(RadiumDustID).setUnlocalizedName("RadiumDust");

GameRegistry.registerItem(RadiumDust, modid+RadiumDust.getUnlocalizedName().substring(5));

LanguageRegistry.addName(RadiumDust, "Radium Dust");

 

FluoriteDust = new FluoriteDust(FluoriteDustID).setUnlocalizedName("FluoriteDust");

GameRegistry.registerItem(FluoriteDust, modid+FluoriteDust.getUnlocalizedName().substring(5));

LanguageRegistry.addName(FluoriteDust, "Fluorite Dust");

 

Element115Dust = new Element115Dust(Element115DustID).setUnlocalizedName("Element115Dust");

GameRegistry.registerItem(Element115Dust, modid+Element115Dust.getUnlocalizedName().substring(5));

LanguageRegistry.addName(Element115Dust, "Element115 Dust");

 

MysteriousDust = new MysteriousDust(MysteriousDustID).setUnlocalizedName("MysteriousDust");

GameRegistry.registerItem(MysteriousDust, modid+MysteriousDust.getUnlocalizedName().substring(5));

LanguageRegistry.addName(MysteriousDust, "Mysterious Dust");

 

DarkDust = new DarkDust(DarkDustID).setUnlocalizedName("DarkDust");

GameRegistry.registerItem(DarkDust, modid+DarkDust.getUnlocalizedName().substring(5));

LanguageRegistry.addName(DarkDust, "Dark Dust");

 

FluxDust = new FluxDust(FluxDustID).setUnlocalizedName("FluxDust");

GameRegistry.registerItem(FluxDust, modid+FluxDust.getUnlocalizedName().substring(5));

LanguageRegistry.addName(FluxDust, "Flux Dust");

//Ingots~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

FluxIngot = new FluxIngot(FluxIngotID).setUnlocalizedName("FluxIngot");

GameRegistry.registerItem(FluxIngot, modid+FluxIngot.getUnlocalizedName().substring(5));

LanguageRegistry.addName(FluxIngot, "Flux Ingot");

 

CitrineIngot = new CitrineIngot(CitrineIngotID).setUnlocalizedName("CitrineIngot");

GameRegistry.registerItem(CitrineIngot, modid+CitrineIngot.getUnlocalizedName().substring(5));

LanguageRegistry.addName(CitrineIngot, "Citrine Ingot");

 

RadiumIngot = new RadiumIngot(RadiumIngotID).setUnlocalizedName("RadiumIngot");

GameRegistry.registerItem(RadiumIngot, modid+RadiumIngot.getUnlocalizedName().substring(5));

LanguageRegistry.addName(RadiumIngot, "Radium Ingot");

 

FluoriteIngot = new FluoriteIngot(FluoriteIngotID).setUnlocalizedName("FluoriteIngot");

GameRegistry.registerItem(FluoriteIngot, modid+FluoriteIngot.getUnlocalizedName().substring(5));

LanguageRegistry.addName(FluoriteIngot, "Fluorite Ingot");

 

Element115Ingot = new Element115Ingot(Element115IngotID).setUnlocalizedName("Element115Ingot");

GameRegistry.registerItem(Element115Ingot, modid+Element115Ingot.getUnlocalizedName().substring(5));

LanguageRegistry.addName(Element115Ingot, "Element 115 Ingot");

 

MysteriousIngot = new MysteriousIngot(MysteriousIngotID).setUnlocalizedName("MysteriousIngot");

GameRegistry.registerItem(MysteriousIngot, modid+MysteriousIngot.getUnlocalizedName().substring(5));

LanguageRegistry.addName(MysteriousIngot, "Mysterious Ingot");

 

DarkIngot = new DarkIngot(DarkIngotID).setUnlocalizedName("DarkIngot");

GameRegistry.registerItem(DarkIngot, modid+DarkIngot.getUnlocalizedName().substring(5));

LanguageRegistry.addName(DarkIngot, "Dark Ingot");

 

EridiumIngot = new EridiumIngot(EridiumIngotID).setUnlocalizedName("EridiumIngot");

GameRegistry.registerItem(EridiumIngot, modid+EridiumIngot.getUnlocalizedName().substring(5));

LanguageRegistry.addName(EridiumIngot, "Eridium Ingot");

 

//Tile Entities~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GameRegistry.registerTileEntity(TileEntityAdvancedPlateBender.class, "AdvancedPlateBenderTileEntity");

//Item Calling~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ArrayList<ItemStack> electrumGear = OreDictionary.getOres("gearElectrum");

 

//Recipes~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GameRegistry.addRecipe(new ItemStack(halotech.AdvancedPlateBender, 1), "zaz","yxy","zbz", 'y', iridiumPlate, 'z', gearElectrum, 'x', bender, 'a', lapotronCrystal, 'b', circuitElite);

 

 

 

}

 

 

Any help appreciated, thanks in advance,

~TehHaloTree

Posted

What I also suggest is to outsource your blocks and items into a seperate class, so that your @Mod class is not so crammed

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

You have done the register wrong, for example

 

GameRegistry.registerShapedRecipe(new ItemStack(MyModClass.coalOnAStick, 1), "XOX", "OXO", "XOX", 'X', new ItemStack(Items.coal, 1), 'O', new ItemStack(Items.stick, 1));

 

Where 'X' represents X in "XOX" and "OXO" and 'O' represents O in "XOX" and "OXO", and adding more items just do the identifier first then then itemstack like I show eg:

 

'A', new ItemStack(Items.apple, 1)

 

Would look like

GameRegistry.registerShapedRecipe(new ItemStack(MyModClass.coalOnAStick, 1), "XOX", "OXO", "XOX", 'X', new ItemStack(Items.coal, 1), 'O', new ItemStack(Items.stick, 1), 'A', new ItemStack(Items.apple, 1));

Posted

First of all, I get an error on "RegisterShapedRecipe". This is the line of code I'm using when it errors.

 

GameRegistry.registerShapedRecipe(new ItemStack(halotech.AdvancedPlateBender, 1), "zzz", "zzz", "zzz", 'z', new ItemStack(Item.coal));

 

Second, the items being used in the original recipe are not from my mod and are being called from other sources (ie. Ic2 API and OreDict). Thus, whenever I type them in as "new ItemStack(<insert Item name>) it errors as I do not know if I should call them separately in the mod file or call them right within that recipe. Thanks,

~TehHaloTree

Posted

Hi

 

Looks to me like you are initialising your crafting handler before you have initialised all the items that it uses.  You should initialise your blocks, items, and register them in preInit.  The recipes should be in load.

 

This link might help explain it further (see Event Handling section)

http://greyminecraftcoder.blogspot.com.au/2013/11/how-forge-starts-up-your-code.html

 

-TGG

 

I put all of my block initialization and registry into preinit and no errors in eclipse. When I startup I get the same crash. Looking at the console when it crashes, it seems to be happening at line 315:

 

GameRegistry.addRecipe(new ItemStack(halotech.AdvancedPlateBender, 1), "zaz","yxy","zbz", 'y', Items.getItem("iridiumPlate"), 'z', OreDictionary.getOres("gearElectrum"), 'x', OreDictionary.getOres("bender"), 'a', Items.getItem("lapotronCrystal"), 'b', OreDictionary.getOres("circuitElite"));

 

 

Here's the redone class.

 

package com.TehHaloTree.halotechmod;

 

import ic2.api.item.Items;

import ic2.api.recipe.RecipeInputItemStack;

import ic2.api.recipe.Recipes;

 

import java.io.File;

import java.util.ArrayList;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.client.Minecraft;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraftforge.common.Configuration;

import net.minecraft.item.crafting.CraftingManager;

import net.minecraftforge.oredict.OreDictionary;

 

import com.TehHaloTree.halotechmod.blocks.AdvancedPlateBender;

import com.TehHaloTree.halotechmod.blocks.CitrineOre;

import com.TehHaloTree.halotechmod.blocks.DarkOre;

import com.TehHaloTree.halotechmod.blocks.Element115Ore;

import com.TehHaloTree.halotechmod.blocks.EridiumOre;

import com.TehHaloTree.halotechmod.blocks.FluoriteOre;

import com.TehHaloTree.halotechmod.blocks.FluxOre;

import com.TehHaloTree.halotechmod.blocks.MysteriousOre;

import com.TehHaloTree.halotechmod.blocks.RadiumOre;

import com.TehHaloTree.halotechmod.items.CitrineDust;

import com.TehHaloTree.halotechmod.items.CitrineIngot;

import com.TehHaloTree.halotechmod.items.DarkDust;

import com.TehHaloTree.halotechmod.items.DarkIngot;

import com.TehHaloTree.halotechmod.items.Element115Dust;

import com.TehHaloTree.halotechmod.items.Element115Ingot;

import com.TehHaloTree.halotechmod.items.EridiumDust;

import com.TehHaloTree.halotechmod.items.EridiumIngot;

import com.TehHaloTree.halotechmod.items.FluoriteDust;

import com.TehHaloTree.halotechmod.items.FluoriteIngot;

import com.TehHaloTree.halotechmod.items.FluxDust;

import com.TehHaloTree.halotechmod.items.FluxIngot;

import com.TehHaloTree.halotechmod.items.MysteriousDust;

import com.TehHaloTree.halotechmod.items.MysteriousIngot;

import com.TehHaloTree.halotechmod.items.RadiumDust;

import com.TehHaloTree.halotechmod.items.RadiumIngot;

import com.TehHaloTree.halotechmod.lib.References;

import com.TehHaloTree.halotechmod.proxy.ProxyCommon;

import com.TehHaloTree.halotechmod.recipes.CraftingHandler;

import com.TehHaloTree.halotechmod.tile.TileEntityAdvancedPlateBender;

import com.TehHaloTree.halotechmod.worldgeneration.EventManager;

 

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.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

import cpw.mods.fml.relauncher.Side;

 

@Mod(modid = References.MODID, version = References.VERSION, name = References.NAME)

 

public class halotech {

 

@Instance(References.MODID)

public static halotech modInstance;

 

@EventHandler

public void prinit(FMLInitializationEvent event) {

if (event.getSide() == Side.CLIENT)

Minecraft.getMinecraft().refreshResources();

proxy.preInit();

 

}

 

@SidedProxy(clientSide = "com.TehHaloTree.halotechmod.proxy.ProxyClient", serverSide = "com.TehHaloTree.halotechmod.proxy.ProxyCommon")

public static ProxyCommon proxy;

 

public static final String modid = "HaloTech";

 

//CreativeTabs

public static CreativeTabs HaloTechCreativeTab = new CreativeTab(CreativeTabs.getNextID(), "HaloTech Mod");

 

//WorldGeneration

EventManager eventmanager = new EventManager();

 

//Recipes

 

//Blocks

//World Generation

public static Block EridiumOre;

public static Block CitrineOre;

public static Block RadiumOre;

public static Block FluoriteOre;

public static Block FluxOre;

public static Block DarkOre;

public static Block Element115Ore;

public static Block MysteriousOre;

 

public static int EridiumOreID;

public static int CitrineOreID;

public static int RadiumOreID;

public static int FluoriteOreID;

public static int FluxOreID;

public static int DarkOreID;

public static int Element115OreID;

public static int MysteriousOreID;

//Machines

public static Block AdvancedPlateBender;

public static int AdvancedPlateBenderID;

 

 

//Items

//Dusts

public static Item EridiumDust;

public static Item CitrineDust;

public static Item RadiumDust;

public static Item FluoriteDust;

public static Item FluxDust;

public static Item DarkDust;

public static Item Element115Dust;

public static Item MysteriousDust;

 

public static int EridiumDustID;

public static int CitrineDustID;

public static int RadiumDustID;

public static int FluoriteDustID;

public static int FluxDustID;

public static int DarkDustID;

public static int Element115DustID;

public static int MysteriousDustID;

//Ingots

public static Item EridiumIngot;

public static Item CitrineIngot;

public static Item RadiumIngot;

public static Item FluoriteIngot;

public static Item FluxIngot;

public static Item DarkIngot;

public static Item Element115Ingot;

public static Item MysteriousIngot;

 

public static int EridiumIngotID;

public static int CitrineIngotID;

public static int RadiumIngotID;

public static int FluoriteIngotID;

public static int FluxIngotID;

public static int DarkIngotID;

public static int Element115IngotID;

public static int MysteriousIngotID;

 

 

 

//Configuration

Configuration config = new Configuration(new File("config/HaloTech.cfg"));{

 

//Blocks

EridiumOreID = config.get("Blocks", "Eridium Ore", 500).getInt();

CitrineOreID = config.get("Blocks", "Citrine Ore", 501).getInt();

RadiumOreID = config.get("Blocks", "Radium Ore", 502).getInt();

FluoriteOreID = config.get("Blocks", "Fluorite Ore", 503).getInt();

FluxOreID = config.get("Blocks", "Flux Ore", 504).getInt();

DarkOreID = config.get("Blocks", "Dark Ore", 505).getInt();

Element115OreID = config.get("Blocks", "Element 115 Ore", 506).getInt();

MysteriousOreID = config.get("Blocks", "Mysterious Ore", 507).getInt();

 

//Machines

AdvancedPlateBenderID = config.get("Machines", "Advanced Plate Bender", 508).getInt();

 

//Items

EridiumDustID = config.get("Dusts", "Eridium Dust", 5000).getInt();

CitrineDustID = config.get("Dusts", "Citrine Dust", 5001).getInt();

RadiumDustID = config.get("Dusts", "Radium Dust", 5002).getInt();

FluoriteDustID = config.get("Dusts", "Fluorite Dust", 5003).getInt();

FluxDustID = config.get("Dusts", "Flux Dust", 5004).getInt();

DarkDustID = config.get("Dusts", "Dark Dust", 5005).getInt();

Element115DustID = config.get("Dusts", "Element 115 Dust", 5006).getInt();

MysteriousDustID = config.get("Dusts", "Mysterious Dust", 5007).getInt();

 

EridiumIngotID = config.get("Ingots", "Eridium Ingot", 5008).getInt();

CitrineIngotID = config.get("Ingots", "Citrine Ingot", 5009).getInt();

RadiumIngotID = config.get("Ingots", "Radium Ingot", 5010).getInt();

FluoriteIngotID = config.get("Ingots", "Fluorite Ingot", 5011).getInt();

FluxIngotID = config.get("Ingots", "Flux Ingot", 5012).getInt();

DarkIngotID = config.get("Ingots", "Dark Ingot", 5013).getInt();

Element115IngotID = config.get("Ingots", "Element 115 Ingot", 5014).getInt();

MysteriousIngotID = config.get("Ingots", "Mysterious Ingot", 5015).getInt();

 

config.save();

 

//World Generator

GameRegistry.registerWorldGenerator(eventmanager);

 

//Block Registry

//World Generation

//Ore~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

EridiumOre = new EridiumOre(EridiumOreID, Material.rock).setUnlocalizedName("EridiumOre");

GameRegistry.registerBlock(EridiumOre, modid+EridiumOre.getUnlocalizedName().substring(5));

LanguageRegistry.addName(EridiumOre, "Eridium Ore");

 

CitrineOre = new CitrineOre(CitrineOreID, Material.rock).setUnlocalizedName("CitrineOre");

GameRegistry.registerBlock(CitrineOre, modid+CitrineOre.getUnlocalizedName().substring(5));

LanguageRegistry.addName(CitrineOre, "Citrine Ore");

 

RadiumOre = new RadiumOre(RadiumOreID, Material.rock).setUnlocalizedName("RadiumOre");

GameRegistry.registerBlock(RadiumOre, modid+RadiumOre.getUnlocalizedName().substring(5));

LanguageRegistry.addName(RadiumOre, "Radium Ore");

 

FluoriteOre = new FluoriteOre(FluoriteOreID, Material.rock).setUnlocalizedName("FluoriteOre");

GameRegistry.registerBlock(FluoriteOre, modid+FluoriteOre.getUnlocalizedName().substring(5));

LanguageRegistry.addName(FluoriteOre,  "FluoriteOre");

 

FluxOre = new FluxOre(FluxOreID, Material.rock).setUnlocalizedName("FluxOre");

GameRegistry.registerBlock(FluxOre, modid+FluxOre.getUnlocalizedName().substring(5));

LanguageRegistry.addName(FluxOre, "Flux Ore");

 

DarkOre = new DarkOre(DarkOreID, Material.rock).setUnlocalizedName("DarkOre");

GameRegistry.registerBlock(DarkOre,  modid+DarkOre.getUnlocalizedName().substring(5));

LanguageRegistry.addName(DarkOre, "Dark Ore");

 

MysteriousOre = new MysteriousOre(MysteriousOreID, Material.rock).setUnlocalizedName("MysteriousOre");

GameRegistry.registerBlock(MysteriousOre, modid+MysteriousOre.getUnlocalizedName().substring(5));

LanguageRegistry.addName(MysteriousOre, "Mysterious Ore");

 

Element115Ore = new Element115Ore(Element115OreID, Material.rock).setUnlocalizedName("Element115Ore");

GameRegistry.registerBlock(Element115Ore, modid+Element115Ore.getUnlocalizedName().substring(5));

LanguageRegistry.addName(Element115Ore, "Element 115 Ore");

 

//Machine Registry~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

AdvancedPlateBender = new AdvancedPlateBender(AdvancedPlateBenderID, Material.iron).setUnlocalizedName("AdvancedPlateBender");

GameRegistry.registerBlock(AdvancedPlateBender, modid+AdvancedPlateBender.getUnlocalizedName().substring(5));

LanguageRegistry.addName(AdvancedPlateBender, "Advanced Plate Bender");

 

//Item Registry

//Dusts~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

EridiumDust = new EridiumDust(EridiumOreID).setUnlocalizedName("EridiumDust");

GameRegistry.registerItem(EridiumDust, modid+EridiumDust.getUnlocalizedName().substring(5));

LanguageRegistry.addName(EridiumDust, "Eridium Dust");

 

CitrineDust = new CitrineDust(CitrineDustID).setUnlocalizedName("CitrineDust");

GameRegistry.registerItem(CitrineDust, modid+CitrineDust.getUnlocalizedName().substring(5));

LanguageRegistry.addName(CitrineDust, "Citrine Dust");

 

RadiumDust = new RadiumDust(RadiumDustID).setUnlocalizedName("RadiumDust");

GameRegistry.registerItem(RadiumDust, modid+RadiumDust.getUnlocalizedName().substring(5));

LanguageRegistry.addName(RadiumDust, "Radium Dust");

 

FluoriteDust = new FluoriteDust(FluoriteDustID).setUnlocalizedName("FluoriteDust");

GameRegistry.registerItem(FluoriteDust, modid+FluoriteDust.getUnlocalizedName().substring(5));

LanguageRegistry.addName(FluoriteDust, "Fluorite Dust");

 

Element115Dust = new Element115Dust(Element115DustID).setUnlocalizedName("Element115Dust");

GameRegistry.registerItem(Element115Dust, modid+Element115Dust.getUnlocalizedName().substring(5));

LanguageRegistry.addName(Element115Dust, "Element115 Dust");

 

MysteriousDust = new MysteriousDust(MysteriousDustID).setUnlocalizedName("MysteriousDust");

GameRegistry.registerItem(MysteriousDust, modid+MysteriousDust.getUnlocalizedName().substring(5));

LanguageRegistry.addName(MysteriousDust, "Mysterious Dust");

 

DarkDust = new DarkDust(DarkDustID).setUnlocalizedName("DarkDust");

GameRegistry.registerItem(DarkDust, modid+DarkDust.getUnlocalizedName().substring(5));

LanguageRegistry.addName(DarkDust, "Dark Dust");

 

FluxDust = new FluxDust(FluxDustID).setUnlocalizedName("FluxDust");

GameRegistry.registerItem(FluxDust, modid+FluxDust.getUnlocalizedName().substring(5));

LanguageRegistry.addName(FluxDust, "Flux Dust");

//Ingots~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

FluxIngot = new FluxIngot(FluxIngotID).setUnlocalizedName("FluxIngot");

GameRegistry.registerItem(FluxIngot, modid+FluxIngot.getUnlocalizedName().substring(5));

LanguageRegistry.addName(FluxIngot, "Flux Ingot");

 

CitrineIngot = new CitrineIngot(CitrineIngotID).setUnlocalizedName("CitrineIngot");

GameRegistry.registerItem(CitrineIngot, modid+CitrineIngot.getUnlocalizedName().substring(5));

LanguageRegistry.addName(CitrineIngot, "Citrine Ingot");

 

RadiumIngot = new RadiumIngot(RadiumIngotID).setUnlocalizedName("RadiumIngot");

GameRegistry.registerItem(RadiumIngot, modid+RadiumIngot.getUnlocalizedName().substring(5));

LanguageRegistry.addName(RadiumIngot, "Radium Ingot");

 

FluoriteIngot = new FluoriteIngot(FluoriteIngotID).setUnlocalizedName("FluoriteIngot");

GameRegistry.registerItem(FluoriteIngot, modid+FluoriteIngot.getUnlocalizedName().substring(5));

LanguageRegistry.addName(FluoriteIngot, "Fluorite Ingot");

 

Element115Ingot = new Element115Ingot(Element115IngotID).setUnlocalizedName("Element115Ingot");

GameRegistry.registerItem(Element115Ingot, modid+Element115Ingot.getUnlocalizedName().substring(5));

LanguageRegistry.addName(Element115Ingot, "Element 115 Ingot");

 

MysteriousIngot = new MysteriousIngot(MysteriousIngotID).setUnlocalizedName("MysteriousIngot");

GameRegistry.registerItem(MysteriousIngot, modid+MysteriousIngot.getUnlocalizedName().substring(5));

LanguageRegistry.addName(MysteriousIngot, "Mysterious Ingot");

 

DarkIngot = new DarkIngot(DarkIngotID).setUnlocalizedName("DarkIngot");

GameRegistry.registerItem(DarkIngot, modid+DarkIngot.getUnlocalizedName().substring(5));

LanguageRegistry.addName(DarkIngot, "Dark Ingot");

 

EridiumIngot = new EridiumIngot(EridiumIngotID).setUnlocalizedName("EridiumIngot");

GameRegistry.registerItem(EridiumIngot, modid+EridiumIngot.getUnlocalizedName().substring(5));

LanguageRegistry.addName(EridiumIngot, "Eridium Ingot");

//Tile Entities~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GameRegistry.registerTileEntity(TileEntityAdvancedPlateBender.class, "AdvancedPlateBenderTileEntity");

//Item Calling~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ItemStack iridiumPlate = Items.getItem("iridiumPlate");

ItemStack lapotronCrystal = Items.getItem("lapotronCrystal");

ArrayList<ItemStack> gearElectrum = OreDictionary.getOres("gearElectrum");

ArrayList<ItemStack> circuitElite = OreDictionary.getOres("circuitElite");

ArrayList<ItemStack> bender = OreDictionary.getOres("bender");

}

 

@EventHandler

public void load(FMLInitializationEvent event){

proxy.load();

 

CraftingHandler.init();

 

//Recipes~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GameRegistry.addRecipe(new ItemStack(halotech.AdvancedPlateBender, 1), "zaz","yxy","zbz", 'y', Items.getItem("iridiumPlate"), 'z', OreDictionary.getOres("gearElectrum"), 'x', OreDictionary.getOres("bender"), 'a', Items.getItem("lapotronCrystal"), 'b', OreDictionary.getOres("circuitElite"));

GameRegistry.addRecipe(new ItemStack(halotech.AdvancedPlateBender, 1), "zzz", "zzz", "zzz", 'z', new ItemStack(Item.coal, 1));

 

 

}}

 

 

 

Sorry if I'm not understanding something, this is the first time I am using a recipe that uses items from separate mods. Thanks again,

~TehHaloTree

Posted

Hi

 

I'm having trouble following the formatting in your mod class so I'm not sure whether your initialisation is happening in a static initialiser.  But anyway it shouldn't.

 

This is not right, it should be FMLPreInitializationEvent for the preinit.

   @EventHandler
   public void prinit(FMLInitializationEvent event) {

 

You need to split your initialisation up into

 

FMLPreInitializationEvent:

Register all your blocks

 

FMLInitializationEvent:

Register your recipes

 

Currently your code doesn't do that, which I think is why it doesn't work.  I reckon the crash is almost certainly caused by your halotech.AdvancedPlateBender not being initialised before you add the Recipe.

 

-TGG

 

 

Posted

I changed the preinit to FMLPreInitializationEvent and it still crashes with the same crash. I examined it a little more, and I think the things throwing the NullPointerExceptio are the items being called from the other mods. I do not know if I called them correctly, if they need to be moved to a different section of code, or if they aren't being place into the recipe code correctly. Thanks,

~TehHaloTree

 

EDIT: Moved recipes into the CraftHandler.java class, no difference. Here's the class:

 

package com.TehHaloTree.halotechmod.recipes;

 

import java.util.ArrayList;

 

import ic2.api.item.Items;

import ic2.api.recipe.RecipeInputItemStack;

import ic2.api.recipe.Recipes;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.item.crafting.CraftingManager;

import net.minecraftforge.oredict.OreDictionary;

 

import com.TehHaloTree.halotechmod.halotech;

import com.TehHaloTree.halotechmod.items.CitrineDust;

import com.TehHaloTree.halotechmod.items.DarkDust;

import com.TehHaloTree.halotechmod.items.Element115Dust;

import com.TehHaloTree.halotechmod.items.EridiumDust;

import com.TehHaloTree.halotechmod.items.FluoriteDust;

import com.TehHaloTree.halotechmod.items.FluxDust;

import com.TehHaloTree.halotechmod.items.MysteriousDust;

import com.TehHaloTree.halotechmod.items.RadiumDust;

 

import cpw.mods.fml.common.registry.GameRegistry;

 

public class CraftingHandler {

 

public static void init()

{

registerRecipes();

}

 

private static void registerRecipes()

{

//Shaped

GameRegistry.addRecipe(new ItemStack(halotech.AdvancedPlateBender, 1), "zaz","yxy","zbz", 'y', Items.getItem("iridiumPlate"), 'z', OreDictionary.getOres("gearElectrum"), 'x', OreDictionary.getOres("bender"), 'a', Items.getItem("lapotronCrystal"), 'b', OreDictionary.getOres("circuitElite"));

GameRegistry.addRecipe(new ItemStack(halotech.AdvancedPlateBender, 1), "zzz", "zzz", "zzz", 'z', new ItemStack(Item.coal, 1));

//Smelting

GameRegistry.addSmelting(halotech.CitrineDustID, new ItemStack(halotech.CitrineIngot, 1), 0.5F);

GameRegistry.addSmelting(halotech.RadiumDustID, new ItemStack(halotech.RadiumIngot, 1), 0.5F);

GameRegistry.addSmelting(halotech.Element115DustID, new ItemStack(halotech.Element115Ingot, 1), 0.5F);

GameRegistry.addSmelting(halotech.EridiumDustID, new ItemStack(halotech.EridiumIngot, 1), 0.5F);

GameRegistry.addSmelting(halotech.FluoriteDustID, new ItemStack(halotech.FluoriteIngot, 1), 0.5F);

GameRegistry.addSmelting(halotech.DarkDustID, new ItemStack(halotech.DarkIngot, 1), 0.5F);

GameRegistry.addSmelting(halotech.FluxDustID, new ItemStack(halotech.FluxIngot, 1), 0.5F);

GameRegistry.addSmelting(halotech.MysteriousDustID, new ItemStack(halotech.MysteriousIngot, 1), 0.5F);

//Macerator

Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(halotech.CitrineOre)), null, new ItemStack(halotech.CitrineDust, 2));

Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(halotech.RadiumOre)), null, new ItemStack(halotech.RadiumDust, 2));

Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(halotech.MysteriousOre)), null, new ItemStack(halotech.MysteriousDust, 2));

Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(halotech.EridiumOre)), null, new ItemStack(halotech.EridiumDust, 2));

Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(halotech.FluoriteOre)), null, new ItemStack(halotech.FluoriteDust, 2));

Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(halotech.FluxOre)), null, new ItemStack(halotech.FluxDust, 2));

Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(halotech.DarkOre)), null, new ItemStack(halotech.DarkDust, 2));

Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(halotech.Element115Ore)), null, new ItemStack(halotech.Element115Dust, 2));

}

}

 

Posted

Hi

 

Try splitting this line into several so you can see exactly which one is null

 

     GameRegistry.addRecipe(new ItemStack(halotech.AdvancedPlateBender, 1), "zaz","yxy","zbz", 'y', Items.getItem("iridiumPlate"), 'z', OreDictionary.getOres("gearElectrum"), 'x', OreDictionary.getOres("bender"), 'a', Items.getItem("lapotronCrystal"), 'b', OreDictionary.getOres("circuitElite"));

eg

ItemStack apb = new ItemStack(halotech.AdvancedPlateBender, 1);
System.out.println("apb:" + apb);
Item iridiumPlate = Items.getItem("iridiumPlate");
// ..etc..

 

You might find that one of them is null, for example if you have misspelled the name.

 

-TGG

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
    • Okay, but does the modpack works with 1.12 or just with 1.12.2, because I need the Forge client specifically for Minecraft 1.12, not 1.12.2
    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
  • Topics

×
×
  • Create New...

Important Information

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