Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TAN Cauldron recipes to fill the canteen from a cauldron
- Loading branch information
1 parent
a6cbe0f
commit b0347e5
Showing
4 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
src/main/java/knightminer/inspirations/plugins/tan/recipes/FillCanteenRecipe.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package knightminer.inspirations.plugins.tan.recipes; | ||
|
||
import java.util.List; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
|
||
import knightminer.inspirations.library.recipe.cauldron.ISimpleCauldronRecipe; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraftforge.fluids.Fluid; | ||
|
||
public class FillCanteenRecipe implements ISimpleCauldronRecipe { | ||
|
||
private Item canteen; | ||
private int meta, current, type; | ||
private CauldronState fluid; | ||
// JEI data | ||
private List<ItemStack> input; | ||
private ItemStack result; | ||
|
||
public FillCanteenRecipe(Item canteen, int current, int type, Fluid fluid) { | ||
this.canteen = canteen; | ||
// canteen level | ||
this.current = current; | ||
// meta offset for canteen | ||
this.type = type; | ||
// detemine the metadata for the input, easier than calculating it two places | ||
this.meta = current == 0 ? 0 : (3 - current) * 4 + type; | ||
this.fluid = CauldronState.fluid(fluid); | ||
|
||
// JEI data | ||
this.input = ImmutableList.of(new ItemStack(canteen, 1, meta)); | ||
this.result = new ItemStack(canteen, 1, type); | ||
} | ||
|
||
@Override | ||
public boolean matches(ItemStack stack, boolean boiling, int level, CauldronState state) { | ||
return level >= 1 && fluid.matches(state) | ||
&& stack.getItem() == canteen && stack.getMetadata() == meta; | ||
} | ||
|
||
@Override | ||
public ItemStack getResult(ItemStack stack, boolean boiling, int level, CauldronState state) { | ||
if(level + current >= 3) { | ||
return new ItemStack(canteen, 1, type); | ||
} | ||
return new ItemStack(canteen, 1, ((3 - (level + current)) * 4) + type); | ||
} | ||
|
||
@Override | ||
public int getInputLevel() { | ||
return 3 - current; | ||
} | ||
|
||
@Override | ||
public int getLevel(int level) { | ||
int total = level + current; | ||
return total <= 3 ? 0 : total - 3; | ||
} | ||
|
||
/* JEI */ | ||
@Override | ||
public List<ItemStack> getInput() { | ||
return input; | ||
} | ||
|
||
@Override | ||
public ItemStack getResult() { | ||
return result; | ||
} | ||
|
||
@Override | ||
public Object getInputState() { | ||
return fluid.getFluid(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters