Fix for MT methods for the Barrel and Squeezer

This commit is contained in:
JAWolfe04 2016-04-24 19:31:06 -05:00
parent 1c7165daec
commit 5ef8e15c21
6 changed files with 86 additions and 24 deletions

View File

@ -103,9 +103,9 @@
//Add Item Conversion Recipe
//-----------------------------------------------
//OutputStack, InputStack, InputFluid(in mb), MinTechLevel (Default: 1), Sealed (Default: true), AllowAnyStack (Default: true)
//mods.tfptweaks.Barrel.addItemConversion(<terrafirmacraft:item.Mortar> * 16, <minecraft:sand> * 16, <liquid:limewater> * 100, 0, true, true);
//mods.tfptweaks.Barrel.addItemConversion(<terrafirmacraft:item.Mortar> * 16, <minecraft:sand> * 16, <liquid:limewater> * 100, 0, true);
//OutputStack, InputStack, InputFluid(in mb), MinTechLevel (Default: 1), Sealed (Default: true), SealedTime (Default: 8 in hours), AllowAnyStack (Default: true)
//mods.tfptweaks.Barrel.addItemConversion(<terrafirmacraft:item.Mortar> * 16, <minecraft:sand> * 16, <liquid:limewater> * 100, 0, true, 4, true);
//mods.tfptweaks.Barrel.addItemConversion(<terrafirmacraft:item.Mortar> * 16, <minecraft:sand> * 16, <liquid:limewater> * 100, 0, true, 4);
//mods.tfptweaks.Barrel.addItemConversion(<terrafirmacraft:item.Mortar> * 16, <minecraft:sand> * 16, <liquid:limewater> * 100, 0);
//mods.tfptweaks.Barrel.addItemConversion(<terrafirmacraft:item.Mortar> * 16, <minecraft:sand> * 16, <liquid:limewater> * 100);

View File

@ -1,6 +1,13 @@
Changelog
=================================================
-------------------------------------------------
TFP Tweaks 1.13
-------------------------------------------------
Bug Fixes
+Fixed Barrel Item conversion for minetweaker to handle input and output stacks sizes correctly
+Fixed Barrel Item conversion for minetweaker to set the length of sealed time
+Fixed minetweaker code for the Forestry Squeezer for the recipe to be undone
-------------------------------------------------
TFP Tweaks 1.12
-------------------------------------------------
New Features

View File

