mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-19 11:59:11 +00:00
Clean Up Cocktail Liquid
This commit is contained in:
1 parent
c247bd1243
commit
f968bfdb38
22 files changed
+365
-382
No files matched your search
@@ -7,14 +7,14 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
class BinnieFluid extends Fluid {
|
||||
private final String name;
|
||||
private final FluidDefinition fluidDefinition;
|
||||
private final FluidType fluidType;
|
||||
private final int color;
|
||||
|
||||
public BinnieFluid(FluidDefinition fluid) {
|
||||
BinnieFluid(FluidType fluid) {
|
||||
super(fluid.getIdentifier(), fluid.getStill(), fluid.getFlowing());
|
||||
this.fluidDefinition = fluid;
|
||||
this.fluidType = fluid;
|
||||
this.name = fluid.getDisplayName();
|
||||
this.color = new Color(this.fluidDefinition.getColor()).getRGB();
|
||||
this.color = new Color(this.fluidType.getColor()).getRGB();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -27,7 +27,7 @@ class BinnieFluid extends Fluid {
|
||||
return color;
|
||||
}
|
||||
|
||||
public FluidDefinition getDefinition() {
|
||||
return this.fluidDefinition;
|
||||
FluidType getDefinition() {
|
||||
return this.fluidType;
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStackSimpl
|
||||
public class FluidHandlerItemBinnie extends FluidHandlerItemStackSimple {
|
||||
private final FluidContainerType containerType;
|
||||
|
||||
public FluidHandlerItemBinnie(ItemStack container, FluidContainerType containerType) {
|
||||
FluidHandlerItemBinnie(ItemStack container, FluidContainerType containerType) {
|
||||
super(container, Fluid.BUCKET_VOLUME);
|
||||
this.containerType = containerType;
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public class FluidHandlerItemBinnie extends FluidHandlerItemStackSimple {
|
||||
|
||||
if (fluid instanceof BinnieFluid) {
|
||||
BinnieFluid binnieFluid = (BinnieFluid) fluid;
|
||||
FluidDefinition definition = binnieFluid.getDefinition();
|
||||
FluidType definition = binnieFluid.getDefinition();
|
||||
return definition.canPlaceIn(containerType);
|
||||
}
|
||||
return false;
|
||||
|
||||
+27
-30
@@ -9,33 +9,35 @@ import binnie.core.Binnie;
|
||||
import binnie.core.Constants;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class FluidDefinition {
|
||||
public ResourceLocation textureFlowing;
|
||||
public ResourceLocation textureStill;
|
||||
public int color;
|
||||
public int containerColor;
|
||||
public int transparency;
|
||||
public String unlocalizedName;
|
||||
public String identifier;
|
||||
public ContainerShowHandler showHandler = (t)->true;
|
||||
public ContainerPlaceHandler placeHandler = (t)->true;
|
||||
public class FluidType {
|
||||
private ResourceLocation textureFlowing;
|
||||
private ResourceLocation textureStill;
|
||||
private int color;
|
||||
private int containerColor;
|
||||
private int transparency;
|
||||
private String unlocalizedName;
|
||||
private final String identifier;
|
||||
private ContainerShowHandler showHandler = (t)->true;
|
||||
private ContainerPlaceHandler placeHandler = (t)->true;
|
||||
|
||||
public FluidDefinition(String identifier, String unlocalizedName, int color) {
|
||||
public FluidType(String identifier, String unlocalizedName, int color) {
|
||||
this.identifier = "binnie." + identifier;
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
this.color = color;
|
||||
this.containerColor = color;
|
||||
setTextures(new ResourceLocation(Constants.CORE_MOD_ID, "blocks/liquids/blank"));
|
||||
ResourceLocation texture = new ResourceLocation(Constants.CORE_MOD_ID, "blocks/liquids/blank");
|
||||
this.textureFlowing = texture;
|
||||
this.textureStill = texture;
|
||||
}
|
||||
|
||||
/* TEXTURES */
|
||||
public FluidDefinition setTextures(ResourceLocation texture) {
|
||||
public FluidType setTextures(ResourceLocation texture) {
|
||||
this.textureFlowing = texture;
|
||||
this.textureStill = texture;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FluidDefinition setTextureFlowing(ResourceLocation textureFlowing) {
|
||||
public FluidType setTextureFlowing(ResourceLocation textureFlowing) {
|
||||
this.textureFlowing = textureFlowing;
|
||||
return this;
|
||||
}
|
||||
@@ -44,7 +46,7 @@ public class FluidDefinition {
|
||||
return textureFlowing;
|
||||
}
|
||||
|
||||
public FluidDefinition setTextureStill(ResourceLocation textureStill) {
|
||||
public FluidType setTextureStill(ResourceLocation textureStill) {
|
||||
this.textureStill = textureStill;
|
||||
return this;
|
||||
}
|
||||
@@ -58,16 +60,11 @@ public class FluidDefinition {
|
||||
return I18N.localise(unlocalizedName);
|
||||
}
|
||||
|
||||
public FluidDefinition setUnlocalizedName(String unlocalizedName) {
|
||||
public FluidType setUnlocalizedName(String unlocalizedName) {
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FluidDefinition setIdentifier(String identifier) {
|
||||
this.identifier = identifier;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
@@ -86,7 +83,7 @@ public class FluidDefinition {
|
||||
}
|
||||
|
||||
/* COLORS */
|
||||
public FluidDefinition setColor(int color) {
|
||||
public FluidType setColor(int color) {
|
||||
this.color = color;
|
||||
return this;
|
||||
}
|
||||
@@ -95,7 +92,7 @@ public class FluidDefinition {
|
||||
return color;
|
||||
}
|
||||
|
||||
public FluidDefinition setContainerColor(int containerColor) {
|
||||
public FluidType setContainerColor(int containerColor) {
|
||||
this.containerColor = containerColor;
|
||||
return this;
|
||||
}
|
||||
@@ -104,12 +101,12 @@ public class FluidDefinition {
|
||||
return containerColor;
|
||||
}
|
||||
|
||||
public FluidDefinition setTransparency(double transparency) {
|
||||
public FluidType setTransparency(double transparency) {
|
||||
this.transparency = (int)(Math.min(1.0, transparency + 0.3) * 255.0);
|
||||
return this;
|
||||
}
|
||||
|
||||
public FluidDefinition setTransparency(int transparency) {
|
||||
public FluidType setTransparency(int transparency) {
|
||||
this.transparency = transparency;
|
||||
return this;
|
||||
}
|
||||
@@ -119,12 +116,12 @@ public class FluidDefinition {
|
||||
}
|
||||
|
||||
/* HANDLERS*/
|
||||
public FluidDefinition setPlaceHandler(ContainerPlaceHandler placeHandler) {
|
||||
public FluidType setPlaceHandler(ContainerPlaceHandler placeHandler) {
|
||||
this.placeHandler = placeHandler;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FluidDefinition setShowHandler(ContainerShowHandler showHandler) {
|
||||
public FluidType setShowHandler(ContainerShowHandler showHandler) {
|
||||
this.showHandler = showHandler;
|
||||
return this;
|
||||
}
|
||||
@@ -137,15 +134,15 @@ public class FluidDefinition {
|
||||
return showHandler.showInCreative(type);
|
||||
}
|
||||
|
||||
public static interface ContainerShowHandler{
|
||||
public interface ContainerShowHandler{
|
||||
boolean showInCreative(FluidContainerType type);
|
||||
}
|
||||
|
||||
public static interface ContainerPlaceHandler{
|
||||
public interface ContainerPlaceHandler{
|
||||
boolean canPlaceIn(FluidContainerType type);
|
||||
}
|
||||
|
||||
public FluidDefinition getDefinition() {
|
||||
public FluidType getDefinition() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -3,7 +3,7 @@ package binnie.core.liquid;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface IFluidType {
|
||||
public interface IFluidDefinition {
|
||||
|
||||
FluidStack get(int amount);
|
||||
|
||||
@@ -11,5 +11,5 @@ public interface IFluidType {
|
||||
return get(Fluid.BUCKET_VOLUME);
|
||||
}
|
||||
|
||||
FluidDefinition getDefinition();
|
||||
FluidType getType();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package binnie.core.liquid;
|
||||
|
||||
public interface ILiquidDefinition extends IFluidDefinition {
|
||||
int ordinal();
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package binnie.core.liquid;
|
||||
|
||||
public interface ILiquidType extends IFluidType {
|
||||
int ordinal();
|
||||
}
|
||||
@@ -62,14 +62,14 @@ public class ItemFluidContainer extends ItemFood implements IItemModelRegister {
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
|
||||
super.getSubItems(tab, items);
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
for (FluidDefinition definition : Binnie.LIQUID.definitions.values()) {
|
||||
if (!definition.canPlaceIn(this.container)) {
|
||||
for (FluidType type : Binnie.LIQUID.fluids.values()) {
|
||||
if (!type.canPlaceIn(this.container)) {
|
||||
continue;
|
||||
}
|
||||
if (!definition.showInCreative(this.container)) {
|
||||
if (!type.showInCreative(this.container)) {
|
||||
continue;
|
||||
}
|
||||
items.add(getContainer(definition));
|
||||
items.add(getContainer(type));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,10 +84,10 @@ public class ItemFluidContainer extends ItemFood implements IItemModelRegister {
|
||||
return fluidHandler.drain(Integer.MAX_VALUE, false);
|
||||
}
|
||||
|
||||
public ItemStack getContainer(FluidDefinition definition) {
|
||||
public ItemStack getContainer(FluidType type) {
|
||||
ItemStack itemStack = new ItemStack(this);
|
||||
IFluidHandler fluidHandler = new FluidHandlerItemBinnie(itemStack, container);
|
||||
FluidStack fluidStack = definition.get();
|
||||
FluidStack fluidStack = type.get();
|
||||
if(fluidStack == null){
|
||||
return container.getEmpty();
|
||||
}
|
||||
|
||||
@@ -29,24 +29,24 @@ public class ManagerLiquid extends ManagerBase {
|
||||
//TODO: test if the name is "Creosote Oil" and not "fluid.creosote"
|
||||
public static final String CREOSOTE = "fluid.creosote";
|
||||
|
||||
Map<String, FluidDefinition> definitions;
|
||||
Map<String, FluidType> fluids;
|
||||
|
||||
public ManagerLiquid() {
|
||||
this.definitions = new LinkedHashMap<>();
|
||||
this.fluids = new LinkedHashMap<>();
|
||||
}
|
||||
|
||||
public void createLiquids(IFluidType[] liquids) {
|
||||
for (IFluidType liquid : liquids) {
|
||||
FluidDefinition definition = liquid.getDefinition();
|
||||
final BinnieFluid fluid = this.createLiquid(definition);
|
||||
public void createLiquids(IFluidDefinition[] liquids) {
|
||||
for (IFluidDefinition liquid : liquids) {
|
||||
FluidType type = liquid.getType();
|
||||
final BinnieFluid fluid = this.createLiquid(type);
|
||||
if (fluid == null) {
|
||||
throw new RuntimeException("Liquid registered incorrectly - " + definition.getIdentifier());
|
||||
throw new RuntimeException("Liquid registered incorrectly - " + type.getIdentifier());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BinnieFluid createLiquid(FluidDefinition fluid) {
|
||||
this.definitions.put(fluid.getIdentifier().toLowerCase(), fluid);
|
||||
private BinnieFluid createLiquid(FluidType fluid) {
|
||||
this.fluids.put(fluid.getIdentifier().toLowerCase(), fluid);
|
||||
final BinnieFluid bFluid = new BinnieFluid(fluid);
|
||||
FluidRegistry.registerFluid(bFluid);
|
||||
FluidRegistry.addBucketForFluid(bFluid);
|
||||
@@ -82,7 +82,7 @@ public class ManagerLiquid extends ManagerBase {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerSprites(TextureStitchEvent event) {
|
||||
TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks();
|
||||
for (FluidDefinition definition : definitions.values()) {
|
||||
for (FluidType definition : fluids.values()) {
|
||||
textureMap.registerSprite(definition.getFlowing());
|
||||
textureMap.registerSprite(definition.getStill());
|
||||
}
|
||||
|
||||
@@ -9,86 +9,85 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.Constants;
|
||||
import binnie.core.liquid.FluidContainerType;
|
||||
import binnie.core.liquid.FluidDefinition;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.core.liquid.FluidType;
|
||||
import binnie.core.liquid.IFluidDefinition;
|
||||
|
||||
public enum Alcohol implements IFluidType, ICocktailLiquid {
|
||||
Apple("cider.apple", 16432700, 0.3, 0.05){
|
||||
public enum Alcohol implements IFluidDefinition, ICocktailIngredientProvider {
|
||||
Apple("cider.apple", 16432700, 0.3, 0.05F){
|
||||
@Override
|
||||
protected void init() {
|
||||
addFementation(Juice.Apple);
|
||||
}
|
||||
},
|
||||
Apricot("wine.apricot", 15781686, 0.3, 0.1){
|
||||
Apricot("wine.apricot", 15781686, 0.3, 0.1F){
|
||||
@Override
|
||||
protected void init() {
|
||||
addFementation(Juice.Apricot);
|
||||
}
|
||||
},
|
||||
Banana("wine.banana", 14993485, 0.3, 0.1){
|
||||
Banana("wine.banana", 14993485, 0.3, 0.1F){
|
||||
@Override
|
||||
protected void init() {
|
||||
addFementation(Juice.Banana);
|
||||
}
|
||||
},
|
||||
Cherry("wine.cherry", 11207702, 0.3, 0.1){
|
||||
Cherry("wine.cherry", 11207702, 0.3, 0.1F){
|
||||
@Override
|
||||
protected void init() {
|
||||
addFementation(Juice.Cherry);
|
||||
}
|
||||
},
|
||||
Elderberry("wine.elderberry", 9764865, 0.3, 0.1){
|
||||
Elderberry("wine.elderberry", 9764865, 0.3, 0.1F){
|
||||
@Override
|
||||
protected void init() {
|
||||
addFementation(Juice.Elderberry);
|
||||
}
|
||||
},
|
||||
Peach("cider.peach", 15361563, 0.3, 0.05){
|
||||
Peach("cider.peach", 15361563, 0.3, 0.05F){
|
||||
@Override
|
||||
protected void init() {
|
||||
addFementation(Juice.Peach);
|
||||
}
|
||||
},
|
||||
Pear("ciderpear", 15061095, 0.3, 0.05){
|
||||
Pear("ciderpear", 15061095, 0.3, 0.05F){
|
||||
@Override
|
||||
protected void init() {
|
||||
addFementation(Juice.Pear);
|
||||
}
|
||||
},
|
||||
Plum("wine.plum", 12063752, 0.3, 0.1){
|
||||
Plum("wine.plum", 12063752, 0.3, 0.1F){
|
||||
@Override
|
||||
protected void init() {
|
||||
addFementation(Juice.Plum);
|
||||
}
|
||||
},
|
||||
Carrot("wine.carrot", 16219394, 0.3, 0.1){
|
||||
Carrot("wine.carrot", 16219394, 0.3, 0.1F){
|
||||
@Override
|
||||
protected void init() {
|
||||
addFementation(Juice.Carrot);
|
||||
}
|
||||
},
|
||||
WhiteWine("wine.white", 15587989, 0.1, 0.1){
|
||||
WhiteWine("wine.white", 15587989, 0.1, 0.1F){
|
||||
@Override
|
||||
protected void init() {
|
||||
addFementation(Juice.WhiteGrape);
|
||||
}
|
||||
},
|
||||
RedWine("wine.red", 7670539, 0.2, 0.1){
|
||||
RedWine("wine.red", 7670539, 0.2, 0.1F){
|
||||
@Override
|
||||
protected void init() {
|
||||
addFementation(Juice.RedGrape);
|
||||
}
|
||||
},
|
||||
SparklingWine("wine.sparkling", 16709566, 0.1, 0.1),
|
||||
Agave("wine.agave", 13938276, 0.2, 0.1),
|
||||
Potato("fermented.potatoes", 12028240, 0.8, 0.1){
|
||||
SparklingWine("wine.sparkling", 16709566, 0.1, 0.1F),
|
||||
Agave("wine.agave", 13938276, 0.2, 0.1F),
|
||||
Potato("fermented.potatoes", 12028240, 0.8, 0.1F){
|
||||
@Override
|
||||
protected void init() {
|
||||
addFementation("cropPotato");
|
||||
}
|
||||
},
|
||||
Citrus("wine.citrus", 16776960, 0.2, 0.1){
|
||||
Citrus("wine.citrus", 16776960, 0.2, 0.1F){
|
||||
@Override
|
||||
protected void init() {
|
||||
addFementation(Juice.Lemon);
|
||||
@@ -97,50 +96,50 @@ public enum Alcohol implements IFluidType, ICocktailLiquid {
|
||||
addFementation(Juice.Grapefruit);
|
||||
}
|
||||
},
|
||||
Cranberry("wine.cranberry", 11599874, 0.2, 0.1){
|
||||
Cranberry("wine.cranberry", 11599874, 0.2, 0.1F){
|
||||
@Override
|
||||
protected void init() {
|
||||
addFementation(Juice.Cranberry);
|
||||
}
|
||||
},
|
||||
Pineapple("wine.pineapple", 14724150, 0.2, 0.1){
|
||||
Pineapple("wine.pineapple", 14724150, 0.2, 0.1F){
|
||||
@Override
|
||||
protected void init() {
|
||||
addFementation(Juice.Pineapple);
|
||||
}
|
||||
},
|
||||
Tomato("wine.tomato", 12458521, 0.2, 0.1){
|
||||
Tomato("wine.tomato", 12458521, 0.2, 0.1F){
|
||||
@Override
|
||||
protected void init() {
|
||||
addFementation(Juice.Tomato);
|
||||
}
|
||||
},
|
||||
Fruit("juice", 16432700, 0.2, 0.1),
|
||||
Ale("beer.ale", 12991009, 0.7, 0.05),
|
||||
Lager("beer.lager", 15301637, 0.7, 0.05),
|
||||
WheatBeer("beer.wheat", 14380552, 0.7, 0.05),
|
||||
RyeBeer("beer.rye", 10836007, 0.7, 0.05),
|
||||
CornBeer("beer.corn", 13411364, 0.7, 0.05),
|
||||
Stout("beer.stout", 5843201, 0.8, 0.05),
|
||||
Barley("mash.grain", 12991009, 0.9, 0.05),
|
||||
Wheat("mash.wheat", 12991009, 0.9, 0.05),
|
||||
Rye("mash.rye", 10836007, 0.9, 0.05),
|
||||
Corn("mash.corn", 13411364, 0.9, 0.05);
|
||||
Fruit("juice", 16432700, 0.2, 0.1F),
|
||||
Ale("beer.ale", 12991009, 0.7, 0.05F),
|
||||
Lager("beer.lager", 15301637, 0.7, 0.05F),
|
||||
WheatBeer("beer.wheat", 14380552, 0.7, 0.05F),
|
||||
RyeBeer("beer.rye", 10836007, 0.7, 0.05F),
|
||||
CornBeer("beer.corn", 13411364, 0.7, 0.05F),
|
||||
Stout("beer.stout", 5843201, 0.8, 0.05F),
|
||||
Barley("mash.grain", 12991009, 0.9, 0.05F),
|
||||
Wheat("mash.wheat", 12991009, 0.9, 0.05F),
|
||||
Rye("mash.rye", 10836007, 0.9, 0.05F),
|
||||
Corn("mash.corn", 13411364, 0.9, 0.05F);
|
||||
|
||||
final List<String> fermentationLiquid;
|
||||
final float abv;
|
||||
final FluidDefinition definition;
|
||||
final FluidType type;
|
||||
String fermentationSolid;
|
||||
CocktailLiquid cocktailLiquid;
|
||||
|
||||
Alcohol(final String ident, final int color, final double transparency, final double abv) {
|
||||
Alcohol(final String ident, final int color, final double transparency, float abv) {
|
||||
this.fermentationLiquid = new ArrayList<>();
|
||||
this.fermentationSolid = "";
|
||||
this.abv = (float) abv;
|
||||
init();
|
||||
definition = new FluidDefinition(ident, "extratrees.fluid.alcohol." + this.name().toLowerCase(), color)
|
||||
type = new FluidType(ident, "extratrees.fluid.alcohol." + this.name().toLowerCase(), color)
|
||||
.setTransparency(transparency)
|
||||
.setTextures(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "blocks/liquids/liquid"))
|
||||
.setPlaceHandler((type) -> type == FluidContainerType.GLASS);
|
||||
cocktailLiquid = new CocktailLiquid(type, abv);
|
||||
}
|
||||
|
||||
protected void init(){
|
||||
@@ -148,8 +147,13 @@ public enum Alcohol implements IFluidType, ICocktailLiquid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidDefinition getDefinition() {
|
||||
return definition;
|
||||
public FluidType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICocktailIngredient getIngredient() {
|
||||
return cocktailLiquid;
|
||||
}
|
||||
|
||||
public List<String> getFermentationLiquid() {
|
||||
@@ -157,7 +161,7 @@ public enum Alcohol implements IFluidType, ICocktailLiquid {
|
||||
}
|
||||
|
||||
protected void addFementation(final Juice juice) {
|
||||
this.fermentationLiquid.add(juice.getIdentifier());
|
||||
this.fermentationLiquid.add(juice.type.getDisplayName());
|
||||
}
|
||||
|
||||
protected void addFementation(final String oreDict) {
|
||||
@@ -166,42 +170,12 @@ public enum Alcohol implements IFluidType, ICocktailLiquid {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return I18N.localise("extratrees.fluid.alcohol." + this.name().toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return definition.getIdentifier();
|
||||
return type.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack get(final int amount) {
|
||||
return definition.get(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return definition.getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransparency() {
|
||||
return definition.getTransparency();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip(final int ratio) {
|
||||
return ratio + " Part" + ((ratio > 1) ? "s " : " ") + definition.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getABV() {
|
||||
return this.abv;
|
||||
return type.get(amount);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -162,6 +162,10 @@ public enum Cocktail {
|
||||
DrinkManager.registerDrinkLiquid(liquid);
|
||||
}
|
||||
|
||||
public static void registerIngredient(final ICocktailIngredientProvider ingredient) {
|
||||
registerIngredient(ingredient.getIngredient());
|
||||
}
|
||||
|
||||
public static ICocktailIngredient getIngredient(final String name2) {
|
||||
return Cocktail.cocktailIngredients.get(name2.toLowerCase());
|
||||
}
|
||||
@@ -173,4 +177,8 @@ public enum Cocktail {
|
||||
private void add(final ICocktailIngredient ingredient, final int ratio) {
|
||||
this.ingredients.put(ingredient, ratio);
|
||||
}
|
||||
|
||||
private void add(final ICocktailIngredientProvider ingredient, final int ratio) {
|
||||
add(ingredient.getIngredient(), ratio);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.liquid.FluidType;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class CocktailLiquid implements ICocktailLiquid {
|
||||
private FluidType definition;
|
||||
private float abv;
|
||||
|
||||
public CocktailLiquid(FluidType definition, float abv) {
|
||||
this.definition = definition;
|
||||
this.abv = abv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack get(int amount) {
|
||||
return definition.get(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return definition.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return definition.getIdentifier();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return definition.getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransparency() {
|
||||
return definition.getTransparency();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip(int ratio) {
|
||||
String unlocalized = "extratrees.cocktail.liquid.tooltip";
|
||||
if(ratio > 1){
|
||||
unlocalized = "extratrees.cocktail.liquids.tooltip";
|
||||
}
|
||||
return I18N.localise(unlocalized, ratio, definition.getDisplayName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getABV() {
|
||||
return abv;
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ public interface ICocktailIngredient {
|
||||
|
||||
int getTransparency();
|
||||
|
||||
String getTooltip(final int p0);
|
||||
String getTooltip(int ratio);
|
||||
|
||||
float getABV();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
public interface ICocktailIngredientProvider {
|
||||
ICocktailIngredient getIngredient();
|
||||
}
|
||||
@@ -6,10 +6,10 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.Constants;
|
||||
import binnie.core.liquid.FluidContainerType;
|
||||
import binnie.core.liquid.FluidDefinition;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import binnie.core.liquid.FluidType;
|
||||
import binnie.core.liquid.IFluidDefinition;
|
||||
|
||||
public enum Juice implements IFluidType, ICocktailLiquid {
|
||||
public enum Juice implements IFluidDefinition, ICocktailIngredientProvider {
|
||||
Apple("Apple Juice", "juice.apple", 16763442, 0.7, "Apple"),
|
||||
Apricot("Apricot Juice", "juice.apricot", 16758046, 0.6, "Apricot"),
|
||||
Banana("Banana Juice", "juice.banana", 15324291, 0.6, "Banana"),
|
||||
@@ -31,15 +31,17 @@ public enum Juice implements IFluidType, ICocktailLiquid {
|
||||
RedGrape("Red Grape Juice", "juice.red.grape", 9775412, 0.6, "RedGrape");
|
||||
|
||||
public String squeezing;
|
||||
FluidDefinition definition;
|
||||
FluidType type;
|
||||
CocktailLiquid cocktailLiquid;
|
||||
|
||||
Juice(final String name, final String ident, final int colour, final double transparency, final String squeezing) {
|
||||
this.addSqueezing("crop" + squeezing);
|
||||
|
||||
definition = new FluidDefinition(ident, name, colour)
|
||||
type = new FluidType(ident, name, colour)
|
||||
.setTransparency(transparency)
|
||||
.setTextures(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "blocks/liquids/liquid"))
|
||||
.setShowHandler(type -> type == FluidContainerType.GLASS);
|
||||
cocktailLiquid = new CocktailLiquid(type, 0.0F);
|
||||
}
|
||||
|
||||
private void addSqueezing(final String oreDict) {
|
||||
@@ -48,46 +50,21 @@ public enum Juice implements IFluidType, ICocktailLiquid {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return definition.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return definition.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return definition.getIdentifier();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return definition.getColor();
|
||||
return type.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack get(final int amount) {
|
||||
return definition.get(amount);
|
||||
return type.get(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransparency() {
|
||||
return definition.getTransparency();
|
||||
public ICocktailIngredient getIngredient() {
|
||||
return cocktailLiquid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip(final int ratio) {
|
||||
return ratio + " Part" + ((ratio > 1) ? "s " : " ") + definition.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getABV() {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidDefinition getDefinition() {
|
||||
return definition;
|
||||
public FluidType getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@@ -6,27 +6,27 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.Constants;
|
||||
import binnie.core.liquid.FluidContainerType;
|
||||
import binnie.core.liquid.FluidDefinition;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import binnie.core.liquid.FluidType;
|
||||
import binnie.core.liquid.IFluidDefinition;
|
||||
|
||||
public enum Liqueur implements IFluidType, ICocktailLiquid {
|
||||
Almond("Almond", 14966063, 0.3, 0.2),
|
||||
Orange("Orange", 16353536, 0.4, 0.2),
|
||||
Banana("Banana", 16302592, 0.5, 0.2),
|
||||
Chocolate("Chocolate", 12667680, 0.3, 0.2),
|
||||
Mint("Mint", 2737788, 0.4, 0.2),
|
||||
Hazelnut("Hazelnut", 15570987, 0.3, 0.2),
|
||||
Cinnamon("Cinnamon", 15028224, 0.3, 0.2),
|
||||
Coffee("Coffee", 9847577, 0.4, 0.2),
|
||||
Melon("Melon", 11584049, 0.4, 0.2),
|
||||
Anise("Anise", 14344681, 0.3, 0.2),
|
||||
Peach("Peach", 16684384, 0.4, 0.2),
|
||||
Lemon("Lemon", 16311405, 0.4, 0.2),
|
||||
Herbal("Herbal", 16700673, 0.3, 0.2),
|
||||
Cherry("Cherry", 14096641, 0.5, 0.2),
|
||||
Blackcurrant("Blackcurrant", 6962541, 0.5, 0.2),
|
||||
Blackberry("Blackberry", 6837581, 0.5, 0.2),
|
||||
Raspberry("Raspberry", 10158848, 0.5, 0.2);
|
||||
public enum Liqueur implements IFluidDefinition, ICocktailIngredientProvider {
|
||||
Almond("Almond", 14966063, 0.3, 0.2F),
|
||||
Orange("Orange", 16353536, 0.4, 0.2F),
|
||||
Banana("Banana", 16302592, 0.5, 0.2F),
|
||||
Chocolate("Chocolate", 12667680, 0.3, 0.2F),
|
||||
Mint("Mint", 2737788, 0.4, 0.2F),
|
||||
Hazelnut("Hazelnut", 15570987, 0.3, 0.2F),
|
||||
Cinnamon("Cinnamon", 15028224, 0.3, 0.2F),
|
||||
Coffee("Coffee", 9847577, 0.4, 0.2F),
|
||||
Melon("Melon", 11584049, 0.4, 0.2F),
|
||||
Anise("Anise", 14344681, 0.3, 0.2F),
|
||||
Peach("Peach", 16684384, 0.4, 0.2F),
|
||||
Lemon("Lemon", 16311405, 0.4, 0.2F),
|
||||
Herbal("Herbal", 16700673, 0.3, 0.2F),
|
||||
Cherry("Cherry", 14096641, 0.5, 0.2F),
|
||||
Blackcurrant("Blackcurrant", 6962541, 0.5, 0.2F),
|
||||
Blackberry("Blackberry", 6837581, 0.5, 0.2F),
|
||||
Raspberry("Raspberry", 10158848, 0.5, 0.2F);
|
||||
|
||||
static {
|
||||
Liqueur.Almond.addFlavour("cropAlmond");
|
||||
@@ -49,18 +49,20 @@ public enum Liqueur implements IFluidType, ICocktailLiquid {
|
||||
}
|
||||
|
||||
float abv;
|
||||
final FluidDefinition definition;
|
||||
final FluidType type;
|
||||
final CocktailLiquid cocktailLiquid;
|
||||
|
||||
Liqueur(final String name, final int colour, final double transparency, final double abv) {
|
||||
Liqueur(final String name, final int colour, final double transparency,float abv) {
|
||||
this(name + " Liqueur", "liqueur." + name.toLowerCase(), colour, transparency, abv);
|
||||
}
|
||||
|
||||
Liqueur(final String name, final String ident, final int color, final double transparency, final double abv) {
|
||||
Liqueur(final String name, final String ident, final int color, final double transparency, float abv) {
|
||||
this.abv = (float) abv;
|
||||
definition = new FluidDefinition(ident, name, color)
|
||||
type = new FluidType(ident, name, color)
|
||||
.setTransparency(transparency)
|
||||
.setTextures(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "blocks/liquids/liquid"))
|
||||
.setShowHandler((type)->type == FluidContainerType.GLASS);
|
||||
cocktailLiquid = new CocktailLiquid(type, abv);
|
||||
}
|
||||
|
||||
private void addFlavour(final String oreDict) {
|
||||
@@ -68,48 +70,21 @@ public enum Liqueur implements IFluidType, ICocktailLiquid {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return definition.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return definition.getDisplayName();
|
||||
return type.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack get(final int amount) {
|
||||
return definition.get(amount);
|
||||
return type.get(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return definition.getColor();
|
||||
public FluidType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransparency() {
|
||||
return definition.getTransparency();
|
||||
public ICocktailIngredient getIngredient() {
|
||||
return cocktailLiquid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip(final int ratio) {
|
||||
return ratio + " Part" + ((ratio > 1) ? "s " : " ") + definition.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getABV() {
|
||||
return this.abv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return definition.getIdentifier();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidDefinition getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -6,10 +6,10 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.Constants;
|
||||
import binnie.core.liquid.FluidContainerType;
|
||||
import binnie.core.liquid.FluidDefinition;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import binnie.core.liquid.FluidType;
|
||||
import binnie.core.liquid.IFluidDefinition;
|
||||
|
||||
public enum MiscFluid implements IFluidType, ICocktailLiquid {
|
||||
public enum MiscFluid implements IFluidDefinition, ICocktailLiquid {
|
||||
CarbonatedWater("Carbonated Water", "water.carbonated", 13421823, 0.10000000149011612),
|
||||
TonicWater("Tonic Water", "water.tonic", 13421823, 0.10000000149011612),
|
||||
Cream("Carbonated Water", "cream", 15395550, 2.0),
|
||||
@@ -19,10 +19,10 @@ public enum MiscFluid implements IFluidType, ICocktailLiquid {
|
||||
AgaveNectar("Agave Nectar", "syrup.agave", 13598245, 0.699999988079071),
|
||||
GrenadineSyrup("Grenadine Syrup", "syrup.grenadine", 16009573, 0.800000011920929);
|
||||
|
||||
FluidDefinition definition;
|
||||
FluidType type;
|
||||
|
||||
MiscFluid(final String name, final String ident, final int color, final double transparency) {
|
||||
definition = new FluidDefinition(ident, name, color)
|
||||
type = new FluidType(ident, name, color)
|
||||
.setTransparency(transparency)
|
||||
.setTextures(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "blocks/liquids/liquid"))
|
||||
.setShowHandler((type)-> type == FluidContainerType.GLASS);
|
||||
@@ -30,32 +30,32 @@ public enum MiscFluid implements IFluidType, ICocktailLiquid {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return definition.toString();
|
||||
return type.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return definition.getDisplayName();
|
||||
return type.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return definition.getIdentifier();
|
||||
return type.getIdentifier();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return definition.getColor();
|
||||
return type.getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack get(final int amount) {
|
||||
return definition.get(amount);
|
||||
return type.get(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransparency() {
|
||||
return definition.getTransparency();
|
||||
return type.getTransparency();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,7 +69,7 @@ public enum MiscFluid implements IFluidType, ICocktailLiquid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidDefinition getDefinition() {
|
||||
return definition;
|
||||
public FluidType getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@@ -6,90 +6,68 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.Constants;
|
||||
import binnie.core.liquid.FluidContainerType;
|
||||
import binnie.core.liquid.FluidDefinition;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import binnie.core.liquid.FluidType;
|
||||
import binnie.core.liquid.IFluidDefinition;
|
||||
|
||||
public enum Spirit implements IFluidType, ICocktailLiquid {
|
||||
NeutralSpirit("Neutral Spirit", "spirit.neutral", 16777215, 0.05, 0.8),
|
||||
Vodka("Vodka", "vodka", 16053751, 0.05, 0.4),
|
||||
WhiteRum("White Rum", "rum.white", 15132132, 0.05, 0.4),
|
||||
DarkRum("Dark Rum", "rum.dark", 11018752, 0.4, 0.4),
|
||||
Whiskey("Whiskey", "whiskey", 13594368, 0.2, 0.4),
|
||||
CornWhiskey("Bourbon", "whiskey.corn", 9835009, 0.2, 0.4),
|
||||
RyeWhiskey("Rye Whiskey", "whiskey.rye", 16085800, 0.2, 0.4),
|
||||
WheatWhiskey("Wheat Whiskey", "whiskey.wheat", 14976530, 0.2, 0.4),
|
||||
FortifiedWine("Fortified Wine", "wine.fortified", 15569439, 0.2, 0.2),
|
||||
Tequila("Tequila", "tequila", 16116160, 0.05, 0.4),
|
||||
Brandy("Brandy", "brandy.grape", 16228128, 0.2, 0.4),
|
||||
AppleBrandy("Apple Brandy", "brandy.apple", 14985790, 0.2, 0.4),
|
||||
PearBrandy("Pear Brandy", "brandy.pear", 16696883, 0.2, 0.4),
|
||||
ApricotBrandy("Apricot Brandy", "brandy.apricot", 13336387, 0.2, 0.4),
|
||||
PlumBrandy("Plum Brandy", "brandy.plum", 9511697, 0.2, 0.4),
|
||||
CherryBrandy("Cherry Brandy", "brandy.cherry", 8588062, 0.2, 0.4),
|
||||
ElderberryBrandy("Elderberry Brandy", "brandy.elderberry", 12462919, 0.2, 0.4),
|
||||
CitrusBrandy("Citrus Brandy", "brandy.citrus", 13336387, 0.2, 0.4),
|
||||
FruitBrandy("Fruit Brandy", "brandy.fruit", 14985790, 0.2, 0.4),
|
||||
Cachaca("Cachaca", "spirit.sugarcane", 15331535, 0.1, 0.4),
|
||||
Gin("Gin", "spirit.gin", 16185078, 0.05, 0.4),
|
||||
AppleLiquor("Apple Liquor", "liquor.apple", 13421772, 0.05, 0.4),
|
||||
PearLiquor("Pear Liquor", "liquor.pear", 13421772, 0.05, 0.4),
|
||||
CherryLiquor("Cherry Liquor", "liquor.cherry", 13421772, 0.05, 0.4),
|
||||
ElderberryLiquor("Elderberry Liquor", "liquor.elderberry", 13421772, 0.05, 0.4),
|
||||
ApricotLiquor("Apricot Liquor", "liquor.apricot", 13421772, 0.05, 0.4),
|
||||
FruitLiquor("Fruit Liquor", "liquor.fruit", 13421772, 0.05, 0.4);
|
||||
public enum Spirit implements IFluidDefinition, ICocktailIngredientProvider {
|
||||
NeutralSpirit("Neutral Spirit", "spirit.neutral", 16777215, 0.05, 0.8F),
|
||||
Vodka("Vodka", "vodka", 16053751, 0.05, 0.4F),
|
||||
WhiteRum("White Rum", "rum.white", 15132132, 0.05, 0.4F),
|
||||
DarkRum("Dark Rum", "rum.dark", 11018752, 0.4, 0.4F),
|
||||
Whiskey("Whiskey", "whiskey", 13594368, 0.2, 0.4F),
|
||||
CornWhiskey("Bourbon", "whiskey.corn", 9835009, 0.2, 0.4F),
|
||||
RyeWhiskey("Rye Whiskey", "whiskey.rye", 16085800, 0.2, 0.4F),
|
||||
WheatWhiskey("Wheat Whiskey", "whiskey.wheat", 14976530, 0.2, 0.4F),
|
||||
FortifiedWine("Fortified Wine", "wine.fortified", 15569439, 0.2, 0.2F),
|
||||
Tequila("Tequila", "tequila", 16116160, 0.05, 0.4F),
|
||||
Brandy("Brandy", "brandy.grape", 16228128, 0.2, 0.4F),
|
||||
AppleBrandy("Apple Brandy", "brandy.apple", 14985790, 0.2, 0.4F),
|
||||
PearBrandy("Pear Brandy", "brandy.pear", 16696883, 0.2, 0.4F),
|
||||
ApricotBrandy("Apricot Brandy", "brandy.apricot", 13336387, 0.2, 0.4F),
|
||||
PlumBrandy("Plum Brandy", "brandy.plum", 9511697, 0.2, 0.4F),
|
||||
CherryBrandy("Cherry Brandy", "brandy.cherry", 8588062, 0.2, 0.4F),
|
||||
ElderberryBrandy("Elderberry Brandy", "brandy.elderberry", 12462919, 0.2, 0.4F),
|
||||
CitrusBrandy("Citrus Brandy", "brandy.citrus", 13336387, 0.2, 0.4F),
|
||||
FruitBrandy("Fruit Brandy", "brandy.fruit", 14985790, 0.2, 0.4F),
|
||||
Cachaca("Cachaca", "spirit.sugarcane", 15331535, 0.1, 0.4F),
|
||||
Gin("Gin", "spirit.gin", 16185078, 0.05, 0.4F),
|
||||
AppleLiquor("Apple Liquor", "liquor.apple", 13421772, 0.05, 0.4F),
|
||||
PearLiquor("Pear Liquor", "liquor.pear", 13421772, 0.05, 0.4F),
|
||||
CherryLiquor("Cherry Liquor", "liquor.cherry", 13421772, 0.05, 0.4F),
|
||||
ElderberryLiquor("Elderberry Liquor", "liquor.elderberry", 13421772, 0.05, 0.4F),
|
||||
ApricotLiquor("Apricot Liquor", "liquor.apricot", 13421772, 0.05, 0.4F),
|
||||
FruitLiquor("Fruit Liquor", "liquor.fruit", 13421772, 0.05, 0.4F);
|
||||
|
||||
float abv;
|
||||
FluidDefinition definition;
|
||||
FluidType type;
|
||||
CocktailLiquid cocktailLiquid;
|
||||
|
||||
Spirit(final String name, final String ident, final int color, final double transparency, final double abv) {
|
||||
Spirit(final String name, final String ident, final int color, final double transparency, final float abv) {
|
||||
this.abv = (float) abv;
|
||||
definition = new FluidDefinition(ident, name, color)
|
||||
type = new FluidType(ident, name, color)
|
||||
.setTextures(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "blocks/liquids/liquid"))
|
||||
.setShowHandler(type -> type == FluidContainerType.GLASS)
|
||||
.setTransparency(transparency);
|
||||
cocktailLiquid = new CocktailLiquid(type, abv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return definition.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return definition.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return definition.getIdentifier();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return definition.getColor();
|
||||
return type.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack get(final int amount) {
|
||||
return definition.get(amount);
|
||||
return type.get(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransparency() {
|
||||
return definition.getTransparency();
|
||||
public FluidType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip(final int ratio) {
|
||||
return ratio + " Part" + ((ratio > 1) ? "s " : " ") + definition.getDisplayName();
|
||||
}
|
||||
@Override
|
||||
public float getABV() {
|
||||
return this.abv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidDefinition getDefinition() {
|
||||
return definition;
|
||||
public ICocktailIngredient getIngredient() {
|
||||
return cocktailLiquid;
|
||||
}
|
||||
}
|
||||
@@ -6,19 +6,19 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.Constants;
|
||||
import binnie.core.liquid.FluidContainerType;
|
||||
import binnie.core.liquid.FluidDefinition;
|
||||
import binnie.core.liquid.ILiquidType;
|
||||
import binnie.core.liquid.FluidType;
|
||||
import binnie.core.liquid.ILiquidDefinition;
|
||||
|
||||
public enum ExtraTreeLiquid implements ILiquidType {
|
||||
public enum ExtraTreeLiquid implements ILiquidDefinition {
|
||||
Sap("Sap", "sap", 12481858),
|
||||
Resin("Resin", "resin", 13199360),
|
||||
Latex("Latex", "latex", 14212041),
|
||||
Turpentine("Turpentine", "turpentine", 7951162);
|
||||
|
||||
FluidDefinition definition;
|
||||
FluidType type;
|
||||
|
||||
ExtraTreeLiquid(final String name, final String ident, final int color) {
|
||||
definition = new FluidDefinition(ident, name, color)
|
||||
type = new FluidType(ident, name, color)
|
||||
.setShowHandler((type)->type == FluidContainerType.CAN || type == FluidContainerType.CAPSULE)
|
||||
.setTransparency(255)
|
||||
.setTextures(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "blocks/liquids/" + ident));
|
||||
@@ -26,11 +26,11 @@ public enum ExtraTreeLiquid implements ILiquidType {
|
||||
|
||||
@Override
|
||||
public FluidStack get(final int amount) {
|
||||
return definition.get(amount);
|
||||
return type.get(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidDefinition getDefinition() {
|
||||
return definition;
|
||||
public FluidType getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package binnie.extratrees.modules;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -18,8 +19,8 @@ import binnie.core.Binnie;
|
||||
import binnie.core.Constants;
|
||||
import binnie.core.Mods;
|
||||
import binnie.core.liquid.DrinkManager;
|
||||
import binnie.core.liquid.FluidDefinition;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import binnie.core.liquid.FluidType;
|
||||
import binnie.core.liquid.IFluidDefinition;
|
||||
import binnie.core.modules.BinnieModule;
|
||||
import binnie.core.modules.ExtraTreesModuleUIDs;
|
||||
import binnie.core.modules.Module;
|
||||
@@ -44,9 +45,11 @@ import binnie.extratrees.machines.distillery.DistilleryLogic;
|
||||
|
||||
@BinnieModule(moduleID = ExtraTreesModuleUIDs.ALCOHOL, moduleContainerID = Constants.EXTRA_TREES_MOD_ID, name = "Alcohol", unlocalizedDescription = "extratrees.module.alcohol")
|
||||
public class ModuleAlcohol extends Module {
|
||||
@Nullable
|
||||
public static ItemDrink drink;
|
||||
@Nullable
|
||||
public static Block blockDrink;
|
||||
public int drinkRendererID;
|
||||
@Nullable
|
||||
public static BinnieSprite liquid;
|
||||
|
||||
@Override
|
||||
@@ -87,60 +90,64 @@ public class ModuleAlcohol extends Module {
|
||||
public void postInit() {
|
||||
IBreweryManager breweryManager = ExtraTreesRecipeManager.breweryManager;
|
||||
IFruitPressManager fruitPressManager = ExtraTreesRecipeManager.fruitPressManager;
|
||||
ItemStack wax = Mods.Forestry.stack("beeswax");
|
||||
ItemStack waxCast = Mods.Forestry.stackWildcard("wax_cast");
|
||||
for (Glassware glassware : Glassware.values()) {
|
||||
ItemStack result = drink.getStack(glassware, null, 8);
|
||||
Object[] recipe = glassware.getRecipePattern(wax.getItem());
|
||||
RecipeManagers.fabricatorManager.addRecipe(waxCast, Fluids.GLASS.getFluid(glassware.getRecipeGlassCost()), result, recipe);
|
||||
}
|
||||
for (final Juice juice : Juice.values()) {
|
||||
final String oreDict = juice.squeezing;
|
||||
final List<ItemStack> ores = new ArrayList<>();
|
||||
ores.addAll(OreDictionary.getOres(oreDict));
|
||||
for (final Food food : Food.values()) {
|
||||
if (food.getOres().contains(oreDict)) {
|
||||
ores.add(food.get(1));
|
||||
}
|
||||
if(fruitPressManager != null) {
|
||||
ItemStack wax = Mods.Forestry.stack("beeswax");
|
||||
ItemStack waxCast = Mods.Forestry.stackWildcard("wax_cast");
|
||||
for (Glassware glassware : Glassware.values()) {
|
||||
ItemStack result = drink.getStack(glassware, null, 8);
|
||||
Object[] recipe = glassware.getRecipePattern(wax.getItem());
|
||||
RecipeManagers.fabricatorManager.addRecipe(waxCast, Fluids.GLASS.getFluid(glassware.getRecipeGlassCost()), result, recipe);
|
||||
}
|
||||
for (final ItemStack stack : ores) {
|
||||
for (final ISqueezerRecipe entry : RecipeManagers.squeezerManager.recipes()) {
|
||||
final ItemStack input = entry.getResources().get(0);
|
||||
final FluidStack output = entry.getFluidOutput();
|
||||
if (!ItemStack.areItemStacksEqual(stack, input) && !OreDictionary.itemMatches(input, stack, true)) {
|
||||
continue;
|
||||
for (final Juice juice : Juice.values()) {
|
||||
final String oreDict = juice.squeezing;
|
||||
final List<ItemStack> ores = new ArrayList<>();
|
||||
ores.addAll(OreDictionary.getOres(oreDict));
|
||||
for (final Food food : Food.values()) {
|
||||
if (food.getOres().contains(oreDict)) {
|
||||
ores.add(food.get(1));
|
||||
}
|
||||
int amount = output.amount;
|
||||
if (Objects.equals(output.getFluid().getName(), "seedoil")) {
|
||||
amount *= 2;
|
||||
}
|
||||
for (final ItemStack stack : ores) {
|
||||
for (final ISqueezerRecipe entry : RecipeManagers.squeezerManager.recipes()) {
|
||||
final ItemStack input = entry.getResources().get(0);
|
||||
final FluidStack output = entry.getFluidOutput();
|
||||
if (!ItemStack.areItemStacksEqual(stack, input) && !OreDictionary.itemMatches(input, stack, true)) {
|
||||
continue;
|
||||
}
|
||||
int amount = output.amount;
|
||||
if (Objects.equals(output.getFluid().getName(), "seedoil")) {
|
||||
amount *= 2;
|
||||
}
|
||||
fruitPressManager.addRecipe(stack, juice.get(amount));
|
||||
}
|
||||
fruitPressManager.addRecipe(stack, juice.get(amount));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Alcohol alcohol : Alcohol.values()) {
|
||||
FluidDefinition definition = alcohol.getDefinition();
|
||||
for (String fermentLiquid : alcohol.getFermentationLiquid()) {
|
||||
FluidStack fluid = Binnie.LIQUID.getFluidStack(fermentLiquid);
|
||||
if (fluid != null) {
|
||||
breweryManager.addRecipe(fluid, definition.get());
|
||||
if(breweryManager != null) {
|
||||
for (Alcohol alcohol : Alcohol.values()) {
|
||||
FluidType type = alcohol.getType();
|
||||
for (String fermentLiquid : alcohol.getFermentationLiquid()) {
|
||||
FluidStack fluid = Binnie.LIQUID.getFluidStack(fermentLiquid);
|
||||
if (fluid != null) {
|
||||
breweryManager.addRecipe(fluid, type.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_BARLEY, Alcohol.Ale.get(), OreDictionaryUtil.HOPS);
|
||||
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_BARLEY, Alcohol.Lager.get(), OreDictionaryUtil.HOPS, ExtraTreeItems.LAGER_YEAST.get(1));
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_ROASTED, Alcohol.Stout.get(), OreDictionaryUtil.HOPS);
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_CORN, Alcohol.CornBeer.get(), OreDictionaryUtil.HOPS);
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_RYE, Alcohol.RyeBeer.get(), OreDictionaryUtil.HOPS);
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_WHEAT, Alcohol.WheatBeer.get(), OreDictionaryUtil.HOPS);
|
||||
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_BARLEY, Alcohol.Barley.get());
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_CORN, Alcohol.Corn.get());
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_RYE, Alcohol.Rye.get());
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_WHEAT, Alcohol.Wheat.get());
|
||||
}
|
||||
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_BARLEY, Alcohol.Ale.get(), OreDictionaryUtil.HOPS);
|
||||
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_BARLEY, Alcohol.Lager.get(), OreDictionaryUtil.HOPS, ExtraTreeItems.LAGER_YEAST.get(1));
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_ROASTED, Alcohol.Stout.get(), OreDictionaryUtil.HOPS);
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_CORN, Alcohol.CornBeer.get(), OreDictionaryUtil.HOPS);
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_RYE, Alcohol.RyeBeer.get(), OreDictionaryUtil.HOPS);
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_WHEAT, Alcohol.WheatBeer.get(), OreDictionaryUtil.HOPS);
|
||||
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_BARLEY, Alcohol.Barley.get());
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_CORN, Alcohol.Corn.get());
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_RYE, Alcohol.Rye.get());
|
||||
breweryManager.addGrainRecipe(OreDictionaryUtil.GRAIN_WHEAT, Alcohol.Wheat.get());
|
||||
|
||||
this.addDistillery(Alcohol.Apple, Spirit.AppleBrandy, Spirit.AppleLiquor, Spirit.NeutralSpirit);
|
||||
this.addDistillery(Alcohol.Pear, Spirit.PearBrandy, Spirit.PearLiquor, Spirit.NeutralSpirit);
|
||||
this.addDistillery(Alcohol.Apricot, Spirit.ApricotBrandy, Spirit.ApricotLiquor, Spirit.NeutralSpirit);
|
||||
@@ -166,7 +173,7 @@ public class ModuleAlcohol extends Module {
|
||||
this.addDistillery(Alcohol.Corn, Spirit.CornWhiskey, Spirit.Vodka, Spirit.NeutralSpirit);
|
||||
}
|
||||
|
||||
private void addDistillery(final IFluidType source, final IFluidType singleDistilled, final IFluidType doubleDistilled, final IFluidType tripleDistilled) {
|
||||
private void addDistillery(final IFluidDefinition source, final IFluidDefinition singleDistilled, final IFluidDefinition doubleDistilled, final IFluidDefinition tripleDistilled) {
|
||||
final int inAmount = DistilleryLogic.INPUT_FLUID_AMOUNT;
|
||||
final int outAmount1 = inAmount * 4 / 5;
|
||||
final int outAmount2 = inAmount * 2 / 5;
|
||||
|
||||
@@ -2,6 +2,7 @@ package binnie.extratrees.modules;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@@ -12,6 +13,7 @@ import java.util.stream.Collectors;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -57,7 +59,7 @@ import binnie.core.BinnieCore;
|
||||
import binnie.core.Constants;
|
||||
import binnie.core.Mods;
|
||||
import binnie.core.block.ItemMetadata;
|
||||
import binnie.core.liquid.ILiquidType;
|
||||
import binnie.core.liquid.ILiquidDefinition;
|
||||
import binnie.core.models.DoublePassBakedModel;
|
||||
import binnie.core.modules.BinnieModule;
|
||||
import binnie.core.modules.ExtraTreesModuleUIDs;
|
||||
@@ -112,16 +114,14 @@ public class ModuleWood extends Module {
|
||||
public static List<BlockETDecorativeLeaves> leavesDecorative = new ArrayList<>();
|
||||
public static Map<String, ItemStack> speciesToLeavesDecorative = new HashMap<>();
|
||||
public static List<BlockETDefaultLeaves> leavesDefault = new ArrayList<>();
|
||||
@Nullable
|
||||
public static BlockMultiFence blockMultiFence;
|
||||
@Nullable
|
||||
public static BlockShrubLog shrubLog;
|
||||
|
||||
public static String[] branches;
|
||||
public static List<List<String>> classifications;
|
||||
|
||||
public ModuleWood() {
|
||||
branches = new String[]{"Malus Maleae Amygdaloideae Rosaceae", "Musa Musaceae Zingiberales Commelinids Angiosperms", "Sorbus Maleae", "Tsuga Pinaceae", "Fraxinus Oleeae Oleaceae Lamiales Asterids Angiospems"};
|
||||
classifications = new ArrayList<>();
|
||||
}
|
||||
//TODO: Unused ?
|
||||
public static String[] branches = new String[]{"Malus Maleae Amygdaloideae Rosaceae", "Musa Musaceae Zingiberales Commelinids Angiosperms", "Sorbus Maleae", "Tsuga Pinaceae", "Fraxinus Oleeae Oleaceae Lamiales Asterids Angiospems"};;
|
||||
public static List<List<String>> classifications = new ArrayList<>();
|
||||
|
||||
private static void registerOreDictWildcard(String oreDictName, Block block) {
|
||||
OreDictionary.registerOre(oreDictName, new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE));
|
||||
@@ -315,12 +315,12 @@ public class ModuleWood extends Module {
|
||||
}
|
||||
|
||||
shrubLog = new BlockShrubLog();
|
||||
ExtraTrees.proxy.registerBlock(shrubLog, new ItemBlockETWood(shrubLog));
|
||||
ExtraTrees.proxy.registerBlock(shrubLog, new ItemBlockETWood<BlockShrubLog>(shrubLog));
|
||||
woodAccess.register(EnumShrubLog.INSTANCE, WoodBlockKind.LOG, false, shrubLog.getStateFromMeta(0), new ItemStack(shrubLog, 1, 0));
|
||||
woodAccess.register(EnumShrubLog.INSTANCE, WoodBlockKind.LOG, true, shrubLog.getStateFromMeta(1), new ItemStack(shrubLog, 1, 1));
|
||||
}
|
||||
|
||||
public void registerDoors(WoodAccess woodAccess, List<BlockETDoor> blocks) {
|
||||
private void registerDoors(WoodAccess woodAccess, List<BlockETDoor> blocks) {
|
||||
for (BlockETDoor block : blocks) {
|
||||
registerWithoutVariants(woodAccess, block, WoodBlockKind.DOOR);
|
||||
}
|
||||
@@ -450,13 +450,13 @@ public class ModuleWood extends Module {
|
||||
this.addSqueezer(EnumVanillaWoodType.SPRUCE, ExtraTreeLiquid.Resin, 50);
|
||||
}
|
||||
|
||||
public void addSqueezer(final IWoodType log, final ILiquidType liquid, final int amount, final float pulpChance) {
|
||||
private void addSqueezer(final IWoodType log, final ILiquidDefinition liquid, final int amount, final float pulpChance) {
|
||||
final FluidStack liquidStack = liquid.get(amount);
|
||||
ItemStack logStack = TreeManager.woodAccess.getStack(log, WoodBlockKind.LOG, false);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, logStack, liquidStack, Mods.Forestry.stack("wood_pulp"), (int) (100.0f * pulpChance));
|
||||
}
|
||||
|
||||
public void addSqueezer(final IWoodType log, final ILiquidType liquid, final int amount) {
|
||||
private void addSqueezer(final IWoodType log, final ILiquidDefinition liquid, final int amount) {
|
||||
this.addSqueezer(log, liquid, amount, 0.5f);
|
||||
}
|
||||
|
||||
@@ -510,7 +510,11 @@ public class ModuleWood extends Module {
|
||||
ETTreeDefinition treeSpecies = map.get(species);
|
||||
int primaryColor = treeSpecies.getLeafColor().getRGB();
|
||||
int secondaryColor = treeSpecies.getWoodColor().getRGB();
|
||||
e.getModelRegistry().putObject(model, new DoublePassBakedModel(e.getModelRegistry().getObject(model), primaryColor, secondaryColor));
|
||||
IBakedModel bakedModel = e.getModelRegistry().getObject(model);
|
||||
if(bakedModel == null){
|
||||
return;
|
||||
}
|
||||
e.getModelRegistry().putObject(model, new DoublePassBakedModel(bakedModel, primaryColor, secondaryColor));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -575,6 +575,9 @@ extratrees.fluid.alcohol.wheat=Fermented Wheat Mash
|
||||
extratrees.fluid.alcohol.rye=Fermented Rye Mash
|
||||
extratrees.fluid.alcohol.corn=Fermented Corn Mash
|
||||
|
||||
extratrees.cocktail.liquid.tooltip=%d Part %s
|
||||
extratrees.cocktail.liquids.tooltip=%d Parts %s
|
||||
|
||||
extrabees.poison.name=Poison
|
||||
extrabees.acid.name=Acid
|
||||
extrabees.glacial.name=Glacial
|
||||
|
||||
@@ -5,21 +5,21 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.liquid.FluidContainerType;
|
||||
import binnie.core.liquid.FluidDefinition;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import binnie.core.liquid.FluidType;
|
||||
import binnie.core.liquid.IFluidDefinition;
|
||||
import binnie.genetics.Genetics;
|
||||
|
||||
public enum GeneticLiquid implements IFluidType {
|
||||
public enum GeneticLiquid implements IFluidDefinition {
|
||||
GrowthMedium("Growth Medium", "growth.medium", 15460533),
|
||||
Bacteria("Bacteria", "bacteria", 14203521),
|
||||
BacteriaPoly("Polymerising Bacteria", "bacteria.poly", 11443396),
|
||||
RawDNA("Raw DNA", "dna.raw", 15089129),
|
||||
BacteriaVector("Bacteria Vector", "bacteria.vector", 15960958);
|
||||
|
||||
FluidDefinition definition;
|
||||
FluidType type;
|
||||
|
||||
GeneticLiquid(final String name, final String ident, final int color) {
|
||||
definition = new FluidDefinition(ident, name, color)
|
||||
type = new FluidType(ident, name, color)
|
||||
.setTextures(new ResourceLocation(Genetics.instance.getModID(), "blocks/liquids/" + ident.replace(".", "_")))
|
||||
.setColor(16777215)
|
||||
.setContainerColor(color)
|
||||
@@ -29,16 +29,16 @@ public enum GeneticLiquid implements IFluidType {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return definition.toString();
|
||||
return type.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack get(final int amount) {
|
||||
return definition.get(amount);
|
||||
return type.get(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidDefinition getDefinition() {
|
||||
return definition;
|
||||
public FluidType getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user