Jump to content

[1.6.4] Making a custom Furnace with 4 input slots


shmcrae

Recommended Posts

I was wondering how to make a custom smelting recipe that allows 4 inputs, and say i wanted 4 iron in the first slot and 3 gold in the second and then have it consume all the iron and gold and output a diamond but if i put 7 iron and 4 gold it would only consume he 4 iron and 3 gold.

 

Link to comment
Share on other sites

Ive made a custom furnace called a forge and i made a GuiHandler class, a BlockForge class, a GuiForge class, and a TileEntityForge class, im just stuck on how to create a custom recipe for that and where to put it

 

I haven't actually finished the furnace yet i still have to add things in most the classes but i just wanted to know how to do the recipes

 

GuiHandler:

http://pastebin.com/CxTSSH1C

 

BlockForge:

http://pastebin.com/kK8Muvjc

 

GuiForge:

http://pastebin.com/JJaq6iEC

 

TileEntityForge:

http://pastebin.com/VmDvAZRu

Link to comment
Share on other sites

Hi

 

Since your recipes are going to be rather different to the vanilla recipes, probably best to create your own.  You could use the vanilla shapeless recipes as inspiration.  Perhaps something as simple as FourInputFurnaceRecipe with eight fields eg

 

public class FourInputFurnaceRecipe
  private ItemStack input1;  // type of Item and the number required
  private ItemStack input2;    
  private ItemStack input3;    
  private ItemStack input4;  
  private ItemStack output;
  
  public ItemStack getOutput(ItemStack slot1, ItemStack slot2, ItemStack slot3, ItemStack 4) {
     // check each slot against the input to see if item matches and slot contains at least the minimum required # of items.  If so, return output, otherwise return null
  }
}

 

-TGG

 

 

 

Link to comment
Share on other sites

Show us your TileEntity and IGuiHandler.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Nit Picks

 

                if(slot == 0) this.forge.cookTime = newValue;
                if(slot == 1) this.forge.cookTime = newValue;
                if(slot == 2) this.forge.cookTime = newValue;
                if(slot == 3) this.forge.cookTime = newValue;

Why not

if (slot >= 0 && slot <= 3) this.forge.cookTime = newValue;

 

Also the reason it's not working probably has something to do with you checking the vanilla furnace recipes rather than the ones you registered.

ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[0]);

Make your own class for registering your recipes, keep them in an ArrayList (I'd assume) and then check that array list

Link to comment
Share on other sites

Don't i need to do all the slots though? because slots 0-3 are all the input slots. and also i still don't know how to create a custom recipe i know i have to see if the itemstack matches the slot but i just don't know how to write it out and how to check the amount that is in the slot

Link to comment
Share on other sites

If you don't realise that

if (slot >= 0 && slot <= 3) this.forge.cookTime = newValue;

Has the exact same functionality of

if(slot == 0) this.forge.cookTime = newValue;
if(slot == 1) this.forge.cookTime = newValue;
if(slot == 2) this.forge.cookTime = newValue;
if(slot == 3) this.forge.cookTime = newValue;

 

And if you don't know how to write out code for what you want to do, you need to learn some java. We can give tips on how to do it (I.E saying what you already know, check if the item matches and the amount in the slot) but we won't write the code for you. It's actually quite simple to do, take a look at how vanilla recipes are stored.

Link to comment
Share on other sites

Quick example code

 

public ItemStack[] in;
public ItemStack out;

public MultiSmelt(ItemStack[] in, ItemStack out) {
this.in = in;
this.out = out;
}

 

Now you have recipes, the ItemStack's can store the stack size. Simple make an array list with multiple of these recipes, then whenever the furnace updates check through the recipes, check to see if there is a recipe with the items in the furnace and if the items in the furnace have a stack size more than or equal to the stack in the "in" list. If so, smelt it to the "out" item.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.