Jump to content

Please Help Me


Cerandior

Recommended Posts

Hello everyone

So i am trying to make my own custom Crafting Table to craft some special items in my mod.

The thing is i am having problems in the *public boolean onBlockActivated*

I am pretty sure that i have registered the GUIHandler into the main registry class file and i am also sure that the GUIHandler is not registered in a constructor.Eclipse got no errors and running minecraft is no problem too. But when i right click the custom Crafting Table the game crashes with this report:

---- Minecraft Crash Report ----
// Shall we play a game?

Time: 15-04-18 2.22.MD
Description: Unexpected error

java.lang.NullPointerException: Unexpected error
at cpw.mods.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:265)
at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:93)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2209)
at com.Cerandior.blocks.WorkSurface.onBlockActivated(WorkSurface.java:44)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:326)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1435)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1941)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:961)
at net.minecraft.client.Minecraft.run(Minecraft.java:887)
at net.minecraft.client.main.Main.main(SourceFile:148)
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 cpw.mods.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:265)
at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:93)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2209)
at com.Cerandior.blocks.WorkSurface.onBlockActivated(WorkSurface.java:44)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:326)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1435)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player965'/422, l='MpServer', x=-233,30, y=73,62, z=238,16]]
Chunk stats: MultiplayerChunkCache: 289, 289
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: World: (-232,64,244), Chunk: (at 8,4,4 in -15,15; contains blocks -240,0,240 to -225,255,255), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Level time: 1707 game time, 1707 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: 146 total; [EntityPig['Pig'/256, l='MpServer', x=-153,69, y=64,00, z=186,03], EntityZombie['Zombie'/258, l='MpServer', x=-153,25, y=23,00, z=246,63], EntitySheep['Sheep'/259, l='MpServer', x=-157,31, y=103,00, z=240,53], EntitySheep['Sheep'/260, l='MpServer', x=-158,34, y=107,00, z=244,81], EntitySheep['Sheep'/261, l='MpServer', x=-156,09, y=103,00, z=240,47], EntityCreeper['Creeper'/263, l='MpServer', x=-158,47, y=55,00, z=284,03], EntityZombie['Zombie'/18, l='MpServer', x=-305,53, y=40,00, z=175,97], EntityCreeper['Creeper'/19, l='MpServer', x=-311,50, y=19,00, z=182,50], EntityCreeper['Creeper'/22, l='MpServer', x=-307,35, y=17,83, z=173,33], EntityChicken['Chicken'/25, l='MpServer', x=-307,63, y=64,00, z=189,53], EntityPig['Pig'/27, l='MpServer', x=-309,44, y=63,00, z=199,59], EntityPig['Pig'/28, l='MpServer', x=-308,19, y=64,00, z=192,59], EntityZombie['Zombie'/42, l='MpServer', x=-297,44, y=41,00, z=170,56], EntitySkeleton['Skeleton'/43, l='MpServer', x=-298,91, y=42,00, z=170,59], EntityBat['Bat'/44, l='MpServer', x=-296,13, y=14,97, z=183,66], EntityBat['Bat'/45, l='MpServer', x=-299,25, y=23,10, z=187,25], EntitySquid['Squid'/46, l='MpServer', x=-296,50, y=52,34, z=217,50], EntitySquid['Squid'/47, l='MpServer', x=-290,72, y=54,38, z=220,44], EntitySquid['Squid'/48, l='MpServer', x=-293,06, y=51,00, z=216,88], EntitySquid['Squid'/49, l='MpServer', x=-285,75, y=53,31, z=213,78], EntitySquid['Squid'/50, l='MpServer', x=-295,56, y=54,34, z=234,53], EntitySquid['Squid'/51, l='MpServer', x=-290,34, y=50,00, z=232,47], EntitySquid['Squid'/52, l='MpServer', x=-294,44, y=50,34, z=223,47], EntitySquid['Squid'/53, l='MpServer', x=-294,75, y=50,34, z=225,16], EntitySquid['Squid'/54, l='MpServer', x=-291,63, y=54,31, z=219,03], EntityZombie['Zombie'/55, l='MpServer', x=-291,69, y=35,00, z=281,50], EntitySquid['Squid'/56, l='MpServer', x=-294,31, y=60,34, z=281,72], EntitySkeleton['Skeleton'/66, l='MpServer', x=-272,16, y=26,00, z=171,47], EntityWitch['Witch'/68, l='MpServer', x=-270,63, y=43,00, z=197,04], EntityBat['Bat'/69, l='MpServer', x=-282,38, y=28,04, z=179,56], EntityCreeper['Creeper'/70, l='MpServer', x=-277,69, y=41,00, z=220,50], EntitySquid['Squid'/71, l='MpServer', x=-276,22, y=54,78, z=218,81], EntitySquid['Squid'/72, l='MpServer', x=-288,53, y=51,31, z=222,56], EntitySquid['Squid'/73, l='MpServer', x=-282,47, y=57,22, z=235,56], EntitySquid['Squid'/74, l='MpServer', x=-277,03, y=57,00, z=238,53], EntitySquid['Squid'/75, l='MpServer', x=-282,38, y=52,00, z=240,50], EntitySquid['Squid'/76, l='MpServer', x=-275,66, y=57,06, z=228,72], EntitySquid['Squid'/77, l='MpServer', x=-277,50, y=56,00, z=242,50], EntitySquid['Squid'/78, l='MpServer', x=-274,50, y=57,34, z=225,03], EntitySquid['Squid'/79, l='MpServer', x=-290,81, y=55,28, z=238,97], EntitySquid['Squid'/80, l='MpServer', x=-274,31, y=58,69, z=231,81], EntitySquid['Squid'/81, l='MpServer', x=-271,50, y=59,34, z=229,78], EntitySquid['Squid'/82, l='MpServer', x=-277,13, y=56,00, z=232,25], EntitySquid['Squid'/83, l='MpServer', x=-283,06, y=53,69, z=223,06], EntitySquid['Squid'/84, l='MpServer', x=-283,25, y=53,78, z=236,28], EntityPig['Pig'/85, l='MpServer', x=-275,88, y=68,00, z=262,94], EntityCreeper['Creeper'/86, l='MpServer', x=-275,88, y=11,47, z=298,70], EntityCreeper['Creeper'/87, l='MpServer', x=-273,97, y=16,00, z=298,53], EntitySpider['Spider'/88, l='MpServer', x=-273,25, y=30,00, z=299,72], EntityCreeper['Creeper'/104, l='MpServer', x=-259,78, y=24,00, z=167,09], EntitySkeleton['Skeleton'/105, l='MpServer', x=-265,44, y=29,00, z=166,06], EntityBat['Bat'/109, l='MpServer', x=-260,03, y=26,45, z=176,53], EntityZombie['Zombie'/110, l='MpServer', x=-264,50, y=25,00, z=198,50], EntityBat['Bat'/111, l='MpServer', x=-265,31, y=20,10, z=210,03], EntityBat['Bat'/112, l='MpServer', x=-262,78, y=37,10, z=217,31], EntitySquid['Squid'/113, l='MpServer', x=-271,56, y=58,31, z=219,56], EntityPig['Pig'/114, l='MpServer', x=-261,31, y=75,00, z=202,50], EntityPig['Pig'/115, l='MpServer', x=-260,03, y=73,00, z=212,13], EntityPig['Pig'/116, l='MpServer', x=-259,91, y=73,00, z=209,94], EntityPig['Pig'/117, l='MpServer', x=-269,50, y=68,00, z=266,88], EntityPig['Pig'/118, l='MpServer', x=-270,41, y=68,00, z=264,47], EntityPig['Pig'/119, l='MpServer', x=-269,50, y=68,00, z=268,50], EntityHorse['Horse'/120, l='MpServer', x=-258,50, y=68,00, z=264,19], EntityCreeper['Creeper'/121, l='MpServer', x=-263,09, y=16,00, z=277,63], EntityZombie['Zombie'/122, l='MpServer', x=-266,09, y=42,00, z=285,47], EntityZombie['Zombie'/123, l='MpServer', x=-261,16, y=20,00, z=300,38], EntitySkeleton['Skeleton'/124, l='MpServer', x=-269,34, y=31,00, z=301,91], EntityZombie['Zombie'/125, l='MpServer', x=-262,34, y=19,00, z=289,94], EntityEnderman['Enderman'/126, l='MpServer', x=-258,09, y=19,00, z=291,16], EntityZombie['Zombie'/127, l='MpServer', x=-258,23, y=44,00, z=291,48], EntitySpider['Spider'/128, l='MpServer', x=-265,25, y=40,00, z=299,03], EntitySkeleton['Skeleton'/129, l='MpServer', x=-273,53, y=30,00, z=301,08], EntitySkeleton['Skeleton'/130, l='MpServer', x=-266,22, y=31,00, z=304,53], EntityCreeper['Creeper'/145, l='MpServer', x=-253,00, y=25,00, z=162,38], EntityCreeper['Creeper'/147, l='MpServer', x=-243,50, y=49,00, z=166,50], EntityCreeper['Creeper'/149, l='MpServer', x=-254,50, y=48,00, z=180,50], EntityPig['Pig'/150, l='MpServer', x=-248,84, y=75,00, z=198,09], EntityCreeper['Creeper'/151, l='MpServer', x=-245,31, y=12,00, z=256,97], EntityZombie['Zombie'/152, l='MpServer', x=-240,94, y=19,00, z=261,31], EntityHorse['Horse'/153, l='MpServer', x=-255,41, y=66,00, z=271,41], EntityHorse['Horse'/154, l='MpServer', x=-251,38, y=66,00, z=264,09], EntitySkeleton['Skeleton'/155, l='MpServer', x=-245,09, y=14,00, z=284,50], EntitySkeleton['Skeleton'/156, l='MpServer', x=-241,50, y=13,00, z=281,50], EntitySpider['Spider'/157, l='MpServer', x=-247,80, y=16,18, z=279,87], EntitySkeleton['Skeleton'/158, l='MpServer', x=-245,50, y=18,00, z=273,91], EntityHorse['Horse'/159, l='MpServer', x=-252,00, y=67,00, z=279,78], EntityHorse['Horse'/160, l='MpServer', x=-250,78, y=66,00, z=273,78], EntityHorse['Horse'/161, l='MpServer', x=-253,56, y=66,00, z=274,47], EntitySpider['Spider'/162, l='MpServer', x=-251,94, y=19,00, z=296,03], EntityEnderman['Enderman'/163, l='MpServer', x=-247,31, y=17,00, z=296,47], EntityEnderman['Enderman'/164, l='MpServer', x=-246,47, y=16,00, z=295,50], EntityEnderman['Enderman'/165, l='MpServer', x=-250,31, y=18,00, z=296,75], EntityZombie['Zombie'/166, l='MpServer', x=-253,94, y=19,00, z=298,34], EntityClientPlayerMP['Player965'/422, l='MpServer', x=-233,30, y=73,62, z=238,16], EntityCreeper['Creeper'/167, l='MpServer', x=-245,50, y=40,00, z=301,50], EntityZombie['Zombie'/168, l='MpServer', x=-244,50, y=40,00, z=302,50], EntityPig['Pig'/169, l='MpServer', x=-241,50, y=64,00, z=303,53], EntityPig['Pig'/170, l='MpServer', x=-247,50, y=64,00, z=303,50], EntityPig['Pig'/171, l='MpServer', x=-240,31, y=64,00, z=304,06], EntitySkeleton['Skeleton'/176, l='MpServer', x=-232,72, y=22,00, z=302,59], EntityPig['Pig'/177, l='MpServer', x=-238,13, y=64,00, z=302,41], EntitySkeleton['Skeleton'/179, l='MpServer', x=-232,50, y=23,00, z=305,50], EntityZombie['Zombie'/180, l='MpServer', x=-235,66, y=23,00, z=312,34], EntityZombie['Zombie'/181, l='MpServer', x=-232,50, y=23,00, z=306,50], EntityZombie['Zombie'/182, l='MpServer', x=-239,34, y=20,00, z=306,16], EntityCreeper['Creeper'/186, l='MpServer', x=-216,34, y=48,00, z=157,91], EntityCreeper['Creeper'/187, l='MpServer', x=-215,69, y=48,00, z=158,78], EntitySheep['Sheep'/188, l='MpServer', x=-213,84, y=64,00, z=162,28], EntityPig['Pig'/189, l='MpServer', x=-217,50, y=69,00, z=198,31], EntityItem['item.item.seeds'/190, l='MpServer', x=-212,06, y=68,13, z=225,34], EntityCreeper['Creeper'/191, l='MpServer', x=-215,50, y=24,00, z=268,50], EntityCreeper['Creeper'/192, l='MpServer', x=-208,74, y=25,00, z=272,63], EntityCreeper['Creeper'/193, l='MpServer', x=-214,00, y=35,00, z=273,56], EntitySheep['Sheep'/201, l='MpServer', x=-207,78, y=64,00, z=159,50], EntitySheep['Sheep'/202, l='MpServer', x=-203,34, y=69,00, z=156,53], EntitySheep['Sheep'/203, l='MpServer', x=-207,50, y=64,00, z=161,50], EntityPig['Pig'/204, l='MpServer', x=-207,25, y=67,00, z=194,13], EntityPig['Pig'/205, l='MpServer', x=-199,50, y=68,00, z=198,78], EntityPig['Pig'/206, l='MpServer', x=-196,50, y=68,00, z=197,50], EntityCreeper['Creeper'/207, l='MpServer', x=-196,03, y=25,00, z=213,59], EntityCreeper['Creeper'/208, l='MpServer', x=-196,00, y=25,00, z=211,44], EntityCreeper['Creeper'/209, l='MpServer', x=-194,41, y=24,00, z=212,34], EntityCreeper['Creeper'/210, l='MpServer', x=-195,50, y=24,00, z=212,69], EntityItem['item.item.seeds'/211, l='MpServer', x=-198,13, y=63,13, z=271,84], EntityBat['Bat'/212, l='MpServer', x=-201,69, y=26,33, z=271,28], EntityBat['Bat'/213, l='MpServer', x=-196,94, y=27,42, z=274,38], EntityPig['Pig'/222, l='MpServer', x=-179,81, y=66,00, z=166,19], EntitySquid['Squid'/223, l='MpServer', x=-183,50, y=56,00, z=255,19], EntitySquid['Squid'/224, l='MpServer', x=-181,50, y=56,00, z=248,50], EntitySquid['Squid'/225, l='MpServer', x=-183,50, y=56,00, z=259,38], EntitySquid['Squid'/226, l='MpServer', x=-183,50, y=56,00, z=260,50], EntitySquid['Squid'/227, l='MpServer', x=-184,50, y=58,31, z=268,56], EntitySquid['Squid'/228, l='MpServer', x=-181,50, y=58,38, z=266,72], EntitySquid['Squid'/229, l='MpServer', x=-182,31, y=57,00, z=260,16], EntitySkeleton['Skeleton'/230, l='MpServer', x=-179,59, y=25,00, z=277,16], EntityPig['Pig'/240, l='MpServer', x=-169,50, y=66,00, z=168,69], EntityPig['Pig'/241, l='MpServer', x=-172,06, y=66,00, z=170,09], EntityPig['Pig'/242, l='MpServer', x=-165,68, y=69,00, z=205,83], EntitySheep['Sheep'/243, l='MpServer', x=-161,47, y=106,00, z=245,63], EntitySheep['Sheep'/244, l='MpServer', x=-166,66, y=109,00, z=266,56], EntitySheep['Sheep'/245, l='MpServer', x=-165,69, y=106,00, z=268,88], EntitySheep['Sheep'/246, l='MpServer', x=-166,53, y=110,00, z=263,84], EntitySheep['Sheep'/247, l='MpServer', x=-160,38, y=104,00, z=268,84], EntityBat['Bat'/248, l='MpServer', x=-170,50, y=40,10, z=287,69], EntityZombie['Zombie'/249, l='MpServer', x=-164,87, y=58,00, z=279,39], EntityPig['Pig'/255, l='MpServer', x=-155,53, y=64,00, z=184,53]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:373)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2432)
at net.minecraft.client.Minecraft.run(Minecraft.java:916)
at net.minecraft.client.main.Main.main(SourceFile:148)
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 7 (x86) version 6.1
Java Version: 1.8.0_31, Oracle Corporation
Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
Memory: 895584816 bytes (854 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 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: 12, tallocated: 94
FML: MCP v9.05 FML v7.10.104.1358 Minecraft Forge 10.13.3.1358 4 mods loaded, 4 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.10.104.1358} [Forge Mod Loader] (forgeBin-1.7.10-10.13.3.1358-1.7.10.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.13.3.1358} [Minecraft Forge] (forgeBin-1.7.10-10.13.3.1358-1.7.10.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
wizcraft{0.1} [WizCraft] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: ATI Radeon HD 3400 Series GL version 3.3.11672 Compatibility Profile Context, ATI Technologies Inc.
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)

 

