Hi guys! This may be a stupid question, but what is the method that is used to check if a play right clicks with an item? I realize onItemUse checks that, but only if you right click a block. Is there a method to check if you right click anywhere, not necessarily on a block? Thanks!
I used your code, and the GUI opens. However, when trying to move stacks of blocks, they just snap back into place. I don't know where that problem could come from, does anyone know?
Have you tried to see what heppens when you remove the if(par1World.isRemote) { return true; } or changed it to !par1World.isRemote. And also try to put this on top in the method so you can see if it get's called at all:
System.out.println("called")
this prints the word "called" in the console whenever it is able to call the system.out.println method.
At the moment, I am at school, but I didn't think of checking that. I will tell you the results whe I get back home.
Sorry for the double post, but I figured out that, when I change the OpenGUI method and take out the if statement, the GUI opens, but I cannot move any items in my inventory. They snap back right away.
I have tried that tutorial, and I have ended up having too many bugs to worry about. I appreciate the help, but I would prefer to use what I already have and make it work. I did the same thing in 1.2.5 and it worked just fine, so I'm not sure what is wrong.
you need several files for a custom furnace, block, recipe, tile, container, guifurnace, and gui handler, slot, and one more I think. If you dont have all these you will have problems...
I have all of the files. I have SlotCoalgen, TileEntityCoalgen, GuiCoalgen, CoalgenRecipes, and ContainerCoalgen. I didn't post them because I didn't think they would be of importance. I can post them if they help solve the problem.
Recently, I made a custom furnace, called, in my code, Coalgen. To make this, I copied the furnace files and replaced all instances of "furnace" with "coalgen," which worked fine. I then registered the TileEntityCoalgen and added the BlockCoalgen in the mod_Coalgen. I had one error, which was a method displaying the GUI, which I fixed (at least I thought). I tested this mod, and was able to craft the block and place it just fine. However, when trying to open the GUI, nothing came up. I would try to place a block on it, and it wouldn't allow it to, which I think means that it's trying to open a GUI, but isn't.
I'm not sure if it has to do with the method I fixed, or something else having nothing to do with it. Can anyone help with this?
Below, I have my mod_Coalgen and the method of my BlockCoalgen file. If you want any more files uploaded, ask me.
mod_Coalgen
package net.minecraft.src;
public class mod_Coalgen extends BaseMod
{
public static final Block Coalgen = (new BlockCoalgen(170, false)).setBlockName("coalgen");
public mod_Coalgen()
{
ModLoader.addName(Coalgen, "Coal Generator");
ModLoader.registerBlock(Coalgen);
ModLoader.registerTileEntity(TileEntityCoalgen.class, "Coalgen");
ModLoader.addRecipe(new ItemStack(Coalgen, 1), new Object [] {"###", "###", "###", Character.valueOf('#'), Block.dirt});
Coalgen.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Drewb13/coalgenfront.png");
}
public String getVersion()
{
return "Coal Generator v0.1";
}
@Override
public void load() {
// TODO Auto-generated method stub
}
}
BlockCoalgen
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par1World.isRemote)
{
return true;
}
else
{
TileEntityCoalgen var10 = (TileEntityCoalgen)par1World.getBlockTileEntity(par2, par3, par4);
if (var10 != null)
{
ModLoader.openGUI(par5EntityPlayer, new GuiCoalgen(par5EntityPlayer.inventory, var10));
}
return true;
}
}
I would love to know the answer to this issue, too. I am having the same problem.
EDIT: I found the answer!
In your inventory, NEI should be up. If it isn't, hit O. Then, at the bottom, the search bar for NEI should be yellow. You double clicked it. Double click it again to take it away! WOOT!
Hello. Basically, I made myself a tool set. It works fine, however, when I try to enchant the tools, the levels come up on the enchanting table, but when I click them, nothing happens. Does anyone know how to fix this?
Already found a bug! Sticks are pretty glitchy.. When I threw 7 sticks on the ground then picked them up, they stayed on the ground. Then, when I tried putting two sticks in a stack, it showed as 1, but was 2..
0
0
0
I used your code, and the GUI opens. However, when trying to move stacks of blocks, they just snap back into place. I don't know where that problem could come from, does anyone know?
Thank you, by the way.
0
At the moment, I am at school, but I didn't think of checking that. I will tell you the results whe I get back home.
0
0
0
I may have registered it wrong. In my mod_Coalgen code, there's this line:
Is that right?
0
0
I guess I should have added that I am only using ModLoader, not Forge.
0
I have all of the files. I have SlotCoalgen, TileEntityCoalgen, GuiCoalgen, CoalgenRecipes, and ContainerCoalgen. I didn't post them because I didn't think they would be of importance. I can post them if they help solve the problem.
0
Recently, I made a custom furnace, called, in my code, Coalgen. To make this, I copied the furnace files and replaced all instances of "furnace" with "coalgen," which worked fine. I then registered the TileEntityCoalgen and added the BlockCoalgen in the mod_Coalgen. I had one error, which was a method displaying the GUI, which I fixed (at least I thought). I tested this mod, and was able to craft the block and place it just fine. However, when trying to open the GUI, nothing came up. I would try to place a block on it, and it wouldn't allow it to, which I think means that it's trying to open a GUI, but isn't.
I'm not sure if it has to do with the method I fixed, or something else having nothing to do with it. Can anyone help with this?
Below, I have my mod_Coalgen and the method of my BlockCoalgen file. If you want any more files uploaded, ask me.
mod_Coalgen
BlockCoalgen
0
Eventually most mods will use forge. I'd get used to it now.
12
EDIT: I found the answer!
In your inventory, NEI should be up. If it isn't, hit O. Then, at the bottom, the search bar for NEI should be yellow. You double clicked it. Double click it again to take it away! WOOT!
0
0