mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-25 22:44:23 +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
@@ -7,43 +7,27 @@ import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
public class Detailing
|
||||
{
|
||||
public class Detailing {
|
||||
public List<DetailInput> detailing = new ArrayList<DetailInput>();
|
||||
|
||||
public void addDetailing (Object input, int inputMeta, Object output, int outputMeta, ToolCore tool)
|
||||
{
|
||||
public void addDetailing(Object input, int inputMeta, Object output, int outputMeta, ToolCore tool) {
|
||||
ItemStack iID, oID;
|
||||
int iMeta = inputMeta, oMeta = outputMeta;
|
||||
|
||||
if (input instanceof Block)
|
||||
iID = new ItemStack(((Block) input));
|
||||
if (input instanceof Block) iID = new ItemStack(((Block) input));
|
||||
else if (input instanceof Item) iID = new ItemStack(((Item) input));
|
||||
else if (input instanceof ItemStack) iID = ((ItemStack) input);
|
||||
else throw new RuntimeException("Invalid detail input!");
|
||||
|
||||
else if (input instanceof Item)
|
||||
iID = new ItemStack(((Item) input));
|
||||
else if (input instanceof ItemStack)
|
||||
iID = ((ItemStack) input);
|
||||
|
||||
else
|
||||
throw new RuntimeException("Invalid detail input!");
|
||||
|
||||
if (output instanceof Block)
|
||||
oID = new ItemStack((Block) output);
|
||||
|
||||
else if (output instanceof Item)
|
||||
oID = new ItemStack((Item) output);
|
||||
|
||||
else if (output instanceof ItemStack)
|
||||
oID = (ItemStack) output;
|
||||
|
||||
else
|
||||
throw new RuntimeException("Invalid detail output!");
|
||||
if (output instanceof Block) oID = new ItemStack((Block) output);
|
||||
else if (output instanceof Item) oID = new ItemStack((Item) output);
|
||||
else if (output instanceof ItemStack) oID = (ItemStack) output;
|
||||
else throw new RuntimeException("Invalid detail output!");
|
||||
|
||||
this.addDetailing(new DetailInput(iID, iMeta, oID, oMeta), tool);
|
||||
}
|
||||
|
||||
public void addDetailing (DetailInput details, ToolCore tool)
|
||||
{
|
||||
public void addDetailing(DetailInput details, ToolCore tool) {
|
||||
detailing.add(details);
|
||||
ItemStack toolstack = new ItemStack(tool, 1, Short.MAX_VALUE);
|
||||
|
||||
@@ -56,31 +40,26 @@ public class Detailing
|
||||
toolTag.setInteger("TotalDurability", 100);
|
||||
compound.setTag("InfiTool", toolTag);
|
||||
toolstack.setTagCompound(compound);
|
||||
addShapelessToolRecipe(new ItemStack(details.output.getItem(), 1, details.outputMeta), toolstack, new ItemStack(details.input.getItem(), 1, details.inputMeta));
|
||||
addShapelessToolRecipe(
|
||||
new ItemStack(details.output.getItem(), 1, details.outputMeta),
|
||||
toolstack,
|
||||
new ItemStack(details.input.getItem(), 1, details.inputMeta));
|
||||
}
|
||||
|
||||
public void addShapelessToolRecipe (ItemStack par1ItemStack, Object... par2ArrayOfObj)
|
||||
{
|
||||
public void addShapelessToolRecipe(ItemStack par1ItemStack, Object... par2ArrayOfObj) {
|
||||
ArrayList arraylist = new ArrayList();
|
||||
Object[] aobject = par2ArrayOfObj;
|
||||
int i = par2ArrayOfObj.length;
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
for (int j = 0; j < i; ++j) {
|
||||
Object object1 = aobject[j];
|
||||
|
||||
if (object1 instanceof ItemStack)
|
||||
{
|
||||
if (object1 instanceof ItemStack) {
|
||||
arraylist.add(((ItemStack) object1).copy());
|
||||
}
|
||||
else if (object1 instanceof Item)
|
||||
{
|
||||
} else if (object1 instanceof Item) {
|
||||
arraylist.add(new ItemStack((Item) object1));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(object1 instanceof Block))
|
||||
{
|
||||
} else {
|
||||
if (!(object1 instanceof Block)) {
|
||||
throw new RuntimeException("Invalid shapeless tool recipe!");
|
||||
}
|
||||
|
||||
@@ -91,28 +70,23 @@ public class Detailing
|
||||
GameRegistry.addRecipe(new ShapelessToolRecipe(par1ItemStack, arraylist));
|
||||
}
|
||||
|
||||
public DetailInput getDetailing (Block block, int inputMeta)
|
||||
{
|
||||
for (int i = 0; i < detailing.size(); i++)
|
||||
{
|
||||
public DetailInput getDetailing(Block block, int inputMeta) {
|
||||
for (int i = 0; i < detailing.size(); i++) {
|
||||
DetailInput detail = (DetailInput) detailing.get(i);
|
||||
if (Item.getItemFromBlock(block) == detail.input.getItem() && inputMeta == detail.inputMeta)
|
||||
{
|
||||
if (Item.getItemFromBlock(block) == detail.input.getItem() && inputMeta == detail.inputMeta) {
|
||||
return detail;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public class DetailInput
|
||||
{
|
||||
public class DetailInput {
|
||||
public ItemStack input;
|
||||
public int inputMeta;
|
||||
public ItemStack output;
|
||||
public int outputMeta;
|
||||
|
||||
public DetailInput(ItemStack input, int inputMeta, ItemStack output, int outputMeta)
|
||||
{
|
||||
public DetailInput(ItemStack input, int inputMeta, ItemStack output, int outputMeta) {
|
||||
this.input = input;
|
||||
this.inputMeta = inputMeta;
|
||||
this.output = output;
|
||||
|
||||
Reference in new issue
Block a user