To be honest i am not a java professional programmer and my only experience has been C# and a little bit of C++, but i am getting into java and starting to understand some stuff.So i would be happy if you don't call me dumb if i have done something stupid in the code :D.

 

[glow=red,2,300]Here is the mainregister class file code: [/glow]

package com.Cerandior.main;

import com.Cerandior.blocks.FireElementBlock;
import com.Cerandior.gui.GuiHandler;
import com.Cerandior.items.FireElement;
import com.Cerandior.lib.RefStrings;
import com.Cerandior.world.MWorld;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
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.NetworkRegistry;

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

public class MainRegister {
public static MainRegister Instance;
@SidedProxy(clientSide = RefStrings.CLIENTSIDE , serverSide = RefStrings.SERVERSIDE)
public static ServerProxy proxy;

@EventHandler
 public void init(FMLInitializationEvent event) {
	NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
	FireElement.MainRegister();
	FireElementBlock.MainRegister();
	CraftingManager.mainRegistry();
	MWorld.mainRegistry();
	proxy.registerRenderInfo();
}

public static void PreLoad(FMLPreInitializationEvent PreEvent) {

}
@EventHandler
public static void load(FMLInitializationEvent event) {

}
@EventHandler
public static void PostLoad(FMLPostInitializationEvent PostEvent) {

}

}

 

