As I will be very busy this weekend with work two 8 hour days, and two 14 hour days, would you mind sharing what you did to fix your issues so that others with similar issues can benefit from your experience. Also the fuel is handles in the tile entity near the bottom of the code. Just change the fuel to whatever you want, and you can also change the speed and rate. If you get confused on how this works, check wuppy's tutorials at custom fuel and you will see what the numbers are for...
I didn't say use this tutorial for making a new fuel, I said it was to understand the numbersfor fuel speed and how much and item can smelt. It explains it quite well in his fuel tut what the numbers are for, they are the same numbers used in the tileentity for the smaelting process. I am not sure what numbers do what exactly off the top of my head, but follow that tutorial and it explains quite a bit of it. The process is handled by the tileentity so use those numbers and play around with it, I am sure you'll get it....
I've read through it like 5 times but I still cannot see where it explains the furnace cooking time. I can only find how long the fuel cooks for. I must be blind. Can someone point it out?
I beleive you will want to mess around with this part of the code in your TileEntity class
Thank you, I believe you are right, but still like I said, in the tile entity... nice avatar by the way, love that show, too bad its coming to an end this summer.
Thank you, I believe you are right, but still like I said, in the tile entity... nice avatar by the way, love that show, too bad its coming to an end this summer.
Will this say the lower the number on the right side, the faster it will melt? or the other way around?
Thank you, I believe you are right, but still like I said, in the tile entity... nice avatar by the way, love that show, too bad its coming to an end this summer.
Why thank you and I should be ashamed but I haven't got to watch it for a few seasons =c[
Yeah, its not just that. That makes the gui go slow but not the actual furnace. I found a way to do it.
1. Press CTRL + F while in the TileEnitityClass, and put in the 'find' slot: 200, then in the 'replace' slot: 'The value you want' (The higher the number the longer it takes).
2. Click Replace all.
3. ????
4. PROFIT!
1. Texture for GUI doesn't work (the path is correct and it's png)
2. Breaking block while burning(with and without ore) crashes
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem; Ticking memory connection
A full error report has been saved to C:\Users\Simon\Desktop\MCP 1.4.7 FasterFurnaces\jars\.\crash-reports\crash-2013-01-12_02.18.18-server.txt - Please include a copy of that file (Not this screen!) if you report this crash to anyone; without it, they will not be able to help fix the crash
--- BEGIN ERROR REPORT 7a295815 --------
Full report at:
C:\Users\Simon\Desktop\MCP 1.4.7 FasterFurnaces\jars\.\crash-reports\crash-2013-01-12_02.18.18-server.txt
Please show that file to Mojang, NOT just this screen!
Generated 12.01.13 02:18
-- System Details --
Details:
Minecraft Version: 1.4.7
Operating System: Windows 8 (x86) version 6.2
Java Version: 1.7.0_09, Oracle Corporation
Java VM Version: Java HotSpotâ„¢ Client VM (mixed mode), Oracle Corporation
Memory: 680768160 bytes (649 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 1303 (72968 bytes; 0 MB) allocated, 1018 (57008 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.26 FML v4.7.3.519 Minecraft Forge 6.6.0.494 4 mods loaded, 4 mods active
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
fasterFurnaces [Faster Furnaces] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 113 (6328 bytes; 0 MB) allocated, 111 (6216 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP['Player161'/50, l='New World', x=1270,70, y=4,00, z=-1741,89]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'forge,fml'
java.lang.ClassCastException: xKashanx.minecraft.fasterfurnace.TileEntityFurnaceIron cannot be cast to net.minecraft.tileentity.TileEntityFurnace
at net.minecraft.block.BlockFurnace.breakBlock(BlockFurnace.java:257)
at net.minecraft.world.chunk.Chunk.setBlockIDWithMetadata(Chunk.java:721)
at net.minecraft.world.chunk.Chunk.setBlockID(Chunk.java:663)
at net.minecraft.world.World.setBlock(World.java:588)
at net.minecraft.world.World.setBlockWithNotify(World.java:697)
at net.minecraft.block.Block.removeBlockByPlayer(Block.java:1537)
at net.minecraft.item.ItemInWorldManager.removeBlock(ItemInWorldManager.java:274)
at net.minecraft.item.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:307)
at net.minecraft.item.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:170)
at net.minecraft.network.NetServerHandler.handleBlockDig(NetServerHandler.java:509)
at net.minecraft.network.packet.Packet14BlockDig.processPacket(Packet14BlockDig.java:67)
at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:80)
at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:136)
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:57)
at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:108)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:599)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:123)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:497)
at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
--- END ERROR REPORT 25f06803 ----------
3. Only iron ore can be smelted(no cobblestone, no sand, no carrot, no potato, no everything)
Okay, for your texture, is it registered in the client proxy? and then in the GuiFurnace? For the crash, try copying the code from the furnace for all, and change the names of the basic stuff involved to your furnace, making it basically the vanilla one but referencing your files. As for the recipes, add or change the recipes in the furnacerecipes file. Also for adding recipes, instead of gameregistry.addsmelting, its 'yourfurnace'.addsmelting
The problem with breaking the block while its trying to smelt is its trying to cast it as the origanal Furnace Entity instead of your created one, you need to look in your TileWhateverName file and make sure you have replaced any code that still says the default furnace
The problem with breaking the block while its trying to smelt is its trying to cast it as the origanal Furnace Entity instead of your created one, you need to look in your TileWhateverName file and make sure you have replaced any code that still says the default furnace
thank you.... Also the problem most people seem to have is, not willing to learn (sorry if this seems rude), but use tutorials as a reference, not a copy and paste tool. I even said look at the original classes. You could even use the original classes and add a GUIHandler, register the whole thing with the new furnace names as long as any reference to original furnace is replaced with your furnace and it will work, would probably be best to do it this way to start with as my tutorial implies. This is simply a guide on how I did it, if you just copy and paste you will lose one important thing, KNOWLEDGE....
I used to be a member some where else a while ago, different type of forum not minecraft related, and my forum name was dumbfounded (the look and expression of avatar face says it all. Plus my dad was a hogans hero fan, and I watched it some growing up too, so I like it, makes me feel fuzzy inside...
no problem, glad to help where i can, not the best of coder but i try and learn what i can. I actually ended up going off your tut and having that same error and ended up doing it from complete scratch before i figured out my problem. Now im stuck on texturing it lol
I use the ingame textures for this, I am not quite sure how to implement my own texture with the code it uses, because part of it is for player facing. I can do multi textures, just not the facing code yet....still learning that one myself....
remember to change the part of the code in @Override public String getTextureFile(){ return Strings.MACHINES_TEXTURES; } from Strings.MACHINES_TEXTURES to wherever your texture path is
Thanks again for the help....yes its like a regular anything else, different block, item...different id. It also not necessary but I use a different GUIHandler for each of the GUI's I use, just to keep it neat and simple.
Also, if the tides don't suck me out to reality, and life doesn't blow me down a few more dark alleys, the crafting table should be up this week....
This is the Original Crafting table code, only one small subtlety in the code when it is changed
public class BlockWorkbench extends Block
{
protected BlockWorkbench(int par1)
{
super(par1, Material.wood);
this.blockIndexInTexture = 59;
this.setCreativeTab(CreativeTabs.tabDecorations);
}
/**
* Returns the block texture based on the side being looked at. Args: side
*/
public int getBlockTextureFromSide(int par1)
{
return par1 == 1 ? this.blockIndexInTexture - 16 : (par1 == 0 ? Block.planks.getBlockTextureFromSide(0) : (par1 != 2 && par1 != 4 ? this.blockIndexInTexture : this.blockIndexInTexture + 1));
}
/**
* Called upon block activation (right click on the block.)
*/
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
{
par5EntityPlayer.displayGUIWorkbench(par2, par3, par4);
return true;
}
}
}
And the new crafting table below, notice the change in the onBlockActivated method.
This is very important, other wise the gui will not open...
public class BlockSmithsBench extends Block
{
public BlockSmithsBench(int par1, int par2)
{
super(par1, par2, Material.wood);
blockIndexInTexture = 59;
this.setCreativeTab(Trees.tabTreeThings);
}
/**
* Returns the block texture based on the side being looked at. Args: side
*/
public int getBlockTextureFromSide(int par1)
{
return par1 == 1 ? this.blockIndexInTexture - 16 : (par1 == 1 ? Block.planks.getBlockTextureFromSide(0) : (par1 != 2 && par1 != 4 ? this.blockIndexInTexture : this.blockIndexInTexture + 1));
}
public boolean onBlockActivated(World var1, int var2, int var3, int var4, EntityPlayer player, int var6, float var7, float var8, float var9)
{
if (!player.isSneaking())
{
player.openGui(Trees.instance, 1, var1, var2, var3, var4);
return true;
}
else
{
return false;
}
}
}
Below is the original GUi Crafting
public class GuiCrafting extends GuiContainer
{
public GuiCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
{
super(new ContainerWorkbench(par1InventoryPlayer, par2World, par3, par4, par5));
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
this.fontRenderer.drawString(StatCollector.translateToLocal("container.crafting"), 28, 6, 4210752);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
/**
* Draw the background layer for the GuiContainer (everything behind the items)
*/
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
int var4 = this.mc.renderEngine.getTexture("/gui/crafting.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture(var4);
int var5 = (this.width - this.xSize) / 2;
int var6 = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
}
}
Ours is going to be very similar, only changes will be with the location of the texture,
Make sure you set the path correctly and register your image. I use the original image for mine
but you can customize your if you choose, just remember to set the path
public class GuiSmithsCrafting extends GuiContainer
{
public GuiSmithsCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
{
super(new ContainerSmithsBench(par1InventoryPlayer, par2World, par3, par4, par5));
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
this.fontRenderer.drawString(StatCollector.translateToLocal("container.crafting"), 28, 6, 4210752);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
/**
* Draw the background layer for the GuiContainer (everything behind the items)
*/
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
int var4 = this.mc.renderEngine.getTexture("/microjunk/trees/common/Smiths.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture(var4);
int var5 = (this.width - this.xSize) / 2;
int var6 = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
}
}
Now lets look at the container, this is the original container below
public class ContainerWorkbench extends Container
{
/** The crafting matrix inventory (3x3). */
public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
public IInventory craftResult = new InventoryCraftResult();
private World worldObj;
private int posX;
private int posY;
private int posZ;
public ContainerWorkbench(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
{
this.worldObj = par2World;
this.posX = par3;
this.posY = par4;
this.posZ = par5;
this.addSlotToContainer(new SlotCrafting(par1InventoryPlayer.player, this.craftMatrix, this.craftResult, 0, 124, 35));
int var6;
int var7;
for (var6 = 0; var6 < 3; ++var6)
{
for (var7 = 0; var7 < 3; ++var7)
{
this.addSlotToContainer(new Slot(this.craftMatrix, var7 + var6 * 3, 30 + var7 * 18, 17 + var6 * 18));
}
}
for (var6 = 0; var6 < 3; ++var6)
{
for (var7 = 0; var7 < 9; ++var7)
{
this.addSlotToContainer(new Slot(par1InventoryPlayer, var7 + var6 * 9 + 9, 8 + var7 * 18, 84 + var6 * 18));
}
}
for (var6 = 0; var6 < 9; ++var6)
{
this.addSlotToContainer(new Slot(par1InventoryPlayer, var6, 8 + var6 * 18, 142));
}
this.onCraftMatrixChanged(this.craftMatrix);
}
/**
* Callback for when the crafting matrix is changed.
*/
public void onCraftMatrixChanged(IInventory par1IInventory)
{
this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
}
/**
* Callback for when the crafting gui is closed.
*/
public void onCraftGuiClosed(EntityPlayer par1EntityPlayer)
{
super.onCraftGuiClosed(par1EntityPlayer);
if (!this.worldObj.isRemote)
{
for (int var2 = 0; var2 < 9; ++var2)
{
ItemStack var3 = this.craftMatrix.getStackInSlotOnClosing(var2);
if (var3 != null)
{
par1EntityPlayer.dropPlayerItem(var3);
}
}
}
}
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
{
return this.worldObj.getBlockId(this.posX, this.posY, this.posZ) != Block.workbench.blockID ? false : par1EntityPlayer.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D;
}
/**
* Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
*/
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
{
ItemStack var3 = null;
Slot var4 = (Slot)this.inventorySlots.get(par2);
if (var4 != null && var4.getHasStack())
{
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if (par2 == 0)
{
if (!this.mergeItemStack(var5, 10, 46, true))
{
return null;
}
var4.onSlotChange(var5, var3);
}
else if (par2 >= 10 && par2 < 37)
{
if (!this.mergeItemStack(var5, 37, 46, false))
{
return null;
}
}
else if (par2 >= 37 && par2 < 46)
{
if (!this.mergeItemStack(var5, 10, 37, false))
{
return null;
}
}
else if (!this.mergeItemStack(var5, 10, 46, false))
{
return null;
}
if (var5.stackSize == 0)
{
var4.putStack((ItemStack)null);
}
else
{
var4.onSlotChanged();
}
if (var5.stackSize == var3.stackSize)
{
return null;
}
var4.onPickupFromSlot(par1EntityPlayer, var5);
}
return var3;
}
}
This is my modified Container below, notice the changes
public class ContainerSmithsBench extends Container
{
/** The crafting matrix inventory (3x3). */
public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
public IInventory craftResult = new InventoryCraftResult();
private World worldObj;
private int posX;
private int posY;
private int posZ;
public ContainerSmithsBench(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
{
this.worldObj = par2World;
this.posX = par3;
this.posY = par4;
this.posZ = par5;
this.addSlotToContainer(new SlotSmithsCrafting(par1InventoryPlayer.player, this.craftMatrix, this.craftResult, 0, 124, 35));
int var6;
int var7;
for (var6 = 0; var6 < 3; ++var6)
{
for (var7 = 0; var7 < 3; ++var7)
{
this.addSlotToContainer(new Slot(this.craftMatrix, var7 + var6 * 3, 30 + var7 * 18, 17 + var6 * 18));
}
}
for (var6 = 0; var6 < 3; ++var6)
{
for (var7 = 0; var7 < 9; ++var7)
{
this.addSlotToContainer(new Slot(par1InventoryPlayer, var7 + var6 * 9 + 9, 8 + var7 * 18, 84 + var6 * 18));
}
}
for (var6 = 0; var6 < 9; ++var6)
{
this.addSlotToContainer(new Slot(par1InventoryPlayer, var6, 8 + var6 * 18, 142));
}
this.onCraftMatrixChanged(this.craftMatrix);
}
/**
* Callback for when the crafting matrix is changed.
*/
public void onCraftMatrixChanged(IInventory par1IInventory)
{
this.craftResult.setInventorySlotContents(0, SmithsCraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
}
/**
* Callback for when the crafting gui is closed.
*/
public void onCraftGuiClosed(EntityPlayer par1EntityPlayer)
{
super.onCraftGuiClosed(par1EntityPlayer);
if (!this.worldObj.isRemote)
{
for (int var2 = 0; var2 < 9; ++var2)
{
ItemStack var3 = this.craftMatrix.getStackInSlotOnClosing(var2);
if (var3 != null)
{
par1EntityPlayer.dropPlayerItem(var3);
}
}
}
}
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
{
return this.worldObj.getBlockId(this.posX, this.posY, this.posZ) != Trees.smithsBench.blockID ? false : par1EntityPlayer.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D;
}
/**
* Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
*/
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
{
ItemStack var3 = null;
Slot var4 = (Slot)this.inventorySlots.get(par2);
if (var4 != null && var4.getHasStack())
{
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if (par2 == 0)
{
if (!this.mergeItemStack(var5, 10, 46, true))
{
return null;
}
var4.onSlotChange(var5, var3);
}
else if (par2 >= 10 && par2 < 37)
{
if (!this.mergeItemStack(var5, 37, 46, false))
{
return null;
}
}
else if (par2 >= 37 && par2 < 46)
{
if (!this.mergeItemStack(var5, 10, 37, false))
{
return null;
}
}
else if (!this.mergeItemStack(var5, 10, 46, false))
{
return null;
}
if (var5.stackSize == 0)
{
var4.putStack((ItemStack)null);
}
else
{
var4.onSlotChanged();
}
if (var5.stackSize == var3.stackSize)
{
return null;
}
var4.onPickupFromSlot(par1EntityPlayer, var5);
}
return var3;
}
}
Make sure to spot the changes here, or your gui will not open and other features will not work as well
make sure the new slot references you slot
public ContainerSmithsBench(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
{
this.worldObj = par2World;
this.posX = par3;
this.posY = par4;
this.posZ = par5;
this.addSlotToContainer(new SlotSmithsCrafting(par1InventoryPlayer.player, this.craftMatrix, this.craftResult, 0, 124, 35));
int var6;
int var7;
Make sure this section references your crafting manager
public void onCraftMatrixChanged(IInventory par1IInventory)
{
this.craftResult.setInventorySlotContents(0, SmithsCraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
}
This section here is most important of all, check to be sure your block is called here
or the gui will not stay open
Now lets look at SlotCrafting, this is where you can add custom achievments and things
public class SlotCrafting extends Slot
{
/** The craft matrix inventory linked to this result slot. */
private final IInventory craftMatrix;
/** The player that is using the GUI where this slot resides. */
private EntityPlayer thePlayer;
/**
* The number of items that have been crafted so far. Gets passed to ItemStack.onCrafting before being reset.
*/
private int amountCrafted;
public SlotCrafting(EntityPlayer par1EntityPlayer, IInventory par2IInventory, IInventory par3IInventory, int par4, int par5, int par6)
{
super(par3IInventory, par4, par5, par6);
this.thePlayer = par1EntityPlayer;
this.craftMatrix = par2IInventory;
}
/**
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
*/
public boolean isItemValid(ItemStack par1ItemStack)
{
return false;
}
/**
* Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new
* stack.
*/
public ItemStack decrStackSize(int par1)
{
if (this.getHasStack())
{
this.amountCrafted += Math.min(par1, this.getStack().stackSize);
}
return super.decrStackSize(par1);
}
/**
* the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an
* internal count then calls onCrafting(item).
*/
protected void onCrafting(ItemStack par1ItemStack, int par2)
{
this.amountCrafted += par2;
this.onCrafting(par1ItemStack);
}
/**
* the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
*/
protected void onCrafting(ItemStack par1ItemStack)
{
par1ItemStack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted);
this.amountCrafted = 0;
if (par1ItemStack.itemID == Block.workbench.blockID)
{
this.thePlayer.addStat(AchievementList.buildWorkBench, 1);
}
else if (par1ItemStack.itemID == Item.pickaxeWood.itemID)
{
this.thePlayer.addStat(AchievementList.buildPickaxe, 1);
}
else if (par1ItemStack.itemID == Block.stoneOvenIdle.blockID)
{
this.thePlayer.addStat(AchievementList.buildFurnace, 1);
}
else if (par1ItemStack.itemID == Item.hoeWood.itemID)
{
this.thePlayer.addStat(AchievementList.buildHoe, 1);
}
else if (par1ItemStack.itemID == Item.bread.itemID)
{
this.thePlayer.addStat(AchievementList.makeBread, 1);
}
else if (par1ItemStack.itemID == Item.cake.itemID)
{
this.thePlayer.addStat(AchievementList.bakeCake, 1);
}
else if (par1ItemStack.itemID == Item.pickaxeStone.itemID)
{
this.thePlayer.addStat(AchievementList.buildBetterPickaxe, 1);
}
else if (par1ItemStack.itemID == Item.swordWood.itemID)
{
this.thePlayer.addStat(AchievementList.buildSword, 1);
}
else if (par1ItemStack.itemID == Block.enchantmentTable.blockID)
{
this.thePlayer.addStat(AchievementList.enchantments, 1);
}
else if (par1ItemStack.itemID == Block.bookShelf.blockID)
{
this.thePlayer.addStat(AchievementList.bookcase, 1);
}
}
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack)
{
GameRegistry.onItemCrafted(par1EntityPlayer, par2ItemStack, craftMatrix);
this.onCrafting(par2ItemStack);
for (int var3 = 0; var3 < this.craftMatrix.getSizeInventory(); ++var3)
{
ItemStack var4 = this.craftMatrix.getStackInSlot(var3);
if (var4 != null)
{
this.craftMatrix.decrStackSize(var3, 1);
if (var4.getItem().hasContainerItem())
{
ItemStack var5 = var4.getItem().getContainerItemStack(var4);
if (var5.isItemStackDamageable() && var5.getItemDamage() > var5.getMaxDamage())
{
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, var5));
var5 = null;
}
if (var5 != null && (!var4.getItem().doesContainerItemLeaveCraftingGrid(var4) || !this.thePlayer.inventory.addItemStackToInventory(var5)))
{
if (this.craftMatrix.getStackInSlot(var3) == null)
{
this.craftMatrix.setInventorySlotContents(var3, var5);
}
else
{
this.thePlayer.dropPlayerItem(var5);
}
}
}
}
}
}
}
There are not very many changes here other than the title
public class SlotSmithsCrafting extends Slot
{
/** The craft matrix inventory linked to this result slot. */
private final IInventory craftMatrix;
/** The player that is using the GUI where this slot resides. */
private EntityPlayer thePlayer;
/**
* The number of items that have been crafted so far. Gets passed to ItemStack.onCrafting before being reset.
*/
private int amountCrafted;
public SlotSmithsCrafting(EntityPlayer par1EntityPlayer, IInventory par2IInventory, IInventory par3IInventory, int par4, int par5, int par6)
{
super(par3IInventory, par4, par5, par6);
this.thePlayer = par1EntityPlayer;
this.craftMatrix = par2IInventory;
}
/**
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
*/
public boolean isItemValid(ItemStack par1ItemStack)
{
return false;
}
/**
* Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new
* stack.
*/
public ItemStack decrStackSize(int par1)
{
if (this.getHasStack())
{
this.amountCrafted += Math.min(par1, this.getStack().stackSize);
}
return super.decrStackSize(par1);
}
/**
* the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an
* internal count then calls onCrafting(item).
*/
protected void onCrafting(ItemStack par1ItemStack, int par2)
{
this.amountCrafted += par2;
this.onCrafting(par1ItemStack);
}
/**
* the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
*/
protected void onCrafting(ItemStack par1ItemStack)
{
par1ItemStack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted);
this.amountCrafted = 0;
if (par1ItemStack.itemID == Block.workbench.blockID)
{
this.thePlayer.addStat(AchievementList.buildWorkBench, 1);
}
else if (par1ItemStack.itemID == Item.pickaxeWood.itemID)
{
this.thePlayer.addStat(AchievementList.buildPickaxe, 1);
}
else if (par1ItemStack.itemID == Block.stoneOvenIdle.blockID)
{
this.thePlayer.addStat(AchievementList.buildFurnace, 1);
}
else if (par1ItemStack.itemID == Item.hoeWood.itemID)
{
this.thePlayer.addStat(AchievementList.buildHoe, 1);
}
else if (par1ItemStack.itemID == Item.bread.itemID)
{
this.thePlayer.addStat(AchievementList.makeBread, 1);
}
else if (par1ItemStack.itemID == Item.cake.itemID)
{
this.thePlayer.addStat(AchievementList.bakeCake, 1);
}
else if (par1ItemStack.itemID == Item.pickaxeStone.itemID)
{
this.thePlayer.addStat(AchievementList.buildBetterPickaxe, 1);
}
else if (par1ItemStack.itemID == Item.swordWood.itemID)
{
this.thePlayer.addStat(AchievementList.buildSword, 1);
}
else if (par1ItemStack.itemID == Block.enchantmentTable.blockID)
{
this.thePlayer.addStat(AchievementList.enchantments, 1);
}
else if (par1ItemStack.itemID == Block.bookShelf.blockID)
{
this.thePlayer.addStat(AchievementList.bookcase, 1);
}
}
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack)
{
GameRegistry.onItemCrafted(par1EntityPlayer, par2ItemStack, craftMatrix);
this.onCrafting(par2ItemStack);
for (int var3 = 0; var3 < this.craftMatrix.getSizeInventory(); ++var3)
{
ItemStack var4 = this.craftMatrix.getStackInSlot(var3);
if (var4 != null)
{
this.craftMatrix.decrStackSize(var3, 1);
if (var4.getItem().hasContainerItem())
{
ItemStack var5 = var4.getItem().getContainerItemStack(var4);
if (var5.isItemStackDamageable() && var5.getItemDamage() > var5.getMaxDamage())
{
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, var5));
var5 = null;
}
if (var5 != null && (!var4.getItem().doesContainerItemLeaveCraftingGrid(var4) || !this.thePlayer.inventory.addItemStackToInventory(var5)))
{
if (this.craftMatrix.getStackInSlot(var3) == null)
{
this.craftMatrix.setInventorySlotContents(var3, var5);
}
else
{
this.thePlayer.dropPlayerItem(var5);
}
}
}
}
}
}
}
Now for the CraftingManager, this is one place you can add new recipes for your table
public class CraftingManager
{
/** The static instance of this class */
private static final CraftingManager instance = new CraftingManager();
/** A list of all the recipes added */
private List recipes = new ArrayList();
/**
* Returns the static instance of this class
*/
public static final CraftingManager getInstance()
{
return instance;
}
private CraftingManager()
{
(new RecipesTools()).addRecipes(this);
(new RecipesWeapons()).addRecipes(this);
(new RecipesIngots()).addRecipes(this);
(new RecipesFood()).addRecipes(this);
(new RecipesCrafting()).addRecipes(this);
(new RecipesArmor()).addRecipes(this);
(new RecipesDyes()).addRecipes(this);
this.recipes.add(new RecipesArmorDyes());
this.recipes.add(new RecipesMapCloning());
this.recipes.add(new RecipesMapExtending());
this.recipes.add(new RecipeFireworks());
this.func_92051_a(new ItemStack(Item.paper, 3), new Object[] {"###", '#', Item.reed});
this.addShapelessRecipe(new ItemStack(Item.book, 1), new Object[] {Item.paper, Item.paper, Item.paper, Item.leather});
this.addShapelessRecipe(new ItemStack(Item.writableBook, 1), new Object[] {Item.book, new ItemStack(Item.dyePowder, 1, 0), Item.feather});
this.func_92051_a(new ItemStack(Block.fence, 2), new Object[] {"###", "###", '#', Item.stick});
this.func_92051_a(new ItemStack(Block.cobblestoneWall, 6, 0), new Object[] {"###", "###", '#', Block.cobblestone});
this.func_92051_a(new ItemStack(Block.cobblestoneWall, 6, 1), new Object[] {"###", "###", '#', Block.cobblestoneMossy});
this.func_92051_a(new ItemStack(Block.netherFence, 6), new Object[] {"###", "###", '#', Block.netherBrick});
this.func_92051_a(new ItemStack(Block.fenceGate, 1), new Object[] {"#W#", "#W#", '#', Item.stick, 'W', Block.planks});
this.func_92051_a(new ItemStack(Block.jukebox, 1), new Object[] {"###", "#X#", "###", '#', Block.planks, 'X', Item.diamond});
this.func_92051_a(new ItemStack(Block.music, 1), new Object[] {"###", "#X#", "###", '#', Block.planks, 'X', Item.redstone});
this.func_92051_a(new ItemStack(Block.bookShelf, 1), new Object[] {"###", "XXX", "###", '#', Block.planks, 'X', Item.book});
this.func_92051_a(new ItemStack(Block.blockSnow, 1), new Object[] {"##", "##", '#', Item.snowball});
this.func_92051_a(new ItemStack(Block.blockClay, 1), new Object[] {"##", "##", '#', Item.clay});
this.func_92051_a(new ItemStack(Block.brick, 1), new Object[] {"##", "##", '#', Item.brick});
this.func_92051_a(new ItemStack(Block.glowStone, 1), new Object[] {"##", "##", '#', Item.lightStoneDust});
this.func_92051_a(new ItemStack(Block.cloth, 1), new Object[] {"##", "##", '#', Item.silk});
this.func_92051_a(new ItemStack(Block.tnt, 1), new Object[] {"X#X", "#X#", "X#X", 'X', Item.gunpowder, '#', Block.sand});
this.func_92051_a(new ItemStack(Block.stoneSingleSlab, 6, 3), new Object[] {"###", '#', Block.cobblestone});
this.func_92051_a(new ItemStack(Block.stoneSingleSlab, 6, 0), new Object[] {"###", '#', Block.stone});
this.func_92051_a(new ItemStack(Block.stoneSingleSlab, 6, 1), new Object[] {"###", '#', Block.sandStone});
this.func_92051_a(new ItemStack(Block.stoneSingleSlab, 6, 4), new Object[] {"###", '#', Block.brick});
this.func_92051_a(new ItemStack(Block.stoneSingleSlab, 6, 5), new Object[] {"###", '#', Block.stoneBrick});
this.func_92051_a(new ItemStack(Block.stoneSingleSlab, 6, 6), new Object[] {"###", '#', Block.netherBrick});
this.func_92051_a(new ItemStack(Block.woodSingleSlab, 6, 0), new Object[] {"###", '#', new ItemStack(Block.planks, 1, 0)});
this.func_92051_a(new ItemStack(Block.woodSingleSlab, 6, 2), new Object[] {"###", '#', new ItemStack(Block.planks, 1, 2)});
this.func_92051_a(new ItemStack(Block.woodSingleSlab, 6, 1), new Object[] {"###", '#', new ItemStack(Block.planks, 1, 1)});
this.func_92051_a(new ItemStack(Block.woodSingleSlab, 6, 3), new Object[] {"###", '#', new ItemStack(Block.planks, 1, 3)});
this.func_92051_a(new ItemStack(Block.ladder, 3), new Object[] {"# #", "###", "# #", '#', Item.stick});
this.func_92051_a(new ItemStack(Item.doorWood, 1), new Object[] {"##", "##", "##", '#', Block.planks});
this.func_92051_a(new ItemStack(Block.trapdoor, 2), new Object[] {"###", "###", '#', Block.planks});
this.func_92051_a(new ItemStack(Item.doorSteel, 1), new Object[] {"##", "##", "##", '#', Item.ingotIron});
this.func_92051_a(new ItemStack(Item.sign, 3), new Object[] {"###", "###", " X ", '#', Block.planks, 'X', Item.stick});
this.func_92051_a(new ItemStack(Item.cake, 1), new Object[] {"AAA", "BEB", "CCC", 'A', Item.bucketMilk, 'B', Item.sugar, 'C', Item.wheat, 'E', Item.egg});
this.func_92051_a(new ItemStack(Item.sugar, 1), new Object[] {"#", '#', Item.reed});
this.func_92051_a(new ItemStack(Block.planks, 4, 0), new Object[] {"#", '#', new ItemStack(Block.wood, 1, 0)});
this.func_92051_a(new ItemStack(Block.planks, 4, 1), new Object[] {"#", '#', new ItemStack(Block.wood, 1, 1)});
this.func_92051_a(new ItemStack(Block.planks, 4, 2), new Object[] {"#", '#', new ItemStack(Block.wood, 1, 2)});
this.func_92051_a(new ItemStack(Block.planks, 4, 3), new Object[] {"#", '#', new ItemStack(Block.wood, 1, 3)});
this.func_92051_a(new ItemStack(Item.stick, 4), new Object[] {"#", "#", '#', Block.planks});
this.func_92051_a(new ItemStack(Block.torchWood, 4), new Object[] {"X", "#", 'X', Item.coal, '#', Item.stick});
this.func_92051_a(new ItemStack(Block.torchWood, 4), new Object[] {"X", "#", 'X', new ItemStack(Item.coal, 1, 1), '#', Item.stick});
this.func_92051_a(new ItemStack(Item.bowlEmpty, 4), new Object[] {"# #", " # ", '#', Block.planks});
this.func_92051_a(new ItemStack(Item.glassBottle, 3), new Object[] {"# #", " # ", '#', Block.glass});
this.func_92051_a(new ItemStack(Block.rail, 16), new Object[] {"X X", "X#X", "X X", 'X', Item.ingotIron, '#', Item.stick});
this.func_92051_a(new ItemStack(Block.railPowered, 6), new Object[] {"X X", "X#X", "XRX", 'X', Item.ingotGold, 'R', Item.redstone, '#', Item.stick});
this.func_92051_a(new ItemStack(Block.railDetector, 6), new Object[] {"X X", "X#X", "XRX", 'X', Item.ingotIron, 'R', Item.redstone, '#', Block.pressurePlateStone});
this.func_92051_a(new ItemStack(Item.minecartEmpty, 1), new Object[] {"# #", "###", '#', Item.ingotIron});
this.func_92051_a(new ItemStack(Item.cauldron, 1), new Object[] {"# #", "# #", "###", '#', Item.ingotIron});
this.func_92051_a(new ItemStack(Item.brewingStand, 1), new Object[] {" B ", "###", '#', Block.cobblestone, 'B', Item.blazeRod});
this.func_92051_a(new ItemStack(Block.pumpkinLantern, 1), new Object[] {"A", "B", 'A', Block.pumpkin, 'B', Block.torchWood});
this.func_92051_a(new ItemStack(Item.minecartCrate, 1), new Object[] {"A", "B", 'A', Block.chest, 'B', Item.minecartEmpty});
this.func_92051_a(new ItemStack(Item.minecartPowered, 1), new Object[] {"A", "B", 'A', Block.stoneOvenIdle, 'B', Item.minecartEmpty});
this.func_92051_a(new ItemStack(Item.boat, 1), new Object[] {"# #", "###", '#', Block.planks});
this.func_92051_a(new ItemStack(Item.bucketEmpty, 1), new Object[] {"# #", " # ", '#', Item.ingotIron});
this.func_92051_a(new ItemStack(Item.flowerPot, 1), new Object[] {"# #", " # ", '#', Item.brick});
this.func_92051_a(new ItemStack(Item.flintAndSteel, 1), new Object[] {"A ", " B", 'A', Item.ingotIron, 'B', Item.flint});
this.func_92051_a(new ItemStack(Item.bread, 1), new Object[] {"###", '#', Item.wheat});
this.func_92051_a(new ItemStack(Block.stairCompactPlanks, 4), new Object[] {"# ", "## ", "###", '#', new ItemStack(Block.planks, 1, 0)});
this.func_92051_a(new ItemStack(Block.stairsWoodBirch, 4), new Object[] {"# ", "## ", "###", '#', new ItemStack(Block.planks, 1, 2)});
this.func_92051_a(new ItemStack(Block.stairsWoodSpruce, 4), new Object[] {"# ", "## ", "###", '#', new ItemStack(Block.planks, 1, 1)});
this.func_92051_a(new ItemStack(Block.stairsWoodJungle, 4), new Object[] {"# ", "## ", "###", '#', new ItemStack(Block.planks, 1, 3)});
this.func_92051_a(new ItemStack(Item.fishingRod, 1), new Object[] {" #", " #X", "# X", '#', Item.stick, 'X', Item.silk});
this.func_92051_a(new ItemStack(Item.carrotOnAStick, 1), new Object[] {"# ", " X", '#', Item.fishingRod, 'X', Item.carrot}).func_92048_c();
this.func_92051_a(new ItemStack(Block.stairCompactCobblestone, 4), new Object[] {"# ", "## ", "###", '#', Block.cobblestone});
this.func_92051_a(new ItemStack(Block.stairsBrick, 4), new Object[] {"# ", "## ", "###", '#', Block.brick});
this.func_92051_a(new ItemStack(Block.stairsStoneBrickSmooth, 4), new Object[] {"# ", "## ", "###", '#', Block.stoneBrick});
this.func_92051_a(new ItemStack(Block.stairsNetherBrick, 4), new Object[] {"# ", "## ", "###", '#', Block.netherBrick});
this.func_92051_a(new ItemStack(Block.stairsSandStone, 4), new Object[] {"# ", "## ", "###", '#', Block.sandStone});
this.func_92051_a(new ItemStack(Item.painting, 1), new Object[] {"###", "#X#", "###", '#', Item.stick, 'X', Block.cloth});
this.func_92051_a(new ItemStack(Item.itemFrame, 1), new Object[] {"###", "#X#", "###", '#', Item.stick, 'X', Item.leather});
this.func_92051_a(new ItemStack(Item.appleGold, 1, 0), new Object[] {"###", "#X#", "###", '#', Item.goldNugget, 'X', Item.appleRed});
this.func_92051_a(new ItemStack(Item.appleGold, 1, 1), new Object[] {"###", "#X#", "###", '#', Block.blockGold, 'X', Item.appleRed});
this.func_92051_a(new ItemStack(Item.goldenCarrot, 1, 0), new Object[] {"###", "#X#", "###", '#', Item.goldNugget, 'X', Item.carrot});
this.func_92051_a(new ItemStack(Block.lever, 1), new Object[] {"X", "#", '#', Block.cobblestone, 'X', Item.stick});
this.func_92051_a(new ItemStack(Block.tripWireSource, 2), new Object[] {"I", "S", "#", '#', Block.planks, 'S', Item.stick, 'I', Item.ingotIron});
this.func_92051_a(new ItemStack(Block.torchRedstoneActive, 1), new Object[] {"X", "#", '#', Item.stick, 'X', Item.redstone});
this.func_92051_a(new ItemStack(Item.redstoneRepeater, 1), new Object[] {"#X#", "III", '#', Block.torchRedstoneActive, 'X', Item.redstone, 'I', Block.stone});
this.func_92051_a(new ItemStack(Item.pocketSundial, 1), new Object[] {" # ", "#X#", " # ", '#', Item.ingotGold, 'X', Item.redstone});
this.func_92051_a(new ItemStack(Item.compass, 1), new Object[] {" # ", "#X#", " # ", '#', Item.ingotIron, 'X', Item.redstone});
this.func_92051_a(new ItemStack(Item.emptyMap, 1), new Object[] {"###", "#X#", "###", '#', Item.paper, 'X', Item.compass});
this.func_92051_a(new ItemStack(Block.stoneButton, 1), new Object[] {"#", '#', Block.stone});
this.func_92051_a(new ItemStack(Block.woodenButton, 1), new Object[] {"#", '#', Block.planks});
this.func_92051_a(new ItemStack(Block.pressurePlateStone, 1), new Object[] {"##", '#', Block.stone});
this.func_92051_a(new ItemStack(Block.pressurePlatePlanks, 1), new Object[] {"##", '#', Block.planks});
this.func_92051_a(new ItemStack(Block.dispenser, 1), new Object[] {"###", "#X#", "#R#", '#', Block.cobblestone, 'X', Item.bow, 'R', Item.redstone});
this.func_92051_a(new ItemStack(Block.pistonBase, 1), new Object[] {"TTT", "#X#", "#R#", '#', Block.cobblestone, 'X', Item.ingotIron, 'R', Item.redstone, 'T', Block.planks});
this.func_92051_a(new ItemStack(Block.pistonStickyBase, 1), new Object[] {"S", "P", 'S', Item.slimeBall, 'P', Block.pistonBase});
this.func_92051_a(new ItemStack(Item.bed, 1), new Object[] {"###", "XXX", '#', Block.cloth, 'X', Block.planks});
this.func_92051_a(new ItemStack(Block.enchantmentTable, 1), new Object[] {" B ", "D#D", "###", '#', Block.obsidian, 'B', Item.book, 'D', Item.diamond});
this.func_92051_a(new ItemStack(Block.anvil, 1), new Object[] {"III", " i ", "iii", 'I', Block.blockSteel, 'i', Item.ingotIron});
this.addShapelessRecipe(new ItemStack(Item.eyeOfEnder, 1), new Object[] {Item.enderPearl, Item.blazePowder});
this.addShapelessRecipe(new ItemStack(Item.fireballCharge, 3), new Object[] {Item.gunpowder, Item.blazePowder, Item.coal});
this.addShapelessRecipe(new ItemStack(Item.fireballCharge, 3), new Object[] {Item.gunpowder, Item.blazePowder, new ItemStack(Item.coal, 1, 1)});
Collections.sort(this.recipes, new RecipeSorter(this));
System.out.println(this.recipes.size() + " recipes");
}
public ShapedRecipes func_92051_a(ItemStack par1ItemStack, Object ... par2ArrayOfObj)
{
String var3 = "";
int var4 = 0;
int var5 = 0;
int var6 = 0;
if (par2ArrayOfObj[var4] instanceof String[])
{
String[] var7 = (String[])((String[])par2ArrayOfObj[var4++]);
for (int var8 = 0; var8 < var7.length; ++var8)
{
String var9 = var7[var8];
++var6;
var5 = var9.length();
var3 = var3 + var9;
}
}
else
{
while (par2ArrayOfObj[var4] instanceof String)
{
String var11 = (String)par2ArrayOfObj[var4++];
++var6;
var5 = var11.length();
var3 = var3 + var11;
}
}
HashMap var12;
for (var12 = new HashMap(); var4 < par2ArrayOfObj.length; var4 += 2)
{
Character var13 = (Character)par2ArrayOfObj[var4];
ItemStack var14 = null;
if (par2ArrayOfObj[var4 + 1] instanceof Item)
{
var14 = new ItemStack((Item)par2ArrayOfObj[var4 + 1]);
}
else if (par2ArrayOfObj[var4 + 1] instanceof Block)
{
var14 = new ItemStack((Block)par2ArrayOfObj[var4 + 1], 1, -1);
}
else if (par2ArrayOfObj[var4 + 1] instanceof ItemStack)
{
var14 = (ItemStack)par2ArrayOfObj[var4 + 1];
}
var12.put(var13, var14);
}
ItemStack[] var15 = new ItemStack[var5 * var6];
for (int var16 = 0; var16 < var5 * var6; ++var16)
{
char var10 = var3.charAt(var16);
if (var12.containsKey(Character.valueOf(var10)))
{
var15[var16] = ((ItemStack)var12.get(Character.valueOf(var10))).copy();
}
else
{
var15[var16] = null;
}
}
ShapedRecipes var17 = new ShapedRecipes(var5, var6, var15, par1ItemStack);
this.recipes.add(var17);
return var17;
}
public void addShapelessRecipe(ItemStack par1ItemStack, Object ... par2ArrayOfObj)
{
ArrayList var3 = new ArrayList();
Object[] var4 = par2ArrayOfObj;
int var5 = par2ArrayOfObj.length;
for (int var6 = 0; var6 < var5; ++var6)
{
Object var7 = var4[var6];
if (var7 instanceof ItemStack)
{
var3.add(((ItemStack)var7).copy());
}
else if (var7 instanceof Item)
{
var3.add(new ItemStack((Item)var7));
}
else
{
if (!(var7 instanceof Block))
{
throw new RuntimeException("Invalid shapeless recipy!");
}
var3.add(new ItemStack((Block)var7));
}
}
this.recipes.add(new ShapelessRecipes(par1ItemStack, var3));
}
public ItemStack findMatchingRecipe(InventoryCrafting par1InventoryCrafting, World par2World)
{
int var3 = 0;
ItemStack var4 = null;
ItemStack var5 = null;
int var6;
for (var6 = 0; var6 < par1InventoryCrafting.getSizeInventory(); ++var6)
{
ItemStack var7 = par1InventoryCrafting.getStackInSlot(var6);
if (var7 != null)
{
if (var3 == 0)
{
var4 = var7;
}
if (var3 == 1)
{
var5 = var7;
}
++var3;
}
}
if (var3 == 2 && var4.itemID == var5.itemID && var4.stackSize == 1 && var5.stackSize == 1 && Item.itemsList[var4.itemID].isRepairable())
{
Item var11 = Item.itemsList[var4.itemID];
int var13 = var11.getMaxDamage() - var4.getItemDamageForDisplay();
int var8 = var11.getMaxDamage() - var5.getItemDamageForDisplay();
int var9 = var13 + var8 + var11.getMaxDamage() * 5 / 100;
int var10 = var11.getMaxDamage() - var9;
if (var10 < 0)
{
var10 = 0;
}
return new ItemStack(var4.itemID, 1, var10);
}
else
{
for (var6 = 0; var6 < this.recipes.size(); ++var6)
{
IRecipe var12 = (IRecipe)this.recipes.get(var6);
if (var12.matches(par1InventoryCrafting, par2World))
{
return var12.getCraftingResult(par1InventoryCrafting);
}
}
return null;
}
}
/**
* returns the List<> of all recipes
*/
public List getRecipeList()
{
return this.recipes;
}
}
And this is my modified Manager
public class SmithsCraftingManager
{
/** The static instance of this class */
private static final SmithsCraftingManager instance = new SmithsCraftingManager();
/** A list of all the recipes added */
private List recipes = new ArrayList();
/**
* Returns the static instance of this class
*/
public static final SmithsCraftingManager getInstance()
{
return instance;
}
private SmithsCraftingManager()
{
recipes = new ArrayList();
this.func_92051_a(new ItemStack(Item.paper, 3), new Object[] {"###", '#', Item.reed});
//addRecipe(new ItemStack(mod_Biology.GeneticallyEngineeredEggCowCow, 1), new Object[] {"C", "E", "C", 'E', Item.egg, 'C', mod_Biology.DnaFilledDartCow});
Collections.sort(this.recipes, new SmithsRecipeSorter(this));
System.out.println(this.recipes.size() + " recipes");
}
public ShapedRecipes func_92051_a(ItemStack par1ItemStack, Object ... par2ArrayOfObj)
{
String var3 = "";
int var4 = 0;
int var5 = 0;
int var6 = 0;
if (par2ArrayOfObj[var4] instanceof String[])
{
String[] var7 = (String[])((String[])par2ArrayOfObj[var4++]);
for (int var8 = 0; var8 < var7.length; ++var8)
{
String var9 = var7[var8];
++var6;
var5 = var9.length();
var3 = var3 + var9;
}
}
else
{
while (par2ArrayOfObj[var4] instanceof String)
{
String var11 = (String)par2ArrayOfObj[var4++];
++var6;
var5 = var11.length();
var3 = var3 + var11;
}
}
HashMap var12;
for (var12 = new HashMap(); var4 < par2ArrayOfObj.length; var4 += 2)
{
Character var13 = (Character)par2ArrayOfObj[var4];
ItemStack var14 = null;
if (par2ArrayOfObj[var4 + 1] instanceof Item)
{
var14 = new ItemStack((Item)par2ArrayOfObj[var4 + 1]);
}
else if (par2ArrayOfObj[var4 + 1] instanceof Block)
{
var14 = new ItemStack((Block)par2ArrayOfObj[var4 + 1], 1, -1);
}
else if (par2ArrayOfObj[var4 + 1] instanceof ItemStack)
{
var14 = (ItemStack)par2ArrayOfObj[var4 + 1];
}
var12.put(var13, var14);
}
ItemStack[] var15 = new ItemStack[var5 * var6];
for (int var16 = 0; var16 < var5 * var6; ++var16)
{
char var10 = var3.charAt(var16);
if (var12.containsKey(Character.valueOf(var10)))
{
var15[var16] = ((ItemStack)var12.get(Character.valueOf(var10))).copy();
}
else
{
var15[var16] = null;
}
}
ShapedRecipes var17 = new ShapedRecipes(var5, var6, var15, par1ItemStack);
this.recipes.add(var17);
return var17;
}
public void addShapelessRecipe(ItemStack par1ItemStack, Object ... par2ArrayOfObj)
{
ArrayList var3 = new ArrayList();
Object[] var4 = par2ArrayOfObj;
int var5 = par2ArrayOfObj.length;
for (int var6 = 0; var6 < var5; ++var6)
{
Object var7 = var4[var6];
if (var7 instanceof ItemStack)
{
var3.add(((ItemStack)var7).copy());
}
else if (var7 instanceof Item)
{
var3.add(new ItemStack((Item)var7));
}
else
{
if (!(var7 instanceof Block))
{
throw new RuntimeException("Invalid shapeless recipy!");
}
var3.add(new ItemStack((Block)var7));
}
}
this.recipes.add(new ShapelessRecipes(par1ItemStack, var3));
}
public ItemStack findMatchingRecipe(InventoryCrafting par1InventoryCrafting, World par2World)
{
int var3 = 0;
ItemStack var4 = null;
ItemStack var5 = null;
int var6;
for (var6 = 0; var6 < par1InventoryCrafting.getSizeInventory(); ++var6)
{
ItemStack var7 = par1InventoryCrafting.getStackInSlot(var6);
if (var7 != null)
{
if (var3 == 0)
{
var4 = var7;
}
if (var3 == 1)
{
var5 = var7;
}
++var3;
}
}
if (var3 == 2 && var4.itemID == var5.itemID && var4.stackSize == 1 && var5.stackSize == 1 && Item.itemsList[var4.itemID].isRepairable())
{
Item var11 = Item.itemsList[var4.itemID];
int var13 = var11.getMaxDamage() - var4.getItemDamageForDisplay();
int var8 = var11.getMaxDamage() - var5.getItemDamageForDisplay();
int var9 = var13 + var8 + var11.getMaxDamage() * 5 / 100;
int var10 = var11.getMaxDamage() - var9;
if (var10 < 0)
{
var10 = 0;
}
return new ItemStack(var4.itemID, 1, var10);
}
else
{
for (var6 = 0; var6 < this.recipes.size(); ++var6)
{
IRecipe var12 = (IRecipe)this.recipes.get(var6);
if (var12.matches(par1InventoryCrafting, par2World))
{
return var12.getCraftingResult(par1InventoryCrafting);
}
}
return null;
}
}
/**
* returns the List<> of all recipes
*/
public List getRecipeList()
{
return this.recipes;
}
}
Notice this part here calling the new recipe sorter
private SmithsCraftingManager()
{
recipes = new ArrayList();
this.func_92051_a(new ItemStack(Item.paper, 3), new Object[] {"###", '#', Item.reed});
//addRecipe(new ItemStack(mod_Biology.GeneticallyEngineeredEggCowCow, 1), new Object[] {"C", "E", "C", 'E', Item.egg, 'C', mod_Biology.DnaFilledDartCow});
Collections.sort(this.recipes, new SmithsRecipeSorter(this));
System.out.println(this.recipes.size() + " recipes");
}
And if you have been following along with the furnace one too, and want a new table to add
to your guihandler, this is how the set up is for multiple gui's in one handler. This
is an exact copy of mine, please be sure, if you just copy and paste and not take the time
to understand the code to change the names to yours
public class GuiHandlerTrees implements IGuiHandler
{
//Constant integer reference
//public static final int OtherGuiID = 2;
@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
// This gets the TileEntity the player is currently activating
TileEntity tile_entity = world.getBlockTileEntity(x, y, z);
// This checks if the TileEntity is not null
switch(id)
{
//The case is equivalent to the id passed with EntityPlayer.openGui(ModInstance, id, World, xCoord, yCoord, zCoord);
case 0: return new ContainerExtruder(player.inventory, (TileEntityExtruder) tile_entity);
case 1: return id == 1 && world.getBlockId(x, y, z) == Trees.smithsBench.blockID ? new ContainerSmithsBench(player.inventory, world, x, y, z) : null;
//For more clear-cut usage, you can change these to constants such as:
//case OtherGuiID: return new ContainerYetAnotherTile(player.inventory, (TileEntityYetAnotherTile)tile_entity);
}
return null;
}
// Returns null if the TileEntity it null
@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
// This gets the TileEntity the player is currently activating
TileEntity tile_entity = world.getBlockTileEntity(x, y, z);
// This checks if the TileEntity is not null
switch(id)
{
//The case is equivalent to the id passed with EntityPlayer.openGui(ModInstance, id, World, xCoord, yCoord, zCoord);
case 0: return new GuiExtruder(player.inventory, (TileEntityExtruder) tile_entity);
case 1: return id == 1 && world.getBlockId(x, y, z) == Trees.smithsBench.blockID ? new GuiSmithsCrafting(player.inventory, world, x, y, z) : null;
//For more clear-cut usage, you can change these to constants such as:
//case OtherGuiID: return new GuiYetAnotherTile(player.inventory, (TileEntityYetAnotherTile)tile_entity);
//You can then reference these contants from the TileEntity for the openGui method as well.
//For instance. player.openGui(ModFile.instance, GuiHandler.OtherGuiID, world, x, y, z);
}
// Returns null if the TileEntity it null
return null;
}
}
Adding recipes to your block can also be done in the mod class like this
SmithsBench.getInstance().addRecipe(new ItemStack(Block.planks, 2, 0), new Object[]{"S S", 'D', Block.dirt});
nice work, Now we just need jcm to finish the workbench tutorial for our page XD
I didn't say use this tutorial for making a new fuel, I said it was to understand the numbersfor fuel speed and how much and item can smelt. It explains it quite well in his fuel tut what the numbers are for, they are the same numbers used in the tileentity for the smaelting process. I am not sure what numbers do what exactly off the top of my head, but follow that tutorial and it explains quite a bit of it. The process is handled by the tileentity so use those numbers and play around with it, I am sure you'll get it....
Find out how I generate....coolAlias...world structure generation and rotation tool...
Thank you, I believe you are right, but still like I said, in the tile entity... nice avatar by the way, love that show, too bad its coming to an end this summer.
Find out how I generate....coolAlias...world structure generation and rotation tool...
Will this say the lower the number on the right side, the faster it will melt? or the other way around?
Why thank you and I should be ashamed but I haven't got to watch it for a few seasons =c[
Should be the higher the number the faster it goes
1. Press CTRL + F while in the TileEnitityClass, and put in the 'find' slot: 200, then in the 'replace' slot: 'The value you want' (The higher the number the longer it takes).
2. Click Replace all.
3. ????
4. PROFIT!
Okay, for your texture, is it registered in the client proxy? and then in the GuiFurnace? For the crash, try copying the code from the furnace for all, and change the names of the basic stuff involved to your furnace, making it basically the vanilla one but referencing your files. As for the recipes, add or change the recipes in the furnacerecipes file. Also for adding recipes, instead of gameregistry.addsmelting, its 'yourfurnace'.addsmelting
Find out how I generate....coolAlias...world structure generation and rotation tool...
thank you.... Also the problem most people seem to have is, not willing to learn (sorry if this seems rude), but use tutorials as a reference, not a copy and paste tool. I even said look at the original classes. You could even use the original classes and add a GUIHandler, register the whole thing with the new furnace names as long as any reference to original furnace is replaced with your furnace and it will work, would probably be best to do it this way to start with as my tutorial implies. This is simply a guide on how I did it, if you just copy and paste you will lose one important thing, KNOWLEDGE....
I used to be a member some where else a while ago, different type of forum not minecraft related, and my forum name was dumbfounded (the look and expression of avatar face says it all. Plus my dad was a hogans hero fan, and I watched it some growing up too, so I like it, makes me feel fuzzy inside...
Find out how I generate....coolAlias...world structure generation and rotation tool...
Find out how I generate....coolAlias...world structure generation and rotation tool...
This part renders the textures when placed in the world
+ 18 = top and bottom
+ 19 = the sides
+ 17 = active
+16 = idle
public int getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
if (par5 == 1)
{
return this.blockIndexInTexture + 18;
}
else if (par5 == 0)
{
return this.blockIndexInTexture + 18;
}
else
{
int var6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
return par5 != var6 ? this.blockIndexInTexture + 19 : (this.isActive ? this.blockIndexInTexture + 17 : this.blockIndexInTexture + 16);
}
}
Same goes for this part except this renders the texture when its in your hotbar, inventory, creative tabs etc.
public int getBlockTextureFromSide(int par1)
{
return par1 == 1 ? this.blockIndexInTexture + 18 : (par1 == 0 ? this.blockIndexInTexture + 18 : (par1 == 3 ? this.blockIndexInTexture + 19 : this.blockIndexInTexture + 16));
}
Then this one is pretty self explanitory.
@Override
public String getTextureFile(){
return Strings.MACHINES_TEXTURES;
}
2013-01-12 10:19:01 [INFO] [STDERR] at java.lang.Class.forName0(Native Method)
2013-01-12 10:19:01 [INFO] [STDERR] at java.lang.Class.forName(Unknown Source)
2013-01-12 10:19:01 [INFO] [STDERR] at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:414)
2013-01-12 10:19:01 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-01-12 10:19:01 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2013-01-12 10:19:01 [INFO] [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-01-12 10:19:01 [INFO] [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
2013-01-12 10:19:01 [INFO] [STDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
2013-01-12 10:19:01 [INFO] [STDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
2013-01-12 10:19:01 [INFO] [STDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
2013-01-12 10:19:01 [INFO] [STDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
2013-01-12 10:19:01 [INFO] [STDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:268)
2013-01-12 10:19:01 [INFO] [STDERR] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140)
2013-01-12 10:19:01 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-01-12 10:19:01 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2013-01-12 10:19:01 [INFO] [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-01-12 10:19:01 [INFO] [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
2013-01-12 10:19:01 [INFO] [STDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
2013-01-12 10:19:01 [INFO] [STDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
2013-01-12 10:19:01 [INFO] [STDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
2013-01-12 10:19:01 [INFO] [STDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
2013-01-12 10:19:01 [INFO] [STDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:268)
2013-01-12 10:19:01 [INFO] [STDERR] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83)
2013-01-12 10:19:01 [INFO] [STDERR] at cpw.mods.fml.common.Loader.loadMods(Loader.java:478)
2013-01-12 10:19:01 [INFO] [STDERR] at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:161)
2013-01-12 10:19:01 [INFO] [STDERR] at net.minecraft.client.Minecraft.startGame(Minecraft.java:410)
2013-01-12 10:19:01 [INFO] [STDERR] at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)
2013-01-12 10:19:01 [INFO] [STDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:744)
2013-01-12 10:19:01 [INFO] [STDERR] at java.lang.Thread.run(Unknown Source)
2013-01-12 10:19:01 [INFO] [STDERR] Caused by: java.lang.IllegalArgumentException: Slot 0 is already occupied by gmod622.ArsiCraft.common.blocks.BlockForceFurance@19d81df3 when adding gmod622.ArsiCraft.common.blocks.BlockForceFurance@3b9649c6
2013-01-12 10:19:01 [INFO] [STDERR] at net.minecraft.block.Block.(Block.java:326)
2013-01-12 10:19:01 [INFO] [STDERR] at net.minecraft.block.BlockContainer.(BlockContainer.java:11)
2013-01-12 10:19:01 [INFO] [STDERR] at gmod622.ArsiCraft.common.blocks.BlockForceFurance.(BlockForceFurance.java:33)
2013-01-12 10:19:01 [INFO] [STDERR] at gmod622.ArsiCraft.common.core.mod_ArsiCraft.(mod_ArsiCraft.java:91)
2013-01-12 10:19:01 [INFO] [STDERR] ... 29 more
2013-01-12 10:19:05 [INFO] [STDERR] Someone is closing me!
Thanks for reading, ( HELP )
Hm, I think that I might go outside today.
@Override
public String getTextureFile(){
return Strings.MACHINES_TEXTURES;
}
from Strings.MACHINES_TEXTURES to wherever your texture path is
Thanks again for the help....yes its like a regular anything else, different block, item...different id. It also not necessary but I use a different GUIHandler for each of the GUI's I use, just to keep it neat and simple.
Also, if the tides don't suck me out to reality, and life doesn't blow me down a few more dark alleys, the crafting table should be up this week....
Find out how I generate....coolAlias...world structure generation and rotation tool...
Find out how I generate....coolAlias...world structure generation and rotation tool...
nice work, Now we just need jcm to finish the workbench tutorial for our page XD
Farewell everyone o/