I am trying to make a custom furnace and I cant find any good tutorials so I gave it ago on my own but my java knowledge is limited and a lot of it was copy and paste from the furnace. There is no errors and the game runs but when I got in the game and clicked on the furnace the mouse does not show up until you move it out of the gui and if you try to pick something up out of your inventory it just places it back so you cant put anything in it. I tried shift clicking Items into it and it seemed to work but then weird stuff started to happen like the stacks went to 1 and it got the normal furnace texture and spat out some items. I am still learning and would appreciate it if someone took the time to look at this code and tell me where I have gone wrong or at least point me in the direction of a good tutorial. (I am using ModLoader not Forge because I know a lot more about ModLoader and I find it easier so don't tell me to use Forge)
package net.minecraft.src;
import net.minecraft.client.Minecraft;
public class mod_FoodPlus extends BaseMod
{
@Override
public void load()
{
//Register Tile Entities\\
ModLoader.registerTileEntity(net.minecraft.src.TileEntityOven.class, "Oven");
//Register Blocks\\
ModLoader.registerBlock(ovenActive);
//Name Blocks\\
ModLoader.addName(ovenActive, "Oven");
//Name Items\\
ModLoader.addName(flour, "Flour");
//Texture Blocks\\
ovenActive.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Mattyp153/FoodPlus/Blocks/OvenActive.png");
ovenIdle.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Mattyp153/FoodPlus/Blocks/OvenIdle.png");
//Texture Items\\
flour.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mattyp153/FoodPlus/Items/Flour.png");
//Block Recipes\\
ModLoader.addRecipe(new ItemStack(ovenIdle, 1), new Object[]{
"III", "IFI", "III", Character.valueOf('I'), Item.ingotIron, Character.valueOf('F'), Block.stoneOvenIdle
});
//Item Recipes\\
ModLoader.addRecipe(new ItemStack(flour, 1), new Object[]{
"W", Character.valueOf('W'), Item.wheat
});
}
@Override
public String getVersion()
{
return ("v0.1 for MC 1.4.6");
}
//Declare Blocks\\
public static final Block ovenActive = (new BlockOven(200, true)).setBlockName("ovenActive");
public static final Block ovenIdle = (new BlockOven(201, false)).setBlockName("ovenIdle");
//Declare Items\\
public static final Item flour = new Item(550).setItemName("flour");
//Multi Texture\\
public static int oven17 = ModLoader.addOverride("/terrain.png", "/Mattyp153/FoodPlus/Blocks/Oven17.png");
public static int oven16 = ModLoader.addOverride("/terrain.png", "/Mattyp153/FoodPlus/Blocks/Oven16.png");
public static int ovenn1 = ModLoader.addOverride("/terrain.png", "/Mattyp153/FoodPlus/Blocks/Ovenn1.png");
}
package net.minecraft.src;
import java.util.Random;
public class BlockOven extends BlockContainer
{
private Random furnaceRand = new Random();
private final boolean isActive;
private static boolean keepFurnaceInventory = false;
protected BlockOven(int par1, boolean par2)
{
super(par1, Material.iron);
this.isActive = par2;
this.setCreativeTab(CreativeTabs.tabDecorations);
}
public int idDropped(int par1, Random par2Random, int par3)
{
return mod_FoodPlus.ovenIdle.blockID;
}
public void onBlockAdded(World par1World, int par2, int par3, int par4)
{
super.onBlockAdded(par1World, par2, par3, par4);
this.setDefaultDirection(par1World, par2, par3, par4);
}
private void setDefaultDirection(World par1World, int par2, int par3, int par4)
{
if (!par1World.isRemote)
{
int var5 = par1World.getBlockId(par2, par3, par4 - 1);
int var6 = par1World.getBlockId(par2, par3, par4 + 1);
int var7 = par1World.getBlockId(par2 - 1, par3, par4);
int var8 = par1World.getBlockId(par2 + 1, par3, par4);
byte var9 = 3;
if (Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var6])
{
var9 = 3;
}
if (Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var5])
{
var9 = 2;
}
if (Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var8])
{
var9 = 5;
}
if (Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var7])
{
var9 = 4;
}
par1World.setBlockMetadataWithNotify(par2, par3, par4, var9);
}
}
public int getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
if (par5 == 1)
{
return mod_FoodPlus.oven17;
}
else if (par5 == 0)
{
return mod_FoodPlus.oven17;
}
else
{
int var6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
return par5 != var6 ? this.blockIndexInTexture : (this.isActive ? mod_FoodPlus.oven16 : mod_FoodPlus.ovenn1);
}
}
public int getBlockTextureFromSide(int par1)
{
return par1 == 1 ? mod_FoodPlus.oven17 : (par1 == 0 ? mod_FoodPlus.oven17 : (par1 == 3 ? mod_FoodPlus.ovenn1 : this.blockIndexInTexture));
}
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
{
TileEntityOven var10 = (TileEntityOven)par1World.getBlockTileEntity(par2, par3, par4);
if (var10 != null)
{
ModLoader.openGUI(ModLoader.getMinecraftInstance().thePlayer, new GuiOven(ModLoader.getMinecraftInstance().thePlayer.inventory, var10));
}
return true;
}
}
public static void updateFurnaceBlockState(boolean par0, World par1World, int par2, int par3, int par4)
{
int var5 = par1World.getBlockMetadata(par2, par3, par4);
TileEntity var6 = par1World.getBlockTileEntity(par2, par3, par4);
keepFurnaceInventory = true;
if (par0)
{
par1World.setBlockWithNotify(par2, par3, par4, mod_FoodPlus.ovenActive.blockID);
}
else
{
par1World.setBlockWithNotify(par2, par3, par4, mod_FoodPlus.ovenIdle.blockID);
}
keepFurnaceInventory = false;
par1World.setBlockMetadataWithNotify(par2, par3, par4, var5);
if (var6 != null)
{
var6.validate();
par1World.setBlockTileEntity(par2, par3, par4, var6);
}
}
public TileEntity createNewTileEntity(World par1World)
{
return new TileEntityOven();
}
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving)
{
int var6 = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (var6 == 0)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2);
}
if (var6 == 1)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 5);
}
if (var6 == 2)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3);
}
if (var6 == 3)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4);
}
}
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6)
{
if (!keepFurnaceInventory)
{
TileEntityOven var7 = (TileEntityOven)par1World.getBlockTileEntity(par2, par3, par4);
if (var7 != null)
{
for (int var8 = 0; var8 < var7.getSizeInventory(); ++var8)
{
ItemStack var9 = var7.getStackInSlot(var8);
if (var9 != null)
{
float var10 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
float var11 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
float var12 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
while (var9.stackSize > 0)
{
int var13 = this.furnaceRand.nextInt(21) + 10;
if (var13 > var9.stackSize)
{
var13 = var9.stackSize;
}
var9.stackSize -= var13;
EntityItem var14 = new EntityItem(par1World, (double)((float)par2 + var10), (double)((float)par3 + var11), (double)((float)par4 + var12), new ItemStack(var9.itemID, var13, var9.getItemDamage()));
if (var9.hasTagCompound())
{
var14.func_92059_d().setTagCompound((NBTTagCompound)var9.getTagCompound().copy());
}
float var15 = 0.05F;
var14.motionX = (double)((float)this.furnaceRand.nextGaussian() * var15);
var14.motionY = (double)((float)this.furnaceRand.nextGaussian() * var15 + 0.2F);
var14.motionZ = (double)((float)this.furnaceRand.nextGaussian() * var15);
par1World.spawnEntityInWorld(var14);
}
}
}
}
}
super.breakBlock(par1World, par2, par3, par4, par5, par6);
}
}
Forge s even easier than ever, just download unzip and go. After hitting the install cmd that is.... plus I have a good tutorial for this, not sure how it would work for modlaoder, I really recommend try forge again...
Forge s even easier than ever, just download unzip and go. After hitting the install cmd that is.... plus I have a good tutorial for this, not sure how it would work for modlaoder, I really recommend try forge again...
I managed to get Forge working (its much easier since last time I tried) and I started looking for some tutorials but I got lost on every tutorial I tried because most are copy and paste and don't explain anything. I know Forge is much better than ModLoader but its what I know so I think I'm going to stick with it so if anyone knows how to fix my problem in ModLoader please help me.
Have you tried these tutorials here..... and here.... they really helped me alot when I swithched to forge, there are some videos too but cant remember where. The mod class is really the only thing different in forge, there are a few other things, but not much really. Once you get past the tough wade through of the mod class it is actually quite nice what you can do with forge, not to mention the ability to make much larger mods.....
Have you tried these tutorials here..... and here.... they really helped me alot when I swithched to forge, there are some videos too but cant remember where. The mod class is really the only thing different in forge, there are a few other things, but not much really. Once you get past the tough wade through of the mod class it is actually quite nice what you can do with forge, not to mention the ability to make much larger mods.....
I was watching the a video from the first link on setting up a base file and the guy in the video has a bunch of files in his common folder but mine is empty. Do you know why that is? Do I just make my packages in src instead of in common like the tutorial?
In 1.4.6 and 1.4.7 everything is setup by packages now. With modloader you just create your files like normal in hte src folder, with forge in eclipse you create a new package...I call mine microjunk.modname.common. Then in that folder I create a new class, my mod class, and setup my mod file, like in the video. Then I make all my imports, like video, and create all my classes as needed in the common folder. I also create a client folder, though it really isn't needed anymore, and put my client proxy and anything related to the client src or proxy. It really is quite simple, all the other files you saw were for the guys tutorials, if you follow the links in order in the other tuts I linked you to, you will get some good explanations there as well, no videos, but I like it that way better so I can read at my own pace and understand it better....
In 1.4.6 and 1.4.7 everything is setup by packages now. With modloader you just create your files like normal in hte src folder, with forge in eclipse you create a new package...I call mine microjunk.modname.common. Then in that folder I create a new class, my mod class, and setup my mod file, like in the video. Then I make all my imports, like video, and create all my classes as needed in the common folder. I also create a client folder, though it really isn't needed anymore, and put my client proxy and anything related to the client src or proxy. It really is quite simple, all the other files you saw were for the guys tutorials, if you follow the links in order in the other tuts I linked you to, you will get some good explanations there as well, no videos, but I like it that way better so I can read at my own pace and understand it better....
OK I followed the tutorials up to new recipes and I have no errors Minecraft loads and Forge shows my mod has loaded but none of the three new recipes I added work. Can you tell me what I'm doing wrong? Here is my code: (the spoilers are setup exactly like the package and file)
package obsidianplus.common;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
@Mod(modid = "mattyp153_Obsidian_Plus", name = "Obsidian_Plus", version = "[MC1.4.7]v0.2")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class ObsidianPlusCore
{
@Init
public void load()
{
//Add Recipes\\
GameRegistry.addRecipe(new ItemStack(Item.diamond, 1), new Object[]
{
"DDD", "DDD", "DDD", 'D', Block.dirt
});
//Add Shapeless Recipes\\
GameRegistry.addShapelessRecipe(new ItemStack(Item.diamond, 1), new Object[]
{
new ItemStack(Item.coal)
});
//Add Smelting Recipes\\
GameRegistry.addSmelting(Block.blockEmerald.blockID, new ItemStack(Item.diamond, 3), 0.5F);
}
}
OK I followed the tutorials up to new recipes and I have no errors Minecraft loads and Forge shows my mod has loaded but none of the three new recipes I added work. Can you tell me what I'm doing wrong? Here is my code: (the spoilers are setup exactly like the package and file)
package obsidianplus.common;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
@Mod(modid = "mattyp153_Obsidian_Plus", name = "Obsidian_Plus", version = "[MC1.4.7]v0.2")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class ObsidianPlusCore
{
@Init
public void load()
{
//Add Recipes\\
GameRegistry.addRecipe(new ItemStack(Item.diamond, 1), new Object[]
{
"DDD", "DDD", "DDD", 'D', Block.dirt
});
//Add Shapeless Recipes\\
GameRegistry.addShapelessRecipe(new ItemStack(Item.diamond, 1), new Object[]
{
new ItemStack(Item.coal)
});
//Add Smelting Recipes\\
GameRegistry.addSmelting(Block.blockEmerald.blockID, new ItemStack(Item.diamond, 3), 0.5F);
}
}
Possibly because you don't have your client or common proxies set up?
Check out this tutorial -->
I seem to remember having this issue before I did that
Rollback Post to RevisionRollBack
If I helped you, return the favor by pressing the green arrow over there -------------->
Proxies are not an absolute necessity in forge anymore, though they are helpful. As for the furnace not quite working correctly, please have a look at my tutorial here... I know this works I have spent a good bit of time making sure it works as its supposed to. It has all files necessary and there are a few very helpful people following the thread, including myself. the biggest thing is to make sure you have a gui handler...
Proxies are not an absolute necessity in forge anymore, though they are helpful. As for the furnace not quite working correctly, please have a look at my tutorial here... I know this works I have spent a good bit of time making sure it works as its supposed to. It has all files necessary and there are a few very helpful people following the thread, including myself. the biggest thing is to make sure you have a gui handler...
I was just trying some more basic things like adding recipes before I move onto a new furnace because I have never used forge before and if I can't get new recipes to work I don't think I should start on something more complicated. I will try the tutorial QuicK2800 linked before moving onto a new furnace.
Proxies are not an absolute necessity in forge anymore, though they are helpful. As for the furnace not quite working correctly, please have a look at my tutorial here... I know this works I have spent a good bit of time making sure it works as its supposed to. It has all files necessary and there are a few very helpful people following the thread, including myself. the biggest thing is to make sure you have a gui handler...
Are you sure? From what I can tell, they've basically merged the client/server ".jar"'s into one...that being said, there would HAVE to be proxies in order for things to run properly.
Rollback Post to RevisionRollBack
If I helped you, return the favor by pressing the green arrow over there -------------->
my point was that you are trying to make a new furnace, so I linked one in forge format. You can add your recipes to the recipe class, your custom one, or add them to the mod class like this....
YourRecipes.smelting().addSmelting(this.blackOre.blockID, new ItemStack(this.blackIngot), 0.1F);
The only new class you need for your furnace to work is the handler, and registering the handler in the mod class like I have shown in the tutorial. I was only trying to help you with what you had already started above, if you already know how to make blocks and items, there is no need to go backwards and start easy. Forge is very similar to modloader, with the only differences being the mod class and proxies.... follow wuppy tutorials or darkhax for simplicity in getting started with expanding your mod. There are other tutorials too, I have seen many when I started and most are not near as detailed or eplanitive as the two I have mentioned. If you need help you can always PM me for further assistance. I am always glad to help when I can.
Are you sure? From what I can tell, they've basically merged the client/server ".jar"'s into one...that being said, there would HAVE to be proxies in order for things to run properly.
Yes, I agree that they do make things nice, and even easier for many things, I do use proxies, but as far as needing them for the furnace, nothing in the way of the furnace is registered in the proxy. That of course unless you use your common proxy to extend the gui handler. I don't use my proxies for that. I have a separate handler and use my proxies for textures, special tile rendering, and a few other things. Furnaces use packet handling for servers, which my mod is not for server yet as I have not yet got the hang of packets. Proxies divide up the server and client handling, and packets are used to send info to the server. There are also tick handlers and hooks and sound managers. Forge can get messy if you are unsure how to handle things like this, and I have found only a few people are willing to help. Darkhax and jcm2606 have great tutorials for forge, and are starting to put some up in the way of packet handling and gui and more. Most importantly, they are willing to help....
Yes, I agree that they do make things nice, and even easier for many things, I do use proxies, but as far as needing them for the furnace, nothing in the way of the furnace is registered in the proxy. That of course unless you use your common proxy to extend the gui handler. I don't use my proxies for that. I have a separate handler and use my proxies for textures, special tile rendering, and a few other things. Furnaces use packet handling for servers, which my mod is not for server yet as I have not yet got the hang of packets. Proxies divide up the server and client handling, and packets are used to send info to the server. There are also tick handlers and hooks and sound managers. Forge can get messy if you are unsure how to handle things like this, and I have found only a few people are willing to help. Darkhax and jcm2606 have great tutorials for forge, and are starting to put some up in the way of packet handling and gui and more. Most importantly, they are willing to help....
I'll take your word for it! I'm somewhat new to the idea of proxies, although I've been dealing with client-sided, server-sided, and shared scripts for a while with garrysmod LUA.
The reason I suggested adding them was that I remembered the first time I tried making a mod after about a 2 year break from any modding, it didn't work, and then I followed his tutorial with the proxies and all the sudden my items and blocks were in the game whereas they weren't before
Rollback Post to RevisionRollBack
If I helped you, return the favor by pressing the green arrow over there -------------->
I have been using Forge following sciguy1121's tutorials and everything is working so far. Next I'm going to try converting one of my mods from ModLoader to Forge then I will try out microjunk's tutorial on custom furnaces. If any one knows any interesting Forge tutorials please post a link to them for me because I can only ever seem to find out of date or really bad tutorials.
Thats what I was saying earlier, not much good in the way of forge for tuts, thats why I suggested wuppy and darkhax and jcm2606, I will send links later getting ready for shift change at work...When you get better you will be able decipher modloader tuts for forge....
Thank you in advance to anyone who helps.
here...
Find out how I generate....coolAlias...world structure generation and rotation tool...
I managed to get Forge working (its much easier since last time I tried) and I started looking for some tutorials but I got lost on every tutorial I tried because most are copy and paste and don't explain anything. I know Forge is much better than ModLoader but its what I know so I think I'm going to stick with it so if anyone knows how to fix my problem in ModLoader please help me.
Find out how I generate....coolAlias...world structure generation and rotation tool...
I was watching the a video from the first link on setting up a base file and the guy in the video has a bunch of files in his common folder but mine is empty. Do you know why that is? Do I just make my packages in src instead of in common like the tutorial?
Find out how I generate....coolAlias...world structure generation and rotation tool...
OK I followed the tutorials up to new recipes and I have no errors Minecraft loads and Forge shows my mod has loaded but none of the three new recipes I added work. Can you tell me what I'm doing wrong? Here is my code: (the spoilers are setup exactly like the package and file)
Possibly because you don't have your client or common proxies set up?
Check out this tutorial -->
I seem to remember having this issue before I did that
Find out how I generate....coolAlias...world structure generation and rotation tool...
I was just trying some more basic things like adding recipes before I move onto a new furnace because I have never used forge before and if I can't get new recipes to work I don't think I should start on something more complicated. I will try the tutorial QuicK2800 linked before moving onto a new furnace.
Are you sure? From what I can tell, they've basically merged the client/server ".jar"'s into one...that being said, there would HAVE to be proxies in order for things to run properly.
The only new class you need for your furnace to work is the handler, and registering the handler in the mod class like I have shown in the tutorial. I was only trying to help you with what you had already started above, if you already know how to make blocks and items, there is no need to go backwards and start easy. Forge is very similar to modloader, with the only differences being the mod class and proxies.... follow wuppy tutorials or darkhax for simplicity in getting started with expanding your mod. There are other tutorials too, I have seen many when I started and most are not near as detailed or eplanitive as the two I have mentioned. If you need help you can always PM me for further assistance. I am always glad to help when I can.
Find out how I generate....coolAlias...world structure generation and rotation tool...
Yes, I agree that they do make things nice, and even easier for many things, I do use proxies, but as far as needing them for the furnace, nothing in the way of the furnace is registered in the proxy. That of course unless you use your common proxy to extend the gui handler. I don't use my proxies for that. I have a separate handler and use my proxies for textures, special tile rendering, and a few other things. Furnaces use packet handling for servers, which my mod is not for server yet as I have not yet got the hang of packets. Proxies divide up the server and client handling, and packets are used to send info to the server. There are also tick handlers and hooks and sound managers. Forge can get messy if you are unsure how to handle things like this, and I have found only a few people are willing to help. Darkhax and jcm2606 have great tutorials for forge, and are starting to put some up in the way of packet handling and gui and more. Most importantly, they are willing to help....
Find out how I generate....coolAlias...world structure generation and rotation tool...
I'll take your word for it! I'm somewhat new to the idea of proxies, although I've been dealing with client-sided, server-sided, and shared scripts for a while with garrysmod LUA.
The reason I suggested adding them was that I remembered the first time I tried making a mod after about a 2 year break from any modding, it didn't work, and then I followed his tutorial with the proxies and all the sudden my items and blocks were in the game whereas they weren't before
Find out how I generate....coolAlias...world structure generation and rotation tool...