Jump to content

[SOLVED] [1.7.10] Problem when adding shapeless crafting recipe


The VoxL

Recommended Posts

Hello,

I have a problem with making my own mod. I don't know alot about Java/Modding but i have followed a tutorial yet the game crashes when trying to craft my one Item created.

 

Crash:

 

---- Minecraft Crash Report ----

// Hi. I'm Minecraft, and I'm a crashaholic.

 

Time: 4/13/16 4:42 PM

Description: Rendering item

 

java.lang.NullPointerException: Rendering item

at net.minecraft.item.ItemStack.getItemDamage(ItemStack.java:265)

at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:419)

at net.minecraft.client.renderer.entity.RenderItem.renderItemAndEffectIntoGUI(RenderItem.java:585)

at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:289)

at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:114)

at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1137)

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067)

at net.minecraft.client.Minecraft.run(Minecraft.java:962)

at net.minecraft.client.main.Main.main(Main.java:164)

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:135)

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

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

at GradleStart.main(Unknown Source)

 

 

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

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

 

-- Head --

Stacktrace:

at net.minecraft.item.ItemStack.getItemDamage(ItemStack.java:265)

at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:419)

 

-- Item being rendered --

Details:

Item Type: null

Item Aux: ~~ERROR~~ NullPointerException: null

Item NBT: null

Item Foil: ~~ERROR~~ NullPointerException: null

Stacktrace:

at net.minecraft.client.renderer.entity.RenderItem.renderItemAndEffectIntoGUI(RenderItem.java:585)

at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:289)

at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:114)

 

-- Screen render details --

Details:

Screen name: net.minecraft.client.gui.inventory.GuiCrafting

Mouse location: Scaled: (172, 93). Absolute: (345, 293)

Screen size: Scaled: (427, 240). Absolute: (854, 480). Scale factor of 2

 

-- Affected level --

Details:

Level name: MpServer

All players: 1 total; [EntityClientPlayerMP['Player406'/278, l='MpServer', x=-421.73, y=5.62, z=428.21]]

Chunk stats: MultiplayerChunkCache: 620, 620

Level seed: 0

Level generator: ID 01 - flat, ver 0. Features enabled: false

Level generator options:

Level spawn location: World: (-426,4,430), Chunk: (at 6,0,14 in -27,26; contains blocks -432,0,416 to -417,255,431), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)

Level time: 5275 game time, 5275 day time

Level dimension: 0

Level storage version: 0x00000 - Unknown?

Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)

Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false

