mirror of
https://github.com/dje4321/TerrafirmaPunk-Tweaks.git
synced 2024-06-29 01:18:45 +00:00
Removed MT support for TFC
This commit is contained in:
parent
8d8a9f60ea
commit
3ae62e20fc
|
@ -1,6 +1,6 @@
|
|||
minecraft_version=1.7.10
|
||||
forge_version=10.13.4.1566-1.7.10
|
||||
tfc_version=0.79.27
|
||||
mod_version=1.14
|
||||
mod_version=1.15
|
||||
mod_id=TerraFirmaPunkTweaks
|
||||
group_name=com.JAWolfe.TerraFirmaPunkTweaks
|
BIN
builds/TerraFirmaPunkTweaks-1.7.10-1.15.jar
Normal file
BIN
builds/TerraFirmaPunkTweaks-1.7.10-1.15.jar
Normal file
Binary file not shown.
|
@ -1,6 +1,11 @@
|
|||
Changelog
|
||||
=================================================
|
||||
-------------------------------------------------
|
||||
TFP Tweaks 1.15
|
||||
-------------------------------------------------
|
||||
Tweaks
|
||||
+Removed minetweaker methods for TFC
|
||||
-------------------------------------------------
|
||||
TFP Tweaks 1.14
|
||||
-------------------------------------------------
|
||||
New Features
|
||||
|
|
|
@ -5,20 +5,8 @@ import java.util.Random;
|
|||
import com.JAWolfe.terrafirmapunktweaks.blocks.TFPBlocks;
|
||||
import com.JAWolfe.terrafirmapunktweaks.items.TFPItems;
|
||||
import com.JAWolfe.terrafirmapunktweaks.reference.ConfigSettings;
|
||||
import com.JAWolfe.terrafirmapunktweaks.reference.ReferenceLists;
|
||||
import com.bioxx.tfc.Core.TFC_Core;
|
||||
import com.bioxx.tfc.Items.ItemBloom;
|
||||
import com.bioxx.tfc.Items.ItemIngot;
|
||||
import com.bioxx.tfc.Items.ItemMetalSheet;
|
||||
import com.bioxx.tfc.Items.ItemTerra;
|
||||
import com.bioxx.tfc.Items.ItemUnfinishedArmor;
|
||||
import com.bioxx.tfc.Items.ItemBlocks.ItemTerraBlock;
|
||||
import com.bioxx.tfc.TileEntities.TEAnvil;
|
||||
import com.bioxx.tfc.api.HeatIndex;
|
||||
import com.bioxx.tfc.api.HeatRegistry;
|
||||
import com.bioxx.tfc.api.TFCBlocks;
|
||||
import com.bioxx.tfc.api.TFCItems;
|
||||
import com.bioxx.tfc.api.TFC_ItemHeat;
|
||||
|
||||
import buildcraft.BuildCraftEnergy;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
@ -32,92 +20,15 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
|
||||
public class PlayerInteractionHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public void onToolTip(ItemTooltipEvent event)
|
||||
{
|
||||
ItemStack object = event.itemStack;
|
||||
|
||||
/*if(!(object.getItem() instanceof ISize))
|
||||
event.toolTip.add("\u2696" + TFC_Core.translate("gui.Weight." + EnumWeight.LIGHT.getName()) + " \u21F2" +
|
||||
TFC_Core.translate("gui.Size." + EnumSize.VERYSMALL.getName().replace(" ", "")));*/
|
||||
|
||||
if(!(object.getItem() instanceof ItemTerra || object.getItem() instanceof ItemTerraBlock))
|
||||
{
|
||||
if (object.hasTagCompound())
|
||||
{
|
||||
if(TFC_ItemHeat.hasTemp(object))
|
||||
{
|
||||
float temp = TFC_ItemHeat.getTemp(object);
|
||||
float meltTemp = -1;
|
||||
HeatIndex hi = HeatRegistry.getInstance().findMatchingIndex(object);
|
||||
if(hi != null)
|
||||
meltTemp = hi.meltTemp;
|
||||
|
||||
if(meltTemp != -1)
|
||||
{
|
||||
event.toolTip.add(TFC_ItemHeat.getHeatColor(temp, meltTemp));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!(object.getItem() instanceof ItemIngot ||
|
||||
object.getItem() instanceof ItemMetalSheet ||
|
||||
object.getItem() instanceof ItemUnfinishedArmor ||
|
||||
object.getItem() instanceof ItemBloom ||
|
||||
object.getItem() == TFCItems.wroughtIronKnifeHead))
|
||||
{
|
||||
if (object.hasTagCompound())
|
||||
{
|
||||
if(TFC_ItemHeat.hasTemp(object))
|
||||
{
|
||||
|
||||
if(ReferenceLists.getInstance().isAnvilInged(object))
|
||||
{
|
||||
String s = "";
|
||||
if(HeatRegistry.getInstance().isTemperatureDanger(object))
|
||||
{
|
||||
s += EnumChatFormatting.WHITE + TFC_Core.translate("gui.ingot.danger") + " | ";
|
||||
}
|
||||
|
||||
if(HeatRegistry.getInstance().isTemperatureWeldable(object))
|
||||
{
|
||||
s += EnumChatFormatting.WHITE + TFC_Core.translate("gui.ingot.weldable") + " | ";
|
||||
}
|
||||
|
||||
if(HeatRegistry.getInstance().isTemperatureWorkable(object))
|
||||
{
|
||||
s += EnumChatFormatting.WHITE + TFC_Core.translate("gui.ingot.workable");
|
||||
}
|
||||
|
||||
if (!"".equals(s))
|
||||
event.toolTip.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!(object.getItem() instanceof ItemTerra))
|
||||
{
|
||||
if (object.hasTagCompound())
|
||||
{
|
||||
if (object.getTagCompound().hasKey(TEAnvil.ITEM_CRAFTING_VALUE_TAG) || object.getTagCompound().hasKey(TEAnvil.ITEM_CRAFTING_RULE_1_TAG))
|
||||
event.toolTip.add(TFC_Core.translate("gui.ItemWorked"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
@SubscribeEvent
|
||||
public void onItemPickup(EntityItemPickupEvent event)
|
||||
{
|
||||
|
|
|
@ -1,567 +0,0 @@
|
|||
package com.JAWolfe.terrafirmapunktweaks.minetweaker.TFC;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.JAWolfe.terrafirmapunktweaks.reference.ReferenceLists;
|
||||
import com.bioxx.tfc.api.Crafting.AnvilManager;
|
||||
import com.bioxx.tfc.api.Crafting.AnvilRecipe;
|
||||
import com.bioxx.tfc.api.Crafting.AnvilReq;
|
||||
import com.bioxx.tfc.api.Crafting.PlanRecipe;
|
||||
import com.bioxx.tfc.api.Enums.RuleEnum;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.minecraft.MineTweakerMC;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.tfptweaks.Anvil")
|
||||
public class Anvil
|
||||
{
|
||||
@ZenMethod
|
||||
public static void addAnvilRecipe(IItemStack Output, IItemStack Input1, IItemStack Input2, String plan, int AnvilReq, int craftingValue)
|
||||
{
|
||||
ItemStack result = MineTweakerMC.getItemStack(Output);
|
||||
ItemStack input1 = MineTweakerMC.getItemStack(Input1);
|
||||
ItemStack input2 = null;
|
||||
if(Input2 != null)
|
||||
input2 = MineTweakerMC.getItemStack(Input2);
|
||||
|
||||
MineTweakerAPI.apply(new addAnvilRecipeAction(result, input1, input2, plan, AnvilReq, craftingValue));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addAnvilRecipe(IItemStack Output, IItemStack Input1, String plan, int AnvilReq, int craftingValue)
|
||||
{
|
||||
addAnvilRecipe(Output, Input1, null, plan, AnvilReq, craftingValue);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeAnvilRecipe(IItemStack Output, IItemStack Input1, IItemStack Input2, String plan, int AnvilReq)
|
||||
{
|
||||
ItemStack result = MineTweakerMC.getItemStack(Output);
|
||||
ItemStack input1 = MineTweakerMC.getItemStack(Input1);
|
||||
ItemStack input2 = null;
|
||||
if(Input2 != null)
|
||||
input2 = MineTweakerMC.getItemStack(Input2);
|
||||
|
||||
MineTweakerAPI.apply(new removeAnvilRecipeAction(result, input1, input2, plan, AnvilReq));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeAnvilRecipe(IItemStack Output, IItemStack Input1, String plan, int AnvilReq)
|
||||
{
|
||||
removeAnvilRecipe(Output, Input1, null, plan, AnvilReq);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addWeldRecipe(IItemStack Output, IItemStack Input1, IItemStack Input2, int AnvilReq)
|
||||
{
|
||||
ItemStack result = MineTweakerMC.getItemStack(Output);
|
||||
ItemStack input1 = MineTweakerMC.getItemStack(Input1);
|
||||
ItemStack input2 = MineTweakerMC.getItemStack(Input2);
|
||||
|
||||
MineTweakerAPI.apply(new addWeldRecipeAction(result, input1, input2, AnvilReq));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeWeldRecipe(IItemStack Output, IItemStack Input1, IItemStack Input2, int AnvilReq)
|
||||
{
|
||||
ItemStack result = MineTweakerMC.getItemStack(Output);
|
||||
ItemStack input1 = MineTweakerMC.getItemStack(Input1);
|
||||
ItemStack input2 = MineTweakerMC.getItemStack(Input2);
|
||||
|
||||
MineTweakerAPI.apply(new removeWeldRecipeAction(result, input1, input2, AnvilReq));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addPlanRecipe(String planName, int lastHitRef, int Hit2Ref, int Hit3Ref)
|
||||
{
|
||||
MineTweakerAPI.apply(new addPlanRecipeAction(planName, lastHitRef, Hit2Ref, Hit3Ref));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removePlanRecipe(String planName, int lastHitRef, int Hit2Ref, int Hit3Ref)
|
||||
{
|
||||
MineTweakerAPI.apply(new removePlanRecipeAction(planName, lastHitRef, Hit2Ref, Hit3Ref));
|
||||
}
|
||||
|
||||
private static class addAnvilRecipeAction implements IUndoableAction
|
||||
{
|
||||
ItemStack input1;
|
||||
ItemStack input2;
|
||||
ItemStack result;
|
||||
String plan;
|
||||
int craftingvalue;
|
||||
int anvilReq;
|
||||
|
||||
public addAnvilRecipeAction(ItemStack result, ItemStack input1, ItemStack input2, String plan, int anvilReq, int craftingValue)
|
||||
{
|
||||
this.input1 = input1;
|
||||
this.input2 = input2;
|
||||
this.result = result;
|
||||
this.plan = plan;
|
||||
this.anvilReq = anvilReq;
|
||||
this.craftingvalue = 50 + craftingValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
if(input1 != null)
|
||||
ReferenceLists.getInstance().addAnvilIngred(input1);
|
||||
|
||||
if(input2 != null)
|
||||
ReferenceLists.getInstance().addAnvilIngred(input2);
|
||||
|
||||
AnvilManager.getInstance().addRecipe(new AnvilRecipe(input1, input2, plan, craftingvalue, false, anvilReq, result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
if(input2 != null)
|
||||
return "Adding '" + input1.getDisplayName() + "' with '" + input2.getDisplayName() + "' to anvil yeilding '" + result.getDisplayName() + "'";
|
||||
else
|
||||
return "Adding '" + input1.getDisplayName() + "' to anvil yeilding '" + result.getDisplayName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
List<AnvilRecipe> AnvilList = AnvilManager.getInstance().getRecipeList();
|
||||
for (int i = 0; i < AnvilList.size(); i++)
|
||||
{
|
||||
if (AnvilList.get(i) != null)
|
||||
{
|
||||
if(input2 != null)
|
||||
{
|
||||
if (AnvilList.get(i).matches(new AnvilRecipe(input1, input2, plan, craftingvalue, false, anvilReq, result)))
|
||||
AnvilList.remove(i--);
|
||||
}
|
||||
else
|
||||
if (AnvilList.get(i).matches(new AnvilRecipe(input1, null, plan, craftingvalue, false, anvilReq, result)))
|
||||
AnvilList.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo()
|
||||
{
|
||||
if(input2 != null)
|
||||
return "Removing '" + input1.getDisplayName() + "' with '" + input2.getDisplayName() + "' to anvil yeild '" + result.getDisplayName() + "'";
|
||||
else
|
||||
return "Removing '" + input1.getDisplayName() + "' to anvil yeild '" + result.getDisplayName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class removeAnvilRecipeAction implements IUndoableAction
|
||||
{
|
||||
Random r = new Random();
|
||||
ItemStack input1;
|
||||
ItemStack input2;
|
||||
ItemStack result;
|
||||
String plan;
|
||||
int anvilReq;
|
||||
|
||||
public removeAnvilRecipeAction(ItemStack result, ItemStack input1, ItemStack input2, String plan, int anvilReq)
|
||||
{
|
||||
this.input1 = input1;
|
||||
this.input2 = input2;
|
||||
this.result = result;
|
||||
this.plan = plan;
|
||||
this.anvilReq = anvilReq;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
List<AnvilRecipe> AnvilList = AnvilManager.getInstance().getRecipeList();
|
||||
for (int i = 0; i < AnvilList.size(); i++)
|
||||
{
|
||||
if (AnvilList.get(i) != null)
|
||||
{
|
||||
if(input2 != null)
|
||||
{
|
||||
if (AnvilList.get(i).matches(new AnvilRecipe(input1, input2, plan, 1, false, anvilReq, result)))
|
||||
AnvilList.remove(i--);
|
||||
}
|
||||
else
|
||||
if (AnvilList.get(i).matches(new AnvilRecipe(input1, null, plan, 1, false, anvilReq, result)))
|
||||
AnvilList.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
if(input2 != null)
|
||||
return "Removing '" + input1.getDisplayName() + "' with '" + input2.getDisplayName() + "' to anvil yeild '" + result.getDisplayName() + "'";
|
||||
else
|
||||
return "Removing '" + input1.getDisplayName() + "' to anvil yeild '" + result.getDisplayName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
AnvilManager.getInstance().addRecipe(new AnvilRecipe(input1, input2, plan, 70 + r.nextInt(50), false, anvilReq, result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo()
|
||||
{
|
||||
if(input2 != null)
|
||||
return "Adding '" + input1.getDisplayName() + "' with '" + input2.getDisplayName() + "' to anvil yeilding '" + result.getDisplayName() + "'";
|
||||
else
|
||||
return "Adding '" + input1.getDisplayName() + "' to anvil yeilding '" + result.getDisplayName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class addWeldRecipeAction implements IUndoableAction
|
||||
{
|
||||
ItemStack input1;
|
||||
ItemStack input2;
|
||||
ItemStack result;
|
||||
AnvilReq anvilReq;
|
||||
|
||||
public addWeldRecipeAction(ItemStack result, ItemStack input1, ItemStack input2, int anvilReq)
|
||||
{
|
||||
this.input1 = input1;
|
||||
this.input2 = input2;
|
||||
this.result = result;
|
||||
this.anvilReq = AnvilReq.getReqFromInt(anvilReq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
if(input1 != null)
|
||||
ReferenceLists.getInstance().addAnvilIngred(input1);
|
||||
|
||||
if(input2 != null)
|
||||
ReferenceLists.getInstance().addAnvilIngred(input2);
|
||||
|
||||
AnvilManager.getInstance().addWeldRecipe(new AnvilRecipe(input1, input2, anvilReq, result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Adding weld'" + input1.getDisplayName() + "' with '" + input2.getDisplayName() + "' to anvil yeilding '" + result.getDisplayName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
List<AnvilRecipe> AnvilList = AnvilManager.getInstance().getWeldRecipeList();
|
||||
for (int i = 0; i < AnvilList.size(); i++)
|
||||
{
|
||||
if (AnvilList.get(i) != null)
|
||||
{
|
||||
if( areItemStacksEqual(input1, AnvilList.get(i).input1) &&
|
||||
areItemStacksEqual(input2, AnvilList.get(i).input2) &&
|
||||
areItemStacksEqual(result, AnvilList.get(i).result) &&
|
||||
AnvilReq.matches(anvilReq.Tier, AnvilList.get(i).anvilreq))
|
||||
{
|
||||
AnvilList.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo()
|
||||
{
|
||||
return "Removing weld'" + input1.getDisplayName() + "' with '" + input2.getDisplayName() + "' to anvil yeilding '" + result.getDisplayName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean areItemStacksEqual(ItemStack is1, ItemStack is2)
|
||||
{
|
||||
if (is1 != null && is2 != null)
|
||||
{
|
||||
if (is1.getItem() != is2.getItem())
|
||||
return false;
|
||||
|
||||
if (is1.getItemDamage() != 32767 && is1.getItemDamage() != is2.getItemDamage())
|
||||
return false;
|
||||
}
|
||||
else if (is1 == null && is2 != null || is1 != null && is2 == null) // XOR, if both are null return true
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static class removeWeldRecipeAction implements IUndoableAction
|
||||
{
|
||||
ItemStack input1;
|
||||
ItemStack input2;
|
||||
ItemStack result;
|
||||
int anvilReq;
|
||||
|
||||
public removeWeldRecipeAction(ItemStack result, ItemStack input1, ItemStack input2, int anvilReq)
|
||||
{
|
||||
this.input1 = input1;
|
||||
this.input2 = input2;
|
||||
this.result = result;
|
||||
this.anvilReq = anvilReq;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
List<AnvilRecipe> AnvilList = AnvilManager.getInstance().getWeldRecipeList();
|
||||
for (int i = 0; i < AnvilList.size(); i++)
|
||||
{
|
||||
if (AnvilList.get(i) != null)
|
||||
{
|
||||
if( areItemStacksEqual(input1, AnvilList.get(i).input1) &&
|
||||
areItemStacksEqual(input2, AnvilList.get(i).input2) &&
|
||||
areItemStacksEqual(result, AnvilList.get(i).result) &&
|
||||
AnvilReq.matches(anvilReq, AnvilList.get(i).anvilreq))
|
||||
{
|
||||
AnvilList.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Removing weld'" + input1.getDisplayName() + "' with '" + input2.getDisplayName() + "' to anvil yeilding '" + result.getDisplayName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
if(input1 != null)
|
||||
ReferenceLists.getInstance().addAnvilIngred(input1);
|
||||
|
||||
if(input2 != null)
|
||||
ReferenceLists.getInstance().addAnvilIngred(input2);
|
||||
|
||||
AnvilManager.getInstance().addWeldRecipe(new AnvilRecipe(input1, input2, AnvilReq.getReqFromInt(anvilReq), result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo()
|
||||
{
|
||||
return "Adding weld'" + input1.getDisplayName() + "' with '" + input2.getDisplayName() + "' to anvil yeilding '" + result.getDisplayName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean areItemStacksEqual(ItemStack is1, ItemStack is2)
|
||||
{
|
||||
if (is1 != null && is2 != null)
|
||||
{
|
||||
if (is1.getItem() != is2.getItem())
|
||||
return false;
|
||||
|
||||
if (is1.getItemDamage() != 32767 && is1.getItemDamage() != is2.getItemDamage())
|
||||
return false;
|
||||
}
|
||||
else if (is1 == null && is2 != null || is1 != null && is2 == null) // XOR, if both are null return true
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static class addPlanRecipeAction implements IUndoableAction
|
||||
{
|
||||
String planName;
|
||||
RuleEnum lastHit;
|
||||
RuleEnum hit2Last;
|
||||
RuleEnum hit3Last;
|
||||
|
||||
public addPlanRecipeAction(String planName, int lastHit, int hit2Last, int hit3Last)
|
||||
{
|
||||
this.lastHit = getRule(lastHit);
|
||||
this.hit2Last = getRule(hit2Last);
|
||||
this.hit3Last = getRule(hit3Last);
|
||||
this.planName = planName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
AnvilManager.getInstance().addPlan(planName, new PlanRecipe(new RuleEnum[]{lastHit, hit2Last, hit3Last}));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Adding plan '" + planName + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
AnvilManager.getInstance().getPlans().remove(planName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo()
|
||||
{
|
||||
return "Removing plan '" + planName + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class removePlanRecipeAction implements IUndoableAction
|
||||
{
|
||||
String planName;
|
||||
RuleEnum lastHit;
|
||||
RuleEnum hit2Last;
|
||||
RuleEnum hit3Last;
|
||||
|
||||
public removePlanRecipeAction(String planName, int lastHit, int hit2Last, int hit3Last)
|
||||
{
|
||||
this.lastHit = getRule(lastHit);
|
||||
this.hit2Last = getRule(hit2Last);
|
||||
this.hit3Last = getRule(hit3Last);
|
||||
this.planName = planName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
AnvilManager.getInstance().getPlans().remove(planName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Removing plan '" + planName + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
AnvilManager.getInstance().addPlan(planName, new PlanRecipe(new RuleEnum[]{lastHit, hit2Last, hit3Last}));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo()
|
||||
{
|
||||
return "Adding plan '" + planName + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static RuleEnum getRule(int ruleRef)
|
||||
{
|
||||
switch(ruleRef)
|
||||
{
|
||||
case 1: return RuleEnum.ANY;
|
||||
case 2: return RuleEnum.BENDANY;
|
||||
case 3: return RuleEnum.BENDLAST;
|
||||
case 4: return RuleEnum.BENDLASTTWO;
|
||||
case 5: return RuleEnum.BENDNOTLAST;
|
||||
case 6: return RuleEnum.BENDSECONDFROMLAST;
|
||||
case 7: return RuleEnum.BENDTHIRDFROMLAST;
|
||||
case 8: return RuleEnum.DRAWANY;
|
||||
case 9: return RuleEnum.DRAWLAST;
|
||||
case 10: return RuleEnum.DRAWLASTTWO;
|
||||
case 11: return RuleEnum.DRAWNOTLAST;
|
||||
case 12: return RuleEnum.DRAWSECONDFROMLAST;
|
||||
case 13: return RuleEnum.DRAWTHIRDFROMLAST;
|
||||
case 14: return RuleEnum.HITANY;
|
||||
case 15: return RuleEnum.HITLAST;
|
||||
case 16: return RuleEnum.HITLASTTWO;
|
||||
case 17: return RuleEnum.HITNOTLAST;
|
||||
case 18: return RuleEnum.HITSECONDFROMLAST;
|
||||
case 19: return RuleEnum.HITTHIRDFROMLAST;
|
||||
case 20: return RuleEnum.PUNCHANY;
|
||||
case 21: return RuleEnum.PUNCHLAST;
|
||||
case 22: return RuleEnum.PUNCHLASTTWO;
|
||||
case 23: return RuleEnum.PUNCHNOTLAST;
|
||||
case 24: return RuleEnum.PUNCHSECONDFROMLAST;
|
||||
case 25: return RuleEnum.PUNCHTHIRDFROMLAST;
|
||||
case 26: return RuleEnum.SHRINKANY;
|
||||
case 27: return RuleEnum.SHRINKLAST;
|
||||
case 28: return RuleEnum.SHRINKLASTTWO;
|
||||
case 29: return RuleEnum.SHRINKNOTLAST;
|
||||
case 30: return RuleEnum.SHRINKSECONDFROMLAST;
|
||||
case 31: return RuleEnum.SHRINKTHIRDFROMLAST;
|
||||
case 32: return RuleEnum.UPSETANY;
|
||||
case 33: return RuleEnum.UPSETLAST;
|
||||
case 34: return RuleEnum.UPSETLASTTWO;
|
||||
case 35: return RuleEnum.UPSETNOTLAST;
|
||||
case 36: return RuleEnum.UPSETSECONDFROMLAST;
|
||||
case 37: return RuleEnum.UPSETTHIRDFROMLAST;
|
||||
default: return RuleEnum.ANY;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,640 +0,0 @@
|
|||
package com.JAWolfe.terrafirmapunktweaks.minetweaker.TFC;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bioxx.tfc.api.Crafting.BarrelLiquidToLiquidRecipe;
|
||||
import com.bioxx.tfc.api.Crafting.BarrelManager;
|
||||
import com.bioxx.tfc.api.Crafting.BarrelRecipe;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import minetweaker.api.minecraft.MineTweakerMC;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.tfptweaks.Barrel")
|
||||
public class Barrel
|
||||
{
|
||||
//BarrelRecipe
|
||||
@ZenMethod
|
||||
public static void addItemFluidConversion(IItemStack outputIS, ILiquidStack outputFS, IItemStack inputIS, ILiquidStack inputFS, int minTechLevel, boolean sealed, int sealtime, boolean removesLiquid, boolean allowAnyStack)
|
||||
{
|
||||
ItemStack inputStack = MineTweakerMC.getItemStack(inputIS);
|
||||
FluidStack inputFluid = MineTweakerMC.getLiquidStack(inputFS);
|
||||
ItemStack outputStack = MineTweakerMC.getItemStack(outputIS);
|
||||
FluidStack outputFluid = MineTweakerMC.getLiquidStack(outputFS);
|
||||
|
||||
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(outputFluid == null || outputFluid.getFluid() == null)
|
||||
MineTweakerAPI.logError("Missing OutputFluid");
|
||||
else if(outputFluid.amount <= 0)
|
||||
MineTweakerAPI.logError("OutputFluid must contain more than 0 mb of fluid");
|
||||
else if(sealed == false && sealtime > 0)
|
||||
MineTweakerAPI.logError("Sealed time must be 0 if barrel is unsealed");
|
||||
else
|
||||
MineTweakerAPI.apply(new addFluidConversionAction(inputStack, inputFluid, outputStack, outputFluid, sealtime, removesLiquid, sealed, minTechLevel, allowAnyStack));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addItemFluidConversion(IItemStack outputIS, ILiquidStack outputFS, IItemStack inputIS, ILiquidStack inputFS, int minTechLevel, boolean sealed, int sealtime, boolean removesLiquid)
|
||||
{
|
||||
addItemFluidConversion(outputIS, outputFS, inputIS, inputFS, minTechLevel, sealed, sealtime, removesLiquid, true);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addItemFluidConversion(IItemStack outputIS, ILiquidStack outputFS, IItemStack inputIS, ILiquidStack inputFS, int minTechLevel, boolean sealed, int sealtime)
|
||||
{
|
||||
addItemFluidConversion(outputIS, outputFS, inputIS, inputFS, minTechLevel, sealed, sealtime, true, true);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addItemFluidConversion(IItemStack outputIS, ILiquidStack outputFS, IItemStack inputIS, ILiquidStack inputFS, int minTechLevel)
|
||||
{
|
||||
addItemFluidConversion(outputIS, outputFS, inputIS, inputFS, minTechLevel, true, 8, true, true);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addItemFluidConversion(IItemStack outputIS, ILiquidStack outputFS, IItemStack inputIS, ILiquidStack inputFS)
|
||||
{
|
||||
addItemFluidConversion(outputIS, outputFS, inputIS, inputFS, 1, true, 8, true, true);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addItemFluidConversion(ILiquidStack outputFS, IItemStack inputIS, ILiquidStack inputFS, int minTechLevel, boolean sealed, int sealtime, boolean removesLiquid, boolean allowAnyStack)
|
||||
{
|
||||
addItemFluidConversion(null, outputFS, inputIS, inputFS, minTechLevel, sealed, sealtime, removesLiquid, allowAnyStack);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addItemFluidConversion(ILiquidStack outputFS, IItemStack inputIS, ILiquidStack inputFS, int minTechLevel, boolean sealed, int sealtime, boolean removesLiquid)
|
||||
{
|
||||
addItemFluidConversion(null, outputFS, inputIS, inputFS, minTechLevel, sealed, sealtime, removesLiquid, true);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addItemFluidConversion(ILiquidStack outputFS, IItemStack inputIS, ILiquidStack inputFS, int minTechLevel, boolean sealed, int sealtime)
|
||||
{
|
||||
addItemFluidConversion(null, outputFS, inputIS, inputFS, minTechLevel, sealed, sealtime, true, true);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addItemFluidConversion(ILiquidStack outputFS, IItemStack inputIS, ILiquidStack inputFS, int minTechLevel)
|
||||
{
|
||||
addItemFluidConversion(null, outputFS, inputIS, inputFS, minTechLevel, true, 8, true, true);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addItemFluidConversion(ILiquidStack outputFS, IItemStack inputIS, ILiquidStack inputFS)
|
||||
{
|
||||
addItemFluidConversion(null, outputFS, inputIS, inputFS, 1, true, 8, true, true);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeItemFluidConversion(IItemStack inputIS, ILiquidStack inputFS)
|
||||
{
|
||||
ItemStack inputStack = MineTweakerMC.getItemStack(inputIS);
|
||||
FluidStack inputFluid = MineTweakerMC.getLiquidStack(inputFS);
|
||||
|
||||
if(inputStack == null || inputStack.getItem() == null)
|
||||
MineTweakerAPI.logError("Missing InputStack");
|
||||
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
|
||||
MineTweakerAPI.apply(new removeItemFluidConversionAction(inputStack, inputFluid));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
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);
|
||||
|
||||
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, int sealedTime)
|
||||
{
|
||||
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, 8, true);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addItemConversion(IItemStack outputIS, IItemStack inputIS, ILiquidStack inputFS)
|
||||
{
|
||||
addItemConversion(outputIS, inputIS, inputFS, 1, true, 8, true);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeItemConversion(IItemStack inputIS, ILiquidStack inputFS)
|
||||
{
|
||||
ItemStack inputStack = MineTweakerMC.getItemStack(inputIS);
|
||||
FluidStack inputFluid = MineTweakerMC.getLiquidStack(inputFS);
|
||||
|
||||
MineTweakerAPI.apply(new removeItemFluidConversionAction(inputStack, inputFluid));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void ageFluid(ILiquidStack outputFS, ILiquidStack inputFS, int minTechLevel, boolean sealed, int sealtime)
|
||||
{
|
||||
FluidStack inputFluid = MineTweakerMC.getLiquidStack(inputFS);
|
||||
FluidStack outputFluid = MineTweakerMC.getLiquidStack(outputFS);
|
||||
|
||||
if(inputFluid.amount <= 0)
|
||||
MineTweakerAPI.logError("InputFluid must contain more than 0 mb of fluid");
|
||||
else if(outputFluid == null || outputFluid.getFluid() == null)
|
||||
MineTweakerAPI.logError("Missing OutputFluid");
|
||||
else if(outputFluid.amount <= 0)
|
||||
MineTweakerAPI.logError("OutputFluid must contain more than 0 mb of fluid");
|
||||
else if(sealed == false && sealtime > 0)
|
||||
MineTweakerAPI.logError("Sealed time must be 0 if barrel is unsealed");
|
||||
else
|
||||
MineTweakerAPI.apply(new addAgedFluidAction(inputFluid, outputFluid, sealtime, sealed, minTechLevel));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void ageFluid(ILiquidStack outputFS, ILiquidStack inputFS, int minTechLevel)
|
||||
{
|
||||
ageFluid(outputFS, inputFS, minTechLevel, true, 8);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void ageFluid(ILiquidStack outputFS, ILiquidStack inputFS)
|
||||
{
|
||||
ageFluid(outputFS, inputFS, 1, true, 8);
|
||||
}
|
||||
|
||||
//BarrelLiquidToLiquidRecipe
|
||||
@ZenMethod
|
||||
public static void addFluidCombination(ILiquidStack outputFluid, ILiquidStack fluidInBarrel, ILiquidStack inputFluid)
|
||||
{
|
||||
FluidStack barrelContents = MineTweakerMC.getLiquidStack(fluidInBarrel);
|
||||
FluidStack inputfluid = MineTweakerMC.getLiquidStack(inputFluid);
|
||||
FluidStack outputfluid = MineTweakerMC.getLiquidStack(outputFluid);
|
||||
|
||||
MineTweakerAPI.apply(new addFluidCombinationAction(barrelContents, inputfluid, outputfluid));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeFluidCombination(ILiquidStack outputFluid, ILiquidStack fluidInBarrel, ILiquidStack inputFluid)
|
||||
{
|
||||
FluidStack barrelContents = MineTweakerMC.getLiquidStack(fluidInBarrel);
|
||||
FluidStack inputfluid = MineTweakerMC.getLiquidStack(inputFluid);
|
||||
FluidStack outputfluid = MineTweakerMC.getLiquidStack(outputFluid);
|
||||
|
||||
MineTweakerAPI.apply(new removeFluidCombinationAction(barrelContents, inputfluid, outputfluid));
|
||||
}
|
||||
|
||||
// ######################
|
||||
// ### Action classes ###
|
||||
// ######################
|
||||
|
||||
//Add Fluid Conversion
|
||||
|
||||
private static class addFluidConversionAction implements IUndoableAction
|
||||
{
|
||||
ItemStack inputStack;
|
||||
ItemStack outputStack;
|
||||
FluidStack inputFluid;
|
||||
FluidStack outputFluid;
|
||||
int sealtime;
|
||||
boolean removesLiquid;
|
||||
boolean sealed;
|
||||
int minTechLevel;
|
||||
boolean allowAnyStack;
|
||||
|
||||
public addFluidConversionAction(ItemStack inputIS, FluidStack inputFS, ItemStack outputIS, FluidStack outputFS, int sealtime, boolean removesLiquid, boolean sealed, int minTechLevel, boolean allowAnyStack)
|
||||
{
|
||||
this.inputStack = inputIS;
|
||||
this.inputFluid = inputFS;
|
||||
this.outputFluid = outputFS;
|
||||
this.outputStack = outputIS;
|
||||
this.sealtime = sealtime;
|
||||
this.removesLiquid = removesLiquid;
|
||||
this.sealed = sealed;
|
||||
this.minTechLevel = minTechLevel;
|
||||
this.allowAnyStack = allowAnyStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
BarrelManager.getInstance().addRecipe(new BarrelRecipe(inputStack, inputFluid, outputStack, outputFluid, sealtime).setRemovesLiquid(removesLiquid).setAllowAnyStack(allowAnyStack).setMinTechLevel(minTechLevel).setSealedRecipe(sealed));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
if(outputStack != null)
|
||||
return "Adding item '" + inputStack.getDisplayName() + "' with '" + inputFluid.getLocalizedName()
|
||||
+ "' to barrel yeilding '" + outputStack.getDisplayName() + "'";
|
||||
else
|
||||
return "Adding item '" + inputStack.getDisplayName() + "' with '" + inputFluid.getLocalizedName()
|
||||
+ "' to barrel yeilding '" + outputFluid.getLocalizedName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
List<BarrelRecipe> BarrelList = BarrelManager.getInstance().getRecipes();
|
||||
for (int i = 0; i < BarrelList.size(); i++)
|
||||
{
|
||||
if (BarrelList.get(i) != null)
|
||||
{
|
||||
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--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo()
|
||||
{
|
||||
return "Removing item '" + inputStack.getDisplayName() + "' with '" + inputFluid.getLocalizedName() + "' from barrel '";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//Remove Fluid Conversion & Remove Item Conversion Action
|
||||
|
||||
private static class removeItemFluidConversionAction implements IUndoableAction
|
||||
{
|
||||
ItemStack inputStack;
|
||||
FluidStack inputFluid;
|
||||
|
||||
public removeItemFluidConversionAction(ItemStack inputIS, FluidStack inputFS)
|
||||
{
|
||||
this.inputStack = inputIS;
|
||||
this.inputFluid = inputFS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
List<BarrelRecipe> BarrelList = BarrelManager.getInstance().getRecipes();
|
||||
for (int i = 0; i < BarrelList.size(); i++)
|
||||
{
|
||||
if (BarrelList.get(i) != null)
|
||||
{
|
||||
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--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Removing item '" + inputStack.getDisplayName() + "' with '" + inputFluid.getLocalizedName() + "' from barrel '";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//Add Item Conversion Action
|
||||
|
||||
private static class addItemConversionAction implements IUndoableAction
|
||||
{
|
||||
ItemStack inputStack;
|
||||
ItemStack outputStack;
|
||||
FluidStack inputFluid;
|
||||
boolean sealed;
|
||||
int sealedTime;
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
BarrelManager.getInstance().addRecipe(new BarrelRecipe(inputStack, inputFluid, outputStack, inputFluid, sealedTime).setAllowAnyStack(allowAnyStack).setMinTechLevel(minTechLevel).setSealedRecipe(sealed));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Adding item '" + inputStack.getDisplayName() + "' with '" + inputFluid.getLocalizedName()
|
||||
+ "' to barrel yeilding '" + outputStack.getDisplayName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
List<BarrelRecipe> BarrelList = BarrelManager.getInstance().getRecipes();
|
||||
for (int i = 0; i < BarrelList.size(); i++)
|
||||
{
|
||||
if (BarrelList.get(i) != null)
|
||||
{
|
||||
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--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo()
|
||||
{
|
||||
return "Removing item '" + inputStack.getDisplayName() + "' with '" + inputFluid.getLocalizedName() + "' from barrel '";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//Add Fluid Combination Action
|
||||
|
||||
private static class addFluidCombinationAction implements IUndoableAction
|
||||
{
|
||||
FluidStack barrelContents;
|
||||
FluidStack inputFluid;
|
||||
FluidStack outputFluid;
|
||||
|
||||
public addFluidCombinationAction(FluidStack barrelContents, FluidStack inputFS, FluidStack outputFS)
|
||||
{
|
||||
this.barrelContents = barrelContents;
|
||||
this.inputFluid = inputFS;
|
||||
this.outputFluid = outputFS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
BarrelManager.getInstance().addRecipe(new BarrelLiquidToLiquidRecipe(barrelContents, inputFluid, outputFluid).setSealedRecipe(false).setMinTechLevel(0).setRemovesLiquid(false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Combining '" + barrelContents.getLocalizedName() + "' with '" + inputFluid.getLocalizedName()
|
||||
+ "' in barrel yeilding '" + outputFluid.getLocalizedName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
List<BarrelRecipe> BarrelList = BarrelManager.getInstance().getRecipes();
|
||||
for (int i = 0; i < BarrelList.size(); i++)
|
||||
{
|
||||
if (BarrelList.get(i) != null)
|
||||
{
|
||||
if(BarrelList.get(i) instanceof BarrelLiquidToLiquidRecipe)
|
||||
{
|
||||
if(BarrelList.get(i).getInItem() == null && BarrelList.get(i).getRecipeOutIS() == null &&
|
||||
((BarrelLiquidToLiquidRecipe)BarrelList.get(i)).getInputfluid().isFluidEqual(inputFluid) &&
|
||||
BarrelList.get(i).getInFluid().isFluidEqual(barrelContents) &&
|
||||
BarrelList.get(i).getRecipeOutFluid().isFluidEqual(outputFluid))
|
||||
{
|
||||
BarrelList.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo()
|
||||
{
|
||||
return "Removing combination of '" + barrelContents.getLocalizedName() + "' with '" + inputFluid.getLocalizedName()
|
||||
+ "' in barrel yeilding '" + outputFluid.getLocalizedName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//Remove Fluid Combination Action
|
||||
|
||||
private static class removeFluidCombinationAction implements IUndoableAction
|
||||
{
|
||||
FluidStack barrelContents;
|
||||
FluidStack inputFluid;
|
||||
FluidStack outputFluid;
|
||||
|
||||
public removeFluidCombinationAction(FluidStack barrelContents, FluidStack inputFS, FluidStack outputFS)
|
||||
{
|
||||
this.barrelContents = barrelContents;
|
||||
this.inputFluid = inputFS;
|
||||
this.outputFluid = outputFS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
List<BarrelRecipe> BarrelList = BarrelManager.getInstance().getRecipes();
|
||||
for (int i = 0; i < BarrelList.size(); i++)
|
||||
{
|
||||
if (BarrelList.get(i) != null)
|
||||
{
|
||||
if(BarrelList.get(i) instanceof BarrelLiquidToLiquidRecipe)
|
||||
{
|
||||
if(BarrelList.get(i).getInItem() == null && BarrelList.get(i).getRecipeOutIS() == null &&
|
||||
((BarrelLiquidToLiquidRecipe)BarrelList.get(i)).getInputfluid().isFluidEqual(inputFluid) &&
|
||||
BarrelList.get(i).getInFluid().isFluidEqual(barrelContents) &&
|
||||
BarrelList.get(i).getRecipeOutFluid().isFluidEqual(outputFluid))
|
||||
{
|
||||
BarrelList.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Removing combination of '" + barrelContents.getLocalizedName() + "' with '" + inputFluid.getLocalizedName()
|
||||
+ "' in barrel yeilding '" + outputFluid.getLocalizedName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
BarrelManager.getInstance().addRecipe(new BarrelLiquidToLiquidRecipe(barrelContents, inputFluid, outputFluid).setSealedRecipe(false).setMinTechLevel(0).setRemovesLiquid(false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo()
|
||||
{
|
||||
return "Adding Combination of '" + barrelContents.getLocalizedName() + "' with '" + inputFluid.getLocalizedName()
|
||||
+ "' in barrel yeilding '" + outputFluid.getLocalizedName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//Add Fluid Aging
|
||||
|
||||
private static class addAgedFluidAction implements IUndoableAction
|
||||
{
|
||||
FluidStack inputFluid;
|
||||
FluidStack outputFluid;
|
||||
int sealtime;
|
||||
boolean sealed;
|
||||
int minTechLevel;
|
||||
|
||||
public addAgedFluidAction(FluidStack inputFS, FluidStack outputFS, int sealtime, boolean sealed, int minTechLevel)
|
||||
{
|
||||
this.inputFluid = inputFS;
|
||||
this.outputFluid = outputFS;
|
||||
this.sealtime = sealtime;
|
||||
this.sealed = sealed;
|
||||
this.minTechLevel = minTechLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
BarrelManager.getInstance().addRecipe(new BarrelRecipe(null, inputFluid, null, outputFluid, sealtime).setRemovesLiquid(false).setMinTechLevel(minTechLevel).setSealedRecipe(sealed));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Adding aging to '" + inputFluid.getLocalizedName() + "' in barrel yeilding '" + outputFluid.getLocalizedName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
List<BarrelRecipe> BarrelList = BarrelManager.getInstance().getRecipes();
|
||||
for (int i = 0; i < BarrelList.size(); i++)
|
||||
{
|
||||
if (BarrelList.get(i) != null)
|
||||
{
|
||||
if (BarrelList.get(i).getRecipeOutIS() == null && BarrelList.get(i).getInItem() == null &&
|
||||
BarrelList.get(i).getInFluid() == inputFluid && BarrelList.get(i).getRecipeOutFluid() == outputFluid)
|
||||
BarrelList.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Remove aging to '" + inputFluid.getLocalizedName() + "' in barrel yeilding '" + outputFluid.getLocalizedName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,196 +0,0 @@
|
|||
package com.JAWolfe.terrafirmapunktweaks.minetweaker.TFC;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bioxx.tfc.api.HeatIndex;
|
||||
import com.bioxx.tfc.api.HeatRegistry;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.minecraft.MineTweakerMC;
|
||||
import minetweaker.api.oredict.IOreDictEntry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.tfptweaks.ItemHeat")
|
||||
public class ItemHeat
|
||||
{
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input, double heat, double specHeat)
|
||||
{
|
||||
ItemStack inputStack = MineTweakerMC.getItemStack(input);
|
||||
ItemStack outputStack = MineTweakerMC.getItemStack(output);
|
||||
|
||||
if(inputStack == null || inputStack.getItem() == null)
|
||||
MineTweakerAPI.logError("Missing InputStack");
|
||||
else if(outputStack == null || outputStack.getItem() == null)
|
||||
MineTweakerAPI.logError("Missing OutputStack");
|
||||
else if(heat < 0)
|
||||
MineTweakerAPI.logError("Item melting point cannot be less than 0");
|
||||
else if(specHeat < 0)
|
||||
MineTweakerAPI.logError("Item specific heat cannot be less than 0");
|
||||
else
|
||||
MineTweakerAPI.apply(new addHeatingAction(outputStack, inputStack, heat, specHeat));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input, int heat)
|
||||
{
|
||||
addRecipe(output, input, heat, 1);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input)
|
||||
{
|
||||
addRecipe(output, input, 600);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IOreDictEntry oredictentry, double heat, double specHeat)
|
||||
{
|
||||
if (oredictentry != null && oredictentry.getAmount() > 0)
|
||||
{
|
||||
List<IItemStack> oreEntries = oredictentry.getItems();
|
||||
for(int i = 0; i < oreEntries.size(); i++)
|
||||
{
|
||||
addRecipe(output, oreEntries.get(i), heat, specHeat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IOreDictEntry oredictentry, double heat)
|
||||
{
|
||||
addRecipe(output, oredictentry, heat, 1);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IOreDictEntry oredictentry)
|
||||
{
|
||||
addRecipe(output, oredictentry, 600);
|
||||
}
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack input)
|
||||
{
|
||||
ItemStack inputStack = MineTweakerMC.getItemStack(input);
|
||||
|
||||
if(inputStack == null || inputStack.getItem() == null)
|
||||
MineTweakerAPI.logError("Missing InputStack");
|
||||
else
|
||||
MineTweakerAPI.apply(new removeHeatingAction(inputStack));
|
||||
}
|
||||
|
||||
private static class addHeatingAction implements IUndoableAction
|
||||
{
|
||||
ItemStack inputStack;
|
||||
ItemStack outputStack;
|
||||
double meltingPoint;
|
||||
double specificHeat;
|
||||
|
||||
public addHeatingAction(ItemStack output, ItemStack input, double heat, double specHeat)
|
||||
{
|
||||
this.outputStack = output;
|
||||
this.inputStack = input;
|
||||
this.meltingPoint = heat;
|
||||
this.specificHeat = specHeat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
HeatRegistry.getInstance().addIndex(new HeatIndex(inputStack, specificHeat, meltingPoint, outputStack).setKeepNBT(true).setMinMax(outputStack.getItemDamage()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Adding item '" + inputStack.getDisplayName() + "' to heated items with melting point '" + meltingPoint
|
||||
+ "' and specific heat '" + specificHeat + "' to yeild '" + outputStack.getDisplayName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
List<HeatIndex> heatList = HeatRegistry.getInstance().getHeatList();
|
||||
for (int i = 0; i < heatList.size(); i++)
|
||||
{
|
||||
if (heatList.get(i) != null)
|
||||
{
|
||||
if (heatList.get(i).matches(inputStack) && heatList.get(i).getOutputItem() == outputStack.getItem()
|
||||
&& heatList.get(i).meltTemp == meltingPoint && heatList.get(i).specificHeat == specificHeat)
|
||||
heatList.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo()
|
||||
{
|
||||
return "Removing item '" + inputStack.getDisplayName() + "' from heated items with melting point '" + meltingPoint
|
||||
+ "' and specific heat '" + specificHeat + "' yeilding '" + outputStack.getDisplayName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class removeHeatingAction implements IUndoableAction
|
||||
{
|
||||
private ItemStack inputStack;
|
||||
|
||||
public removeHeatingAction(ItemStack input)
|
||||
{
|
||||
this.inputStack = input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
List<HeatIndex> heatList = HeatRegistry.getInstance().getHeatList();
|
||||
for (int i = 0; i < heatList.size(); i++)
|
||||
{
|
||||
if (heatList.get(i) != null)
|
||||
{
|
||||
if (heatList.get(i).matches(inputStack))
|
||||
heatList.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing item '" + inputStack.getDisplayName() + "' from Heated Items.'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
//Cannot undo
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
//Cannot undo
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,174 +0,0 @@
|
|||
package com.JAWolfe.terrafirmapunktweaks.minetweaker.TFC;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bioxx.tfc.Reference;
|
||||
import com.bioxx.tfc.api.Crafting.LoomManager;
|
||||
import com.bioxx.tfc.api.Crafting.LoomRecipe;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.minecraft.MineTweakerMC;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.tfptweaks.Loom")
|
||||
public class Loom
|
||||
{
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input, String resource)
|
||||
{
|
||||
ItemStack inputStack = MineTweakerMC.getItemStack(input);
|
||||
ItemStack outputStack = MineTweakerMC.getItemStack(output);
|
||||
|
||||
if(inputStack == null || inputStack.getItem() == null)
|
||||
MineTweakerAPI.logError("Missing InputStack");
|
||||
else if(outputStack == null || outputStack.getItem() == null)
|
||||
MineTweakerAPI.logError("Missing OutputStack");
|
||||
else if(resource != null && resource.length() == 0)
|
||||
MineTweakerAPI.logError("Missing Resource Location");
|
||||
else
|
||||
MineTweakerAPI.apply(new addLoomAction(outputStack, inputStack, resource));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input, int overlay)
|
||||
{
|
||||
switch(overlay)
|
||||
{
|
||||
case 1: addRecipe(output, input, Reference.MOD_ID + ":" + "blocks/String"); break;
|
||||
case 2: addRecipe(output, input, Reference.MOD_ID + ":" + "blocks/Silk"); break;
|
||||
case 3: addRecipe(output, input, Reference.MOD_ID + ":" + "blocks/Rope"); break;
|
||||
default: addRecipe(output, input, Reference.MOD_ID + ":" + "blocks/String"); break;
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input)
|
||||
{
|
||||
addRecipe(output, input, 1);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack input)
|
||||
{
|
||||
ItemStack inputStack = MineTweakerMC.getItemStack(input);
|
||||
|
||||
if(inputStack == null || inputStack.getItem() == null)
|
||||
MineTweakerAPI.logError("Missing InputStack");
|
||||
else
|
||||
MineTweakerAPI.apply(new removeLoomAction(inputStack));
|
||||
}
|
||||
|
||||
private static class addLoomAction implements IUndoableAction
|
||||
{
|
||||
private ItemStack inputStack;
|
||||
private ItemStack outputStack;
|
||||
private String modid;
|
||||
private String pathLocation;
|
||||
|
||||
public addLoomAction(ItemStack output, ItemStack input, String location)
|
||||
{
|
||||
this.inputStack = input;
|
||||
this.outputStack = output;
|
||||
|
||||
String[] itemresource = location.split(":");
|
||||
this.modid = itemresource[0];
|
||||
this.pathLocation = "textures/" + itemresource[1] + ".png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
LoomManager.getInstance().addRecipe(new LoomRecipe(inputStack, outputStack), new ResourceLocation(modid, pathLocation));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Adding item '" + inputStack.getDisplayName() + "' to loom yeilding '" + outputStack.getDisplayName()
|
||||
+ "' with the resource location of '" + modid +":" + pathLocation + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
List<LoomRecipe> LoomList = LoomManager.getInstance().getRecipes();
|
||||
for (int i = 0; i < LoomList.size(); i++)
|
||||
{
|
||||
if (LoomList.get(i) != null)
|
||||
{
|
||||
if (LoomList.get(i).matches(inputStack) && LoomList.get(i).resultMatches(outputStack))
|
||||
LoomList.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing item '" + inputStack.getDisplayName() + "' from loom'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class removeLoomAction implements IUndoableAction
|
||||
{
|
||||
private ItemStack inputStack;
|
||||
|
||||
public removeLoomAction(ItemStack input)
|
||||
{
|
||||
this.inputStack = input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
List<LoomRecipe> LoomList = LoomManager.getInstance().getRecipes();
|
||||
for (int i = 0; i < LoomList.size(); i++)
|
||||
{
|
||||
if (LoomList.get(i) != null)
|
||||
{
|
||||
if (LoomList.get(i).matches(inputStack))
|
||||
LoomList.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing item '" + inputStack.getDisplayName() + "' from loom'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,183 +0,0 @@
|
|||
package com.JAWolfe.terrafirmapunktweaks.minetweaker.TFC;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bioxx.tfc.api.Crafting.QuernManager;
|
||||
import com.bioxx.tfc.api.Crafting.QuernRecipe;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.minecraft.MineTweakerMC;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.tfptweaks.Quern")
|
||||
public class Quern
|
||||
{
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input)
|
||||
{
|
||||
ItemStack inputStack = MineTweakerMC.getItemStack(input);
|
||||
ItemStack outputStack = MineTweakerMC.getItemStack(output);
|
||||
|
||||
if(inputStack == null || inputStack.getItem() == null)
|
||||
MineTweakerAPI.logError("Missing InputStack");
|
||||
else if(outputStack == null || outputStack.getItem() == null)
|
||||
MineTweakerAPI.logError("Missing OutputStack");
|
||||
else
|
||||
MineTweakerAPI.apply(new addQuernAction(outputStack, inputStack));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output, IItemStack input)
|
||||
{
|
||||
ItemStack inputStack = MineTweakerMC.getItemStack(input);
|
||||
ItemStack outputStack = MineTweakerMC.getItemStack(output);
|
||||
|
||||
if(inputStack == null || inputStack.getItem() == null)
|
||||
MineTweakerAPI.logError("Missing InputStack");
|
||||
else if(outputStack == null || outputStack.getItem() == null)
|
||||
MineTweakerAPI.logError("Missing OutputStack");
|
||||
else
|
||||
MineTweakerAPI.apply(new removeQuernAction(outputStack, inputStack));
|
||||
}
|
||||
|
||||
private static class addQuernAction implements IUndoableAction
|
||||
{
|
||||
private ItemStack inputStack;
|
||||
private ItemStack outputStack;
|
||||
|
||||
public addQuernAction(ItemStack output, ItemStack input)
|
||||
{
|
||||
|
||||
this.outputStack = output;
|
||||
this.inputStack = input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
QuernManager.getInstance().addRecipe(new QuernRecipe(inputStack, outputStack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Adding item '" + inputStack.getDisplayName() + "' to the Quern to yeild '" + outputStack.getDisplayName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
List<QuernRecipe> quernList = QuernManager.getInstance().getRecipes();
|
||||
for (int i = 0; i < quernList.size(); i++)
|
||||
{
|
||||
if (quernList.get(i) != null)
|
||||
{
|
||||
if (quernList.get(i).isInItem(inputStack) && ItemStack.areItemStacksEqual(quernList.get(i).getResult(), outputStack))
|
||||
quernList.remove(i--);
|
||||
}
|
||||
}
|
||||
|
||||
if(QuernManager.getInstance().findMatchingRecipe(inputStack) == null && QuernManager.getInstance().isValidItem(inputStack))
|
||||
{
|
||||
List<ItemStack> validItemsList = QuernManager.getInstance().getValidItems();
|
||||
for (int i = 0; i < validItemsList.size(); i++)
|
||||
{
|
||||
if (validItemsList.get(i) != null)
|
||||
{
|
||||
if (ItemStack.areItemStacksEqual(validItemsList.get(i), inputStack))
|
||||
validItemsList.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo()
|
||||
{
|
||||
return "Removing item '" + inputStack.getDisplayName() + "' from the Quern yeilding '" + outputStack.getDisplayName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class removeQuernAction implements IUndoableAction
|
||||
{
|
||||
private ItemStack inputStack;
|
||||
private ItemStack outputStack;
|
||||
|
||||
public removeQuernAction(ItemStack output, ItemStack input)
|
||||
{
|
||||
this.outputStack = output;
|
||||
this.inputStack = input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
List<QuernRecipe> quernList = QuernManager.getInstance().getRecipes();
|
||||
for (int i = 0; i < quernList.size(); i++)
|
||||
{
|
||||
if (quernList.get(i) != null)
|
||||
{
|
||||
if (quernList.get(i).isInItem(inputStack) && ItemStack.areItemStacksEqual(quernList.get(i).getResult(), outputStack))
|
||||
quernList.remove(i--);
|
||||
}
|
||||
}
|
||||
|
||||
if(QuernManager.getInstance().findMatchingRecipe(inputStack) == null && QuernManager.getInstance().isValidItem(inputStack))
|
||||
{
|
||||
List<ItemStack> validItemsList = QuernManager.getInstance().getValidItems();
|
||||
for (int i = 0; i < validItemsList.size(); i++)
|
||||
{
|
||||
if (validItemsList.get(i) != null)
|
||||
{
|
||||
if (ItemStack.areItemStacksEqual(validItemsList.get(i), inputStack))
|
||||
validItemsList.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Removing item '" + inputStack.getDisplayName() + "' from the Quern yeilding '" + outputStack.getDisplayName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
QuernManager.getInstance().addRecipe(new QuernRecipe(inputStack, outputStack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo()
|
||||
{
|
||||
return "Adding item '" + inputStack.getDisplayName() + "' to the Quern to yeild '" + outputStack.getDisplayName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,11 +2,6 @@ package com.JAWolfe.terrafirmapunktweaks.minetweaker;
|
|||
|
||||
import com.JAWolfe.terrafirmapunktweaks.minetweaker.Buildcraft.AssemblyTable;
|
||||
import com.JAWolfe.terrafirmapunktweaks.minetweaker.Forestry.Squeezer;
|
||||
import com.JAWolfe.terrafirmapunktweaks.minetweaker.TFC.Anvil;
|
||||
import com.JAWolfe.terrafirmapunktweaks.minetweaker.TFC.Barrel;
|
||||
import com.JAWolfe.terrafirmapunktweaks.minetweaker.TFC.ItemHeat;
|
||||
import com.JAWolfe.terrafirmapunktweaks.minetweaker.TFC.Loom;
|
||||
import com.JAWolfe.terrafirmapunktweaks.minetweaker.TFC.Quern;
|
||||
import com.JAWolfe.terrafirmapunktweaks.reference.ConfigSettings;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
@ -20,12 +15,6 @@ public class TFCTweaker
|
|||
{
|
||||
MineTweakerAPI.registerClass(BrickOven.class);
|
||||
|
||||
MineTweakerAPI.registerClass(ItemHeat.class);
|
||||
MineTweakerAPI.registerClass(Loom.class);
|
||||
MineTweakerAPI.registerClass(Quern.class);
|
||||
MineTweakerAPI.registerClass(Barrel.class);
|
||||
MineTweakerAPI.registerClass(Anvil.class);
|
||||
|
||||
if(Loader.isModLoaded("BuildCraft|Core"))
|
||||
{
|
||||
MineTweakerAPI.registerClass(AssemblyTable.class);
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
package com.JAWolfe.terrafirmapunktweaks.reference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ReferenceLists
|
||||
{
|
||||
private static final ReferenceLists INSTANCE = new ReferenceLists();
|
||||
public static final ReferenceLists getInstance()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public List<ItemStack> anvilIngredList;
|
||||
|
||||
private ReferenceLists()
|
||||
{
|
||||
anvilIngredList = new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
public void addAnvilIngred(ItemStack newIS)
|
||||
{
|
||||
if(!isAnvilInged(newIS))
|
||||
{
|
||||
anvilIngredList.add(newIS);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAnvilInged(ItemStack is)
|
||||
{
|
||||
for(int i = 0; i < anvilIngredList.size(); i++)
|
||||
{
|
||||
ItemStack listIS = anvilIngredList.get(i);
|
||||
if(is != null && listIS != null)
|
||||
{
|
||||
if(is.getItem() == listIS.getItem())
|
||||
{
|
||||
if(is.getItemDamage() == listIS.getItemDamage())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user