[glow=red,2,300]Here is my Strings Class File:[/glow]

package com.Cerandior.lib;

import com.Cerandior.gui.GuiHandler;

import cpw.mods.fml.common.network.NetworkRegistry;

public class RefStrings {

public static final String MODID = "wizcraft";
public static final String NAME = "WizCraft";
public static final String VERSION = "0.1";
public static final String CLIENTSIDE = "com.Cerandior.main.ClientProxy";
public static final String SERVERSIDE = "com.Cerandior.main.ServerProxy";
public static RefStrings Instance;



}

 

[glow=red,2,300]And here is my Crafting Table Class Code:[/glow]

 

package com.Cerandior.blocks;

import com.Cerandior.lib.RefStrings;
import com.Cerandior.main.MainRegister;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;

public class WorkSurface extends Block {

@SideOnly(Side.CLIENT)
private IIcon workSurfaceTop;

public WorkSurface() {
	super(Material.wood);

	this.setHardness(3.5F);
	this.setResistance(5.0F);
	this.setCreativeTab(CreativeTabs.tabMisc);
}

@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int metadata) {
	return side == 1 ? this.workSurfaceTop : this.blockIcon;
}

@SideOnly(Side.CLIENT)
public void registerBlockIcons (IIconRegister iconRegister) {
	this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":WorkSurfaceSide");
	this.workSurfaceTop = iconRegister.registerIcon(RefStrings.MODID + ":WorkSurfaceTop");
}


