1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
package ihl.processing.metallurgy;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import ic2.core.ContainerBase;
import ihl.IHLMod;
import ihl.recipes.RecipeOutputItemStack;
import ihl.recipes.UniversalRecipeInput;
import ihl.recipes.UniversalRecipeManager;
import ihl.recipes.UniversalRecipeOutput;
import ihl.utils.IHLUtils;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class MuffleFurnanceTileEntity extends MachineBaseTileEntity{
protected static UniversalRecipeManager recipeManager = new UniversalRecipeManager("mufflefurnace");
public MuffleFurnanceTileEntity()
{
super(2);
}
@Override
public String getStartSoundFile() {
return null;
}
@Override
public String getLoopSoundFile() {
return null;
}
@Override
public String getStopSoundFile() {
return null;
}
@Override
public String getInventoryName() {
return "MuffleFurnance";
}
@Override
@SideOnly(Side.CLIENT)
public GuiScreen getGui(EntityPlayer player, boolean arg1) {
return new MuffleFurnaceGui(new MuffleFurnanceContainer(player, this));
}
@Override
public ContainerBase<?> getGuiContainer(EntityPlayer player) {
return new MuffleFurnanceContainer(player, this);
}
@Override
public boolean canOperate()
{
ItemStack crucible = input.getItemStack(IHLMod.crucible);
if(crucible!=null)
{
return true;
}
ItemStack mold = input.getItemStack(IHLUtils.getThisModItem("injectionMold"));
if(mold!=null)
{
return true;
}
return getOutput()!=null;
}
@Override
public void operate()
{
ItemStack crucible = input.getItemStack(IHLMod.crucible);
if(crucible!=null)
{
((Crucible)crucible.getItem()).processContent(crucible, this);
return;
}
ItemStack mold = input.getItemStack(IHLUtils.getThisModItem("injectionMold"));
if(mold!=null)
{
mold.stackTagCompound.setBoolean("isContainStearin", false);
return;
}
if(this.getOutput()!=null)
{
List<RecipeOutputItemStack> output = MuffleFurnanceTileEntity.recipeManager.getOutputFor(null,this.input.getItemStackList(), true, true).getItemOutputs();
for(int i=0; i<this.input.size();i++)
{
if(i<output.size() && output.get(i)!=null)
{
ItemStack outStack = output.get(i).itemStack.copy();
outStack.stackSize=Math.round(output.get(i).quantity);
if(this.input.get(i)!=null)
{
outStack.stackTagCompound=this.input.get(i).stackTagCompound;
}
this.input.put(i,outStack);
}
if(this.input.get(i)!=null && this.input.get(i).stackSize<=0)this.input.put(i, null);
}
}
}
public static void addRecipe(ItemStack input1, ItemStack output)
{
recipeManager.addRecipe(new UniversalRecipeInput(null, Arrays.asList(new ItemStack [] {input1})),new UniversalRecipeOutput(null, Arrays.asList(new ItemStack [] {output}),20));
}
public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
return recipeManager.getRecipes();
}
@Override
public UniversalRecipeOutput getOutput()
{
return MuffleFurnanceTileEntity.recipeManager.getOutputFor(null,this.input.getItemStackList(), false, false);
}
public static void addRecipe(UniversalRecipeInput universalRecipeInput, UniversalRecipeOutput universalRecipeOutput)
{
recipeManager.addRecipe(universalRecipeInput, universalRecipeOutput);
}
public static void addRecipe(ItemStack input1, ItemStack output, float f) {
recipeManager.addRecipe(new UniversalRecipeInput(null, Arrays.asList(new ItemStack [] {input1})),new UniversalRecipeOutput(null, Arrays.asList(new RecipeOutputItemStack [] {new RecipeOutputItemStack(output,f)}),20));
}
}
|