Forced entities: 148 total; [EntitySheep['Sheep'/19, l='MpServer', x=-497.31, y=4.00, z=366.16], EntityPig['Pig'/20, l='MpServer', x=-501.44, y=4.00, z=365.13], EntityClientPlayerMP['Player406'/278, l='MpServer', x=-421.73, y=5.62, z=428.21], EntityHorse['Horse'/25, l='MpServer', x=-497.38, y=4.00, z=389.91], EntityCow['Cow'/26, l='MpServer', x=-501.16, y=4.00, z=388.16], EntitySheep['Sheep'/27, l='MpServer', x=-498.50, y=4.00, z=461.47], EntityPig['Pig'/28, l='MpServer', x=-498.47, y=4.00, z=491.03], EntityChicken['Chicken'/29, l='MpServer', x=-491.59, y=4.00, z=494.44], EntitySheep['Sheep'/30, l='MpServer', x=-499.69, y=4.00, z=489.31], EntityChicken['Chicken'/32, l='MpServer', x=-494.56, y=4.00, z=507.44], EntityChicken['Chicken'/33, l='MpServer', x=-499.59, y=4.00, z=498.59], EntitySlime['Slime'/46889, l='MpServer', x=-463.39, y=4.82, z=448.36], EntityPig['Pig'/50, l='MpServer', x=-482.13, y=4.00, z=355.66], EntitySlime['Slime'/49202, l='MpServer', x=-367.36, y=4.99, z=475.54], EntityCow['Cow'/51, l='MpServer', x=-491.81, y=4.00, z=362.84], EntityCow['Cow'/52, l='MpServer', x=-488.88, y=4.00, z=372.88], EntityCow['Cow'/53, l='MpServer', x=-484.22, y=4.00, z=373.88], EntityCow['Cow'/54, l='MpServer', x=-490.94, y=4.00, z=374.31], EntityPig['Pig'/55, l='MpServer', x=-494.19, y=4.00, z=389.78], EntityHorse['Horse'/56, l='MpServer', x=-485.53, y=4.00, z=395.00], EntityHorse['Horse'/57, l='MpServer', x=-481.88, y=4.00, z=391.56], EntitySheep['Sheep'/58, l='MpServer', x=-482.88, y=4.00, z=394.97], EntitySlime['Slime'/59, l='MpServer', x=-480.16, y=4.81, z=387.53], EntitySheep['Sheep'/60, l='MpServer', x=-485.31, y=4.00, z=477.97], EntityCow['Cow'/61, l='MpServer', x=-480.63, y=4.00, z=473.59], EntityChicken['Chicken'/63, l='MpServer', x=-481.44, y=4.00, z=475.56], EntityChicken['Chicken'/64, l='MpServer', x=-492.19, y=4.00, z=491.22], EntityChicken['Chicken'/65, l='MpServer', x=-490.09, y=4.00, z=495.16], EntityCow['Cow'/66, l='MpServer', x=-487.47, y=4.00, z=486.81], EntityChicken['Chicken'/67, l='MpServer', x=-492.22, y=4.00, z=495.19], EntityPig['Pig'/68, l='MpServer', x=-490.69, y=4.00, z=484.16], EntityChicken['Chicken'/70, l='MpServer', x=-489.56, y=4.00, z=508.44], EntityPig['Pig'/71, l='MpServer', x=-480.81, y=4.00, z=508.91], EntitySheep['Sheep'/72, l='MpServer', x=-488.22, y=4.00, z=497.44], EntitySlime['Slime'/63560, l='MpServer', x=-364.22, y=4.00, z=492.32], EntityPig['Pig'/74, l='MpServer', x=-494.84, y=4.00, z=499.16], EntityPig['Pig'/88, l='MpServer', x=-469.75, y=4.00, z=350.13], EntityPig['Pig'/90, l='MpServer', x=-471.66, y=4.00, z=360.91], EntityPig['Pig'/91, l='MpServer', x=-478.16, y=4.00, z=365.13], EntityPig['Pig'/92, l='MpServer', x=-471.16, y=4.00, z=358.72], EntityChicken['Chicken'/93, l='MpServer', x=-479.44, y=4.00, z=352.34], EntityCow['Cow'/94, l='MpServer', x=-475.34, y=4.00, z=378.13], EntityCow['Cow'/95, l='MpServer', x=-467.19, y=4.00, z=372.25], EntityCow['Cow'/96, l='MpServer', x=-470.75, y=4.00, z=366.22], EntityPig['Pig'/97, l='MpServer', x=-478.06, y=4.00, z=371.16], EntityPig['Pig'/98, l='MpServer', x=-472.72, y=4.00, z=359.09], EntitySlime['Slime'/99, l='MpServer', x=-481.70, y=4.00, z=413.60], EntitySheep['Sheep'/100, l='MpServer', x=-468.84, y=4.00, z=460.06], EntitySheep['Sheep'/101, l='MpServer', x=-480.66, y=4.00, z=448.94], EntitySlime['Slime'/102, l='MpServer', x=-485.62, y=4.47, z=433.59], EntitySlime['Slime'/103, l='MpServer', x=-475.09, y=4.00, z=459.57], EntitySlime['Slime'/104, l='MpServer', x=-486.60, y=4.00, z=471.09], EntitySlime['Slime'/105, l='MpServer', x=-473.70, y=4.61, z=456.78], EntityChicken['Chicken'/106, l='MpServer', x=-477.41, y=4.00, z=477.22], EntityCow['Cow'/107, l='MpServer', x=-458.09, y=4.00, z=480.97], EntitySheep['Sheep'/108, l='MpServer', x=-470.88, y=4.00, z=474.16], EntitySlime['Slime'/109, l='MpServer', x=-490.19, y=4.18, z=470.27], EntityHorse['Donkey'/110, l='MpServer', x=-473.75, y=4.00, z=493.91], EntityCow['Cow'/111, l='MpServer', x=-469.53, y=4.00, z=486.25], EntitySlime['Slime'/85105, l='MpServer', x=-364.69, y=4.69, z=349.46], EntitySlime['Slime'/65911, l='MpServer', x=-463.30, y=5.06, z=504.46], EntityChicken['Chicken'/128, l='MpServer', x=-462.13, y=4.00, z=366.28], EntityPig['Pig'/129, l='MpServer', x=-460.88, y=4.00, z=377.03], EntitySlime['Slime'/130, l='MpServer', x=-463.06, y=4.81, z=361.88], EntitySlime['Slime'/131, l='MpServer', x=-434.96, y=4.00, z=375.41], EntitySlime['Slime'/132, l='MpServer', x=-460.06, y=4.99, z=411.05], EntitySlime['Slime'/133, l='MpServer', x=-444.67, y=4.00, z=417.85], EntitySlime['Slime'/134, l='MpServer', x=-454.06, y=4.00, z=457.94], EntityPig['Pig'/137, l='MpServer', x=-444.97, y=4.00, z=378.19], EntityChicken['Chicken'/138, l='MpServer', x=-433.44, y=4.00, z=386.44], EntitySlime['Slime'/139, l='MpServer', x=-445.30, y=4.00, z=397.66], EntitySlime['Slime'/140, l='MpServer', x=-424.34, y=4.00, z=399.31], EntitySlime['Slime'/2193, l='MpServer', x=-449.03, y=4.00, z=461.51], EntitySheep['Sheep'/148, l='MpServer', x=-422.81, y=4.00, z=364.09], EntityChicken['Chicken'/149, l='MpServer', x=-418.56, y=4.00, z=372.56], EntityPig['Pig'/150, l='MpServer', x=-417.91, y=4.00, z=376.50], EntityPig['Pig'/151, l='MpServer', x=-426.13, y=4.00, z=377.31], EntitySheep['Sheep'/152, l='MpServer', x=-411.91, y=4.00, z=387.03], EntityChicken['Chicken'/153, l='MpServer', x=-429.56, y=4.00, z=387.53], EntityPig['Pig'/155, l='MpServer', x=-413.03, y=4.00, z=383.97], EntitySheep['Sheep'/156, l='MpServer', x=-409.59, y=4.00, z=377.69], EntitySheep['Sheep'/157, l='MpServer', x=-403.69, y=4.00, z=390.84], EntitySlime['Slime'/158, l='MpServer', x=-392.29, y=4.96, z=436.11], EntitySlime['Slime'/159, l='MpServer', x=-403.54, y=4.00, z=425.79], EntitySlime['Slime'/160, l='MpServer', x=-415.97, y=4.00, z=424.84], EntitySheep['Sheep'/161, l='MpServer', x=-417.88, y=4.00, z=488.75], EntitySlime['Slime'/162, l='MpServer', x=-415.86, y=4.81, z=493.65], EntityHorse['Horse'/163, l='MpServer', x=-413.75, y=4.00, z=499.34], EntityHorse['Horse'/164, l='MpServer', x=-403.87, y=4.00, z=506.69], EntityHorse['Horse'/165, l='MpServer', x=-405.94, y=4.00, z=503.50], EntitySlime['Slime'/166, l='MpServer', x=-410.99, y=4.00, z=493.06], EntityChicken['Chicken'/169, l='MpServer', x=-389.59, y=4.00, z=374.47], EntityPig['Pig'/170, l='MpServer', x=-383.94, y=4.00, z=391.59], EntitySlime['Slime'/171, l='MpServer', x=-382.74, y=4.00, z=376.25], EntitySlime['Slime'/172, l='MpServer', x=-386.35, y=4.00, z=380.69], EntitySheep['Sheep'/173, l='MpServer', x=-387.38, y=4.00, z=402.84], EntityPig['Pig'/174, l='MpServer', x=-388.94, y=4.00, z=405.03], EntityHorse['Horse'/175, l='MpServer', x=-396.13, y=4.00, z=494.22], EntityHorse['Horse'/176, l='MpServer', x=-397.00, y=4.00, z=497.88], EntityHorse['Horse'/177, l='MpServer', x=-392.00, y=4.00, z=506.84], EntitySheep['Sheep'/178, l='MpServer', x=-396.03, y=4.00, z=507.97], EntitySlime['Slime'/67507, l='MpServer', x=-397.03, y=4.00, z=350.72], EntitySheep['Sheep'/180, l='MpServer', x=-393.50, y=4.00, z=503.59], EntityHorse['Horse'/181, l='MpServer', x=-397.09, y=4.00, z=506.16], EntitySheep['Sheep'/182, l='MpServer', x=-389.19, y=4.00, z=498.84], EntitySlime['Slime'/186, l='MpServer', x=-384.84, y=4.81, z=356.82], EntitySheep['Sheep'/187, l='MpServer', x=-378.81, y=4.00, z=360.41], EntitySheep['Sheep'/188, l='MpServer', x=-372.66, y=4.00, z=354.72], EntitySheep['Sheep'/190, l='MpServer', x=-388.13, y=4.00, z=378.56], EntityPig['Pig'/191, l='MpServer', x=-372.97, y=4.00, z=396.88], EntitySheep['Sheep'/192, l='MpServer', x=-380.75, y=4.00, z=390.34], EntityPig['Pig'/193, l='MpServer', x=-380.91, y=4.00, z=396.38], EntitySheep['Sheep'/194, l='MpServer', x=-382.66, y=4.00, z=413.19], EntitySheep['Sheep'/195, l='MpServer', x=-380.19, y=4.00, z=423.88], EntityPig['Pig'/196, l='MpServer', x=-368.06, y=4.00, z=431.97], EntityPig['Pig'/197, l='MpServer', x=-370.19, y=4.00, z=419.47], EntitySheep['Sheep'/198, l='MpServer', x=-374.88, y=4.00, z=432.72], EntityPig['Pig'/199, l='MpServer', x=-368.94, y=4.00, z=435.25], EntityPig['Pig'/200, l='MpServer', x=-370.91, y=4.00, z=451.66], EntitySlime['Slime'/201, l='MpServer', x=-365.15, y=4.95, z=442.63], EntityCow['Cow'/202, l='MpServer', x=-371.09, y=4.00, z=484.19], EntitySlime['Slime'/203, l='MpServer', x=-393.35, y=4.00, z=482.53], EntityHorse['Horse'/204, l='MpServer', x=-381.97, y=4.00, z=498.44], EntityHorse['Horse'/205, l='MpServer', x=-373.66, y=4.00, z=506.16], EntityCow['Cow'/206, l='MpServer', x=-374.81, y=4.00, z=499.78], EntityHorse['Horse'/217, l='MpServer', x=-355.34, y=4.00, z=349.63], EntitySheep['Sheep'/219, l='MpServer', x=-353.53, y=4.00, z=356.69], EntitySlime['Slime'/220, l='MpServer', x=-343.29, y=4.96, z=365.79], EntityPig['Pig'/221, l='MpServer', x=-356.13, y=4.00, z=357.16], EntitySlime['Slime'/222, l='MpServer', x=-340.99, y=4.00, z=385.97], EntitySheep['Sheep'/223, l='MpServer', x=-363.91, y=4.00, z=399.09], EntitySlime['Slime'/224, l='MpServer', x=-345.37, y=4.61, z=408.17], EntitySheep['Sheep'/225, l='MpServer', x=-353.16, y=4.00, z=445.84], EntitySheep['Sheep'/226, l='MpServer', x=-364.34, y=4.00, z=436.25], EntitySheep['Sheep'/227, l='MpServer', x=-359.75, y=4.00, z=443.63], EntityPig['Pig'/228, l='MpServer', x=-352.94, y=4.00, z=453.09], EntitySlime['Slime'/229, l='MpServer', x=-380.51, y=4.81, z=471.06], EntitySlime['Slime'/230, l='MpServer', x=-348.44, y=4.00, z=476.56], EntitySlime['Slime'/231, l='MpServer', x=-362.50, y=4.14, z=482.94], EntityCow['Cow'/232, l='MpServer', x=-358.31, y=4.00, z=507.69], EntitySheep['Sheep'/233, l='MpServer', x=-366.38, y=4.00, z=499.78], EntitySlime['Slime'/30959, l='MpServer', x=-381.00, y=4.00, z=507.49], EntityItem['item.item.redstone'/59891, l='MpServer', x=-423.56, y=4.13, z=428.75], EntityPig['Pig'/250, l='MpServer', x=-345.22, y=4.00, z=356.63], EntitySheep['Sheep'/251, l='MpServer', x=-348.56, y=4.00, z=400.19], EntityPig['Pig'/253, l='MpServer', x=-343.97, y=4.00, z=447.94], EntityPig['Pig'/254, l='MpServer', x=-350.44, y=4.00, z=443.88], EntitySlime['Slime'/255, l='MpServer', x=-341.80, y=4.00, z=494.24]]

Retry entities: 0 total; []

Server brand: fml,forge

Server type: Integrated singleplayer server

Stacktrace:

at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)

at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2566)

at net.minecraft.client.Minecraft.run(Minecraft.java:984)

at net.minecraft.client.main.Main.main(Main.java:164)

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:135)

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

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

at GradleStart.main(Unknown Source)

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 8.1 (amd64) version 6.3

Java Version: 1.8.0_31, Oracle Corporation

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

Memory: 877028864 bytes (836 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

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

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

FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1558 4 mods loaded, 4 mods active

States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)

UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)

UCHIJAAAA Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)

UCHIJAAAA mechanika{a.0.1} [Mechanika] (bin)

GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 358.91' Renderer: 'GeForce GTX 960/PCIe/SSE2'

Launched Version: 1.7.10

LWJGL: 2.9.1

OpenGL: GeForce GTX 960/PCIe/SSE2 GL version 4.5.0 NVIDIA 358.91, NVIDIA Corporation

GL Caps: Using GL 1.3 multitexturing.

Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.

Anisotropic filtering is supported and maximum anisotropy is 16.

Shaders are available because OpenGL 2.1 is supported.

 

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

Type: Client (map_client.txt)

Resource Packs: []

Current Language: English (US)

Profiler Position: N/A (disabled)

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

Anisotropic Filtering: Off (1)

 

 

Main.class:

 

package com.The_VoxL.mechanika;

 

import com.The_VoxL.mechanika.Item.ironCircuit;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

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.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

 

@Mod(modid=Reference.MODID, name=Reference.MODNAME, version=Reference.MODVER)

public class Main

{

 

public static ItemStack ingotIron = new ItemStack(Items.iron_ingot);

public static ItemStack dustRedstone = new ItemStack(Items.redstone);

public static ItemStack circuitIron = new ItemStack(ironCircuit.circuitIron);

 

@EventHandler

public void preLoad(FMLPreInitializationEvent event)

{

ironCircuit.init();

}

 

@EventHandler

public void load(FMLInitializationEvent event)

{

ironCircuit.recipe();

}

 

@EventHandler

public void postInit(FMLPostInitializationEvent event)

{

 

}

 

public static CreativeTabs tabMechanika = new CreativeTabs("tabMechanika")

{

@Override

@SideOnly(Side.CLIENT)

public Item getTabIconItem()

{

ItemStack tabStack = new ItemStack(ironCircuit.circuitIron);

return tabStack.getItem();

}

 

};

 

}

 

 

 

ironCircuit.class:

 

package com.The_VoxL.mechanika.Item;

 

import com.The_VoxL.mechanika.Main;

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

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

 