public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {

	if (!player.isSneaking()) {
		player.openGui(MainRegister.Instance, FireElementBlock.guiIDWorkSurface, world, x, y, z);
	    return false;
	}else{
		return true;
	}
}

}

 

[glow=red,2,300]This is my GuiHandler Code:[/glow]

 

package com.Cerandior.gui;

import com.Cerandior.blocks.FireElementBlock;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;

public class GuiHandler implements IGuiHandler {

@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
		TileEntity entity = world.getTileEntity(x, y, z);

		if(ID == FireElementBlock.guiIDWorkSurface) {
			return ID == FireElementBlock.guiIDWorkSurface && world.getBlock(x, y, z) == FireElementBlock.blockWorkSurface ? new ContainerWorkSurface(player.inventory, world, x, y, z) : null;
		}

		return null;
}

@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	TileEntity entity = world.getTileEntity(x, y, z);

	if(ID == FireElementBlock.guiIDWorkSurface) {
		return ID == FireElementBlock.guiIDWorkSurface && world.getBlock(x, y, z) == FireElementBlock.blockWorkSurface ? new GuiWorkSurface(player.inventory, world, x, y, z) : null;
	}

	return null;
}

}

 

[glow=red,2,300]And this is my Blocks class code:[/glow]

 

package com.Cerandior.blocks;

