I cannot figure out why, But I keep getting java.lang.NullPointerException at RuneScapeCraft.Common.GuiSmeltFurnace.drawGuiContainerBackgroundLayer(GuiSmeltFurnace.java:33)
@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j){
int picture = mc.renderEngine.getTexture("/ModGUIs/SmeltFurnace.png");
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
this.mc.renderEngine.bindTexture(picture);
int x = (width - xSize) / 2;
int y = (height - ySize) / 2;
this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
int smelt;
if (furnace.isSmelting()){
smelt = furnace.getTimeRemainingScaled(12);
drawTexturedModalRect(x + 56, y + 36 + 12 - smelt, 176, 12 - smelt, 14, smelt + 2);
}
smelt = furnace.getProgressScaled(24);
drawTexturedModalRect(x + 79, y + 34, 176, 14, smelt + 1, 16);
}
I cannot figure out why, But I keep getting java.lang.NullPointerException at RuneScapeCraft.Common.GuiSmeltFurnace.drawGuiContainerBackgroundLayer(GuiSmeltFurnace.java:33)
@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j){
int picture = mc.renderEngine.getTexture("/ModGUIs/SmeltFurnace.png");
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
this.mc.renderEngine.bindTexture(picture);
int x = (width - xSize) / 2;
int y = (height - ySize) / 2;
this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
int smelt;
if (furnace.isSmelting()){
smelt = furnace.getTimeRemainingScaled(12);
drawTexturedModalRect(x + 56, y + 36 + 12 - smelt, 176, 12 - smelt, 14, smelt + 2);
}
smelt = furnace.getProgressScaled(24);
drawTexturedModalRect(x + 79, y + 34, 176, 14, smelt + 1, 16);
}
Line 33:
if (furnace.isSmelting()){
So something is returning null on (or in) that line. Probably "furnace" is null, meaning it didn't get initialized. It could also be something in isSmelting(). Your whole stack trace would be more helpful
Rollback Post to RevisionRollBack
Learn some Java before you mod, and skip over the chapter on ModLoader, straight to MinecraftForge. It's better. Trust me.
I've been having a persistent annoying bug for the past weeks, and I've tried just about anything without luck.
It's this:
Whenever I open my GUI, it opens the GUI like it should, but when I click a slot, it does what it should do IF the inventory slot with the same slot ID is empty, if however that slot isn't empty, it doesn't do what it should do, but instead picks the block from the inventory slot with the same ID as the slot that I clicked.
I can't seem to get this bug away, and it is starting to get REALLY frustrating.
I've asked just about anywhere for help, but no luck.
Maybe you could help me with this?
NOTE: My GUI used no TileEntity before, then I put one in, and it still had the same bug, It doesn't use a block though, and it's supposed to not use a block.
I've been having a persistent annoying bug for the past weeks, and I've tried just about anything without luck.
It's this:
Whenever I open my GUI, it opens the GUI like it should, but when I click a slot, it does what it should do IF the inventory slot with the same slot ID is empty, if however that slot isn't empty, it doesn't do what it should do, but instead picks the block from the inventory slot with the same ID as the slot that I clicked.
I can't seem to get this bug away, and it is starting to get REALLY frustrating.
I've asked just about anywhere for help, but no luck.
Maybe you could help me with this?
NOTE: My GUI used no TileEntity before, then I put one in, and it still had the same bug, It doesn't use a block though, and it's supposed to not use a block.
Maybe post your code? Pastebin or here or whatever you feel like. It's probably a bug in your Container code and how it adds the Slots, but I would need to see it to tell.
Rollback Post to RevisionRollBack
Learn some Java before you mod, and skip over the chapter on ModLoader, straight to MinecraftForge. It's better. Trust me.
Maybe post your code? Pastebin or here or whatever you feel like. It's probably a bug in your Container code and how it adds the Slots, but I would need to see it to tell.
I don't usually post code, but my container looks almost exactly the same as every other container.
Well, I don't usually have the ability to solve problems for people without being able to know what the cause is.
If you want, you can PM it to me. Or not. Whatever.
I've tried just about everything, but this problem seems unsolveable, and I also seem to be just about the only one to have this problem...
Just my luck again...
I've tried just about everything, but this problem seems unsolveable, and I also seem to be just about the only one to have this problem...
Just my luck again...
It appears to me that you haven't tried having someone else look over your code. I am fairly positive that I understand your problem, what causes it, what its effects are, and I have also encountered it, if I am correct.
Sometimes problems in code can be sneaky little s. It only takes one wrong line of code, one number in the wrong order, one parameter defined wrong, or one operator being wrong to totally screw up a program (or mod). This is true of (nearly) all coding, no matter what language or markup. Often, having two heads is better than one, so to speak. That is one of the main reasons why software firms sometimes have large teams to write even the simplest of programs.
Like I said, if you want help, you will probably have to post your code. You can post it here, PM it to me, Dropbox it, Pastebin it, GitHub it, or whatever delivery method you want, but if I can't see your code, I can't help much, and it doesn't help for you skulk about it, no offense.
Rollback Post to RevisionRollBack
Learn some Java before you mod, and skip over the chapter on ModLoader, straight to MinecraftForge. It's better. Trust me.
I did some digging in your code just now and compared and noticed that that was missing. It works now and I appreciate all of y'alls help =o)
No problem I did my part with the tutorial / random help, but I give millions of :diamonds: to drinfernoo because hes probably helped more people in the replies than I probably would ever have :). So yes drinfernoo your amazing
It appears to me that you haven't tried having someone else look over your code. I am fairly positive that I understand your problem, what causes it, what its effects are, and I have also encountered it, if I am correct.
Sometimes problems in code can be sneaky little s. It only takes one wrong line of code, one number in the wrong order, one parameter defined wrong, or one operator being wrong to totally screw up a program (or mod). This is true of (nearly) all coding, no matter what language or markup. Often, having two heads is better than one, so to speak. That is one of the main reasons why software firms sometimes have large teams to write even the simplest of programs.
Like I said, if you want help, you will probably have to post your code. You can post it here, PM it to me, Dropbox it, Pastebin it, GitHub it, or whatever delivery method you want, but if I can't see your code, I can't help much, and it doesn't help for you skulk about it, no offense.
Well I thought that maybe because you (and others on this topic) are so good with GUI's you've maybe encountered this problem already, or maybe heard of it or solved it, but I'll see how I can send the code, because I have no clue whatsoever of what can cause it, I've ran over the code more then 20 times now, and modified it everytime, and it is as if nothing ever happened.
im wondering how you get the recipe to do multiple outputs with arrays, right now i have it for 9 slots output, but even 2 outputs with the same kind of recipe format would be nice
i increased the array of slots with
{
/** A list of one item containing the result of the crafting formula */
private ItemStack[] stackResult = new ItemStack[9];
private int inventoryWidth;
private Container eventHandler;
public InventoryCraftResult2(Container par1Container, int par2, int par3)
{
int var4 = par2 * par3;
this.stackResult = new ItemStack[var4];
this.eventHandler = par1Container;
this.inventoryWidth = par2;
}
/**
* Returns the number of slots in the inventory.
*/
public int getSizeInventory()
{
return 9;
}
now this is the current base recipe code
addRecipe(new ItemStack(Item.paper, 3), new Object[]
{
"###", '#', Block.dirt
});
what i want, if not an array like the object is to show me how to make a second itemstack variable in the addRecipe method that uses the second slot, ive been working on this for a bit and i'd prefer to try to do this myself but i need a bit of a nudge for how to actually get a working code started
EDIT:
heres my theory of how i could do it
im wondering how you get the recipe to do multiple outputs with arrays, right now i have it for 9 slots output, but even 2 outputs with the same kind of recipe format would be nice
i increased the array of slots with
{
/** A list of one item containing the result of the crafting formula */
private ItemStack[] stackResult = new ItemStack[9];
private int inventoryWidth;
private Container eventHandler;
public InventoryCraftResult2(Container par1Container, int par2, int par3)
{
int var4 = par2 * par3;
this.stackResult = new ItemStack[var4];
this.eventHandler = par1Container;
this.inventoryWidth = par2;
}
/**
* Returns the number of slots in the inventory.
*/
public int getSizeInventory()
{
return 9;
}
now this is the current base recipe code
addRecipe(new ItemStack(Item.paper, 3), new Object[]
{
"###", '#', Block.dirt
});
what i want, if not an array like the object is to show me how to make a second itemstack variable in the addRecipe method that uses the second slot, ive been working on this for a bit and i'd prefer to try to do this myself but i need a bit of a nudge for how to actually get a working code started
EDIT:
heres my theory of how i could do it
To do this, you _can_ actually use an array of Items. CHeck out my source if you want, here The tricky parts are in the EnigmaCraft and TileEntity classes.
Rollback Post to RevisionRollBack
Learn some Java before you mod, and skip over the chapter on ModLoader, straight to MinecraftForge. It's better. Trust me.
Lol this was a long and hard tutorial, and it was hard to write, so I hope you enjoy it and if you have any questions or concerns please message me, post below, or message me on WindowsLive Messager (Acount is below in my signature ). A lot of this stuff is not covered fully because I either didn't have the knowledge of the subject or it wasn't a thing that needed to be covered in this tutorial. So again Enjoy..
Also If you would mind I ask anyone that learns how to make a Gui like this, just post a little credit to me in one of the mods you created using this tutorial, this is not required but is a nice gesture and I will post your name below and a link to your mod, as a nice gesture for doing the nice gesture for me . I give what I get
--EDIT--
plzzz call me Leah as that is my name (real name) instead of trying to type out my screen name
Line 33:
So something is returning null on (or in) that line. Probably "furnace" is null, meaning it didn't get initialized. It could also be something in isSmelting(). Your whole stack trace would be more helpful
Here is the whole GUI Class
I think the problem is that it is trying to assign a value to a variable that hasn't actually been created yet.
The problem was here:
I never assigned furnace to the tile_entity, so it should have been
I did some digging in your code just now and compared and noticed that that was missing. It works now and I appreciate all of y'alls help =o)
It's this:
Whenever I open my GUI, it opens the GUI like it should, but when I click a slot, it does what it should do IF the inventory slot with the same slot ID is empty, if however that slot isn't empty, it doesn't do what it should do, but instead picks the block from the inventory slot with the same ID as the slot that I clicked.
I can't seem to get this bug away, and it is starting to get REALLY frustrating.
I've asked just about anywhere for help, but no luck.
Maybe you could help me with this?
NOTE: My GUI used no TileEntity before, then I put one in, and it still had the same bug, It doesn't use a block though, and it's supposed to not use a block.
Maybe post your code? Pastebin or here or whatever you feel like. It's probably a bug in your Container code and how it adds the Slots, but I would need to see it to tell.
I don't usually post code, but my container looks almost exactly the same as every other container.
Well, I don't usually have the ability to solve problems for people without being able to know what the cause is.
If you want, you can PM it to me. Or not. Whatever.
I've tried just about everything, but this problem seems unsolveable, and I also seem to be just about the only one to have this problem...
Just my luck again...
It appears to me that you haven't tried having someone else look over your code. I am fairly positive that I understand your problem, what causes it, what its effects are, and I have also encountered it, if I am correct.
Sometimes problems in code can be sneaky little s. It only takes one wrong line of code, one number in the wrong order, one parameter defined wrong, or one operator being wrong to totally screw up a program (or mod). This is true of (nearly) all coding, no matter what language or markup. Often, having two heads is better than one, so to speak. That is one of the main reasons why software firms sometimes have large teams to write even the simplest of programs.
Like I said, if you want help, you will probably have to post your code. You can post it here, PM it to me, Dropbox it, Pastebin it, GitHub it, or whatever delivery method you want, but if I can't see your code, I can't help much, and it doesn't help for you skulk about it, no offense.
No problem I did my part with the tutorial / random help, but I give millions of :diamonds: to drinfernoo because hes probably helped more people in the replies than I probably would ever have :). So yes drinfernoo your amazing
EDIT: At some point I became a Gold Miner lol
Well I thought that maybe because you (and others on this topic) are so good with GUI's you've maybe encountered this problem already, or maybe heard of it or solved it, but I'll see how I can send the code, because I have no clue whatsoever of what can cause it, I've ran over the code more then 20 times now, and modified it everytime, and it is as if nothing ever happened.
PS: I PM'ed you.
Regards: Thieves
i increased the array of slots with
what i want, if not an array like the object is to show me how to make a second itemstack variable in the addRecipe method that uses the second slot, ive been working on this for a bit and i'd prefer to try to do this myself but i need a bit of a nudge for how to actually get a working code started
EDIT:
heres my theory of how i could do it
To do this, you _can_ actually use an array of Items. CHeck out my source if you want, here The tricky parts are in the EnigmaCraft and TileEntity classes.
Thank's very much for this incredibly detailed write-up.
LogCat?
No Problem
Girls can code....