@ -1,14 +1,12 @@
package com.JAWolfe.terrafirmapunktweaks.items;
import com.JAWolfe.terrafirmapunktweaks.reference.References;
import com.bioxx.tfc.Reference;
import com.bioxx.tfc.Items.ItemTerra;
import com.bioxx.tfc.api.Enums.EnumSize;
import com.bioxx.tfc.api.Enums.EnumWeight;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
public class MetalMold extends ItemTerra
{

View File

@ -1,6 +1,7 @@
package com.JAWolfe.terrafirmapunktweaks.minetweaker.Forestry;
import forestry.api.recipes.RecipeManagers;
import forestry.factory.recipes.SqueezerRecipeManager;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
@ -39,7 +40,7 @@ public class Squeezer
private ItemStack byProduct;
private FluidStack outputFluid;
private int tickcount;
private int chance;
private int chance = 0;
public addSqueezerAction(FluidStack output, int ticks, ItemStack[] inputs)
{
@ -67,22 +68,45 @@ public class Squeezer
@Override
public String describe()
{
return null;
String inputString = "";
for(int i = 0; i < inputStacks.length; i++)
{
inputString.concat(inputStacks[i].getDisplayName() + " ");
}
if(byProduct == null)
return "Adding items '" + inputString + "' to squeezer yeilding '" + outputFluid.getLocalizedName() + "'";
else
return "Adding items '" + inputString + "' to squeezer yeilding '" + outputFluid.getLocalizedName() +
" with the byproduct " + byProduct.getDisplayName() + "'";
}
@Override
public boolean canUndo()
{
return false;
return true;
}
@Override
public void undo() {
public void undo()
{
RecipeManagers.squeezerManager.removeRecipe(SqueezerRecipeManager.findMatchingRecipe(inputStacks));
}
@Override
public String describeUndo() {
return null;
public String describeUndo()
{
String inputString = "";
for(int i = 0; i < inputStacks.length; i++)
{
inputString = inputString.concat(inputStacks[i].getDisplayName() + " ");
}
if(byProduct == null)
return "Removing items '" + inputString + "' from squeezer yeilding '" + outputFluid.getLocalizedName() + "'";
else
return "Removing items '" + inputString + "' from squeezer yeilding '" + outputFluid.getLocalizedName() +
" with the byproduct " + byProduct.getDisplayName() + "'";
}
@Override

View File

@ -112,33 +112,46 @@ public class Barrel
MineTweakerAPI.apply(new removeItemFluidConversionAction(inputStack, inputFluid));
}
//BarrelMultiItemRecipe - Better for converting items as the outputstack size can match the input
@ZenMethod
public static void addItemConversion(IItemStack outputIS, IItemStack inputIS, ILiquidStack inputFS, int minTechLevel, boolean sealed, boolean allowAnyStack)
public static void addItemConversion(IItemStack outputIS, IItemStack inputIS, ILiquidStack inputFS, int minTechLevel, boolean sealed, int sealedTime, boolean allowAnyStack)
{
ItemStack inputStack = MineTweakerMC.getItemStack(inputIS);
ItemStack outputStack = MineTweakerMC.getItemStack(outputIS);
FluidStack inputFluid = MineTweakerMC.getLiquidStack(inputFS);
MineTweakerAPI.apply(new addItemConversionAction(inputStack, inputFluid, outputStack, sealed, minTechLevel, allowAnyStack));
if(inputStack == null || inputStack.getItem() == null)
MineTweakerAPI.logError("Missing InputStack");
else if(inputStack.stackSize < 1)
MineTweakerAPI.logError("InputStack must be at least 1 item");
else if(inputFluid == null || inputFluid.getFluid() == null)
MineTweakerAPI.logError("Missing InputFluid");
else if(inputFluid.amount <= 0)
MineTweakerAPI.logError("InputFluid must contain more than 0 mb of fluid");
else if(outputStack == null || outputStack.getItem() == null)
MineTweakerAPI.logError("Missing OutputStack");
else
{
inputFluid.amount = inputFluid.amount/inputStack.stackSize;
MineTweakerAPI.apply(new addItemConversionAction(inputStack, inputFluid, outputStack, sealed, sealedTime, minTechLevel, allowAnyStack));
}
}
@ZenMethod
public static void addItemConversion(IItemStack outputIS, IItemStack inputIS, ILiquidStack inputFS, int minTechLevel, boolean sealed)
public static void addItemConversion(IItemStack outputIS, IItemStack inputIS, ILiquidStack inputFS, int minTechLevel, boolean sealed, int sealedTime)
{
addItemConversion(outputIS, inputIS, inputFS, minTechLevel, sealed, true);
addItemConversion(outputIS, inputIS, inputFS, minTechLevel, sealed, sealedTime, true);
}
@ZenMethod
public static void addItemConversion(IItemStack outputIS, IItemStack inputIS, ILiquidStack inputFS, int minTechLevel)
{
addItemConversion(outputIS, inputIS, inputFS, minTechLevel, true, true);
addItemConversion(outputIS, inputIS, inputFS, minTechLevel, true, 8, true);
}
@ZenMethod
public static void addItemConversion(IItemStack outputIS, IItemStack inputIS, ILiquidStack inputFS)
{
addItemConversion(outputIS, inputIS, inputFS, 1, true, true);
addItemConversion(outputIS, inputIS, inputFS, 1, true, 8, true);
}
@ZenMethod
@ -263,8 +276,14 @@ public class Barrel
{
if (BarrelList.get(i) != null)
{
if (BarrelList.get(i).matches(inputStack, inputFluid))
ItemStack recipeIS = BarrelList.get(i).getInItem();
FluidStack recipeFS = BarrelList.get(i).getInFluid();
if (recipeIS != null && inputStack != null && recipeIS.isItemEqual(inputStack) &&
recipeFS != null && inputFluid != null && recipeFS.isFluidStackIdentical(inputFluid))
{
BarrelList.remove(i--);
}
}
}
}
@ -301,9 +320,15 @@ public class Barrel
for (int i = 0; i < BarrelList.size(); i++)
{
if (BarrelList.get(i) != null)
{
if (BarrelList.get(i).matches(inputStack, inputFluid))
{
ItemStack recipeIS = BarrelList.get(i).getInItem();
FluidStack recipeFS = BarrelList.get(i).getInFluid();
if (recipeIS != null && inputStack != null && recipeIS.isItemEqual(inputStack) &&
recipeFS != null && inputFluid != null && recipeFS.isFluidStackIdentical(inputFluid))
{
BarrelList.remove(i--);
}
}
}
}
@ -345,15 +370,17 @@ public class Barrel
ItemStack outputStack;
FluidStack inputFluid;
boolean sealed;
int sealedTime;
int minTechLevel;
boolean allowAnyStack;
public addItemConversionAction(ItemStack inputIS, FluidStack inputFS, ItemStack outputIS, boolean sealed, int minTechLevel, boolean allowAnyStack)
public addItemConversionAction(ItemStack inputIS, FluidStack inputFS, ItemStack outputIS, boolean sealed, int sealedTime, int minTechLevel, boolean allowAnyStack)
{
this.inputStack = inputIS;
this.inputFluid = inputFS;
this.outputStack = outputIS;
this.sealed = sealed;
this.sealedTime = sealedTime;
this.minTechLevel = minTechLevel;
this.allowAnyStack = allowAnyStack;
@ -362,7 +389,7 @@ public class Barrel
@Override
public void apply()
{
BarrelManager.getInstance().addRecipe(new BarrelRecipe(inputStack, inputFluid, outputStack, inputFluid).setAllowAnyStack(allowAnyStack).setMinTechLevel(minTechLevel).setSealedRecipe(sealed));
BarrelManager.getInstance().addRecipe(new BarrelRecipe(inputStack, inputFluid, outputStack, inputFluid, sealedTime).setAllowAnyStack(allowAnyStack).setMinTechLevel(minTechLevel).setSealedRecipe(sealed));
}
@Override
@ -386,8 +413,14 @@ public class Barrel
{
if (BarrelList.get(i) != null)
{
if (BarrelList.get(i).matches(inputStack, inputFluid))
ItemStack recipeIS = BarrelList.get(i).getInItem();
FluidStack recipeFS = BarrelList.get(i).getInFluid();
if (recipeIS != null && inputStack != null && recipeIS.isItemEqual(inputStack) &&
recipeFS != null && inputFluid != null && recipeFS.isFluidStackIdentical(inputFluid))
{
BarrelList.remove(i--);
}
}
}
}