public class ironCircuit extends Item

{

 

 

 

public static Item circuitIron;

 

public static void init()

{

circuitIron = new ironCircuit()

.setMaxStackSize(64)

.setUnlocalizedName("ironCircuit")

.setCreativeTab(Main.tabMechanika);

GameRegistry.registerItem(circuitIron, "circuitIron");

}

 

public static void recipe()

{

 

GameRegistry.addShapelessRecipe(Main.circuitIron, 

Main.ingotIron,

Main.dustRedstone);

}

 

}

 

 

 

please help if you can

Link to comment
Share on other sites

No, he's saying that you should call your ironCircuit.init() in your load() function (which would usually be called init()). By way of naming conventions, in Java, you're supposed to name classes with Capital letters, so ironCircuit.class should be IronCircuit.class that way it's easier to differentiate between say a variable called ironCircuit and a class called IronCircuit. It makes it a lot easier for other people to read your code if you follow the convention and makes it less confusing for you.

- Just because things are the way they are doesn't mean they can't be the way you want them to be. Unless they're aspen trees. You can tell they're aspens 'cause the way they are.

Link to comment
Share on other sites

Still doesnt work! :/

 

Main.class now:

 

package com.The_VoxL.mechanika;

 

import com.The_VoxL.mechanika.Item.ironCircuit;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

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.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

 

