mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-19 03:49:07 +00:00
[1.7.10] Removed unfinished features (#118)
* Removed unused Honey Crystal * Removed unfinished kitchen machines Removed Alcohol * Removed unused items * Removed unused PNGs * Fix README.md
This commit is contained in:
1 parent
31caf3c4c3
commit
fe56638f16
124 files changed
+45
-3824
No files matched your search
@@ -2,15 +2,11 @@ package binnie.core.liquid;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.extratrees.alcohol.AlcoholEffect;
|
||||
import binnie.extratrees.alcohol.drink.DrinkManager;
|
||||
import binnie.extratrees.alcohol.drink.IDrinkLiquid;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -123,50 +119,18 @@ public class ItemFluidContainer extends ItemFood {
|
||||
return container.getEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
FluidStack fluid = getLiquid(stack);
|
||||
IDrinkLiquid liquid = DrinkManager.getLiquid(fluid);
|
||||
if (liquid != null) {
|
||||
AlcoholEffect.makeDrunk(player, liquid.getABV() * fluid.amount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack stack) {
|
||||
return isDrinkable(stack) ? EnumAction.drink : EnumAction.none;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (isDrinkable(stack)) {
|
||||
player.setItemInUse(stack, getMaxItemUseDuration(stack));
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int func_150905_g(ItemStack stack) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float func_150906_h(ItemStack p_150906_1_) {
|
||||
public float func_150906_h(ItemStack stack) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
private boolean isDrinkable(ItemStack stack) {
|
||||
FluidStack fluid = getLiquid(stack);
|
||||
IDrinkLiquid liquid = DrinkManager.getLiquid(fluid);
|
||||
return liquid != null && liquid.isConsumable();
|
||||
}
|
||||
}
|
||||
@@ -46,8 +46,6 @@ public class ExtraBees extends AbstractMod {
|
||||
public static Item comb;
|
||||
public static Item propolis;
|
||||
public static Item honeyDrop;
|
||||
public static Item honeyCrystal;
|
||||
public static Item honeyCrystalEmpty;
|
||||
public static Item dictionary;
|
||||
public static Item itemMisc;
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package binnie.extrabees.products;
|
||||
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ItemHoneyCrystal extends Item {
|
||||
private int maxCharge;
|
||||
private int transferLimit;
|
||||
private int tier;
|
||||
|
||||
public ItemHoneyCrystal() {
|
||||
maxCharge = 8000;
|
||||
transferLimit = 500;
|
||||
tier = 1;
|
||||
setMaxDamage(27);
|
||||
setMaxStackSize(1);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
setUnlocalizedName("honeyCrystal");
|
||||
}
|
||||
|
||||
public static NBTTagCompound getOrCreateNbtData(ItemStack itemStack) {
|
||||
NBTTagCompound ret = itemStack.getTagCompound();
|
||||
if (ret == null) {
|
||||
ret = new NBTTagCompound();
|
||||
itemStack.setTagCompound(ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = ExtraBees.proxy.getIcon(register, "honeyCrystal");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack i) {
|
||||
return I18N.localise("extrabees.item.honeycrystal");
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package binnie.extrabees.products;
|
||||
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemHoneyCrystalEmpty extends ItemHoneyCrystal {
|
||||
public ItemHoneyCrystalEmpty() {
|
||||
setMaxDamage(0);
|
||||
setMaxStackSize(64);
|
||||
setUnlocalizedName("honeyCrystalEmpty");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = ExtraBees.proxy.getIcon(register, "honeyCrystalEmpty");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack i) {
|
||||
return I18N.localise("extrabees.item.honeycrystal.empty");
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,6 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
public class ModuleProducts implements IInitializable {
|
||||
@Override
|
||||
public void preInit() {
|
||||
ExtraBees.honeyCrystal = new ItemHoneyCrystal();
|
||||
ExtraBees.honeyCrystalEmpty = new ItemHoneyCrystalEmpty();
|
||||
ExtraBees.honeyDrop = new ItemHoneyDrop();
|
||||
ExtraBees.comb = new ItemHoneyComb();
|
||||
ExtraBees.propolis = new ItemPropolis();
|
||||
@@ -28,12 +26,6 @@ public class ModuleProducts implements IInitializable {
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
GameRegistry.addRecipe(
|
||||
new ItemStack(ExtraBees.honeyCrystalEmpty),
|
||||
"#@#", "@#@", "#@#",
|
||||
'@', Mods.forestry.stack("honeyDrop"),
|
||||
'#', EnumHoneyDrop.ENERGY.get(1)
|
||||
);
|
||||
for (EnumHoneyComb info : EnumHoneyComb.values()) {
|
||||
info.addRecipe();
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ import binnie.core.gui.IBinnieGUID;
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extratrees.alcohol.ModuleAlcohol;
|
||||
import binnie.extratrees.alcohol.drink.ItemDrink;
|
||||
import binnie.extratrees.block.ModuleBlocks;
|
||||
import binnie.extratrees.block.decor.BlockHedge;
|
||||
import binnie.extratrees.block.decor.BlockMultiFence;
|
||||
@@ -63,13 +61,9 @@ public class ExtraTrees extends AbstractMod {
|
||||
public static Item itemDurableHammer;
|
||||
public static Block blockGate;
|
||||
public static Block blockDoor;
|
||||
public static Block blockBranch;
|
||||
public static ItemDrink drink;
|
||||
public static BlockMultiFence blockMultiFence;
|
||||
public static Block blockDrink;
|
||||
public static BlockHedge blockHedge;
|
||||
public static BlockStainedDesign blockStained;
|
||||
public static int fruitPodRenderId;
|
||||
public static int doorRenderId;
|
||||
public static int branchRenderId;
|
||||
public static int fenceID;
|
||||
@@ -83,7 +77,6 @@ public class ExtraTrees extends AbstractMod {
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
addModule(new ModuleBlocks());
|
||||
addModule(new ModuleItems());
|
||||
addModule(new ModuleAlcohol());
|
||||
addModule(new ModuleGenetics());
|
||||
addModule(new ModuleCarpentry());
|
||||
addModule(new ModuleMachine());
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.liquid.FluidContainer;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public enum Alcohol implements IFluidType, ICocktailLiquid {
|
||||
Apple("ciderApple", 0xfabe3c, 0.3, 0.05),
|
||||
Apricot("wineApricot", 0xf0cf36, 0.3, 0.1),
|
||||
Banana("wineBanana", 0xe4c84d, 0.3, 0.1),
|
||||
Cherry("wineCherry", 0xab0416, 0.3, 0.1),
|
||||
Elderberry("wineElderberry", 0x950001, 0.3, 0.1),
|
||||
Peach("ciderPeach", 0xea661b, 0.3, 0.05),
|
||||
Pear("ciderPear", 0xe5d067, 0.3, 0.05),
|
||||
Plum("winePlum", 0xb81408, 0.3, 0.1),
|
||||
Carrot("wineCarrot", 0xf77d02, 0.3, 0.1),
|
||||
WhiteWine("wineWhite", 0xedda95, 0.1, 0.1),
|
||||
RedWine("wineRed", 0x750b0b, 0.2, 0.1),
|
||||
SparklingWine("wineSparkling", 0xfef7be, 0.1, 0.1),
|
||||
Agave("wineAgave", 0xd4ae64, 0.2, 0.1),
|
||||
Potato("fermentedPotatoes", 0xb78950, 0.8, 0.1),
|
||||
Citrus("wineCitrus", 0xffff00, 0.2, 0.1),
|
||||
Cranberry("wineCranberry", 0xb10002, 0.2, 0.1),
|
||||
Pineapple("winePineapple", 0xe0ac36, 0.2, 0.1),
|
||||
Tomato("wineTomato", 0xbe1a19, 0.2, 0.1),
|
||||
Fruit("juice", 0xfabe3c, 0.2, 0.1),
|
||||
Ale("beerAle", 0xc63a21, 0.7, 0.05),
|
||||
Lager("beerLager", 0xe97c05, 0.7, 0.05),
|
||||
WheatBeer("beerWheat", 0xdb6e08, 0.7, 0.05),
|
||||
RyeBeer("beerRye", 0xa55827, 0.7, 0.05),
|
||||
CornBeer("beerCorn", 0xcca424, 0.7, 0.05),
|
||||
Stout("beerStout", 0x592901, 0.8, 0.05),
|
||||
Barley("mashGrain", 0xc63a21, 0.9, 0.05),
|
||||
Wheat("mashWheat", 0xc63a21, 0.9, 0.05),
|
||||
Rye("mashRye", 0xa55827, 0.9, 0.05),
|
||||
Corn("mashCorn", 0xcca424, 0.9, 0.05);
|
||||
|
||||
static {
|
||||
Alcohol.Apple.setFementation(Juice.Apple);
|
||||
Alcohol.Apricot.setFementation(Juice.Apricot);
|
||||
Alcohol.Banana.setFementation(Juice.Banana);
|
||||
Alcohol.Cherry.setFementation(Juice.Cherry);
|
||||
Alcohol.Elderberry.setFementation(Juice.Elderberry);
|
||||
Alcohol.Peach.setFementation(Juice.Peach);
|
||||
Alcohol.Pear.setFementation(Juice.Pear);
|
||||
Alcohol.Plum.setFementation(Juice.Plum);
|
||||
Alcohol.Carrot.setFementation(Juice.Carrot);
|
||||
Alcohol.WhiteWine.setFementation(Juice.WhiteGrape);
|
||||
Alcohol.RedWine.setFementation(Juice.RedGrape);
|
||||
Alcohol.Citrus.setFementation(Juice.Lemon);
|
||||
Alcohol.Citrus.setFementation(Juice.Lime);
|
||||
Alcohol.Citrus.setFementation(Juice.Orange);
|
||||
Alcohol.Citrus.setFementation(Juice.Grapefruit);
|
||||
Alcohol.Tomato.setFementation(Juice.Tomato);
|
||||
Alcohol.Cranberry.setFementation(Juice.Cranberry);
|
||||
Alcohol.Pineapple.setFementation(Juice.Pineapple);
|
||||
Alcohol.Potato.setFementation("cropPotato");
|
||||
}
|
||||
|
||||
protected List<String> fermentationLiquid;
|
||||
protected String fermentationSolid;
|
||||
protected String ident;
|
||||
protected IIcon icon;
|
||||
protected int colour;
|
||||
protected float transparency;
|
||||
protected float abv;
|
||||
|
||||
Alcohol(String ident, int colour, double transparency, double abv) {
|
||||
fermentationLiquid = new ArrayList<>();
|
||||
fermentationSolid = "";
|
||||
this.ident = ident;
|
||||
this.colour = colour;
|
||||
this.transparency = (float) transparency;
|
||||
this.abv = (float) abv;
|
||||
}
|
||||
|
||||
private void setFementation(Juice juice) {
|
||||
fermentationLiquid.add(juice.getIdentifier());
|
||||
}
|
||||
|
||||
private void setFementation(String oreDict) {
|
||||
fermentationSolid = oreDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcon(IIconRegister register) {
|
||||
icon = ExtraTrees.proxy.getIcon(register, "liquids/liquid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return I18N.localise("extrabees.fluid.alcohol." + name().toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "binnie." + ident;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack get(int amount) {
|
||||
return Binnie.Liquid.getLiquidStack(getIdentifier(), amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransparency() {
|
||||
return (int) (Math.min(1.0, transparency + 0.3) * 255.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip(int ratio) {
|
||||
return ratio + " Part" + ((ratio > 1) ? "s " : " ") + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceIn(FluidContainer container) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showInCreative(FluidContainer container) {
|
||||
return container == FluidContainer.Glass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getContainerColor() {
|
||||
return getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getABV() {
|
||||
return abv;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
public class AlcoholEffect {
|
||||
public static void makeDrunk(EntityPlayer player, float strength) {
|
||||
int existingStrength = player.isPotionActive(Potion.confusion) ? player.getActivePotionEffect(Potion.confusion).getAmplifier() : 0;
|
||||
int existingTime = player.isPotionActive(Potion.confusion) ? player.getActivePotionEffect(Potion.confusion).getDuration() : 0;
|
||||
int time = (int) (100.0 * Math.sqrt(strength)) + existingTime;
|
||||
|
||||
float intensity = 0.1f * strength + existingStrength + existingTime / 500;
|
||||
if (time < 5) {
|
||||
time = 5;
|
||||
}
|
||||
|
||||
float slowIntense = (intensity - 10.0f) / 4.0f;
|
||||
if (slowIntense < 0.0f) {
|
||||
slowIntense = 0.0f;
|
||||
}
|
||||
|
||||
float blindIntense = (intensity - 25.0f) / 2.0f;
|
||||
if (blindIntense < 0.0f) {
|
||||
blindIntense = 0.0f;
|
||||
}
|
||||
|
||||
player.addPotionEffect(new PotionEffect(Potion.confusion.id, time, (int) intensity, false));
|
||||
if (slowIntense > 0.0f) {
|
||||
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, time, (int) slowIntense, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
import binnie.extratrees.alcohol.drink.DrinkLiquid;
|
||||
import binnie.extratrees.alcohol.drink.DrinkManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public enum Cocktail {
|
||||
Bellini("Bellini", Glassware.Flute, 0xf3c16c),
|
||||
BlackRussian("Black Russian", Glassware.OldFashioned, 0x331618),
|
||||
BloodyMary("Bloody Mary", Glassware.Highball, 0xc12f00),
|
||||
Cosmopolitan("Cosmopolitan", Glassware.Cocktail, 0xe20000),
|
||||
CubaLibre("Cuba Libre", Glassware.Highball, 0x8a0404),
|
||||
FrenchConnection("French Connection", Glassware.OldFashioned, 0xf6ad27),
|
||||
GodFather("God Father", Glassware.OldFashioned, 0xc8691d),
|
||||
GodMother("God Mother", Glassware.OldFashioned, 0xdf7601),
|
||||
Grasshopper("Grasshopper", Glassware.Cocktail, 0x43c46a),
|
||||
French75("French 75", Glassware.Flute, 0xecd89d),
|
||||
HarveyWallbanger("Harvey Wallbanger", Glassware.Highball, 0xf9d100),
|
||||
HemingwaySpecial("Hemingway Special", Glassware.Cocktail, 0xe7f3b5),
|
||||
HorsesNeck("Horse's Neck", Glassware.OldFashioned, 0xfeb500),
|
||||
IrishCoffee("Irish Coffee", Glassware.Wine, 0x440e02),
|
||||
Kir("Kir", Glassware.Wine, 0xf4361e),
|
||||
Bramble("Bramble", Glassware.OldFashioned, 0xc3636e),
|
||||
B52("B-52", Glassware.Shot, 0xc55e00),
|
||||
DarkNStormy("Dark 'N' Stormy", Glassware.Highball, 0xba6628),
|
||||
DirtyMartini("Dirty Martini", Glassware.Cocktail, 0xdab253),
|
||||
ExpressoMartini("Expresso Martini", Glassware.Cocktail, 0x63282a),
|
||||
FrenchMartini("French Martini", Glassware.Cocktail, 0xc12d4d),
|
||||
Kamikaze("Kamikaze", Glassware.Cocktail, 0xe1d8ad),
|
||||
LemonDropMartini("Lemon Drop Martini", Glassware.Cocktail, 0xf9de8d),
|
||||
PiscoSour("Pisco Sour", Glassware.OldFashioned, 0xeae69f),
|
||||
RussianSpringPunch("Russian Spring Punch", Glassware.Highball, 0xb4242c),
|
||||
SpritzVeneziano("Spritz Veneziano", Glassware.OldFashioned, 0xea4f00),
|
||||
TommysMargarita("Tommy's Margartita", Glassware.Cocktail, 0xe2dc88),
|
||||
Vesper("Vesper", Glassware.Cocktail, 0xeeeeec),
|
||||
SexOnTheBeach("Sex on the Beach", Glassware.Highball, 0xfe7a32);
|
||||
|
||||
static Map<String, ICocktailIngredient> cocktailIngredients;
|
||||
|
||||
static {
|
||||
cocktailIngredients = new HashMap<>();
|
||||
Cocktail.Bellini.add(Alcohol.SparklingWine, 2);
|
||||
Cocktail.Bellini.add(Juice.Peach, 1);
|
||||
Cocktail.BlackRussian.add(Spirit.Vodka, 5);
|
||||
Cocktail.BlackRussian.add(Liqueur.Coffee, 2);
|
||||
Cocktail.BloodyMary.add(Spirit.Vodka, 3);
|
||||
Cocktail.BloodyMary.add(Juice.Tomato, 6);
|
||||
Cocktail.BloodyMary.add(Juice.Lemon, 1);
|
||||
Cocktail.Cosmopolitan.add(Spirit.Vodka, 3);
|
||||
Cocktail.Cosmopolitan.add(Liqueur.Orange, 1);
|
||||
Cocktail.Cosmopolitan.add(Juice.Lime, 1);
|
||||
Cocktail.Cosmopolitan.add(Juice.Cranberry, 2);
|
||||
Cocktail.CubaLibre.add(MiscFluid.CarbonatedWater, 12);
|
||||
Cocktail.CubaLibre.add(Spirit.WhiteRum, 5);
|
||||
Cocktail.CubaLibre.add(Juice.Lime, 1);
|
||||
Cocktail.FrenchConnection.add(Spirit.Brandy, 1);
|
||||
Cocktail.FrenchConnection.add(Liqueur.Almond, 1);
|
||||
Cocktail.GodFather.add(Spirit.Whiskey, 1);
|
||||
Cocktail.GodFather.add(Liqueur.Almond, 1);
|
||||
Cocktail.GodMother.add(Spirit.Vodka, 1);
|
||||
Cocktail.GodFather.add(Liqueur.Almond, 1);
|
||||
Cocktail.Grasshopper.add(Liqueur.Mint, 1);
|
||||
Cocktail.Grasshopper.add(Liqueur.Chocolate, 1);
|
||||
Cocktail.Grasshopper.add(MiscFluid.Cream, 1);
|
||||
Cocktail.French75.add(Spirit.Gin, 2);
|
||||
Cocktail.French75.add(Juice.Lemon, 1);
|
||||
Cocktail.French75.add(Alcohol.SparklingWine, 4);
|
||||
Cocktail.HarveyWallbanger.add(Spirit.Vodka, 3);
|
||||
Cocktail.HarveyWallbanger.add(Liqueur.Herbal, 1);
|
||||
Cocktail.HarveyWallbanger.add(Juice.Orange, 6);
|
||||
Cocktail.HemingwaySpecial.add(Spirit.WhiteRum, 4);
|
||||
Cocktail.HemingwaySpecial.add(Juice.Grapefruit, 3);
|
||||
Cocktail.HemingwaySpecial.add(Liqueur.Cherry, 1);
|
||||
Cocktail.HemingwaySpecial.add(Juice.Lime, 1);
|
||||
Cocktail.HorsesNeck.add(Spirit.Brandy, 1);
|
||||
Cocktail.HorsesNeck.add(MiscFluid.GingerAle, 3);
|
||||
Cocktail.IrishCoffee.add(Spirit.Whiskey, 2);
|
||||
Cocktail.IrishCoffee.add(MiscFluid.Coffee, 4);
|
||||
Cocktail.IrishCoffee.add(MiscFluid.Cream, 2);
|
||||
Cocktail.Kir.add(Alcohol.WhiteWine, 9);
|
||||
Cocktail.Kir.add(Liqueur.Blackcurrant, 1);
|
||||
Cocktail.Bramble.add(Spirit.Gin, 4);
|
||||
Cocktail.Bramble.add(Juice.Lemon, 2);
|
||||
Cocktail.Bramble.add(MiscFluid.SugarSyrup, 1);
|
||||
Cocktail.Bramble.add(Liqueur.Blackberry, 2);
|
||||
Cocktail.B52.add(Liqueur.Coffee, 1);
|
||||
Cocktail.B52.add(Liqueur.Orange, 1);
|
||||
Cocktail.DarkNStormy.add(Spirit.DarkRum, 1);
|
||||
Cocktail.DarkNStormy.add(MiscFluid.GingerAle, 3);
|
||||
Cocktail.DirtyMartini.add(Spirit.Vodka, 6);
|
||||
Cocktail.DirtyMartini.add(Spirit.FortifiedWine, 1);
|
||||
Cocktail.DirtyMartini.add(Juice.Olive, 1);
|
||||
Cocktail.ExpressoMartini.add(Spirit.Vodka, 5);
|
||||
Cocktail.ExpressoMartini.add(Liqueur.Coffee, 1);
|
||||
Cocktail.ExpressoMartini.add(MiscFluid.SugarSyrup, 1);
|
||||
Cocktail.ExpressoMartini.add(MiscFluid.Coffee, 1);
|
||||
Cocktail.FrenchMartini.add(Spirit.Vodka, 3);
|
||||
Cocktail.FrenchMartini.add(Liqueur.Raspberry, 1);
|
||||
Cocktail.FrenchMartini.add(Juice.Pineapple, 1);
|
||||
Cocktail.Kamikaze.add(Spirit.Vodka, 1);
|
||||
Cocktail.Kamikaze.add(Liqueur.Orange, 1);
|
||||
Cocktail.Kamikaze.add(Juice.Lime, 1);
|
||||
Cocktail.LemonDropMartini.add(Spirit.Vodka, 5);
|
||||
Cocktail.LemonDropMartini.add(Liqueur.Orange, 4);
|
||||
Cocktail.LemonDropMartini.add(Juice.Lemon, 3);
|
||||
Cocktail.PiscoSour.add(Spirit.Brandy, 8);
|
||||
Cocktail.PiscoSour.add(Juice.Lemon, 4);
|
||||
Cocktail.PiscoSour.add(MiscFluid.SugarSyrup, 3);
|
||||
Cocktail.RussianSpringPunch.add(Spirit.Vodka, 5);
|
||||
Cocktail.RussianSpringPunch.add(Juice.Lemon, 5);
|
||||
Cocktail.RussianSpringPunch.add(Liqueur.Blackcurrant, 3);
|
||||
Cocktail.RussianSpringPunch.add(MiscFluid.SugarSyrup, 1);
|
||||
Cocktail.SpritzVeneziano.add(Alcohol.SparklingWine, 6);
|
||||
Cocktail.SpritzVeneziano.add(MiscFluid.CarbonatedWater, 1);
|
||||
Cocktail.TommysMargarita.add(Spirit.Tequila, 6);
|
||||
Cocktail.TommysMargarita.add(Juice.Lime, 2);
|
||||
Cocktail.TommysMargarita.add(MiscFluid.AgaveNectar, 1);
|
||||
Cocktail.Vesper.add(Spirit.Gin, 8);
|
||||
Cocktail.Vesper.add(Spirit.Vodka, 2);
|
||||
Cocktail.Vesper.add(Spirit.FortifiedWine, 1);
|
||||
Cocktail.SexOnTheBeach.add(Spirit.Vodka, 2);
|
||||
Cocktail.SexOnTheBeach.add(Liqueur.Peach, 1);
|
||||
Cocktail.SexOnTheBeach.add(Juice.Orange, 2);
|
||||
Cocktail.SexOnTheBeach.add(Juice.Cranberry, 2);
|
||||
}
|
||||
|
||||
public String name;
|
||||
public Glassware glassware;
|
||||
public int colour;
|
||||
public Map<ICocktailIngredient, Integer> ingredients;
|
||||
|
||||
Cocktail(String name, Glassware glassware, int colour) {
|
||||
ingredients = new HashMap<>();
|
||||
this.name = name;
|
||||
this.glassware = glassware;
|
||||
this.colour = colour;
|
||||
}
|
||||
|
||||
public static Cocktail get(Map<ICocktailIngredient, Integer> ingredients) {
|
||||
for (Cocktail cocktail : values()) {
|
||||
boolean is = true;
|
||||
for (Map.Entry<ICocktailIngredient, Integer> entry : ingredients.entrySet()) {
|
||||
if (cocktail.ingredients.get(entry.getKey()) != entry.getValue()) {
|
||||
is = false;
|
||||
}
|
||||
}
|
||||
if (is) {
|
||||
return cocktail;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void registerIngredient(ICocktailIngredient ingredient) {
|
||||
Cocktail.cocktailIngredients.put(ingredient.getIdentifier().toLowerCase(), ingredient);
|
||||
DrinkManager.registerDrinkLiquid(ingredient.getIdentifier().toLowerCase(), new DrinkLiquid(ingredient.getName(), ingredient.getColor(), ingredient.getTransparency(), ingredient.getABV()));
|
||||
}
|
||||
|
||||
public static ICocktailIngredient getIngredient(String name2) {
|
||||
return Cocktail.cocktailIngredients.get(name2.toLowerCase());
|
||||
}
|
||||
|
||||
public static boolean isIngredient(String name) {
|
||||
return name != null && Cocktail.cocktailIngredients.containsKey(name.toLowerCase());
|
||||
}
|
||||
|
||||
private void add(ICocktailIngredient ingredient, int ratio) {
|
||||
ingredients.put(ingredient, ratio);
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public enum Glassware {
|
||||
BeerMug(16, 10, 14),
|
||||
Pint(20, 6, 20),
|
||||
Snifter(17, 14, 11),
|
||||
Flute(6, 13, 15),
|
||||
Cocktail(8, 20, 8),
|
||||
Cordial(2, 15, 7),
|
||||
Collins(12, 8, 18),
|
||||
Highball(8, 10, 14),
|
||||
Hurricane(15, 10, 18),
|
||||
Margarita(12, 18, 9),
|
||||
OldFashioned(8, 13, 8),
|
||||
Wine(8, 17, 10),
|
||||
Shot(1, 13, 7),
|
||||
Sherry(2, 17, 7),
|
||||
Coupe(6, 19, 8);
|
||||
|
||||
public IIcon glass;
|
||||
public IIcon contents;
|
||||
|
||||
protected float contentBottom;
|
||||
protected float contentHeight;
|
||||
|
||||
private int capacity;
|
||||
|
||||
Glassware(int capacity, int contentBottom, int contentHeight) {
|
||||
this.capacity = 30 * capacity;
|
||||
this.contentBottom = contentBottom / 32.0f;
|
||||
this.contentHeight = contentHeight / 32.0f;
|
||||
}
|
||||
|
||||
public String getName(String liquid) {
|
||||
if (liquid == null) {
|
||||
return I18N.localise("extratrees.item.glassware." + name().toLowerCase());
|
||||
}
|
||||
return I18N.localise("extratrees.item.glassware." + name().toLowerCase() + ".usage", liquid);
|
||||
}
|
||||
|
||||
public int getCapacity() {
|
||||
return capacity;
|
||||
}
|
||||
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
glass = ExtraTrees.proxy.getIcon(par1IconRegister, "glassware/" + toString().toLowerCase() + ".glass");
|
||||
contents = ExtraTrees.proxy.getIcon(par1IconRegister, "glassware/" + toString().toLowerCase() + ".contents");
|
||||
}
|
||||
|
||||
public ItemStack get(int i) {
|
||||
return ExtraTrees.drink.getStack(this, null);
|
||||
}
|
||||
|
||||
public float getContentBottom() {
|
||||
return contentBottom;
|
||||
}
|
||||
|
||||
public float getContentHeight() {
|
||||
return contentHeight;
|
||||
}
|
||||
|
||||
public int getVolume() {
|
||||
return getCapacity();
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
public interface ICocktailIngredient {
|
||||
String getName();
|
||||
|
||||
String getIdentifier();
|
||||
|
||||
int getColor();
|
||||
|
||||
int getTransparency();
|
||||
|
||||
String getTooltip(int ratio);
|
||||
|
||||
float getABV();
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface ICocktailLiquid extends ICocktailIngredient {
|
||||
FluidStack get(int amount);
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.liquid.FluidContainer;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public enum Juice implements IFluidType, ICocktailLiquid {
|
||||
Apple("Apple Juice", "juiceApple", 0xffca32, 0.7, "Apple"),
|
||||
Apricot("Apricot Juice", "juiceApricot", 0xffb51e, 0.6, "Apricot"),
|
||||
Banana("Banana Juice", "juiceBanana", 0xe9d483, 0.6, "Banana"),
|
||||
Cherry("Cherry Juice", "juiceCherry", 0xc70b1f, 0.6, "Cherry"),
|
||||
Elderberry("Elderberry Juice", "juiceElderberry", 0x402629, 0.6, "Elderberry"),
|
||||
Lemon("Lemon Juice", "juiceLemon", 0xdeda52, 0.7, "Lemon"),
|
||||
Lime("Lime Juice", "juiceLime", 0xb9ce6f, 0.6, "Lime"),
|
||||
Orange("Orange Juice", "juiceOrange", 0xf9a22f, 0.8, "Orange"),
|
||||
Peach("Peach Juice", "juicePeach", 0xfac55d, 0.7, "Peach"),
|
||||
Plum("Plum Juice", "juicePlum", 0xa11f11, 0.7, "Plum"),
|
||||
Carrot("Carrot Juice", "juiceCarrot", 0xfb8e17, 0.7, "Carrot"),
|
||||
Tomato("Tomato Juice", "juiceTomato", 0xc2442e, 0.7, "Tomato"),
|
||||
Cranberry("Cranberry Juice", "juiceCranberry", 0xc52735, 0.7, "Cranberry"),
|
||||
Grapefruit("Grapefruit Juice", "juiceGrapefruit", 0xf29255, 0.6, "Grapefruit"),
|
||||
Olive("Olive Oil", "juiceOlive", 0xf4c900, 0.6, "Olive"),
|
||||
Pineapple("Pineapple Juice", "juicePineapple", 0xe7c547, 0.6, "Pineapple"),
|
||||
Pear("Pear Juice", "juicePear", 0xd8bf65, 0.6, "Pear"),
|
||||
WhiteGrape("White Grape Juice", "juiceWhiteGrape", 0xfbe379, 0.6, "WhiteGrape"),
|
||||
RedGrape("Red Grape Juice", "juiceRedGrape", 0x952934, 0.6, "RedGrape");
|
||||
|
||||
public String squeezing;
|
||||
|
||||
protected String name;
|
||||
protected String ident;
|
||||
protected IIcon icon;
|
||||
protected int colour;
|
||||
protected float transparency;
|
||||
|
||||
Juice(String name, String ident, int colour, double transparency, String squeezing) {
|
||||
this.name = name;
|
||||
this.ident = ident;
|
||||
this.colour = colour;
|
||||
this.transparency = (float) transparency;
|
||||
addSqueezing("crop" + squeezing);
|
||||
}
|
||||
|
||||
private void addSqueezing(String oreDict) {
|
||||
squeezing = oreDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceIn(FluidContainer container) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showInCreative(FluidContainer container) {
|
||||
return container == FluidContainer.Glass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcon(IIconRegister register) {
|
||||
icon = ExtraTrees.proxy.getIcon(register, "liquids/liquid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "binnie." + ident;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack get(int amount) {
|
||||
return Binnie.Liquid.getLiquidStack(getIdentifier(), amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransparency() {
|
||||
return (int) (Math.min(1.0, transparency + 0.3) * 255.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip(int ratio) {
|
||||
return ratio + " Part" + ((ratio > 1) ? "s " : " ") + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getContainerColor() {
|
||||
return getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getABV() {
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.liquid.FluidContainer;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public enum Liqueur implements IFluidType, ICocktailLiquid {
|
||||
Almond("Almond", 0xe45d2f, 0.3, 0.2),
|
||||
Orange("Orange", 0xf98900, 0.4, 0.2),
|
||||
Banana("Banana", 0xf8c200, 0.5, 0.2),
|
||||
Chocolate("Chocolate", 0xc14b20, 0.3, 0.2),
|
||||
Mint("Mint", 0x29c67c, 0.4, 0.2),
|
||||
Hazelnut("Hazelnut", 0xed982b, 0.3, 0.2),
|
||||
Cinnamon("Cinnamon", 0xe55000, 0.3, 0.2),
|
||||
Coffee("Coffee", 0x964319, 0.4, 0.2),
|
||||
Melon("Melon", 0xb0c231, 0.4, 0.2),
|
||||
Anise("Anise", 0xdae1e9, 0.3, 0.2),
|
||||
Peach("Peach", 0xfe9560, 0.4, 0.2),
|
||||
Lemon("Lemon", 0xf8e46d, 0.4, 0.2),
|
||||
Herbal("Herbal", 0xfed501, 0.3, 0.2),
|
||||
Cherry("Cherry", 0xd71901, 0.5, 0.2),
|
||||
Blackcurrant("Blackcurrant", 0x6a3d6d, 0.5, 0.2),
|
||||
Blackberry("Blackberry", 0x68554d, 0.5, 0.2),
|
||||
Raspberry("Raspberry", 0x9b0300, 0.5, 0.2);
|
||||
|
||||
static {
|
||||
Liqueur.Almond.addFlavour("cropAlmond");
|
||||
Liqueur.Orange.addFlavour("cropOrange");
|
||||
Liqueur.Banana.addFlavour("cropBanana");
|
||||
Liqueur.Chocolate.addFlavour("cropCocoa");
|
||||
Liqueur.Mint.addFlavour("cropMint");
|
||||
Liqueur.Hazelnut.addFlavour("cropHazelnut");
|
||||
Liqueur.Cinnamon.addFlavour("cropCinnamon");
|
||||
Liqueur.Coffee.addFlavour("cropCoffee");
|
||||
Liqueur.Melon.addFlavour("cropMelon");
|
||||
Liqueur.Anise.addFlavour("cropAnise");
|
||||
Liqueur.Peach.addFlavour("cropPeach");
|
||||
Liqueur.Lemon.addFlavour("cropLemon");
|
||||
Liqueur.Herbal.addFlavour("cropHerbal");
|
||||
Liqueur.Cherry.addFlavour("cropCherry");
|
||||
Liqueur.Blackcurrant.addFlavour("cropBlackcurrant");
|
||||
Liqueur.Blackberry.addFlavour("cropBlackberry");
|
||||
Liqueur.Raspberry.addFlavour("cropRaspberry");
|
||||
}
|
||||
|
||||
protected String name;
|
||||
protected String ident;
|
||||
protected IIcon icon;
|
||||
protected int colour;
|
||||
protected float transparency;
|
||||
protected float abv;
|
||||
|
||||
Liqueur(String name, int colour, double transparency, double abv) {
|
||||
this(name + " Liqueur", "liqueur" + name, colour, transparency, abv);
|
||||
}
|
||||
|
||||
Liqueur(String name, String ident, int colour, double transparency, double abv) {
|
||||
this.name = name;
|
||||
this.ident = ident;
|
||||
this.colour = colour;
|
||||
this.transparency = (float) transparency;
|
||||
this.abv = (float) abv;
|
||||
}
|
||||
|
||||
private void addFlavour(String oreDict) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceIn(FluidContainer container) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showInCreative(FluidContainer container) {
|
||||
return container == FluidContainer.Glass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcon(IIconRegister register) {
|
||||
icon = ExtraTrees.proxy.getIcon(register, "liquids/liquid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "binnie." + ident;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack get(int amount) {
|
||||
return Binnie.Liquid.getLiquidStack(getIdentifier(), amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransparency() {
|
||||
return (int) (Math.min(1.0, transparency + 0.3) * 255.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip(int ratio) {
|
||||
return ratio + " Part" + ((ratio > 1) ? "s " : " ") + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getContainerColor() {
|
||||
return getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getABV() {
|
||||
return abv;
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.liquid.FluidContainer;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public enum MiscFluid implements IFluidType, ICocktailLiquid {
|
||||
CarbonatedWater("Carbonated Water", "water.carbonated", 0xccccff, 0.10000000149011612),
|
||||
TonicWater("Tonic Water", "water.tonic", 0xccccff, 0.10000000149011612),
|
||||
Cream("Carbonated Water", "cream", 0xeaeade, 2.0),
|
||||
GingerAle("Ginger Ale", "gingerAle", 0xffffff, 0.6000000238418579),
|
||||
Coffee("Coffee", "coffee", 0x5a3105, 0.30000001192092896),
|
||||
SugarSyrup("Simple Syrup", "syrup.simple", 0xf5f8f1, 0.10000000149011612),
|
||||
AgaveNectar("Agave Nectar", "syrup.agave", 0xcf7e25, 0.699999988079071),
|
||||
GrenadineSyrup("Grenadine Syrup", "syrup.grenadine", 0xf44965, 0.800000011920929);
|
||||
|
||||
protected String name;
|
||||
protected String ident;
|
||||
protected IIcon icon;
|
||||
protected int colour;
|
||||
protected float transparency;
|
||||
|
||||
MiscFluid(String name, String ident, int colour, double transparency) {
|
||||
this.name = name;
|
||||
this.ident = ident;
|
||||
this.colour = colour;
|
||||
this.transparency = (float) transparency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceIn(FluidContainer container) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showInCreative(FluidContainer container) {
|
||||
return container == FluidContainer.Glass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcon(IIconRegister register) {
|
||||
icon = ExtraTrees.proxy.getIcon(register, "liquids/liquid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "binnie." + ident;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack get(int amount) {
|
||||
return Binnie.Liquid.getLiquidStack(getIdentifier(), amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransparency() {
|
||||
return (int) (Math.min(1.0, transparency + 0.3) * 255.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip(int ratio) {
|
||||
return ratio + " Part" + ((ratio > 1) ? "s " : " ") + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getContainerColor() {
|
||||
return getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getABV() {
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.IInitializable;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import binnie.core.liquid.ItemFluidContainer;
|
||||
import binnie.core.resource.BinnieIcon;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.extratrees.alcohol.drink.CocktailRenderer;
|
||||
import binnie.extratrees.alcohol.drink.DrinkLiquid;
|
||||
import binnie.extratrees.alcohol.drink.DrinkManager;
|
||||
import binnie.extratrees.alcohol.drink.ItemDrink;
|
||||
import binnie.extratrees.item.Food;
|
||||
import binnie.extratrees.machines.Brewery;
|
||||
import binnie.extratrees.machines.Distillery;
|
||||
import binnie.extratrees.machines.Press;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ModuleAlcohol implements IInitializable {
|
||||
public static int drinkRendererID;
|
||||
public static BinnieIcon liquid;
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
ModuleAlcohol.liquid = Binnie.Resource.getBlockIcon(ExtraTrees.instance, "liquids/liquid");
|
||||
ModuleAlcohol.drinkRendererID = BinnieCore.proxy.getUniqueRenderID();
|
||||
ExtraTrees.drink = new ItemDrink();
|
||||
BinnieCore.proxy.registerCustomItemRenderer(ExtraTrees.drink, new CocktailRenderer());
|
||||
Binnie.Liquid.createLiquids(Juice.values(), ItemFluidContainer.LiquidJuice);
|
||||
Binnie.Liquid.createLiquids(Alcohol.values(), ItemFluidContainer.LiquidAlcohol);
|
||||
Binnie.Liquid.createLiquids(Spirit.values(), ItemFluidContainer.LiquidSpirit);
|
||||
Binnie.Liquid.createLiquids(Liqueur.values(), ItemFluidContainer.LiquidLiqueuer);
|
||||
|
||||
for (Juice juice : Juice.values()) {
|
||||
Cocktail.registerIngredient(juice);
|
||||
}
|
||||
for (Alcohol juice2 : Alcohol.values()) {
|
||||
Cocktail.registerIngredient(juice2);
|
||||
}
|
||||
for (Spirit juice3 : Spirit.values()) {
|
||||
Cocktail.registerIngredient(juice3);
|
||||
}
|
||||
for (Liqueur juice4 : Liqueur.values()) {
|
||||
Cocktail.registerIngredient(juice4);
|
||||
}
|
||||
DrinkManager.registerDrinkLiquid("water", new DrinkLiquid("Water", 0xccccff, 0.1f, 0.0f));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
for (Juice juice : Juice.values()) {
|
||||
String oreDict = juice.squeezing;
|
||||
List<ItemStack> ores = new ArrayList<ItemStack>();
|
||||
ores.addAll(OreDictionary.getOres(oreDict));
|
||||
for (Food food : Food.values()) {
|
||||
if (food.getOres().contains(oreDict)) {
|
||||
ores.add(food.get(1));
|
||||
}
|
||||
}
|
||||
|
||||
for (ItemStack stack : ores) {
|
||||
for (Map.Entry<Object[], Object[]> entry : RecipeManagers.squeezerManager.getRecipes().entrySet()) {
|
||||
try {
|
||||
ItemStack input = (ItemStack) entry.getKey()[0];
|
||||
FluidStack output = (FluidStack) entry.getValue()[1];
|
||||
if (!ItemStack.areItemStacksEqual(stack, input) && !OreDictionary.itemMatches(input, stack, true)) {
|
||||
continue;
|
||||
}
|
||||
int amount = output.amount;
|
||||
if (output.getFluid().getName() == "seedoil") {
|
||||
amount *= 2;
|
||||
}
|
||||
Press.addRecipe(stack, juice.get(amount));
|
||||
} catch (Exception ex) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Alcohol alcohol : Alcohol.values()) {
|
||||
for (String fermentLiquid : alcohol.fermentationLiquid) {
|
||||
FluidStack fluid = Binnie.Liquid.getLiquidStack(fermentLiquid, 5);
|
||||
if (fluid != null) {
|
||||
Brewery.addRecipe(fluid, alcohol.get(5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Brewery.addBeerAndMashRecipes();
|
||||
addDistillery(Alcohol.Apple, Spirit.AppleBrandy, Spirit.AppleLiquor, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Pear, Spirit.PearBrandy, Spirit.PearLiquor, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Apricot, Spirit.ApricotBrandy, Spirit.ApricotLiquor, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Banana, Spirit.FruitBrandy, Spirit.FruitLiquor, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Cherry, Spirit.CherryBrandy, Spirit.CherryLiquor, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Elderberry, Spirit.ElderberryBrandy, Spirit.ElderberryLiquor, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Peach, Spirit.FruitBrandy, Spirit.FruitLiquor, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Plum, Spirit.PlumBrandy, Spirit.FruitLiquor, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Carrot, Spirit.FruitBrandy, Spirit.Vodka, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.WhiteWine, Spirit.Brandy, Spirit.Brandy, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.RedWine, Spirit.Brandy, Spirit.Brandy, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.SparklingWine, Spirit.Brandy, Spirit.Brandy, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Agave, Spirit.Tequila, Spirit.Tequila, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Potato, Spirit.FruitBrandy, Spirit.Vodka, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Citrus, Spirit.CitrusBrandy, Spirit.FruitLiquor, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Cranberry, Spirit.FruitBrandy, Spirit.FruitLiquor, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Pineapple, Spirit.FruitBrandy, Spirit.FruitLiquor, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Tomato, Spirit.FruitBrandy, Spirit.FruitLiquor, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Fruit, Spirit.FruitBrandy, Spirit.FruitLiquor, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Barley, Spirit.Whiskey, Spirit.Vodka, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Wheat, Spirit.WheatWhiskey, Spirit.Vodka, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Rye, Spirit.RyeWhiskey, Spirit.Vodka, Spirit.NeutralSpirit);
|
||||
addDistillery(Alcohol.Corn, Spirit.CornWhiskey, Spirit.Vodka, Spirit.NeutralSpirit);
|
||||
}
|
||||
|
||||
private void addDistillery(IFluidType source, IFluidType a, IFluidType b, IFluidType c) {
|
||||
Distillery.addRecipe(source.get(5), a.get(4), 0);
|
||||
Distillery.addRecipe(source.get(5), b.get(2), 1);
|
||||
Distillery.addRecipe(source.get(5), c.get(1), 2);
|
||||
Distillery.addRecipe(a.get(5), b.get(2), 0);
|
||||
Distillery.addRecipe(a.get(5), b.get(1), 1);
|
||||
Distillery.addRecipe(b.get(5), c.get(2), 0);
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.liquid.FluidContainer;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public enum Spirit implements IFluidType, ICocktailLiquid {
|
||||
NeutralSpirit("Neutral Spirit", "spiritNeutral", 0xffffff, 0.05, 0.8),
|
||||
Vodka("Vodka", "vodka", 0xf4f5f7, 0.05, 0.4),
|
||||
WhiteRum("White Rum", "rumWhite", 0xe6e5e4, 0.05, 0.4),
|
||||
DarkRum("Dark Rum", "rumDark", 0xa82200, 0.4, 0.4),
|
||||
Whiskey("Whiskey", "whiskey", 0xcf6f00, 0.2, 0.4),
|
||||
CornWhiskey("Bourbon", "whiskeyCorn", 0x961201, 0.2, 0.4),
|
||||
RyeWhiskey("Rye Whiskey", "whiskeyRye", 0xf57328, 0.2, 0.4),
|
||||
WheatWhiskey("Wheat Whiskey", "whiskeyWheat", 0xe48612, 0.2, 0.4),
|
||||
FortifiedWine("Fortified Wine", "wineFortified", 0xed921f, 0.2, 0.2),
|
||||
Tequila("Tequila", "tequila", 0xf5e9c0, 0.05, 0.4),
|
||||
Brandy("Brandy", "brandyGrape", 0xf79f20, 0.2, 0.4),
|
||||
AppleBrandy("Apple Brandy", "brandyApple", 0xe4aa3e, 0.2, 0.4),
|
||||
PearBrandy("Pear Brandy", "brandyPear", 0xfec633, 0.2, 0.4),
|
||||
ApricotBrandy("Apricot Brandy", "brandyApricot", 0xcb7f43, 0.2, 0.4),
|
||||
PlumBrandy("Plum Brandy", "brandyPlum", 0x912311, 0.2, 0.4),
|
||||
CherryBrandy("Cherry Brandy", "brandyCherry", 0x830b1e, 0.2, 0.4),
|
||||
ElderberryBrandy("Elderberry Brandy", "brandyElderberry", 0xbe2b47, 0.2, 0.4),
|
||||
CitrusBrandy("Citrus Brandy", "brandyCitrus", 0xcb7f43, 0.2, 0.4),
|
||||
FruitBrandy("Fruit Brandy", "brandyFruit", 0xe4aa3e, 0.2, 0.4),
|
||||
Cachaca("Cachaca", "spiritSugarcane", 0xe9f0cf, 0.1, 0.4),
|
||||
Gin("Gin", "spiritGin", 0xf6f6f6, 0.05, 0.4),
|
||||
AppleLiquor("Apple Liquor", "liquorApple", 0xcccccc, 0.05, 0.4),
|
||||
PearLiquor("Pear Liquor", "liquorPear", 0xcccccc, 0.05, 0.4),
|
||||
CherryLiquor("Cherry Liquor", "liquorCherry", 0xcccccc, 0.05, 0.4),
|
||||
ElderberryLiquor("Elderberry Liquor", "liquorElderberry", 0xcccccc, 0.05, 0.4),
|
||||
ApricotLiquor("Apricot Liquor", "liquorApricot", 0xcccccc, 0.05, 0.4),
|
||||
FruitLiquor("Fruit Liquor", "liquorFruit", 0xcccccc, 0.05, 0.4);
|
||||
|
||||
protected String name;
|
||||
protected String ident;
|
||||
protected IIcon icon;
|
||||
protected int colour;
|
||||
protected float transparency;
|
||||
protected float abv;
|
||||
|
||||
Spirit(String name, String ident, int colour, double transparency, double abv) {
|
||||
this.name = name;
|
||||
this.ident = ident;
|
||||
this.colour = colour;
|
||||
this.transparency = (float) transparency;
|
||||
this.abv = (float) abv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceIn(FluidContainer container) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showInCreative(FluidContainer container) {
|
||||
return container == FluidContainer.Glass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcon(IIconRegister register) {
|
||||
icon = ExtraTrees.proxy.getIcon(register, "liquids/liquid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "binnie." + ident;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack get(int amount) {
|
||||
return Binnie.Liquid.getLiquidStack(getIdentifier(), amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransparency() {
|
||||
return (int) (Math.min(1.0, transparency + 0.3) * 255.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip(int ratio) {
|
||||
return ratio + " Part" + ((ratio > 1) ? "s " : " ") + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getContainerColor() {
|
||||
return getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getABV() {
|
||||
return abv;
|
||||
}
|
||||
}
|
||||
@@ -1,218 +0,0 @@
|
||||
package binnie.extratrees.alcohol.drink;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.extratrees.alcohol.Glassware;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class CocktailRenderer implements IItemRenderer {
|
||||
private void renderCocktail(RenderBlocks renderBlocks, ItemStack item, float p, float q, float r) {
|
||||
RenderItem renderItem = new RenderItem();
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
Glassware glass = ExtraTrees.drink.getGlassware(item);
|
||||
FluidStack fluid = ExtraTrees.drink.getFluid(item);
|
||||
IDrinkLiquid drink = (fluid == null) ? null : DrinkManager.getLiquid(fluid.getFluid());
|
||||
setColor(16777215, 0.8f);
|
||||
renderItem.renderIcon(0, 0, glass.glass, 16, 16);
|
||||
|
||||
if (drink != null) {
|
||||
setColor(drink.getColour(), 1.2f * drink.getTransparency() + 0.3f);
|
||||
IIcon icon = glass.contents;
|
||||
float amount = fluid.amount / glass.getVolume();
|
||||
float level = glass.getContentHeight() * (1.0f - amount);
|
||||
float gapAtTop = 1.0f - (glass.getContentBottom() + glass.getContentHeight());
|
||||
float x = 0.0f;
|
||||
float y = 16.0f * (gapAtTop + level);
|
||||
float w = 16.0f;
|
||||
float h = 16.0f - y;
|
||||
float minV = icon.getInterpolatedV(y);
|
||||
float maxV = icon.getInterpolatedV(16.0);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(x + 0.0f, y + h, renderItem.zLevel, icon.getMinU(), maxV);
|
||||
tessellator.addVertexWithUV(x + w, y + h, renderItem.zLevel, icon.getMaxU(), maxV);
|
||||
tessellator.addVertexWithUV(x + w, y + 0.0f, renderItem.zLevel, icon.getMaxU(), minV);
|
||||
tessellator.addVertexWithUV(x + 0.0f, y + 0.0f, renderItem.zLevel, icon.getMinU(), minV);
|
||||
tessellator.draw();
|
||||
}
|
||||
GL11.glDisable(3042);
|
||||
}
|
||||
|
||||
private void setColor(int i1, float alpha) {
|
||||
float f = (i1 >> 16 & 0xFF) / 255.0f;
|
||||
float f2 = (i1 >> 8 & 0xFF) / 255.0f;
|
||||
float f3 = (i1 & 0xFF) / 255.0f;
|
||||
GL11.glColor4f(f, f2, f3, (alpha > 1.0f) ? 1.0f : alpha);
|
||||
}
|
||||
|
||||
private void renderFace(Tessellator tessellator, ForgeDirection dir) {
|
||||
switch (dir) {
|
||||
case DOWN:
|
||||
tessellator.addVertex(0.0, 0.0, 0.0);
|
||||
tessellator.addVertex(0.0, 0.0, 1.0);
|
||||
tessellator.addVertex(1.0, 0.0, 1.0);
|
||||
tessellator.addVertex(1.0, 0.0, 0.0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
case EQUIPPED:
|
||||
case INVENTORY:
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
|
||||
return helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION
|
||||
|| helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
case EQUIPPED:
|
||||
case EQUIPPED_FIRST_PERSON: {
|
||||
if (type == IItemRenderer.ItemRenderType.ENTITY) {
|
||||
GL11.glTranslatef(-0.5f, -0.25f, -0.0f);
|
||||
}
|
||||
TextureManager texturemanager = BinnieCore.proxy.getMinecraftInstance().getTextureManager();
|
||||
Glassware glass = ExtraTrees.drink.getGlassware(item);
|
||||
FluidStack fluid = ExtraTrees.drink.getFluid(item);
|
||||
IIcon iicon = glass.glass;
|
||||
float f = iicon.getMinU();
|
||||
float f2 = iicon.getMaxU();
|
||||
float f3 = iicon.getMinV();
|
||||
float f4 = iicon.getMaxV();
|
||||
texturemanager.bindTexture(texturemanager.getResourceLocation(item.getItemSpriteNumber()));
|
||||
TextureUtil.func_152777_a(false, false, 1.0f);
|
||||
setColor(0xffffff, 0.8f);
|
||||
IDrinkLiquid drink = (fluid == null) ? null : DrinkManager.getLiquid(fluid.getFluid());
|
||||
setColor(0xffffff, 0.8f);
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f2, f3, f, f4, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625f);
|
||||
if (drink != null) {
|
||||
setColor(drink.getColour(), 1.2f * drink.getTransparency() + 0.3f);
|
||||
iicon = glass.contents;
|
||||
IIcon icon = glass.contents;
|
||||
float amount = fluid.amount / glass.getVolume();
|
||||
float level = glass.getContentHeight() * (1.0f - amount);
|
||||
float gapAtTop = 1.0f - (glass.getContentBottom() + glass.getContentHeight());
|
||||
float x = 0.0f;
|
||||
float y = 1.0f * (gapAtTop + level);
|
||||
float w = 1.0f;
|
||||
float h = 1.0f - y;
|
||||
float minV = icon.getInterpolatedV(y * 16.0f);
|
||||
float maxV = icon.getInterpolatedV(16.0);
|
||||
float minU = icon.getMinU();
|
||||
float maxU = icon.getMaxU();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setNormal(0.0f, 0.0f, -1.0f);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(0.0, 1.0 - y, -0.03125, maxU, minV);
|
||||
tessellator.addVertexWithUV(1.0, 1.0 - y, -0.03125, minU, minV);
|
||||
tessellator.addVertexWithUV(1.0, 0.0, -0.03125, minU, maxV);
|
||||
tessellator.addVertexWithUV(0.0, 0.0, -0.03125, maxU, maxV);
|
||||
tessellator.draw();
|
||||
tessellator.setNormal(0.0f, 0.0f, 1.0f);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(0.0, 1.0 - y, -0.03125, maxU, minV);
|
||||
tessellator.addVertexWithUV(0.0, 0.0, -0.03125, maxU, maxV);
|
||||
tessellator.addVertexWithUV(1.0, 0.0, -0.03125, minU, maxV);
|
||||
tessellator.addVertexWithUV(1.0, 1.0 - y, -0.03125, minU, minV);
|
||||
tessellator.draw();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case INVENTORY: {
|
||||
renderCocktail((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void renderItemIn2DPercentage(Tessellator tesselator, float maxU, float minV, float minU, float maxV, int width, int height, float depth, float percent) {
|
||||
maxV = minV + (maxV - minV) * 1.0f;
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.setNormal(0.0f, 0.0f, 1.0f);
|
||||
tesselator.addVertexWithUV(0.0, 0.0, 0.0, maxU, maxV);
|
||||
tesselator.addVertexWithUV(1.0, 0.0, 0.0, minU, maxV);
|
||||
tesselator.addVertexWithUV(1.0, 1.0, 0.0, minU, minV);
|
||||
tesselator.addVertexWithUV(0.0, 1.0, 0.0, maxU, minV);
|
||||
tesselator.draw();
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.setNormal(0.0f, 0.0f, -1.0f);
|
||||
tesselator.addVertexWithUV(0.0, percent, 0.0f - depth, maxU, minV);
|
||||
tesselator.addVertexWithUV(1.0, percent, 0.0f - depth, minU, minV);
|
||||
tesselator.addVertexWithUV(1.0, 0.0, 0.0f - depth, minU, maxV);
|
||||
tesselator.addVertexWithUV(0.0, 0.0, 0.0f - depth, maxU, maxV);
|
||||
tesselator.draw();
|
||||
float f5 = 0.5f * (maxU - minU) / width;
|
||||
float f6 = 0.5f * (maxV - minV) / height;
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.setNormal(-1.0f, 0.0f, 0.0f);
|
||||
for (int k = 0; k < width; ++k) {
|
||||
float f7 = k / width;
|
||||
float f8 = maxU + (minU - maxU) * f7 - f5;
|
||||
tesselator.addVertexWithUV(f7, 0.0, 0.0f - depth, f8, maxV);
|
||||
tesselator.addVertexWithUV(f7, 0.0, 0.0, f8, maxV);
|
||||
tesselator.addVertexWithUV(f7, 1.0, 0.0, f8, minV);
|
||||
tesselator.addVertexWithUV(f7, 1.0, 0.0f - depth, f8, minV);
|
||||
}
|
||||
tesselator.draw();
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.setNormal(1.0f, 0.0f, 0.0f);
|
||||
for (int k = 0; k < width; ++k) {
|
||||
float f7 = k / width;
|
||||
float f8 = maxU + (minU - maxU) * f7 - f5;
|
||||
float f9 = f7 + 1.0f / width;
|
||||
tesselator.addVertexWithUV(f9, 1.0, 0.0f - depth, f8, minV);
|
||||
tesselator.addVertexWithUV(f9, 1.0, 0.0, f8, minV);
|
||||
tesselator.addVertexWithUV(f9, 0.0, 0.0, f8, maxV);
|
||||
tesselator.addVertexWithUV(f9, 0.0, 0.0f - depth, f8, maxV);
|
||||
}
|
||||
tesselator.draw();
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.setNormal(0.0f, 1.0f, 0.0f);
|
||||
for (int k = 0; k < height; ++k) {
|
||||
float f7 = k / height;
|
||||
float f8 = maxV + (minV - maxV) * f7 - f6;
|
||||
float f9 = f7 + 1.0f / height;
|
||||
tesselator.addVertexWithUV(0.0, f9, 0.0, maxU, f8);
|
||||
tesselator.addVertexWithUV(1.0, f9, 0.0, minU, f8);
|
||||
tesselator.addVertexWithUV(1.0, f9, 0.0f - depth, minU, f8);
|
||||
tesselator.addVertexWithUV(0.0, f9, 0.0f - depth, maxU, f8);
|
||||
}
|
||||
tesselator.draw();
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.setNormal(0.0f, -1.0f, 0.0f);
|
||||
for (int k = 0; k < height; ++k) {
|
||||
float f7 = k / height;
|
||||
float f8 = maxV + (minV - maxV) * f7 - f6;
|
||||
tesselator.addVertexWithUV(1.0, f7, 0.0, minU, f8);
|
||||
tesselator.addVertexWithUV(0.0, f7, 0.0, maxU, f8);
|
||||
tesselator.addVertexWithUV(0.0, f7, 0.0f - depth, maxU, f8);
|
||||
tesselator.addVertexWithUV(1.0, f7, 0.0f - depth, minU, f8);
|
||||
}
|
||||
tesselator.draw();
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package binnie.extratrees.alcohol.drink;
|
||||
|
||||
import binnie.Binnie;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class DrinkLiquid implements IDrinkLiquid {
|
||||
public String ident;
|
||||
|
||||
protected String name;
|
||||
protected int colour;
|
||||
protected float transparency;
|
||||
protected float abv;
|
||||
|
||||
public DrinkLiquid(String name, int colour, float transparency, float abv) {
|
||||
this.name = name;
|
||||
this.colour = colour;
|
||||
this.transparency = transparency;
|
||||
this.abv = abv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConsumable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
return colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTransparency() {
|
||||
return transparency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return ident;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIdent(String lowerCase) {
|
||||
ident = lowerCase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getABV() {
|
||||
return abv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack get(int amount) {
|
||||
return Binnie.Liquid.getLiquidStack(ident, amount);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package binnie.extratrees.alcohol.drink;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class DrinkManager {
|
||||
protected static Map<String, IDrinkLiquid> drinkLiquids = new HashMap<>();
|
||||
|
||||
public static IDrinkLiquid getLiquid(String id) {
|
||||
return DrinkManager.drinkLiquids.get(id.toLowerCase());
|
||||
}
|
||||
|
||||
public static void registerDrinkLiquid(String id, IDrinkLiquid liquid) {
|
||||
liquid.setIdent(id.toLowerCase());
|
||||
DrinkManager.drinkLiquids.put(id.toLowerCase(), liquid);
|
||||
}
|
||||
|
||||
public static IDrinkLiquid getLiquid(Fluid fluid) {
|
||||
return getLiquid(fluid.getName());
|
||||
}
|
||||
|
||||
public static IDrinkLiquid getLiquid(FluidStack fluid) {
|
||||
if (fluid == null) {
|
||||
return null;
|
||||
}
|
||||
return getLiquid(fluid.getFluid());
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package binnie.extratrees.alcohol.drink;
|
||||
|
||||
public interface IAlcoholic {
|
||||
float getABV();
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package binnie.extratrees.alcohol.drink;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface IDrinkLiquid {
|
||||
boolean isConsumable();
|
||||
|
||||
int getColour();
|
||||
|
||||
String getName();
|
||||
|
||||
float getTransparency();
|
||||
|
||||
String getIdentifier();
|
||||
|
||||
void setIdent(String lowerCase);
|
||||
|
||||
float getABV();
|
||||
|
||||
FluidStack get(int amount);
|
||||
}
|
||||
@@ -1,217 +0,0 @@
|
||||
package binnie.extratrees.alcohol.drink;
|
||||
|
||||
import binnie.extratrees.alcohol.Alcohol;
|
||||
import binnie.extratrees.alcohol.AlcoholEffect;
|
||||
import binnie.extratrees.alcohol.Glassware;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemDrink extends ItemFood implements IFluidContainerItem {
|
||||
public ItemDrink() {
|
||||
super(0, 0.0f, false);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setUnlocalizedName("drink");
|
||||
setHasSubtypes(true);
|
||||
setMaxStackSize(1);
|
||||
setAlwaysEdible();
|
||||
}
|
||||
|
||||
public Glassware getGlassware(ItemStack container) {
|
||||
if (!container.hasTagCompound() || !container.getTagCompound().hasKey("glassware")) {
|
||||
return Glassware.BeerMug;
|
||||
}
|
||||
return Glassware.values()[container.getTagCompound().getShort("glassware")];
|
||||
}
|
||||
|
||||
public ItemStack getStack(Glassware glass, FluidStack fluid) {
|
||||
ItemStack stack = new ItemStack(this);
|
||||
saveGlassware(glass, stack);
|
||||
saveFluid(fluid, stack);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public void saveGlassware(Glassware container, ItemStack stack) {
|
||||
if (!stack.hasTagCompound()) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
stack.getTagCompound().setShort("glassware", (short) container.ordinal());
|
||||
}
|
||||
|
||||
public void saveFluid(FluidStack fluid, ItemStack stack) {
|
||||
if (!stack.hasTagCompound()) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound nbt = stack.getTagCompound();
|
||||
if (fluid == null) {
|
||||
nbt.removeTag("fluid");
|
||||
} else {
|
||||
NBTTagCompound liq = new NBTTagCompound();
|
||||
fluid.writeToNBT(liq);
|
||||
nbt.setTag("fluid", liq);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack getFluid(ItemStack container) {
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("fluid")) {
|
||||
return null;
|
||||
}
|
||||
return FluidStack.loadFluidStackFromNBT(container.stackTagCompound.getCompoundTag("fluid"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity(ItemStack container) {
|
||||
return getGlassware(container).getCapacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ItemStack container, FluidStack resource, boolean doFill) {
|
||||
if (resource == null || !container.hasTagCompound() || DrinkManager.getLiquid(resource.getFluid()) == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
FluidStack existing = getFluid(container);
|
||||
int space = getGlassware(container).getCapacity() - ((existing == null) ? 0 : existing.amount);
|
||||
int added = Math.min(space, resource.amount);
|
||||
if (space <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (existing == null) {
|
||||
if (doFill) {
|
||||
FluidStack fill = resource.copy();
|
||||
fill.amount = added;
|
||||
saveFluid(fill, container);
|
||||
}
|
||||
return added;
|
||||
}
|
||||
|
||||
if (!existing.isFluidEqual(resource)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (doFill) {
|
||||
FluidStack fill = existing.copy();
|
||||
fill.amount += added;
|
||||
saveFluid(fill, container);
|
||||
}
|
||||
return added;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) {
|
||||
if (!container.hasTagCompound()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
FluidStack content = getFluid(container);
|
||||
if (content == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int toRemove = Math.min(maxDrain, content.amount);
|
||||
FluidStack fill = content.copy();
|
||||
FluidStack drain = content.copy();
|
||||
drain.amount = toRemove;
|
||||
fill.amount -= toRemove;
|
||||
if (fill.amount == 0) {
|
||||
fill = null;
|
||||
}
|
||||
|
||||
if (doDrain) {
|
||||
saveFluid(fill, container);
|
||||
}
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (Glassware glassware : Glassware.values()) {
|
||||
list.add(getStack(glassware, null));
|
||||
}
|
||||
list.add(getStack(Glassware.Wine, Alcohol.RedWine.get(Glassware.Wine.getCapacity())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
FluidStack fluid = getFluid(stack);
|
||||
IDrinkLiquid liquid = (fluid == null) ? null : DrinkManager.getLiquid(fluid.getFluid());
|
||||
return getGlassware(stack).getName((liquid == null) ? null : liquid.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (Glassware glassware : Glassware.values()) {
|
||||
glassware.registerIcons(register);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass) {
|
||||
Glassware glass = getGlassware(stack);
|
||||
return (pass == 0) ? glass.glass : ((getFluid(stack) == null) ? glass.glass : glass.contents);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass) {
|
||||
FluidStack fluid = getFluid(stack);
|
||||
IDrinkLiquid drink = (fluid == null) ? null : DrinkManager.getLiquid(fluid.getFluid());
|
||||
if (pass == 0 || drink == null) {
|
||||
return 0xffffff;
|
||||
}
|
||||
return drink.getColour();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int metadata) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) {
|
||||
drain(stack, 30, true);
|
||||
AlcoholEffect.makeDrunk(player, 2.1f);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack stack) {
|
||||
return (getFluid(stack) == null) ? EnumAction.none : EnumAction.drink;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack p_77626_1_) {
|
||||
return 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
player.setItemInUse(stack, getMaxItemUseDuration(stack));
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package binnie.extratrees.alcohol.drink;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityDrink extends TileEntity {
|
||||
}
|
||||
@@ -2,15 +2,11 @@ package binnie.extratrees.core;
|
||||
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import binnie.extratrees.craftgui.dictionary.WindowArboristDatabase;
|
||||
import binnie.extratrees.craftgui.dictionary.WindowBrewery;
|
||||
import binnie.extratrees.craftgui.dictionary.WindowDistillery;
|
||||
import binnie.extratrees.craftgui.dictionary.WindowLepidopteristDatabase;
|
||||
import binnie.extratrees.craftgui.dictionary.WindowLumbermill;
|
||||
import binnie.extratrees.craftgui.dictionary.WindowPress;
|
||||
import binnie.extratrees.craftgui.dictionary.WindowSetSquare;
|
||||
import binnie.extratrees.craftgui.dictionary.WindowWoodworker;
|
||||
import binnie.extratrees.craftgui.kitchen.WindowBottleRack;
|
||||
import binnie.extratrees.craftgui.WindowArboristDatabase;
|
||||
import binnie.extratrees.craftgui.WindowLepidopteristDatabase;
|
||||
import binnie.extratrees.craftgui.WindowLumbermill;
|
||||
import binnie.extratrees.craftgui.WindowSetSquare;
|
||||
import binnie.extratrees.craftgui.WindowWoodworker;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -25,10 +21,6 @@ public enum ExtraTreesGUID implements IBinnieGUID {
|
||||
Incubator,
|
||||
MothDatabase,
|
||||
MothDatabaseNEI,
|
||||
Press,
|
||||
Brewery,
|
||||
Distillery,
|
||||
KitchenBottleRack,
|
||||
Infuser,
|
||||
SetSquare;
|
||||
|
||||
@@ -54,22 +46,6 @@ public enum ExtraTreesGUID implements IBinnieGUID {
|
||||
window = WindowLumbermill.create(player, object, side);
|
||||
break;
|
||||
|
||||
case KitchenBottleRack:
|
||||
window = WindowBottleRack.create(player, object, side);
|
||||
break;
|
||||
|
||||
case Press:
|
||||
window = WindowPress.create(player, object, side);
|
||||
break;
|
||||
|
||||
case Brewery:
|
||||
window = WindowBrewery.create(player, object, side);
|
||||
break;
|
||||
|
||||
case Distillery:
|
||||
window = WindowDistillery.create(player, object, side);
|
||||
break;
|
||||
|
||||
case MothDatabase:
|
||||
case MothDatabaseNEI:
|
||||
window = WindowLepidopteristDatabase.create(player, side, this != ExtraTreesGUID.MothDatabase);
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.kitchen;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
@@ -25,7 +25,7 @@ public class ControlLumbermillProgress extends ControlProgressBase {
|
||||
protected float oldProgress;
|
||||
protected float animation;
|
||||
|
||||
protected ControlLumbermillProgress(IWidget parent, float x, float y) {
|
||||
public ControlLumbermillProgress(IWidget parent, float x, float y) {
|
||||
super(parent, x, y, 66.0f, 18.0f);
|
||||
oldProgress = 0.0f;
|
||||
animation = 0.0f;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.events.EventMouse;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.kitchen;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.kitchen;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.events.EventMouse;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
@@ -88,7 +88,7 @@ public class ControlTileSelect extends Control implements IControlValue<IDesign>
|
||||
for (IDesignCategory category : CarpentryManager.carpentryInterface.getAllDesignCategories()) {
|
||||
designs.put(category, new ArrayList<>());
|
||||
for (IDesign tile : category.getDesigns()) {
|
||||
if (filterText == "" || tile.getName().toLowerCase().contains(filterText)) {
|
||||
if (filterText.isEmpty() || tile.getName().toLowerCase().contains(filterText)) {
|
||||
designs.get(category).add(tile);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.ControlTextCentered;
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
@@ -14,6 +14,7 @@ import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.extratrees.FakeWorld;
|
||||
import binnie.extratrees.craftgui.ControlBlockIconDisplay;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.AbstractMod;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.AbstractMod;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.geometry.Position;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
package binnie.extratrees.craftgui;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
@@ -1,86 +0,0 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.WidgetAttribute;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.geometry.IPoint;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlProgressBase;
|
||||
import binnie.core.craftgui.resource.Texture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.util.ItemStackSet;
|
||||
import binnie.extratrees.core.ExtraTreeTexture;
|
||||
import binnie.extratrees.machines.Brewery;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class ControlBreweryProgress extends ControlProgressBase {
|
||||
protected static Texture brewery = new StandardTexture(0, 69, 34, 39, ExtraTreeTexture.Gui);
|
||||
protected static Texture breweryOverlay = new StandardTexture(34, 69, 34, 39, ExtraTreeTexture.Gui);
|
||||
|
||||
protected ControlBreweryProgress(IWidget parent, float x, float y) {
|
||||
super(parent, x, y, 34.0f, 39.0f);
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.Render.texture(ControlBreweryProgress.brewery, new IPoint(0.0f, 0.0f));
|
||||
Brewery.ComponentBreweryLogic logic = Machine.getInterface(Brewery.ComponentBreweryLogic.class, Window.get(this).getInventory());
|
||||
if (logic.currentCrafting == null || logic.currentCrafting.currentInput == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int fermentedHeight = (int) (32.0f * logic.getProgress() / 100.0f);
|
||||
CraftGUI.Render.limitArea(new IArea(new IPoint(1.0f, 6.0f).add(getAbsolutePosition()), new IPoint(32.0f, 32 - fermentedHeight)));
|
||||
GL11.glEnable(3089);
|
||||
renderFluid(logic.currentCrafting.currentInput, new IPoint(1.0f, 6.0f));
|
||||
renderFluid(logic.currentCrafting.currentInput, new IPoint(17.0f, 6.0f));
|
||||
renderFluid(logic.currentCrafting.currentInput, new IPoint(1.0f, 22.0f));
|
||||
renderFluid(logic.currentCrafting.currentInput, new IPoint(17.0f, 22.0f));
|
||||
GL11.glDisable(3089);
|
||||
CraftGUI.Render.limitArea(new IArea(new IPoint(1.0f, 38 - fermentedHeight).add(getAbsolutePosition()), new IPoint(32.0f, fermentedHeight)));
|
||||
GL11.glEnable(3089);
|
||||
renderFluid(binnie.extratrees.machines.Brewery.getOutput(logic.currentCrafting), new IPoint(1.0f, 6.0f));
|
||||
renderFluid(binnie.extratrees.machines.Brewery.getOutput(logic.currentCrafting), new IPoint(17.0f, 6.0f));
|
||||
renderFluid(binnie.extratrees.machines.Brewery.getOutput(logic.currentCrafting), new IPoint(1.0f, 22.0f));
|
||||
renderFluid(binnie.extratrees.machines.Brewery.getOutput(logic.currentCrafting), new IPoint(17.0f, 22.0f));
|
||||
GL11.glDisable(3089);
|
||||
|
||||
ItemStackSet stacks = new ItemStackSet();
|
||||
Collections.addAll(stacks, logic.currentCrafting.inputs);
|
||||
stacks.add(logic.currentCrafting.ingr);
|
||||
int x = 1;
|
||||
int y = 6;
|
||||
for (ItemStack stack : stacks) {
|
||||
CraftGUI.Render.item(new IPoint(x, y), stack);
|
||||
x += 16;
|
||||
if (x > 18) {
|
||||
x = 1;
|
||||
y += 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
}
|
||||
|
||||
public void renderFluid(FluidStack fluid, IPoint pos) {
|
||||
int hex = fluid.getFluid().getColor(fluid);
|
||||
int r = (hex & 0xFF0000) >> 16;
|
||||
int g = (hex & 0xFF00) >> 8;
|
||||
int b = hex & 0xFF;
|
||||
GL11.glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
CraftGUI.Render.iconBlock(pos, fluid.getFluid().getIcon());
|
||||
GL11.glDisable(3042);
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.events.EventMouse;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.geometry.IPoint;
|
||||
import binnie.core.craftgui.geometry.Position;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlProgressBase;
|
||||
import binnie.core.craftgui.resource.Texture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.extratrees.core.ExtraTreeTexture;
|
||||
import binnie.extratrees.machines.Distillery;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ControlDistilleryProgress extends ControlProgressBase {
|
||||
protected static Texture distilleryBase = new StandardTexture(43, 0, 58, 66, ExtraTreeTexture.Gui);
|
||||
protected static Texture distilleryOverlay = new StandardTexture(139, 0, 18, 66, ExtraTreeTexture.Gui);
|
||||
protected static Texture liquidFlow = new StandardTexture(101, 0, 38, 66, ExtraTreeTexture.Gui);
|
||||
protected static Texture output = new StandardTexture(68, 66, 17, 7, ExtraTreeTexture.Gui);
|
||||
|
||||
protected ControlDistilleryProgress(IWidget parent, float x, float y) {
|
||||
super(parent, x, y, 58.0f, 66.0f);
|
||||
addSelfEventHandler(new MouseDownHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.Render.texture(ControlDistilleryProgress.distilleryBase, new IPoint(0.0f, 0.0f));
|
||||
CraftGUI.Render.texturePercentage(ControlDistilleryProgress.liquidFlow, new IArea(18.0f, 0.0f, 38.0f, 66.0f), Position.LEFT, progress);
|
||||
Distillery.ComponentDistilleryLogic component = Machine.getInterface(Distillery.ComponentDistilleryLogic.class, Window.get(this).getInventory());
|
||||
FluidStack stack = null;
|
||||
if (component != null) {
|
||||
stack = component.currentFluid;
|
||||
}
|
||||
|
||||
if (stack != null) {
|
||||
for (int y = 0; y < 4; ++y) {
|
||||
renderFluid(stack, new IPoint(1.0f, 1 + y * 16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
int level = Machine.getInterface(Distillery.ComponentDistilleryLogic.class, Window.get(this).getInventory()).level;
|
||||
CraftGUI.Render.texture(output, new IPoint(47.0f, 14 + level * 15));
|
||||
CraftGUI.Render.texture(distilleryOverlay, new IPoint(0.0f, 0.0f));
|
||||
}
|
||||
|
||||
public void renderFluid(FluidStack fluid, IPoint pos) {
|
||||
int hex = fluid.getFluid().getColor(fluid);
|
||||
int r = (hex & 0xFF0000) >> 16;
|
||||
int g = (hex & 0xFF00) >> 8;
|
||||
int b = hex & 0xFF;
|
||||
GL11.glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
CraftGUI.Render.iconBlock(pos, fluid.getFluid().getIcon());
|
||||
GL11.glDisable(3042);
|
||||
}
|
||||
|
||||
private class MouseDownHandler extends EventMouse.Down.Handler {
|
||||
@Override
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
int distillationLevel = -1;
|
||||
if (new IArea(45.0f, 8.0f, 19.0f, 11.0f).contains(getRelativeMousePosition())) {
|
||||
distillationLevel = 0;
|
||||
} else if (new IArea(45.0f, 23.0f, 19.0f, 11.0f).contains(getRelativeMousePosition())) {
|
||||
distillationLevel = 1;
|
||||
} else if (new IArea(45.0f, 38.0f, 19.0f, 11.0f).contains(getRelativeMousePosition())) {
|
||||
distillationLevel = 2;
|
||||
}
|
||||
|
||||
if (distillationLevel >= 0) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setByte("i", (byte) distillationLevel);
|
||||
Window.get(getWidget()).sendClientAction("still-level", nbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.WidgetAttribute;
|
||||
import binnie.core.craftgui.events.EventMouse;
|
||||
import binnie.core.craftgui.geometry.IPoint;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlProgressBase;
|
||||
import binnie.core.craftgui.resource.Texture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.extratrees.core.ExtraTreeTexture;
|
||||
import binnie.extratrees.machines.Press;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ControlFruitPressProgress extends ControlProgressBase {
|
||||
protected static Texture pressTexture = new StandardTexture(6, 0, 24, 52, ExtraTreeTexture.Gui);
|
||||
protected static Texture pressSlot = new StandardTexture(9, 52, 34, 17, ExtraTreeTexture.Gui);
|
||||
|
||||
protected ControlFruitPressProgress(IWidget parent, float x, float y) {
|
||||
super(parent, x, y, 37.0f, 69.0f);
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
addSelfEventHandler(new MouseDownHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
Window window = Window.get(this);
|
||||
CraftGUI.Render.texture(ControlFruitPressProgress.pressSlot, new IPoint(3.0f, 52.0f));
|
||||
ItemStack input = window.getContainer().getSlotFromInventory(window.getInventory(), Press.slotCurrent).getStack();
|
||||
if (input == null || Press.getOutput(input) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Fluid fluid = Press.getOutput(input).getFluid();
|
||||
int hex = fluid.getColor(Press.getOutput(input));
|
||||
int r = (hex & 0xFF0000) >> 16;
|
||||
int g = (hex & 0xFF00) >> 8;
|
||||
int b = hex & 0xFF;
|
||||
GL11.glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
CraftGUI.Render.iconBlock(new IPoint(4.0f, 52.0f), fluid.getIcon());
|
||||
GL11.glDisable(3042);
|
||||
CraftGUI.Render.iconItem(new IPoint(4.0f, 52.0f), input.getIconIndex());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
CraftGUI.Render.texture(ControlFruitPressProgress.pressTexture, new IPoint(0.0f, 16.0f * progress));
|
||||
}
|
||||
|
||||
private class MouseDownHandler extends EventMouse.Down.Handler {
|
||||
@Override
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
if (event.getButton() == 0) {
|
||||
NBTTagCompound action = new NBTTagCompound();
|
||||
Window.get(getWidget()).sendClientAction("fruitpress-click", action);
|
||||
} else if (event.getButton() == 1) {
|
||||
NBTTagCompound action = new NBTTagCompound();
|
||||
Window.get(getWidget()).sendClientAction("clear-fruit", action);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.geometry.Position;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
|
||||
import binnie.core.craftgui.minecraft.control.ControlErrorState;
|
||||
import binnie.core.craftgui.minecraft.control.ControlLiquidTank;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlotArray;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.extratrees.machines.Brewery;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class WindowBrewery extends Window {
|
||||
public WindowBrewery(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(228.0f, 218.0f, player, inventory, side);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowBrewery(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return ExtraTrees.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Brewery";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
setTitle(Machine.getMachine(getInventory()).getPackage().getDisplayName());
|
||||
new ControlSlotArray(this, 42, 32, 1, 3).create(Brewery.slotRecipeGrains);
|
||||
new ControlSlot(this, 16.0f, 41.0f).assign(Brewery.slotRecipeInput);
|
||||
new ControlSlot(this, 105.0f, 77.0f).assign(Brewery.slotRecipeYeast);
|
||||
new ControlLiquidTank(this, 76, 32).setTankID(Brewery.tankInput);
|
||||
new ControlLiquidTank(this, 162, 32).setTankID(Brewery.tankOutput);
|
||||
new ControlEnergyBar(this, 196, 32, 16, 60, Position.BOTTOM);
|
||||
new ControlBreweryProgress(this, 110.0f, 32.0f);
|
||||
new ControlSlotArray(this, (int) (getSize().x() / 2.0f - 81.0f), 104, 9, 1).create(Brewery.slotInventory);
|
||||
new ControlPlayerInventory(this);
|
||||
new ControlErrorState(this, 133.0f, 79.0f);
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.geometry.Position;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
|
||||
import binnie.core.craftgui.minecraft.control.ControlErrorState;
|
||||
import binnie.core.craftgui.minecraft.control.ControlLiquidTank;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.extratrees.machines.Distillery;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class WindowDistillery extends Window {
|
||||
public WindowDistillery(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(224.0f, 192.0f, player, inventory, side);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowDistillery(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return ExtraTrees.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Distillery";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
setTitle(Machine.getMachine(getInventory()).getPackage().getDisplayName());
|
||||
int x = 16;
|
||||
new ControlLiquidTank(this, x, 35).setTankID(Distillery.tankInput);
|
||||
x += 34;
|
||||
new ControlDistilleryProgress(this, x, 32.0f);
|
||||
x += 64;
|
||||
new ControlLiquidTank(this, x, 35).setTankID(Distillery.tankOutput);
|
||||
x += 34;
|
||||
new ControlEnergyBar(this, x, 36, 60, 16, Position.LEFT);
|
||||
new ControlPlayerInventory(this);
|
||||
new ControlErrorState(this, x + 21, 62.0f);
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.geometry.Position;
|
||||
import binnie.core.craftgui.minecraft.InventoryType;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
|
||||
import binnie.core.craftgui.minecraft.control.ControlErrorState;
|
||||
import binnie.core.craftgui.minecraft.control.ControlLiquidTank;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.power.ErrorState;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.extratrees.machines.Press;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class WindowPress extends Window {
|
||||
public WindowPress(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(194.0f, 192.0f, player, inventory, side);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowPress(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return ExtraTrees.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Press";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
setTitle(Machine.getMachine(getInventory()).getPackage().getDisplayName());
|
||||
new ControlSlot(this, 24.0f, 52.0f).assign(Press.slotFruit);
|
||||
new ControlLiquidTank(this, 99, 32).setTankID(Press.tankWater);
|
||||
new ControlEnergyBar(this, 154, 32, 16, 60, Position.BOTTOM);
|
||||
new ControlPlayerInventory(this);
|
||||
new ControlErrorState(this, 128.0f, 54.0f);
|
||||
new ControlFruitPressProgress(this, 62.0f, 24.0f);
|
||||
((Window) getSuperParent()).getContainer().getOrCreateSlot(InventoryType.Machine, Press.slotCurrent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||
Press.ComponentFruitPressLogic logic = Machine.getInterface(Press.ComponentFruitPressLogic.class, getInventory());
|
||||
super.recieveGuiNBT(side, player, name, nbt);
|
||||
if (side != Side.SERVER || !name.equals("fruitpress-click")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (logic.canWork() == null && (logic.canProgress() == null || logic.canProgress() instanceof ErrorState.InsufficientPower)) {
|
||||
logic.alterProgress(2.0f);
|
||||
} else if (side == Side.SERVER && name.equals("clear-fruit")) {
|
||||
logic.setProgress(0.0f);
|
||||
getInventory().setInventorySlotContents(Press.slotCurrent, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package binnie.extratrees.craftgui.kitchen;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.WidgetAttribute;
|
||||
import binnie.core.craftgui.minecraft.MinecraftGUI;
|
||||
import binnie.core.craftgui.window.Panel;
|
||||
|
||||
public class ControlDropDownMenu extends Panel {
|
||||
public boolean stayOpenOnChildClick;
|
||||
|
||||
public ControlDropDownMenu(IWidget parent, float x, float y, float width, float height) {
|
||||
super(parent, x, y, width, 2.0f, MinecraftGUI.PanelType.Gray);
|
||||
stayOpenOnChildClick = false;
|
||||
addAttribute(WidgetAttribute.CAN_FOCUS);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package binnie.extratrees.craftgui.kitchen;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class WindowBottleRack extends Window {
|
||||
public WindowBottleRack(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(248.0f, 180.0f, player, inventory, side);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowBottleRack(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return ExtraTrees.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "BottleBank";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
setTitle(Machine.getMachine(getInventory()).getPackage().getDisplayName());
|
||||
for (int i = 0; i < 36; ++i) {
|
||||
int x = i % 12;
|
||||
int y = i / 12;
|
||||
new ControlTankSlot(this, 16 + x * 18, 32 + y * 18, i);
|
||||
}
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,6 @@ public enum ExtraTreeItems implements IItemMisc {
|
||||
Bark("bark"),
|
||||
ProvenGear("provenGear"),
|
||||
WoodWax("woodWax"),
|
||||
Hops("hops"),
|
||||
Yeast("yeast"),
|
||||
LagerYeast("yeastLager"),
|
||||
GrainWheat("grainWheat"),
|
||||
GrainBarley("grainBarley"),
|
||||
GrainRye("grainRye"),
|
||||
GrainCorn("grainCorn"),
|
||||
GrainRoasted("grainRoasted"),
|
||||
GlassFitting("glassFitting");
|
||||
|
||||
protected String name;
|
||||
|
||||
@@ -44,13 +44,7 @@ public class ModuleItems implements IInitializable {
|
||||
OreDictionary.registerOre("pulpWood", ExtraTreeItems.Sawdust.get(1));
|
||||
Food.registerOreDictionary();
|
||||
OreDictionary.registerOre("cropApple", Items.apple);
|
||||
OreDictionary.registerOre("cropHops", ExtraTreeItems.Hops.get(1));
|
||||
OreDictionary.registerOre("seedWheat", Items.wheat_seeds);
|
||||
OreDictionary.registerOre("seedWheat", ExtraTreeItems.GrainWheat.get(1));
|
||||
OreDictionary.registerOre("seedBarley", ExtraTreeItems.GrainBarley.get(1));
|
||||
OreDictionary.registerOre("seedCorn", ExtraTreeItems.GrainCorn.get(1));
|
||||
OreDictionary.registerOre("seedRye", ExtraTreeItems.GrainRye.get(1));
|
||||
OreDictionary.registerOre("seedRoasted", ExtraTreeItems.GrainRoasted.get(1));
|
||||
|
||||
Food.Crabapple.addJuice(10, 150, 10);
|
||||
Food.Orange.addJuice(10, 400, 15);
|
||||
@@ -106,7 +100,7 @@ public class ModuleItems implements IInitializable {
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
new ItemStack(ExtraTrees.itemDurableHammer, 1, 0),
|
||||
"wiw", " s ", " s ",
|
||||
'w', Blocks.obsidian,
|
||||
@@ -114,7 +108,7 @@ public class ModuleItems implements IInitializable {
|
||||
's', Items.stick
|
||||
));
|
||||
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
new ItemStack(ExtraTrees.itemHammer, 1, 0),
|
||||
"wiw", " s ", " s ",
|
||||
'w', "plankWood",
|
||||
@@ -122,53 +116,6 @@ public class ModuleItems implements IInitializable {
|
||||
's', Items.stick
|
||||
));
|
||||
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(
|
||||
ExtraTreeItems.Yeast.get(8),
|
||||
" m ", "mbm",
|
||||
'b', Items.bread,
|
||||
'm', Blocks.brown_mushroom
|
||||
));
|
||||
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(
|
||||
ExtraTreeItems.LagerYeast.get(8),
|
||||
"mbm", " m ",
|
||||
'b', Items.bread,
|
||||
'm', Blocks.brown_mushroom
|
||||
));
|
||||
|
||||
GameRegistry.addRecipe(
|
||||
ExtraTreeItems.GrainWheat.get(5),
|
||||
" s ", "sss", " s ",
|
||||
's', Items.wheat_seeds
|
||||
);
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
ExtraTreeItems.GrainBarley.get(3), new Object[]{
|
||||
false,
|
||||
" s ", "s ", " s ",
|
||||
's', ExtraTreeItems.GrainWheat.get(1)
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
ExtraTreeItems.GrainCorn.get(3), new Object[]{
|
||||
false,
|
||||
" s ", " s", " s ",
|
||||
's', ExtraTreeItems.GrainWheat.get(1)
|
||||
}
|
||||
));
|
||||
|
||||
GameRegistry.addRecipe(
|
||||
ExtraTreeItems.GrainRye.get(3),
|
||||
" ", "s s", " s ",
|
||||
's', ExtraTreeItems.GrainWheat.get(1)
|
||||
);
|
||||
|
||||
GameRegistry.addRecipe(
|
||||
ExtraTreeItems.Hops.get(3),
|
||||
" s ", "sps", " s ",
|
||||
's', Items.wheat_seeds,
|
||||
'p', Items.apple
|
||||
);
|
||||
|
||||
GameRegistry.addRecipe(
|
||||
ExtraTreeItems.ProvenGear.get(1),
|
||||
" s ", "s s", " s ",
|
||||
@@ -182,14 +129,9 @@ public class ModuleItems implements IInitializable {
|
||||
's', Items.stick
|
||||
);
|
||||
|
||||
GameRegistry.addSmelting(ExtraTreeItems.GrainWheat.get(1), ExtraTreeItems.GrainRoasted.get(1), 0.0f);
|
||||
GameRegistry.addSmelting(ExtraTreeItems.GrainRye.get(1), ExtraTreeItems.GrainRoasted.get(1), 0.0f);
|
||||
GameRegistry.addSmelting(ExtraTreeItems.GrainCorn.get(1), ExtraTreeItems.GrainRoasted.get(1), 0.0f);
|
||||
GameRegistry.addSmelting(ExtraTreeItems.GrainBarley.get(1), ExtraTreeItems.GrainRoasted.get(1), 0.0f);
|
||||
|
||||
try {
|
||||
Item minium = (Item) Class.forName("com.pahimar.ee3.lib.ItemIds").getField("miniumShard").get(null);
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(Food.Papayimar.get(1), minium, "cropPapaya"));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(Food.Papayimar.get(1), minium, "cropPapaya"));
|
||||
} catch (Exception ex) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package binnie.extratrees.kitchen;
|
||||
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.inventory.ComponentTankContainer;
|
||||
import binnie.extratrees.core.ExtraTreeTexture;
|
||||
import binnie.extratrees.core.ExtraTreesGUID;
|
||||
import binnie.extratrees.machines.ExtraTreeMachine;
|
||||
|
||||
public class BottleRack {
|
||||
public static class PackageBottleRack extends KitchenMachine.PackageKitchenMachine implements IMachineInformation {
|
||||
public PackageBottleRack() {
|
||||
super("bottleRack", ExtraTreeTexture.lumbermillTexture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ExtraTreeMachine.ComponentExtraTreeGUI(machine, ExtraTreesGUID.KitchenBottleRack);
|
||||
ComponentTankContainer inventory = new ComponentTankContainer(machine);
|
||||
for (int x = 0; x < 36; ++x) {
|
||||
inventory.addTank(x, "input", 1000);
|
||||
inventory.getTankSlot(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package binnie.extratrees.kitchen;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.machines.IMachineType;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.MachinePackage;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.core.resource.BinnieResource;
|
||||
import binnie.core.resource.ResourceType;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public enum KitchenMachine implements IMachineType {
|
||||
Worktop(null),
|
||||
Cupboard(null),
|
||||
BottleRack(BottleRack.PackageBottleRack.class);
|
||||
|
||||
protected Class<? extends MachinePackage> cls;
|
||||
|
||||
KitchenMachine(Class<? extends MachinePackage> cls) {
|
||||
this.cls = cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends MachinePackage> getPackageClass() {
|
||||
return cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return cls != null;
|
||||
}
|
||||
|
||||
public ItemStack get(int i) {
|
||||
return new ItemStack(ExtraTrees.blockKitchen, i, ordinal());
|
||||
}
|
||||
|
||||
public abstract static class PackageKitchenMachine extends MachinePackage {
|
||||
protected BinnieResource textureName;
|
||||
|
||||
protected PackageKitchenMachine(String uid, String textureName) {
|
||||
super(uid, false);
|
||||
this.textureName = Binnie.Resource.getFile(ExtraTrees.instance, ResourceType.Tile, textureName);
|
||||
}
|
||||
|
||||
protected PackageKitchenMachine(String uid, BinnieResource textureName) {
|
||||
super(uid, false);
|
||||
this.textureName = textureName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick, RenderBlocks renderer) {
|
||||
MachineRendererKitchen.instance.renderMachine(machine, textureName, x, y, z, partialTick, renderer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package binnie.extratrees.kitchen;
|
||||
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.resource.BinnieResource;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class MachineRendererKitchen {
|
||||
public static MachineRendererKitchen instance = new MachineRendererKitchen();
|
||||
|
||||
protected static int level = 0;
|
||||
protected BinnieResource texture;
|
||||
|
||||
public void renderMachine(Machine machine, BinnieResource texture, double x, double y, double z, float var8, RenderBlocks renderer) {
|
||||
if (renderer != null && renderer.blockAccess != null) {
|
||||
Block block = machine.getPackage().getGroup().getBlock();
|
||||
float i = 0.0625f;
|
||||
renderer.setRenderBounds(2.0f * i, 0.0, 2.0f * i, 14.0f * i, 14.0f * i, 14.0f * i);
|
||||
renderer.renderStandardBlock(block, (int) x, (int) y, (int) z);
|
||||
MachineRendererKitchen.level = 1;
|
||||
renderer.setRenderBounds(0.0, 14.0f * i, 0.0, 1.0, 1.0, 1.0);
|
||||
renderer.renderStandardBlock(block, (int) x, (int) y, (int) z);
|
||||
MachineRendererKitchen.level = 0;
|
||||
renderer.setRenderBounds(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
|
||||
if (RenderManager.instance == null || RenderManager.instance.renderEngine == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IIcon icon = Blocks.dirt.getIcon(0, 0);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
boolean wasTessellating = true;
|
||||
|
||||
try {
|
||||
tess.draw();
|
||||
} catch (Exception e) {
|
||||
wasTessellating = false;
|
||||
}
|
||||
|
||||
tess.startDrawingQuads();
|
||||
tess.draw();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 1.0, z + 0.5);
|
||||
RenderManager.instance.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
float ux = icon.getMinU();
|
||||
float uy = icon.getMinV();
|
||||
float uw = icon.getMaxU();
|
||||
float uh = icon.getMaxV();
|
||||
int[] widths = {1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, 6, 6, 6, 5, 4};
|
||||
|
||||
for (int h = 0; h < 15; ++h) {
|
||||
float h2 = h * i;
|
||||
float h3 = h2 + i;
|
||||
float d1 = widths[h] * i;
|
||||
float d2 = widths[h + 1] * i;
|
||||
float ang = 0.707f;
|
||||
float half = 8.0f * i;
|
||||
if (h < 13) {
|
||||
ang -= 0.05f;
|
||||
for (int angle = 0; angle < 360; angle += 90) {
|
||||
}
|
||||
if (h == 12) {
|
||||
}
|
||||
ang += 0.05f;
|
||||
}
|
||||
|
||||
for (int angle = 0; angle < 360; angle += 90) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(angle, 0.0f, 1.0f, 0.0f);
|
||||
GL11.glTranslatef(-0.5f, 0.0f, 0.0f);
|
||||
tess.startDrawingQuads();
|
||||
tess.setColorRGBA(255, 255, 255, 150);
|
||||
tess.addVertexWithUV(half - d1 * ang, h2, -d1 * ang, 0.0, 0.0);
|
||||
tess.addVertexWithUV(half - d2 * ang, h3, -d2 * ang, 0.0, 0.0);
|
||||
tess.addVertexWithUV(half + d2 * ang, h3, -d2 * ang, 0.0, 0.0);
|
||||
tess.addVertexWithUV(half + d1 * ang, h2, -d1 * ang, 0.0, 0.0);
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(half + d1 * ang, h2, -d1 * ang, 0.0, 0.0);
|
||||
tess.addVertexWithUV(half + d2 * ang, h3, -d2 * ang, 0.0, 0.0);
|
||||
tess.addVertexWithUV(half - d2 * ang, h3, -d2 * ang, 0.0, 0.0);
|
||||
tess.addVertexWithUV(half - d1 * ang, h2, -d1 * ang, 0.0, 0.0);
|
||||
tess.draw();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
if (wasTessellating) {
|
||||
tess.startDrawingQuads();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package binnie.extratrees.kitchen;
|
||||
|
||||
import binnie.core.IInitializable;
|
||||
import binnie.core.machines.MachineGroup;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import forestry.api.core.Tabs;
|
||||
|
||||
public class ModuleKitchen implements IInitializable {
|
||||
@Override
|
||||
public void preInit() {
|
||||
MachineGroup machineGroup = new MachineGroup(ExtraTrees.instance, "kitchen", "kitchen", KitchenMachine.values());
|
||||
machineGroup.setCreativeTab(Tabs.tabArboriculture);
|
||||
machineGroup.customRenderer = false;
|
||||
ExtraTrees.blockKitchen = machineGroup.getBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
}
|
||||
}
|
||||
@@ -1,594 +0,0 @@
|
||||
package binnie.extratrees.machines;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
import binnie.core.machines.inventory.ComponentTankContainer;
|
||||
import binnie.core.machines.inventory.InventorySlot;
|
||||
import binnie.core.machines.inventory.MachineSide;
|
||||
import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.core.machines.inventory.TankValidator;
|
||||
import binnie.core.machines.network.INetwork;
|
||||
import binnie.core.machines.power.ComponentPowerReceptor;
|
||||
import binnie.core.machines.power.ComponentProcessSetCost;
|
||||
import binnie.core.machines.power.ErrorState;
|
||||
import binnie.core.machines.power.IProcess;
|
||||
import binnie.extratrees.alcohol.Alcohol;
|
||||
import binnie.extratrees.core.ExtraTreeTexture;
|
||||
import binnie.extratrees.core.ExtraTreesGUID;
|
||||
import binnie.extratrees.item.ExtraTreeItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import forestry.api.core.INBTTagable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Brewery {
|
||||
public static int[] slotRecipeGrains = new int[]{0, 1, 2};
|
||||
public static int slotRecipeInput = 3;
|
||||
public static int slotRecipeYeast = 4;
|
||||
public static int[] slotInventory = new int[]{5, 6, 7, 8, 9, 10, 11, 12, 13};
|
||||
public static int tankInput = 0;
|
||||
public static int tankOutput = 1;
|
||||
|
||||
private static List<IBreweryRecipe> recipes = new ArrayList<>();
|
||||
|
||||
public static boolean isValidGrain(ItemStack itemstack) {
|
||||
for (IBreweryRecipe recipe : Brewery.recipes) {
|
||||
for (ItemStack ingredient : recipe.getGrains()) {
|
||||
if (ingredient.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isValidYeast(ItemStack itemstack) {
|
||||
for (IBreweryRecipe recipe : Brewery.recipes) {
|
||||
for (ItemStack ingredient : recipe.getYeasts()) {
|
||||
if (ingredient.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static FluidStack getOutput(FluidStack stack) {
|
||||
BreweryCrafting crafting = new BreweryCrafting(stack, null, null, null);
|
||||
for (IBreweryRecipe recipe : Brewery.recipes) {
|
||||
if (recipe.getOutput(crafting) != null) {
|
||||
return recipe.getOutput(crafting);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static FluidStack getOutput(BreweryCrafting crafting) {
|
||||
if (crafting.currentInput == null || crafting.yeast == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (IBreweryRecipe recipe : Brewery.recipes) {
|
||||
if (recipe.getOutput(crafting) != null) {
|
||||
return recipe.getOutput(crafting);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isValidIngredient(ItemStack itemstack) {
|
||||
for (IBreweryRecipe recipe : Brewery.recipes) {
|
||||
for (ItemStack ingr : recipe.getIngredient()) {
|
||||
if (ingr.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isValidInputLiquid(FluidStack fluid) {
|
||||
for (IBreweryRecipe recipe : Brewery.recipes) {
|
||||
for (FluidStack ingr : recipe.getInput()) {
|
||||
if (ingr.isFluidEqual(fluid)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isValidOutputLiquid(FluidStack fluid) {
|
||||
for (IBreweryRecipe recipe : Brewery.recipes) {
|
||||
for (FluidStack ingr : recipe.getOutput()) {
|
||||
if (ingr.isFluidEqual(fluid)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void addRecipe(FluidStack input, FluidStack output) {
|
||||
Brewery.recipes.add(new BreweryRecipe(input, output));
|
||||
}
|
||||
|
||||
public static void addBeerAndMashRecipes() {
|
||||
Brewery.recipes.add(new BeerRecipe());
|
||||
}
|
||||
|
||||
private interface IBreweryRecipe {
|
||||
FluidStack getOutput(BreweryCrafting crafting);
|
||||
|
||||
FluidStack[] getInput();
|
||||
|
||||
FluidStack[] getOutput();
|
||||
|
||||
ItemStack[] getGrains();
|
||||
|
||||
ItemStack[] getIngredient();
|
||||
|
||||
ItemStack[] getYeasts();
|
||||
}
|
||||
|
||||
public static class PackageBrewery extends ExtraTreeMachine.PackageExtraTreeMachine implements IMachineInformation {
|
||||
public PackageBrewery() {
|
||||
super("brewery", ExtraTreeTexture.breweryTexture, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ExtraTreeMachine.ComponentExtraTreeGUI(machine, ExtraTreesGUID.Brewery);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlotArray(Brewery.slotRecipeGrains, "grain");
|
||||
for (InventorySlot slot : inventory.getSlots(Brewery.slotRecipeGrains)) {
|
||||
slot.setValidator(new SlotValidatorBreweryGrain());
|
||||
slot.setType(InventorySlot.Type.Recipe);
|
||||
}
|
||||
|
||||
inventory.addSlotArray(Brewery.slotInventory, "inventory");
|
||||
for (InventorySlot slot : inventory.getSlots(Brewery.slotInventory)) {
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
|
||||
inventory.addSlot(Brewery.slotRecipeYeast, "yeast");
|
||||
inventory.getSlot(Brewery.slotRecipeYeast).setValidator(new SlotValidatorYeast());
|
||||
inventory.getSlot(Brewery.slotRecipeYeast).setType(InventorySlot.Type.Recipe);
|
||||
inventory.addSlot(Brewery.slotRecipeInput, "ingredient");
|
||||
inventory.getSlot(Brewery.slotRecipeInput).setValidator(new SlotValidatorBreweryIngredient());
|
||||
inventory.getSlot(Brewery.slotRecipeInput).setType(InventorySlot.Type.Recipe);
|
||||
|
||||
ComponentTankContainer tanks = new ComponentTankContainer(machine);
|
||||
tanks.addTank(Brewery.tankInput, "input", 5000);
|
||||
tanks.getTankSlot(Brewery.tankInput).setValidator(new TankValidatorFermentInput());
|
||||
tanks.getTankSlot(Brewery.tankInput).setOutputSides(MachineSide.TOP_AND_BOTTOM);
|
||||
tanks.addTank(Brewery.tankOutput, "output", 5000);
|
||||
tanks.getTankSlot(Brewery.tankOutput).setValidator(new TankValidatorFermentOutput());
|
||||
tanks.getTankSlot(Brewery.tankOutput).forbidInsertion();
|
||||
tanks.getTankSlot(Brewery.tankOutput).setOutputSides(MachineSide.SIDES);
|
||||
|
||||
new ComponentPowerReceptor(machine);
|
||||
new ComponentBreweryLogic(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static class BreweryCrafting implements INBTTagable {
|
||||
public FluidStack currentInput;
|
||||
public ItemStack[] inputs;
|
||||
public ItemStack ingr;
|
||||
public ItemStack yeast;
|
||||
|
||||
public BreweryCrafting(FluidStack currentInput, ItemStack ingr, ItemStack[] inputs, ItemStack yeast) {
|
||||
this.currentInput = currentInput;
|
||||
this.inputs = ((inputs == null) ? new ItemStack[3] : inputs);
|
||||
this.ingr = ingr;
|
||||
this.yeast = yeast;
|
||||
}
|
||||
|
||||
public BreweryCrafting(NBTTagCompound nbt) {
|
||||
readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
currentInput = FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag("fluid"));
|
||||
ingr = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("ingr"));
|
||||
|
||||
inputs = new ItemStack[3];
|
||||
inputs[0] = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("in1"));
|
||||
inputs[1] = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("in2"));
|
||||
inputs[2] = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("in3"));
|
||||
yeast = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("yeast"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
NBTTagCompound fluidTag = new NBTTagCompound();
|
||||
currentInput.writeToNBT(fluidTag);
|
||||
nbt.setTag("fluid", fluidTag);
|
||||
nbt.setTag("ingr", getNBT(ingr));
|
||||
nbt.setTag("in1", getNBT(inputs[0]));
|
||||
nbt.setTag("in2", getNBT(inputs[1]));
|
||||
nbt.setTag("in3", getNBT(inputs[2]));
|
||||
nbt.setTag("yeast", getNBT(yeast));
|
||||
}
|
||||
|
||||
private NBTTagCompound getNBT(ItemStack ingr) {
|
||||
if (ingr == null) {
|
||||
return new NBTTagCompound();
|
||||
}
|
||||
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
ingr.writeToNBT(nbt);
|
||||
return nbt;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentBreweryLogic extends ComponentProcessSetCost implements IProcess, INetwork.GuiNBT {
|
||||
public BreweryCrafting currentCrafting;
|
||||
|
||||
public ComponentBreweryLogic(Machine machine) {
|
||||
super(machine, 16000, 800);
|
||||
currentCrafting = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isTankEmpty(Brewery.tankInput) && currentCrafting == null) {
|
||||
return new ErrorState.InsufficientLiquid("No Input Liquid", Brewery.tankInput);
|
||||
}
|
||||
if (Brewery.getOutput(getInputCrafting()) == null && currentCrafting == null) {
|
||||
return new ErrorState("No Recipe", "Brewing cannot occur with these ingredients");
|
||||
}
|
||||
if (!getUtil().hasIngredients(new int[]{0, 1, 2, 3, 4}, Brewery.slotInventory) && currentCrafting == null) {
|
||||
return new ErrorState("Insufficient Ingredients", "Not enough ingredients for Brewing");
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
private BreweryCrafting getInputCrafting() {
|
||||
return new BreweryCrafting(getUtil().getFluid(Brewery.tankInput), getUtil().getStack(Brewery.slotRecipeInput), getUtil().getStacks(Brewery.slotRecipeGrains), getUtil().getStack(Brewery.slotRecipeYeast));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (currentCrafting == null) {
|
||||
return new ErrorState("Brewery Empty", "No liquid in Brewery");
|
||||
}
|
||||
if (!getUtil().spaceInTank(Brewery.tankOutput, 1000)) {
|
||||
return new ErrorState.TankSpace("No Space for Fermented Liquid", Brewery.tankOutput);
|
||||
}
|
||||
if (getUtil().getFluid(Brewery.tankOutput) != null && !getUtil().getFluid(Brewery.tankOutput).isFluidEqual(Brewery.getOutput(currentCrafting))) {
|
||||
return new ErrorState.TankSpace("Different fluid in tank", Brewery.tankOutput);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
FluidStack output = Brewery.getOutput(currentCrafting).copy();
|
||||
output.amount = 1000;
|
||||
getUtil().fillTank(Brewery.tankOutput, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
if (canWork() != null || currentCrafting != null || getUtil().getTank(Brewery.tankInput).getFluidAmount() < 1000) {
|
||||
return;
|
||||
}
|
||||
|
||||
FluidStack stack = getUtil().drainTank(Brewery.tankInput, 1000);
|
||||
currentCrafting = getInputCrafting();
|
||||
currentCrafting.currentInput = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendGuiNBT(Map<String, NBTTagCompound> nbts) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
if (currentCrafting == null) {
|
||||
nbt.setBoolean("null", true);
|
||||
} else {
|
||||
currentCrafting.writeToNBT(nbt);
|
||||
}
|
||||
nbts.put("brewery-recipe", nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||
if (!name.equals("brewery-recipe")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nbt.getBoolean("null")) {
|
||||
currentCrafting = null;
|
||||
} else {
|
||||
currentCrafting = new BreweryCrafting(nbt);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
if (currentCrafting == null) {
|
||||
return "Empty";
|
||||
}
|
||||
// TODO remove deprecated
|
||||
return "Creating " + Brewery.getOutput(currentCrafting).getFluid().getLocalizedName();
|
||||
}
|
||||
}
|
||||
|
||||
public static class SlotValidatorBreweryGrain extends SlotValidator {
|
||||
public SlotValidatorBreweryGrain() {
|
||||
super(SlotValidator.IconBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
return Brewery.isValidGrain(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Brewing Grains";
|
||||
}
|
||||
}
|
||||
|
||||
public static class SlotValidatorBreweryIngredient extends SlotValidator {
|
||||
public SlotValidatorBreweryIngredient() {
|
||||
super(SlotValidator.IconBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
return Brewery.isValidIngredient(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Brewing Ingredient";
|
||||
}
|
||||
}
|
||||
|
||||
public static class SlotValidatorYeast extends SlotValidator {
|
||||
public SlotValidatorYeast() {
|
||||
super(SlotValidator.IconBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
return Brewery.isValidYeast(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Yeast";
|
||||
}
|
||||
}
|
||||
|
||||
public static class TankValidatorFermentInput extends TankValidator {
|
||||
@Override
|
||||
public boolean isValid(FluidStack liquid) {
|
||||
return Brewery.isValidInputLiquid(liquid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Fermentable Liquids";
|
||||
}
|
||||
}
|
||||
|
||||
public static class TankValidatorFermentOutput extends TankValidator {
|
||||
@Override
|
||||
public boolean isValid(FluidStack liquid) {
|
||||
return Brewery.isValidOutputLiquid(liquid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Fermented Liquids";
|
||||
}
|
||||
}
|
||||
|
||||
public static class BreweryRecipe implements IBreweryRecipe {
|
||||
protected FluidStack input;
|
||||
protected ItemStack specificYeast;
|
||||
protected FluidStack output;
|
||||
|
||||
public BreweryRecipe(FluidStack input, FluidStack output) {
|
||||
this(input, null, output);
|
||||
}
|
||||
|
||||
public BreweryRecipe(FluidStack input, ItemStack specificYeast, FluidStack output) {
|
||||
this.input = input;
|
||||
this.specificYeast = specificYeast;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack getOutput(BreweryCrafting crafting) {
|
||||
if (specificYeast != null && !specificYeast.isItemEqual(crafting.yeast)) {
|
||||
return null;
|
||||
}
|
||||
if (input.isFluidEqual(crafting.currentInput)) {
|
||||
return output;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack[] getInput() {
|
||||
return new FluidStack[]{input};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack[] getOutput() {
|
||||
return new FluidStack[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getGrains() {
|
||||
return new ItemStack[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getIngredient() {
|
||||
return new ItemStack[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getYeasts() {
|
||||
return new ItemStack[]{ExtraTreeItems.Yeast.get(1)};
|
||||
}
|
||||
}
|
||||
|
||||
public static class BeerRecipe implements IBreweryRecipe {
|
||||
protected static String barley = "seedBarley";
|
||||
protected static String wheat = "seedWheat";
|
||||
protected static String rye = "seedRye";
|
||||
protected static String corn = "seedCorn";
|
||||
protected static String roasted = "seedRoasted";
|
||||
|
||||
Map<ItemStack, String> grainCrops;
|
||||
List<FluidStack> outputs;
|
||||
String[] grains;
|
||||
FluidStack water;
|
||||
ItemStack hops;
|
||||
|
||||
public BeerRecipe() {
|
||||
grainCrops = new HashMap<>();
|
||||
outputs = new ArrayList<>();
|
||||
grains = new String[]{BeerRecipe.barley, BeerRecipe.wheat, BeerRecipe.rye, BeerRecipe.corn, BeerRecipe.roasted};
|
||||
for (String grainType : grains) {
|
||||
for (ItemStack stack : OreDictionary.getOres(grainType)) {
|
||||
grainCrops.put(stack, grainType);
|
||||
}
|
||||
}
|
||||
|
||||
water = Binnie.Liquid.getLiquidStack("water", 5);
|
||||
hops = OreDictionary.getOres("cropHops").get(0);
|
||||
add(Alcohol.Ale);
|
||||
add(Alcohol.Lager);
|
||||
add(Alcohol.Stout);
|
||||
add(Alcohol.CornBeer);
|
||||
add(Alcohol.RyeBeer);
|
||||
add(Alcohol.WheatBeer);
|
||||
add(Alcohol.Barley);
|
||||
add(Alcohol.Corn);
|
||||
add(Alcohol.Rye);
|
||||
add(Alcohol.Wheat);
|
||||
}
|
||||
|
||||
private void add(IFluidType fluid) {
|
||||
outputs.add(fluid.get(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack getOutput(BreweryCrafting crafting) {
|
||||
if (!crafting.currentInput.isFluidEqual(water)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int roasted = 0;
|
||||
int barley = 0;
|
||||
int wheat = 0;
|
||||
int rye = 0;
|
||||
int corn = 0;
|
||||
|
||||
for (ItemStack stack : crafting.inputs) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String name = "";
|
||||
for (Map.Entry<ItemStack, String> entry : grainCrops.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
name = entry.getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (name.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (name.equals(BeerRecipe.roasted)) {
|
||||
roasted++;
|
||||
}
|
||||
if (name.equals(BeerRecipe.barley)) {
|
||||
barley++;
|
||||
}
|
||||
if (name.equals(BeerRecipe.wheat)) {
|
||||
wheat++;
|
||||
}
|
||||
if (name.equals(BeerRecipe.rye)) {
|
||||
rye++;
|
||||
}
|
||||
if (name.equals(BeerRecipe.corn)) {
|
||||
corn++;
|
||||
}
|
||||
}
|
||||
|
||||
boolean isBeer = crafting.ingr != null;
|
||||
boolean isLager = crafting.yeast.isItemEqual(ExtraTreeItems.LagerYeast.get(1));
|
||||
if (roasted >= 2 && isBeer) {
|
||||
return Alcohol.Stout.get(5);
|
||||
}
|
||||
if (wheat >= 2) {
|
||||
return isBeer ? Alcohol.WheatBeer.get(5) : Alcohol.Wheat.get(5);
|
||||
}
|
||||
if (rye >= 2) {
|
||||
return isBeer ? Alcohol.RyeBeer.get(5) : Alcohol.Rye.get(5);
|
||||
}
|
||||
if (corn >= 2) {
|
||||
return isBeer ? Alcohol.CornBeer.get(5) : Alcohol.Corn.get(5);
|
||||
}
|
||||
return isBeer ? (isLager ? Alcohol.Lager.get(5) : Alcohol.Ale.get(5)) : Alcohol.Barley.get(5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack[] getInput() {
|
||||
return new FluidStack[]{water};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack[] getOutput() {
|
||||
return outputs.toArray(new FluidStack[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getGrains() {
|
||||
return grainCrops.keySet().toArray(new ItemStack[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getIngredient() {
|
||||
return new ItemStack[]{hops};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getYeasts() {
|
||||
return new ItemStack[]{
|
||||
ExtraTreeItems.Yeast.get(1),
|
||||
ExtraTreeItems.LagerYeast.get(1)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,246 +0,0 @@
|
||||
package binnie.extratrees.machines;
|
||||
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
import binnie.core.machines.inventory.ComponentTankContainer;
|
||||
import binnie.core.machines.inventory.MachineSide;
|
||||
import binnie.core.machines.inventory.TankValidator;
|
||||
import binnie.core.machines.network.INetwork;
|
||||
import binnie.core.machines.power.ComponentPowerReceptor;
|
||||
import binnie.core.machines.power.ComponentProcessSetCost;
|
||||
import binnie.core.machines.power.ErrorState;
|
||||
import binnie.core.machines.power.IProcess;
|
||||
import binnie.extratrees.core.ExtraTreeTexture;
|
||||
import binnie.extratrees.core.ExtraTreesGUID;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Distillery {
|
||||
public static int tankInput = 0;
|
||||
public static int tankOutput = 1;
|
||||
|
||||
protected static List<Map<Fluid, FluidStack>> recipes = new ArrayList<>();
|
||||
|
||||
static {
|
||||
Distillery.recipes.add(new HashMap<>());
|
||||
Distillery.recipes.add(new HashMap<>());
|
||||
Distillery.recipes.add(new HashMap<>());
|
||||
}
|
||||
|
||||
public static FluidStack getOutput(FluidStack fluid, int level) {
|
||||
if (fluid == null) {
|
||||
return null;
|
||||
}
|
||||
return Distillery.recipes.get(level).get(fluid.getFluid());
|
||||
}
|
||||
|
||||
public static boolean isValidInputLiquid(FluidStack fluid) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (Distillery.recipes.get(i).containsKey(fluid.getFluid())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isValidOutputLiquid(FluidStack fluid) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (Map.Entry<Fluid, FluidStack> entry : Distillery.recipes.get(i).entrySet()) {
|
||||
if (entry.getValue().isFluidEqual(fluid)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void addRecipe(FluidStack input, FluidStack output, int level) {
|
||||
Distillery.recipes.get(level).put(input.getFluid(), output);
|
||||
}
|
||||
|
||||
public static class PackageDistillery extends ExtraTreeMachine.PackageExtraTreeMachine implements IMachineInformation {
|
||||
public PackageDistillery() {
|
||||
super("distillery", ExtraTreeTexture.distilleryTexture, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ExtraTreeMachine.ComponentExtraTreeGUI(machine, ExtraTreesGUID.Distillery);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
ComponentTankContainer tanks = new ComponentTankContainer(machine);
|
||||
tanks.addTank(Distillery.tankInput, "input", 5000);
|
||||
tanks.getTankSlot(Distillery.tankInput).setValidator(new TankValidatorDistilleryInput());
|
||||
tanks.getTankSlot(Distillery.tankInput).setOutputSides(MachineSide.TOP_AND_BOTTOM);
|
||||
tanks.addTank(Distillery.tankOutput, "output", 5000);
|
||||
tanks.getTankSlot(Distillery.tankOutput).setValidator(new TankValidatorDistilleryOutput());
|
||||
tanks.getTankSlot(Distillery.tankOutput).setReadOnly();
|
||||
tanks.getTankSlot(Distillery.tankOutput).setOutputSides(MachineSide.SIDES);
|
||||
new ComponentPowerReceptor(machine);
|
||||
new ComponentDistilleryLogic(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentDistilleryLogic extends ComponentProcessSetCost implements
|
||||
IProcess,
|
||||
INetwork.SendGuiNBT,
|
||||
INetwork.RecieveGuiNBT {
|
||||
public FluidStack currentFluid;
|
||||
public int level;
|
||||
|
||||
protected int guiLevel;
|
||||
|
||||
public ComponentDistilleryLogic(Machine machine) {
|
||||
super(machine, 16000, 800);
|
||||
currentFluid = null;
|
||||
level = 0;
|
||||
guiLevel = machine.getUniqueProgressBarID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEnergyPerTick() {
|
||||
return 2.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessLength() {
|
||||
return 2000 + 800 * level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
level = nbt.getByte("dlevel");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setByte("dlevel", (byte) level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isTankEmpty(Distillery.tankInput) && currentFluid == null) {
|
||||
return new ErrorState.InsufficientLiquid("No Input Liquid", Distillery.tankInput);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (currentFluid == null) {
|
||||
return new ErrorState("Distillery Empty", "No liquid in Distillery");
|
||||
}
|
||||
if (!getUtil().isTankEmpty(Distillery.tankOutput) && getOutput() != null && !getOutput().isFluidEqual(getUtil().getFluid(Distillery.tankOutput))) {
|
||||
return new ErrorState.Tank("No Room", "No room for liquid", new int[]{Distillery.tankOutput});
|
||||
}
|
||||
if (getUtil().getFluid(Distillery.tankOutput) != null && !getUtil().getFluid(Distillery.tankOutput).isFluidEqual(Distillery.getOutput(getUtil().getFluid(Distillery.tankInput), level))) {
|
||||
return new ErrorState.TankSpace("Different fluid in tank", Distillery.tankOutput);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
private FluidStack getOutput() {
|
||||
return Distillery.getOutput(getUtil().getFluid(Distillery.tankInput), level);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
FluidStack output = Distillery.getOutput(currentFluid, level).copy();
|
||||
output.amount = 1000;
|
||||
getUtil().fillTank(Distillery.tankOutput, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||
if (name.equals("still-level")) {
|
||||
level = nbt.getByte("i");
|
||||
}
|
||||
|
||||
if (name.equals("still-recipe")) {
|
||||
if (nbt.getBoolean("null")) {
|
||||
currentFluid = null;
|
||||
} else {
|
||||
currentFluid = FluidStack.loadFluidStackFromNBT(nbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendGuiNBT(Map<String, NBTTagCompound> nbts) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
if (currentFluid == null) {
|
||||
nbt.setBoolean("null", true);
|
||||
} else {
|
||||
currentFluid.writeToNBT(nbt);
|
||||
}
|
||||
|
||||
nbts.put("still-recipe", nbt);
|
||||
nbt.setByte("i", (byte) level);
|
||||
nbts.put("still-level", nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
if (canWork() == null && currentFluid == null && getUtil().getTank(Distillery.tankInput).getFluidAmount() >= 1000) {
|
||||
FluidStack stack = getUtil().drainTank(Distillery.tankInput, 1000);
|
||||
currentFluid = stack;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
if (currentFluid == null) {
|
||||
return "Empty";
|
||||
}
|
||||
// TODO remove deprecated
|
||||
return "Creating " + Distillery.getOutput(currentFluid, level).getFluid().getLocalizedName();
|
||||
}
|
||||
}
|
||||
|
||||
public static class TankValidatorDistilleryInput extends TankValidator {
|
||||
@Override
|
||||
public boolean isValid(FluidStack liquid) {
|
||||
return Distillery.isValidInputLiquid(liquid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Distillable Liquids";
|
||||
}
|
||||
}
|
||||
|
||||
public static class TankValidatorDistilleryOutput extends TankValidator {
|
||||
@Override
|
||||
public boolean isValid(FluidStack liquid) {
|
||||
return Distillery.isValidOutputLiquid(liquid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Distilled Liquids";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,9 +27,6 @@ public enum ExtraTreeMachine implements IMachineType {
|
||||
Lumbermill(LumbermillPackage.class),
|
||||
Woodworker(WoodworkerPackage.class),
|
||||
Panelworker(PanelworkerPackage.class),
|
||||
Press(Press.PackagePress.class),
|
||||
Brewery(Brewery.PackageBrewery.class),
|
||||
Distillery(Distillery.PackageDistillery.class),
|
||||
Glassworker(GlassworkerPackage.class),
|
||||
Tileworker(TileworkerPackage.class);
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import forestry.api.core.Tabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
public class ModuleMachine implements IInitializable {
|
||||
@@ -40,42 +39,6 @@ public class ModuleMachine implements IInitializable {
|
||||
));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
ExtraTreeMachine.Press.get(1),
|
||||
new Object[]{
|
||||
"iGi", "tSt", "tPt",
|
||||
'i', "ingotIron",
|
||||
'G', Blocks.glass,
|
||||
't', "ingotTin",
|
||||
'S', Mods.forestry.stack("sturdyMachine"),
|
||||
'P', "gearBronze"
|
||||
}
|
||||
));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
ExtraTreeMachine.Brewery.get(1),
|
||||
new Object[]{
|
||||
"bGb", "iSi", "bPb",
|
||||
'i', "ingotIron",
|
||||
'G', Blocks.glass,
|
||||
'b', "gearBronze",
|
||||
'S', Mods.forestry.stack("sturdyMachine"),
|
||||
'P', "gearBronze"
|
||||
}
|
||||
));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
ExtraTreeMachine.Distillery.get(1),
|
||||
new Object[]{
|
||||
"rGr", "iSi", "rPr",
|
||||
'i', "ingotIron",
|
||||
'G', Blocks.glass,
|
||||
'r', "dustRedstone",
|
||||
'S', Mods.forestry.stack("sturdyMachine"),
|
||||
'P', "gearBronze"
|
||||
}
|
||||
));
|
||||
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(
|
||||
ExtraTreeMachine.Woodworker.get(1),
|
||||
"wGw", "GsG", "ggg",
|
||||
'G', Blocks.glass,
|
||||
@@ -84,7 +47,7 @@ public class ModuleMachine implements IInitializable {
|
||||
's', Mods.forestry.stack("impregnatedCasing")
|
||||
));
|
||||
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
ExtraTreeMachine.Panelworker.get(1),
|
||||
"wGw", "GsG", "ggg",
|
||||
'G', Blocks.glass,
|
||||
@@ -93,7 +56,7 @@ public class ModuleMachine implements IInitializable {
|
||||
's', Mods.forestry.stack("impregnatedCasing")
|
||||
));
|
||||
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
ExtraTreeMachine.Glassworker.get(1),
|
||||
"wGw", "GsG", "ggg",
|
||||
'G', Blocks.glass,
|
||||
@@ -102,7 +65,7 @@ public class ModuleMachine implements IInitializable {
|
||||
's', Mods.forestry.stack("impregnatedCasing")
|
||||
));
|
||||
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
ExtraTreeMachine.Tileworker.get(1),
|
||||
"wGw", "GsG", "ggg",
|
||||
'G', Blocks.glass,
|
||||
|
||||
@@ -1,162 +0,0 @@
|
||||
package binnie.extratrees.machines;
|
||||
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
import binnie.core.machines.inventory.ComponentInventoryTransfer;
|
||||
import binnie.core.machines.inventory.ComponentTankContainer;
|
||||
import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.core.machines.power.ComponentPowerReceptor;
|
||||
import binnie.core.machines.power.ComponentProcessSetCost;
|
||||
import binnie.core.machines.power.ErrorState;
|
||||
import binnie.core.machines.power.IProcess;
|
||||
import binnie.extratrees.core.ExtraTreeTexture;
|
||||
import binnie.extratrees.core.ExtraTreesGUID;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Press {
|
||||
public static int slotFruit = 0;
|
||||
public static int slotCurrent = 1;
|
||||
public static int tankWater = 0;
|
||||
private static Map<ItemStack, FluidStack> pressRecipes = new HashMap<>();
|
||||
|
||||
public static boolean isInput(ItemStack itemstack) {
|
||||
return getOutput(itemstack) != null;
|
||||
}
|
||||
|
||||
public static FluidStack getOutput(ItemStack itemstack) {
|
||||
if (itemstack == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (Map.Entry<ItemStack, FluidStack> entry : Press.pressRecipes.entrySet()) {
|
||||
if (itemstack.isItemEqual(entry.getKey())) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void addRecipe(ItemStack stack, FluidStack fluid) {
|
||||
if (getOutput(stack) != null) {
|
||||
return;
|
||||
}
|
||||
Press.pressRecipes.put(stack, fluid);
|
||||
}
|
||||
|
||||
public static class PackagePress extends ExtraTreeMachine.PackageExtraTreeMachine implements IMachineInformation {
|
||||
public PackagePress() {
|
||||
super("press", ExtraTreeTexture.pressTexture, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ExtraTreeMachine.ComponentExtraTreeGUI(machine, ExtraTreesGUID.Press);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlot(Press.slotFruit, "input");
|
||||
inventory.getSlot(Press.slotFruit).setValidator(new SlotValidatorSqueezable());
|
||||
inventory.getSlot(Press.slotFruit).forbidExtraction();
|
||||
inventory.addSlot(Press.slotCurrent, "process");
|
||||
inventory.getSlot(Press.slotCurrent).setValidator(new SlotValidatorSqueezable());
|
||||
inventory.getSlot(Press.slotCurrent).forbidInteraction();
|
||||
ComponentTankContainer tanks = new ComponentTankContainer(machine);
|
||||
tanks.addTank(Press.tankWater, "output", 5000);
|
||||
new ComponentPowerReceptor(machine);
|
||||
new ComponentInventoryTransfer(machine).addRestock(new int[]{Press.slotFruit}, Press.slotCurrent, 1);
|
||||
new ComponentFruitPressLogic(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentFruitPressLogic extends ComponentProcessSetCost implements IProcess {
|
||||
protected int lastProgress;
|
||||
|
||||
public ComponentFruitPressLogic(Machine machine) {
|
||||
super(machine, 1000, 50);
|
||||
lastProgress = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(Press.slotCurrent)) {
|
||||
return new ErrorState.NoItem("No Fruit", Press.slotCurrent);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (!getUtil().spaceInTank(Press.tankWater, 5)) {
|
||||
return new ErrorState.TankSpace("No room in tank", Press.tankWater);
|
||||
}
|
||||
if (getUtil().getFluid(Press.tankWater) != null && !getUtil().getFluid(Press.tankWater).isFluidEqual(Press.getOutput(getUtil().getStack(Press.slotCurrent)))) {
|
||||
return new ErrorState.TankSpace("Different fluid in tank", Press.tankWater);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
getUtil().decreaseStack(Press.slotCurrent, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
FluidStack output = Press.getOutput(getUtil().getStack(Press.slotCurrent));
|
||||
if (output == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int newProgress = (int) getProgress();
|
||||
while (lastProgress + 4 <= newProgress) {
|
||||
int change = newProgress - lastProgress;
|
||||
int amount = output.amount * change / 100;
|
||||
FluidStack tank = new FluidStack(output, amount);
|
||||
getUtil().fillTank(Press.tankWater, tank);
|
||||
lastProgress += 4;
|
||||
}
|
||||
|
||||
if (lastProgress > newProgress) {
|
||||
lastProgress = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStartTask() {
|
||||
super.onStartTask();
|
||||
lastProgress = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SlotValidatorSqueezable extends SlotValidator {
|
||||
public SlotValidatorSqueezable() {
|
||||
super(SlotValidator.IconBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
return Press.isInput(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Fruit";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,6 @@ import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
||||
import binnie.core.util.UniqueFluidStackSet;
|
||||
import binnie.core.util.UniqueItemStackSet;
|
||||
import binnie.extratrees.machines.Brewery;
|
||||
import binnie.extratrees.machines.Distillery;
|
||||
import binnie.extratrees.machines.Press;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -40,7 +37,7 @@ public abstract class AnalystPageProduce extends ControlAnalystPage {
|
||||
}
|
||||
|
||||
public Collection<ItemStack> getCentrifuge(ItemStack stack) {
|
||||
List<ItemStack> products = new ArrayList<ItemStack>();
|
||||
List<ItemStack> products = new ArrayList<>();
|
||||
for (Map.Entry<Object[], Object[]> recipe : RecipeManagers.centrifugeManager.getRecipes().entrySet()) {
|
||||
boolean isRecipe = false;
|
||||
for (Object obj : recipe.getKey()) {
|
||||
@@ -124,16 +121,13 @@ public abstract class AnalystPageProduce extends ControlAnalystPage {
|
||||
}
|
||||
|
||||
public Collection<FluidStack> getAllFluids(ItemStack stack) {
|
||||
List<FluidStack> products = new ArrayList<FluidStack>();
|
||||
List<FluidStack> products = new ArrayList<>();
|
||||
products.addAll(getSqueezerFluid(stack));
|
||||
if (Press.getOutput(stack) != null) {
|
||||
products.add(Press.getOutput(stack));
|
||||
}
|
||||
return products;
|
||||
}
|
||||
|
||||
public Collection<FluidStack> getSqueezerFluid(ItemStack stack) {
|
||||
List<FluidStack> products = new ArrayList<FluidStack>();
|
||||
List<FluidStack> products = new ArrayList<>();
|
||||
for (Map.Entry<Object[], Object[]> recipe : RecipeManagers.squeezerManager.getRecipes().entrySet()) {
|
||||
boolean isRecipe = false;
|
||||
for (Object obj : recipe.getKey()) {
|
||||
@@ -154,10 +148,6 @@ public abstract class AnalystPageProduce extends ControlAnalystPage {
|
||||
|
||||
protected Collection<? extends FluidStack> getAllProducts(FluidStack stack) {
|
||||
Collection<FluidStack> fluids = new UniqueFluidStackSet();
|
||||
fluids.add(Brewery.getOutput(stack));
|
||||
fluids.add(Distillery.getOutput(stack, 0));
|
||||
fluids.add(Distillery.getOutput(stack, 1));
|
||||
fluids.add(Distillery.getOutput(stack, 2));
|
||||
return fluids;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.geometry.IPoint;
|
||||
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
||||
import binnie.core.util.UniqueItemStackSet;
|
||||
import binnie.extratrees.craftgui.kitchen.ControlFluidDisplay;
|
||||
import binnie.extratrees.craftgui.ControlFluidDisplay;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
@@ -42,8 +42,7 @@ public class AnalystPageProducts extends AnalystPageProduce {
|
||||
y += 20;
|
||||
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
|
||||
Collection<ItemStack> productList = new UniqueItemStackSet();
|
||||
Collection<ItemStack> specialtyList = new UniqueItemStackSet();
|
||||
Map<ItemStack, Float> products = new HashMap<ItemStack, Float>();
|
||||
Map<ItemStack, Float> products = new HashMap<>();
|
||||
products.putAll(genome.getPrimary().getProductChances());
|
||||
products.putAll(genome.getSecondary().getProductChances());
|
||||
if (!products.isEmpty()) {
|
||||
|
||||
Reference in new issue
Block a user