mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 20:22:36 +00:00
Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392> * Change 0-sized ItemStacks into null stacks in crafting station attached slots Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425> * Update buildscript * spotlessApply
This commit is contained in:
1 parent
18bfeaff32
commit
39be06c23b
571 files changed
+25959
-28223
No files matched your search
@@ -4,85 +4,64 @@ import java.util.ArrayList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.*;
|
||||
|
||||
public class DryingRackRecipes
|
||||
{
|
||||
public class DryingRackRecipes {
|
||||
public static ArrayList<DryingRecipe> recipes = new ArrayList<DryingRecipe>();
|
||||
|
||||
public static void addDryingRecipe (Object input, int time, Object output)
|
||||
{
|
||||
public static void addDryingRecipe(Object input, int time, Object output) {
|
||||
ItemStack inputItem = null;
|
||||
ItemStack outputItem = null;
|
||||
|
||||
if (input instanceof ItemStack)
|
||||
inputItem = (ItemStack) input;
|
||||
else if (input instanceof Item)
|
||||
inputItem = new ItemStack((Item) input, 1, 0);
|
||||
else if (input instanceof Block)
|
||||
inputItem = new ItemStack((Block) input, 1, 0);
|
||||
else
|
||||
throw new RuntimeException("Drying recipe input is invalid!");
|
||||
if (input instanceof ItemStack) inputItem = (ItemStack) input;
|
||||
else if (input instanceof Item) inputItem = new ItemStack((Item) input, 1, 0);
|
||||
else if (input instanceof Block) inputItem = new ItemStack((Block) input, 1, 0);
|
||||
else throw new RuntimeException("Drying recipe input is invalid!");
|
||||
|
||||
if (output instanceof ItemStack)
|
||||
outputItem = (ItemStack) output;
|
||||
else if (output instanceof Item)
|
||||
outputItem = new ItemStack((Item) output, 1, 0);
|
||||
else if (output instanceof Block)
|
||||
outputItem = new ItemStack((Block) output, 1, 0);
|
||||
else
|
||||
throw new RuntimeException("Drying recipe output is invalid!");
|
||||
if (output instanceof ItemStack) outputItem = (ItemStack) output;
|
||||
else if (output instanceof Item) outputItem = new ItemStack((Item) output, 1, 0);
|
||||
else if (output instanceof Block) outputItem = new ItemStack((Block) output, 1, 0);
|
||||
else throw new RuntimeException("Drying recipe output is invalid!");
|
||||
|
||||
recipes.add(new DryingRecipe(inputItem, time, outputItem));
|
||||
}
|
||||
|
||||
public static int getDryingTime (ItemStack input)
|
||||
{
|
||||
for (DryingRecipe r : recipes)
|
||||
{
|
||||
if (r.matches(input))
|
||||
return r.time;
|
||||
public static int getDryingTime(ItemStack input) {
|
||||
for (DryingRecipe r : recipes) {
|
||||
if (r.matches(input)) return r.time;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static ItemStack getDryingResult (ItemStack input)
|
||||
{
|
||||
for (DryingRecipe r : recipes)
|
||||
{
|
||||
if (r.matches(input))
|
||||
return r.getResult();
|
||||
public static ItemStack getDryingResult(ItemStack input) {
|
||||
for (DryingRecipe r : recipes) {
|
||||
if (r.matches(input)) return r.getResult();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class DryingRecipe
|
||||
{
|
||||
public static class DryingRecipe {
|
||||
public final int time;
|
||||
public final ItemStack input;
|
||||
public final ItemStack result;
|
||||
|
||||
DryingRecipe(ItemStack input, int time, ItemStack result)
|
||||
{
|
||||
DryingRecipe(ItemStack input, int time, ItemStack result) {
|
||||
this.time = time;
|
||||
this.input = input;
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public boolean matches (ItemStack input)
|
||||
{
|
||||
public boolean matches(ItemStack input) {
|
||||
// makes all drying rack recipies compatible with stuff killed by a frying pan
|
||||
if(input.hasTagCompound()) {
|
||||
if (input.hasTagCompound()) {
|
||||
input = input.copy();
|
||||
input.getTagCompound().removeTag("frypanKill");
|
||||
if(input.getTagCompound().hasNoTags())
|
||||
input.setTagCompound(null);
|
||||
if (input.getTagCompound().hasNoTags()) input.setTagCompound(null);
|
||||
}
|
||||
return ItemStack.areItemStacksEqual(this.input, input);
|
||||
}
|
||||
|
||||
public ItemStack getResult ()
|
||||
{
|
||||
public ItemStack getResult() {
|
||||
return result.copy();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user