@Mod(modid=Reference.MODID, name=Reference.MODNAME, version=Reference.MODVER)

public class Main

{

 

public static ItemStack ingotIron = new ItemStack(Items.iron_ingot);

public static ItemStack dustRedstone = new ItemStack(Items.redstone);

public static ItemStack circuitIron = new ItemStack(ironCircuit.circuitIron);

 

@EventHandler

public void preInit(FMLPreInitializationEvent event)

{

 

}

 

@EventHandler

public void init(FMLInitializationEvent event)

{

ironCircuit.init();

}

 

@EventHandler

public void postInit(FMLPostInitializationEvent event)

{

ironCircuit.recipe();

}

 

public static CreativeTabs tabMechanika = new CreativeTabs("tabMechanika")

{

@Override

@SideOnly(Side.CLIENT)

public Item getTabIconItem()

{

ItemStack tabStack = new ItemStack(ironCircuit.circuitIron);

return tabStack.getItem();

}

 

};

 

}

 

 

Link to comment
Share on other sites

You are creating itemstacks at class-instantiaion, before your items have been created and registered. Those stacks are stacks of null and cannot be rendered or used in recipes.

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.

Link to comment
Share on other sites

okay, i think I understand that but where should i put them then? when i try to put e.g. "public static ItemStack ingotIron = new ItemStack(Items.iron_ingot);" into public void stacks() it says "Illegal modifier for parameter ingotIron; only final is permitted"

Link to comment
Share on other sites

okay, i think I understand that but where should i put them then? when i try to put e.g. "public static ItemStack ingotIron = new ItemStack(Items.iron_ingot);" into public void stacks() it says "Illegal modifier for parameter ingotIron; only final is permitted"

 

You're trying to declare a class variable in a location that only local variables are allowed.

 

Go learn Java programming.

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.

Link to comment
Share on other sites

I did, I was still wanting to inform you what you were doing wrong.

 

Also, read my sig, thanks. :)

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.

Link to comment
Share on other sites

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

    • They were already updated, and just to double check I even did a cleanup and fresh update from that same page. I'm quite sure drivers are not the problem here. 
    • i tried downloading the drivers but it says no AMD graphics hardware has been detected    
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
  • Topics

×
×
  • Create New...

Important Information

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