Posted September 22, 201411 yr Hi guys! I've been working on a custom furnace and every time I right click the block the GUI doesn't open and crashes the client. Here is the error log: ---- Minecraft Crash Report ---- // Daisy, daisy... Time: 9/22/14 7:51 PM Description: Unexpected error java.lang.NullPointerException: Unexpected error at cpw.mods.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:263) at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:93) at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2514) at io.kaminocoding.commumod.blocks.BlockPurifier.onBlockActivated(BlockPurifier.java:77) at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:380) at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1529) at net.minecraft.client.Minecraft.runTick(Minecraft.java:2044) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1039) at net.minecraft.client.Minecraft.run(Minecraft.java:961) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at GradleStart.bounce(GradleStart.java:107) at GradleStart.startClient(GradleStart.java:100) at GradleStart.main(GradleStart.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) 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:263) at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:93) at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2514) at io.kaminocoding.commumod.blocks.BlockPurifier.onBlockActivated(BlockPurifier.java:77) at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:380) at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1529) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['ForgeDevName'/385, l='MpServer', x=-122.33, y=65.62, z=369.55]] Chunk stats: MultiplayerChunkCache: 25, 25 Level seed: 0 Level generator: ID 00 - default, ver 1. Features enabled: false Level generator options: Level spawn location: World: (104,64,256), Chunk: (at 8,4,0 in 6,16; contains blocks 96,0,256 to 111,255,271), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 19037 game time, 6791 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: 28 total; [EntityPig['Pig'/402, l='MpServer', x=-111.22, y=63.00, z=343.06], EntityPig['Pig'/403, l='MpServer', x=-103.50, y=69.00, z=339.31], EntityPig['Pig'/400, l='MpServer', x=-101.50, y=66.00, z=348.50], EntityPig['Pig'/401, l='MpServer', x=-101.50, y=66.00, z=346.50], EntityChicken['Chicken'/406, l='MpServer', x=-117.81, y=79.14, z=326.22], EntityChicken['Chicken'/407, l='MpServer', x=-171.63, y=61.14, z=362.53], EntityBat['Bat'/404, l='MpServer', x=-119.82, y=20.62, z=323.18], EntityPig['Pig'/15, l='MpServer', x=-95.41, y=70.00, z=342.38], EntityChicken['Chicken'/405, l='MpServer', x=-115.44, y=78.14, z=328.44], EntityPig['Pig'/395, l='MpServer', x=-99.88, y=63.00, z=387.75], EntityPig['Pig'/16, l='MpServer', x=-91.13, y=63.00, z=365.66], EntityPig['Pig'/394, l='MpServer', x=-101.31, y=63.00, z=391.25], EntityPig['Pig'/393, l='MpServer', x=-102.28, y=66.00, z=358.47], EntityPig['Pig'/392, l='MpServer', x=-130.91, y=66.00, z=354.53], EntityBat['Bat'/399, l='MpServer', x=-127.43, y=23.00, z=406.95], EntityChicken['Chicken'/398, l='MpServer', x=-126.34, y=65.00, z=350.44], EntityPig['Pig'/397, l='MpServer', x=-122.50, y=69.00, z=344.50], EntityItem['item.item.stick'/396, l='MpServer', x=-148.88, y=62.13, z=378.41], EntityClientPlayerMP['ForgeDevName'/385, l='MpServer', x=-122.33, y=65.62, z=369.55], EntityPig['Pig'/386, l='MpServer', x=-112.75, y=63.00, z=380.59], EntityPig['Pig'/391, l='MpServer', x=-133.78, y=64.00, z=387.94], EntityPig['Pig'/390, l='MpServer', x=-113.56, y=69.00, z=355.47], EntityPig['Pig'/389, l='MpServer', x=-121.50, y=68.00, z=361.39], EntityPig['Pig'/388, l='MpServer', x=-135.47, y=64.00, z=376.13], EntityPig['Pig'/444, l='MpServer', x=-172.50, y=64.96, z=408.69], EntityCow['Cow'/445, l='MpServer', x=-174.53, y=62.96, z=412.22], EntityChicken['Chicken'/446, l='MpServer', x=-166.41, y=68.14, z=350.53], EntityBat['Bat'/447, l='MpServer', x=-163.75, y=58.10, z=421.47]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:417) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2568) at net.minecraft.client.Minecraft.run(Minecraft.java:990) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at GradleStart.bounce(GradleStart.java:107) at GradleStart.startClient(GradleStart.java:100) at GradleStart.main(GradleStart.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Mac OS X (x86_64) version 10.7.5 Java Version: 1.7.0_55, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 849882216 bytes (810 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 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.18.1180 Minecraft Forge 10.13.0.1180 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.18.1180} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1180.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.13.0.1180} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1180.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available commumod{1.4.0a Build: 56} [Community Mod] (main) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: Intel GMA X3100 OpenGL Engine GL version 2.1 APPLE-7.4.1, Intel Inc. GL Caps: Using GL 1.3 multitexturing. Using framebuffer objects because EXT_framebuffer_object 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) Here is the code from the file that is erroring: package io.kaminocoding.commumod.blocks; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.kaminocoding.commumod.entity.TileEntityPurifier; import io.kaminocoding.commumod.help.Reference; import io.kaminocoding.commumod.main; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import java.util.Random; /** * Created by noah on 9/9/14. */ public class BlockPurifier extends BlockContainer { @SideOnly(Side.CLIENT) private IIcon top; @SideOnly(Side.CLIENT) private IIcon front; private static boolean isBurning; private final boolean isIsBurning; private final Random rand = new Random(); public BlockPurifier(boolean isActive) { super(Material.rock); setBlockName("purifierIdle"); setCreativeTab(main.modTab); isIsBurning = isActive; } @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) { this.blockIcon = register.registerIcon(Reference.MODID + ":purifier_side"); this.front = register.registerIcon(this.isIsBurning ? Reference.MODID + ":purifier_frontActive" : Reference.MODID + ":purifier_frontIdle"); this.top = register.registerIcon(Reference.MODID + ":purifier_top"); } public IIcon getIcon(int side, int meta) { if(side == 1) { return top; } else if (side == 3) { return front; } else { return this.blockIcon; } } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { FMLLog.info("Attempting to open GUI for purifier"); player.openGui(main.instance, 10, world, x, y, z); return true; } public Item getItemDropped(int par1, Random rand, int par3) { return Item.getItemFromBlock(ModBlocks.purifier_idle); } public Item getItem(World world, int par2, int par3, int par4) { return Item.getItemFromBlock(ModBlocks.purifier_idle); } @SideOnly(Side.CLIENT) public void onBlockAdded(World world, int x, int y, int z) { super.onBlockAdded(world, x, y, z); this.direction(world, x, y, z); } private void direction(World world, int x, int y, int z) { if ( !world.isRemote ) { Block direction = world.getBlock(x, y, z - 1); Block direction1 = world.getBlock(x, y, z + 1); Block direction2 = world.getBlock(x - 1, y, z); Block direction3 = world.getBlock(x + 1, y, z); byte byte0 = 3; if (direction.func_149730_j() && direction.func_149730_j()) { byte0 = 3; } if (direction1.func_149730_j() && direction1.func_149730_j()) { byte0 = 2; } if (direction2.func_149730_j() && direction2.func_149730_j()) { byte0 = 5; } if (direction3.func_149730_j() && direction3.func_149730_j()) { byte0 = 4; } world.setBlockMetadataWithNotify(x, y, z, byte0, 2); } } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack itemStack) { int direction = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D ) & 3; if( direction == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } if( direction == 1) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } if( direction == 2) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } if( direction == 3) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } if (itemStack.hasDisplayName()) { ((TileEntityPurifier) world.getTileEntity(x, y, z)).furnaceName(itemStack.getDisplayName()); } } public static void updateBlockState(boolean burning, World world, int x, int y, int z) { int direction = world.getBlockMetadata(x, y, z); TileEntity tileEntity = world.getTileEntity(x, y, z); isBurning = true; if (burning) { world.setBlock(x, y, z, ModBlocks.purifier_active); } else { world.setBlock(x, y, z, ModBlocks.purifier_idle); } isBurning = false; world.setBlockMetadataWithNotify(x, y, z, direction, 2); if(tileEntity != null) { tileEntity.validate(); world.setTileEntity(x, y, z, tileEntity); } } public void breakBlock(World world, int x, int y, int z, Block block, int meta) { if (!isBurning) { TileEntityPurifier tileEntityPurifier = (TileEntityPurifier)world.getTileEntity(x, y, z); if (tileEntityPurifier != null) { for (int i1 = 0; i1 < tileEntityPurifier.getSizeInventory(); ++i1) { ItemStack itemstack = tileEntityPurifier.getStackInSlot(i1); if (itemstack != null) { float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; EntityItem entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); if (itemstack.hasTagCompound()) { entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); } float f3 = 0.05F; entityitem.motionX = (double)((float)this.rand.nextGaussian() * f3); entityitem.motionY = (double)((float)this.rand.nextGaussian() * f3 + 0.2F); entityitem.motionZ = (double)((float)this.rand.nextGaussian() * f3); world.spawnEntityInWorld(entityitem); } } } world.func_147453_f(x, y, z, block); } } super.breakBlock(world, x, y, z, block, meta); } @SideOnly(Side.CLIENT) public void randomDisplayTick(World world, int x, int y, int z, Random rand) { if (this.isIsBurning) { int l = world.getBlockMetadata(x, y, z); float f = (float)x + 0.5F; float f1 = (float)y + 0.0F + rand.nextFloat() * 6.0F / 16.0F; float f2 = (float)z + 0.5F; float f3 = 0.52F; float f4 = rand.nextFloat() * 0.6F - 0.3F; if (l == 4) { world.spawnParticle("smoke", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); } else if (l == 5) { world.spawnParticle("smoke", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); } else if (l == 2) { world.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D); } else if (l == 3) { world.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D); } } } @Override public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return null; } } Any help is appreciated. Thanks!
September 23, 201411 yr Author How do I fix that? Sorry... I'm a novice and GUI/containers are what I want to learn next. I have no idea what to do after I did the block related stuff...
September 23, 201411 yr Author Is this what you're looking for? package io.kaminocoding.commumod.client.gui; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ContainerFurnace; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; /** * Created by noah on 9/19/14. */ public class GuiPurifier extends GuiContainer { private static final ResourceLocation furnaceGuiTextures = new ResourceLocation("textures/gui/container/purifier.png"); private TileEntityFurnace tilePurifier; public GuiPurifier(InventoryPlayer p_i1091_1_, TileEntityFurnace p_i1091_2_) { super(new ContainerFurnace(p_i1091_1_, p_i1091_2_)); this.tilePurifier = p_i1091_2_; } /** * Draw the foreground layer for the GuiContainer (everything in front of the items) */ protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { String s = this.tilePurifier.hasCustomInventoryName() ? this.tilePurifier.getInventoryName() : I18n.format(this.tilePurifier.getInventoryName(), new Object[0]); this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); } protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(furnaceGuiTextures); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); if (this.tilePurifier.isBurning()) { int i1 = this.tilePurifier.getBurnTimeRemainingScaled(13); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1); i1 = this.tilePurifier.getCookProgressScaled(24); this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16); } } } If this isn't it then I guess I don't have one...
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.