import com.Cerandior.items.FireElement;
import com.Cerandior.lib.RefStrings;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import cpw.mods.fml.common.registry.GameRegistry;

public class FireElementBlock {

public static void MainRegister(){
	initializeBlock();
	registeritem();
}

public static Block FEBlock;
public static Block FEore;
public static Block blockWorkSurface;
public static final int guiIDWorkSurface = 1;

public static void initializeBlock(){
	FEBlock = new FEBlock(Material.ground).setBlockName("FireElementBlock").setCreativeTab(CreativeTabs.tabBlock).setBlockTextureName(RefStrings.MODID + ":fireblock");
	FEore = new FEore(Material.rock).setBlockName("FireElementOre").setHardness(10).setCreativeTab(CreativeTabs.tabBlock).setBlockTextureName(RefStrings.MODID + ":fore");
    blockWorkSurface = new WorkSurface().setBlockName("WorkSurface");
}

public static void registeritem(){
	GameRegistry.registerBlock(FEBlock, FEBlock.getUnlocalizedName());
	GameRegistry.registerBlock(FEore, FEore.getUnlocalizedName());
	GameRegistry.registerBlock(blockWorkSurface, blockWorkSurface.getUnlocalizedName());
}
}

 

[glow=red,2,300]Thanks for your help in advance[/glow]

Link to comment
Share on other sites

Ok, I don't know what's wrong, but I suspect that it's your GUI Handler.

 

if(ID == FireElementBlock.guiIDWorkSurface) {
return ID == FireElementBlock.guiIDWorkSurface && world.getBlock(x, y, z) == FireElementBlock.blockWorkSurface ? new ContainerWorkSurface(player.inventory, world, x, y, z) : null;
}

 

The hell are you doing here?  First you're checking to see if the ID is the right ID, then you check to see if the ID is the right ID.

 

 

if(ID == FireElementBlock.guiIDWorkSurface) {
return ID new ContainerWorkSurface(player.inventory, world, x, y, z);
}

 

Done.  And do the same to the other one for the client side.

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

Thank you for the quick answer.

Changing the code brings up the same crash-report.

It probably may be in the crafting container class file wich contains some Vanilla crafting table code.

I would be grateful if you have a look into it:

package com.Cerandior.gui;

import com.Cerandior.blocks.FireElementBlock;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCraftResult;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class ContainerWorkSurface extends Container {

public InventoryCrafting craftMatrix;
public IInventory craftResult;
private World worldObj;
private int posX;
private int posY;
private int posZ;

public ContainerWorkSurface(InventoryPlayer invPlayer, World world, int x, int y, int z) {
	craftMatrix = new InventoryCrafting(this, 5, 5);
	craftResult = new InventoryCraftResult();
	worldObj = world;
	posX = x;
	posY = y;
	posZ = z;

	this.addSlotToContainer(new SlotCrafting(invPlayer.player, craftMatrix, craftResult, 0, 131, 36));

	for (int i = 0; i < 5; i++) {
		for(int k = 0; k < 5; k++) {
			this.addSlotToContainer(new Slot(craftMatrix, k + 1 * 5, 4 + k * 18, 3 + i * 18));
		}
	}

	for (int i = 0; i < 3; i++) {
		for (int k = 0; k < 9; k++) {
			this.addSlotToContainer(new Slot(invPlayer, k + i * 9 + 9, 8 + k * 18, 94 + i * 18));
		}
	}

	for (int i = 0; i < 9; i++) {
		this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 148));
	}

	onCraftMatrixChanged(craftMatrix);
}


public void onCraftMatrixChanged(IInventory iiventory) {
	//craftResult.setInventorySlotContents(0, WorkSurfaceCraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj));
}


@Override
public boolean canInteractWith(EntityPlayer player) {
	if(worldObj.getBlock(posX, posY, posZ) != FireElementBlock.blockWorkSurface) {
		return false;
	}else{
		return (player.getDistanceSq((double)posX, (double)posY, (double)posZ) <= 64.0D);
	}
}

public void onContainerClosed(EntityPlayer player)
{
super.onContainerClosed(player);

if (!this.worldObj.isRemote)
{
for (int i = 0; i < 9; ++i)
{
ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i);

if (itemstack != null)
{
player.dropPlayerItemWithRandomChoice(itemstack, false);
}
}
}
}

public ItemStack transferStackInSlot(EntityPlayer entityplayer, int q)
{
ItemStack itemstack = null;
Slot slot = (Slot)this.inventorySlots.get(q);

if (slot != null && slot.getHasStack())
{
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();

if (q == 0)
{
if (!this.mergeItemStack(itemstack1, 10, 46, true))
{
return null;
}

slot.onSlotChange(itemstack1, itemstack);
}
else if (q >= 10 && q < 37)
{
if (!this.mergeItemStack(itemstack1, 37, 46, false))
{
return null;
}
}
else if (q >= 37 && q < 46)
{
if (!this.mergeItemStack(itemstack1, 10, 37, false))
{
return null;
}
}
else if (!this.mergeItemStack(itemstack1, 10, 46, false))
{
return null;
}

if (itemstack1.stackSize == 0)
{
slot.putStack((ItemStack)null);
}
else
{
slot.onSlotChanged();
}

if (itemstack1.stackSize == itemstack.stackSize)
{
return null;
}

slot.onPickupFromSlot(entityplayer, itemstack1);
}

return itemstack;
}
}

 

Link to comment
Share on other sites

Your crash is because of a nullPointer right? In my early days as a java coder, I learned that nullPointers are pretty easy to fix. I also once got the same error with the NetworkRegistry. Try putting your mod's instance instead of this in this code:

NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());

Link to comment
Share on other sites

No, i changed all the stuff you guys said and i am being a little surprised, because i am getting the exact same crash-report log. I am not really understanding what's going on. Even if the gui itself wasn't created yet, right-clicking that block shouldn't crash the game. But i did create the gui and when i tried to check out the texture that i did for it i saw this error coming out. I am getting a little hopeless on this, i'll probably just thing of another way to get the items i want to.

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



×
×
  • Create New...

Important Information

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