diff --git a/lang b/lang index f7b40946a..60edefb43 160000 --- a/lang +++ b/lang @@ -1 +1 @@ -Subproject commit f7b40946a9ce4e3aa503f1eefb3d827487548f9e +Subproject commit 60edefb43d0e962ca85753d966d4063e16709167 diff --git a/src/main/java/forestry/core/config/ForestryItem.java b/src/main/java/forestry/core/config/ForestryItem.java index a37a07a6c..60cad8cfc 100755 --- a/src/main/java/forestry/core/config/ForestryItem.java +++ b/src/main/java/forestry/core/config/ForestryItem.java @@ -32,14 +32,6 @@ import forestry.plugins.PluginManager.Stage; * @author SirSengir */ public enum ForestryItem { - bucketBiomass, - bucketEthanol, - bucketGlass, - bucketHoney, - bucketIce, - bucketJuice, - bucketSeedoil, - bucketShortMead, // Mail stamps, letters, @@ -67,42 +59,7 @@ public enum ForestryItem { foresterBackpackT2, hunterBackpackT2, builderBackpackT2, - adventurerBackpackT2, - // Capsules - waxCapsule, - waxCapsuleWater, - waxCapsuleBiomass, - waxCapsuleEthanol, - waxCapsuleOil, - waxCapsuleFuel, - waxCapsuleSeedOil, - waxCapsuleHoney, - waxCapsuleJuice, - waxCapsuleIce, - // Refractory Capsules - refractoryEmpty, - refractoryWater, - refractoryBiomass, - refractoryEthanol, - refractoryOil, - refractoryFuel, - refractoryLava, - refractorySeedOil, - refractoryHoney, - refractoryJuice, - refractoryIce, - // Cans - canWater, - canEmpty, - canBiomass, - canEthanol, - canOil, - canFuel, - canLava, - canSeedOil, - canHoney, - canJuice, - canIce; + adventurerBackpackT2; private Item item; public void registerItem(Item item, String name) { diff --git a/src/main/java/forestry/core/config/GameMode.java b/src/main/java/forestry/core/config/GameMode.java index e9a510b1f..8e55f9d65 100644 --- a/src/main/java/forestry/core/config/GameMode.java +++ b/src/main/java/forestry/core/config/GameMode.java @@ -21,6 +21,7 @@ import forestry.Forestry; import forestry.api.core.IGameMode; import forestry.core.utils.Log; import forestry.plugins.PluginCore; +import forestry.plugins.PluginFluids; public class GameMode implements IGameMode { private static final String GAMEMODE_KEY = "gamemode"; @@ -48,9 +49,9 @@ public class GameMode implements IGameMode { private final ItemStack recipeBogEarthOutputBucket = ForestryBlock.soil.getItemStack(6, 1); private final ItemStack recipeBogEarthOutputCans = ForestryBlock.soil.getItemStack(8, 1); - private final ItemStack recipeCanOutput = ForestryItem.canEmpty.getItemStack(12); - private final ItemStack recipeCapsuleOutput = ForestryItem.waxCapsule.getItemStack(4); - private final ItemStack recipeRefractoryOutput = ForestryItem.refractoryEmpty.getItemStack(4); + private final ItemStack recipeCanOutput = PluginFluids.items.canEmpty.getItemStack(12); + private final ItemStack recipeCapsuleOutput = PluginFluids.items.waxCapsuleEmpty.getItemStack(4); + private final ItemStack recipeRefractoryOutput = PluginFluids.items.refractoryEmpty.getItemStack(4); private static final int FERMENTATION_DURATION_FERTILIZER = 200; private static final int FERMENTATION_DURATION_COMPOST = 250; diff --git a/src/main/java/forestry/core/fluids/FluidHelper.java b/src/main/java/forestry/core/fluids/FluidHelper.java index 5167b633a..9403ed339 100644 --- a/src/main/java/forestry/core/fluids/FluidHelper.java +++ b/src/main/java/forestry/core/fluids/FluidHelper.java @@ -27,9 +27,9 @@ import net.minecraftforge.fluids.IFluidContainerItem; import net.minecraftforge.fluids.IFluidHandler; import forestry.core.config.Constants; -import forestry.core.config.ForestryItem; import forestry.core.utils.InventoryUtil; import forestry.core.utils.ItemStackUtil; +import forestry.plugins.PluginFluids; /** * @author CovertJaguar @@ -209,7 +209,7 @@ public final class FluidHelper { // consume forestry containers if there is only one slot if (outputSlot == inputSlot && drainedItem != null) { Item item = drainedItem.getItem(); - if (ForestryItem.canEmpty.isItemEqual(item) || ForestryItem.waxCapsule.isItemEqual(item) || ForestryItem.refractoryEmpty.isItemEqual(item)) { + if (PluginFluids.items.canEmpty == item || PluginFluids.items.waxCapsuleEmpty == item || PluginFluids.items.refractoryEmpty == item) { drainedItem = null; } } diff --git a/src/main/java/forestry/core/fluids/Fluids.java b/src/main/java/forestry/core/fluids/Fluids.java index 8f1ca5ab6..26fbd0392 100644 --- a/src/main/java/forestry/core/fluids/Fluids.java +++ b/src/main/java/forestry/core/fluids/Fluids.java @@ -12,13 +12,15 @@ package forestry.core.fluids; import javax.annotation.Nonnull; import java.awt.Color; -import java.util.Arrays; import java.util.Collections; +import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; +import org.apache.commons.lang3.text.WordUtils; + import net.minecraft.block.Block; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -28,11 +30,9 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import forestry.core.config.Constants; -import forestry.core.config.ForestryItem; +import forestry.core.items.EnumContainerType; import forestry.core.items.ItemLiquidContainer; -import static forestry.core.items.ItemLiquidContainer.EnumContainerType; - public enum Fluids { ETHANOL(new Color(255, 111, 0), 790, 1000) { @@ -47,19 +47,13 @@ public enum Fluids { } @Override - public ForestryItem getContainerForType(EnumContainerType type) { - switch (type) { - case BUCKET: - return ForestryItem.bucketEthanol; - case CAN: - return ForestryItem.canEthanol; - case CAPSULE: - return ForestryItem.waxCapsuleEthanol; - case REFRACTORY: - return ForestryItem.refractoryEthanol; - default: - return null; - } + public EnumSet getContainerTypes() { + return EnumSet.of( + EnumContainerType.BUCKET, + EnumContainerType.CAN, + EnumContainerType.CAPSULE, + EnumContainerType.REFRACTORY + ); } }, BIOMASS(new Color(100, 132, 41), 400, 6560) { @@ -69,19 +63,13 @@ public enum Fluids { } @Override - public ForestryItem getContainerForType(EnumContainerType type) { - switch (type) { - case BUCKET: - return ForestryItem.bucketBiomass; - case CAN: - return ForestryItem.canBiomass; - case CAPSULE: - return ForestryItem.waxCapsuleBiomass; - case REFRACTORY: - return ForestryItem.refractoryBiomass; - default: - return null; - } + public EnumSet getContainerTypes() { + return EnumSet.of( + EnumContainerType.BUCKET, + EnumContainerType.CAN, + EnumContainerType.CAPSULE, + EnumContainerType.REFRACTORY + ); } }, GLASS(new Color(164, 164, 164), 2400, 10000) { @@ -96,13 +84,10 @@ public enum Fluids { } @Override - public ForestryItem getContainerForType(EnumContainerType type) { - switch (type) { - case BUCKET: - return ForestryItem.bucketGlass; - default: - return null; - } + public EnumSet getContainerTypes() { + return EnumSet.of( + EnumContainerType.BUCKET + ); } }, HONEY(new Color(255, 196, 35), 1420, 73600) { @@ -117,19 +102,13 @@ public enum Fluids { } @Override - public ForestryItem getContainerForType(EnumContainerType type) { - switch (type) { - case BUCKET: - return ForestryItem.bucketHoney; - case CAN: - return ForestryItem.canHoney; - case CAPSULE: - return ForestryItem.waxCapsuleHoney; - case REFRACTORY: - return ForestryItem.refractoryHoney; - default: - return null; - } + public EnumSet getContainerTypes() { + return EnumSet.of( + EnumContainerType.BUCKET, + EnumContainerType.CAN, + EnumContainerType.CAPSULE, + EnumContainerType.REFRACTORY + ); } @Override @@ -157,19 +136,13 @@ public enum Fluids { } @Override - public ForestryItem getContainerForType(EnumContainerType type) { - switch (type) { - case BUCKET: - return ForestryItem.bucketIce; - case CAN: - return ForestryItem.canIce; - case CAPSULE: - return ForestryItem.waxCapsuleIce; - case REFRACTORY: - return ForestryItem.refractoryIce; - default: - return null; - } + public EnumSet getContainerTypes() { + return EnumSet.of( + EnumContainerType.BUCKET, + EnumContainerType.CAN, + EnumContainerType.CAPSULE, + EnumContainerType.REFRACTORY + ); } }, JUICE(new Color(168, 201, 114)) { @@ -179,19 +152,13 @@ public enum Fluids { } @Override - public ForestryItem getContainerForType(EnumContainerType type) { - switch (type) { - case BUCKET: - return ForestryItem.bucketJuice; - case CAN: - return ForestryItem.canJuice; - case CAPSULE: - return ForestryItem.waxCapsuleJuice; - case REFRACTORY: - return ForestryItem.refractoryJuice; - default: - return null; - } + public EnumSet getContainerTypes() { + return EnumSet.of( + EnumContainerType.BUCKET, + EnumContainerType.CAN, + EnumContainerType.CAPSULE, + EnumContainerType.REFRACTORY + ); } @Override @@ -209,34 +176,28 @@ public enum Fluids { @Override public List getOtherContainers() { - return Arrays.asList( + return Collections.singletonList( new ItemStack(Items.milk_bucket) ); } }, - SEEDOIL(new Color(255, 255, 168), 885, 5000) { + SEEDOIL("SeedOil", new Color(255, 255, 168), 885, 5000) { @Override public Block makeBlock() { return new BlockForestryFluid(this, 2, true); } @Override - public ForestryItem getContainerForType(EnumContainerType type) { - switch (type) { - case BUCKET: - return ForestryItem.bucketSeedoil; - case CAN: - return ForestryItem.canSeedOil; - case CAPSULE: - return ForestryItem.waxCapsuleSeedOil; - case REFRACTORY: - return ForestryItem.refractorySeedOil; - default: - return null; - } + public EnumSet getContainerTypes() { + return EnumSet.of( + EnumContainerType.BUCKET, + EnumContainerType.CAN, + EnumContainerType.CAPSULE, + EnumContainerType.REFRACTORY + ); } }, - SHORT_MEAD(new Color(239, 154, 56), 1000, 1200) { + SHORT_MEAD("ShortMead", new Color(239, 154, 56), 1000, 1200) { @Override public String getTag() { return "short.mead"; @@ -248,73 +209,51 @@ public enum Fluids { } @Override - public ForestryItem getContainerForType(EnumContainerType type) { - switch (type) { - case BUCKET: - return ForestryItem.bucketShortMead; - default: - return null; - } + public EnumSet getContainerTypes() { + return EnumSet.of( + EnumContainerType.BUCKET + ); } }, // Vanilla WATER(new Color(0x2432ec)) { @Override - public ForestryItem getContainerForType(EnumContainerType type) { - switch (type) { - case CAN: - return ForestryItem.canWater; - case CAPSULE: - return ForestryItem.waxCapsuleWater; - case REFRACTORY: - return ForestryItem.refractoryWater; - default: - return null; - } + public EnumSet getContainerTypes() { + return EnumSet.of( + EnumContainerType.CAN, + EnumContainerType.CAPSULE, + EnumContainerType.REFRACTORY + ); } }, LAVA(new Color(0xfd461f)) { @Override - public ForestryItem getContainerForType(EnumContainerType type) { - switch (type) { - case CAN: - return ForestryItem.canLava; - case REFRACTORY: - return ForestryItem.refractoryLava; - default: - return null; - } + public EnumSet getContainerTypes() { + return EnumSet.of( + EnumContainerType.CAN, + EnumContainerType.REFRACTORY + ); } }, // BuildCraft FUEL(new Color(0xffff00)) { @Override - public ForestryItem getContainerForType(EnumContainerType type) { - switch (type) { - case CAN: - return ForestryItem.canFuel; - case CAPSULE: - return ForestryItem.waxCapsuleFuel; - case REFRACTORY: - return ForestryItem.refractoryFuel; - default: - return null; - } + public EnumSet getContainerTypes() { + return EnumSet.of( + EnumContainerType.CAN, + EnumContainerType.CAPSULE, + EnumContainerType.REFRACTORY + ); } }, OIL(new Color(0x404040)) { @Override - public ForestryItem getContainerForType(EnumContainerType type) { - switch (type) { - case CAN: - return ForestryItem.canOil; - case CAPSULE: - return ForestryItem.waxCapsuleOil; - case REFRACTORY: - return ForestryItem.refractoryOil; - default: - return null; - } + public EnumSet getContainerTypes() { + return EnumSet.of( + EnumContainerType.CAN, + EnumContainerType.CAPSULE, + EnumContainerType.REFRACTORY + ); } }, // Railcraft @@ -331,16 +270,25 @@ public enum Fluids { } } + private final String containerNameKey; private final String tag; private final int density, viscosity; @Nonnull private final Color color; Fluids(@Nonnull Color color) { - this(color, 1000, 1000); + this(null, color, 1000, 1000); } Fluids(@Nonnull Color color, int density, int viscosity) { + this(null, color, density, viscosity); + } + + Fluids(String containerNameKey, @Nonnull Color color, int density, int viscosity) { + if (containerNameKey == null) { + containerNameKey = WordUtils.capitalize(toString().toLowerCase(Locale.ENGLISH)); + } + this.containerNameKey = containerNameKey; this.tag = name().toLowerCase(Locale.ENGLISH); this.color = color; this.density = density; @@ -429,12 +377,12 @@ public enum Fluids { } /** FluidBlock and Container registration */ - /** - * Add the filled containers for this fluid. - * They will be automatically created and registered. - */ - public ForestryItem getContainerForType(EnumContainerType type) { - return null; + public String getContainerNameKey() { + return containerNameKey; + } + + public EnumSet getContainerTypes() { + return EnumSet.noneOf(EnumContainerType.class); } /** diff --git a/src/main/java/forestry/core/fluids/LiquidRegistryHelper.java b/src/main/java/forestry/core/fluids/LiquidRegistryHelper.java index b061a2074..c5c17d4d8 100644 --- a/src/main/java/forestry/core/fluids/LiquidRegistryHelper.java +++ b/src/main/java/forestry/core/fluids/LiquidRegistryHelper.java @@ -22,20 +22,19 @@ import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData; import net.minecraftforge.fluids.FluidStack; import forestry.core.config.Constants; -import forestry.core.config.ForestryItem; +import forestry.core.items.EnumContainerType; import forestry.core.items.ItemLiquidContainer; import forestry.core.utils.Log; - -import static forestry.core.items.ItemLiquidContainer.EnumContainerType; +import forestry.plugins.PluginFluids; public class LiquidRegistryHelper { - private static final EnumMap emptyContainers = new EnumMap<>(EnumContainerType.class); + private static final EnumMap emptyContainers = new EnumMap<>(EnumContainerType.class); static { - emptyContainers.put(EnumContainerType.CAN, ForestryItem.canEmpty); - emptyContainers.put(EnumContainerType.CAPSULE, ForestryItem.waxCapsule); - emptyContainers.put(EnumContainerType.REFRACTORY, ForestryItem.refractoryEmpty); + emptyContainers.put(EnumContainerType.CAN, PluginFluids.items.canEmpty); + emptyContainers.put(EnumContainerType.CAPSULE, PluginFluids.items.waxCapsuleEmpty); + emptyContainers.put(EnumContainerType.REFRACTORY, PluginFluids.items.refractoryEmpty); } public static void registerLiquidContainer(Fluids fluid, ItemStack filled) { @@ -47,7 +46,7 @@ public class LiquidRegistryHelper { } else if (item instanceof ItemLiquidContainer) { ItemLiquidContainer liquidContainer = (ItemLiquidContainer) item; EnumContainerType containerType = liquidContainer.getType(); - ForestryItem emptyContainer = emptyContainers.get(containerType); + ItemLiquidContainer emptyContainer = emptyContainers.get(containerType); empty = emptyContainer.getItemStack(); } diff --git a/src/main/java/forestry/core/items/EnumContainerType.java b/src/main/java/forestry/core/items/EnumContainerType.java new file mode 100644 index 000000000..7036ed309 --- /dev/null +++ b/src/main/java/forestry/core/items/EnumContainerType.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.core.items; + +public enum EnumContainerType { + GLASS("glass"), + JAR("jar"), + CAN("can"), + CAPSULE("waxCapsule"), + REFRACTORY("refractory"), + BUCKET("bucket"); + + private final String name; + + EnumContainerType(String name) { + this.name = name; + } + + public String getContainerNameKey() { + return name; + } +} diff --git a/src/main/java/forestry/core/items/ItemLiquidContainer.java b/src/main/java/forestry/core/items/ItemLiquidContainer.java index 3cb78732a..6b445dd08 100755 --- a/src/main/java/forestry/core/items/ItemLiquidContainer.java +++ b/src/main/java/forestry/core/items/ItemLiquidContainer.java @@ -23,7 +23,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumAction; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; @@ -44,12 +43,7 @@ import forestry.core.fluids.FluidHelper; import forestry.core.proxy.Proxies; import forestry.core.render.TextureManager; -public class ItemLiquidContainer extends Item { - - public enum EnumContainerType { - GLASS, JAR, CAN, CAPSULE, REFRACTORY, BUCKET - } - +public class ItemLiquidContainer extends ItemForestry { private static final Map buckets = new HashMap<>(); private boolean isDrink = false; @@ -63,10 +57,10 @@ public class ItemLiquidContainer extends Item { private final Color color; public ItemLiquidContainer(EnumContainerType type, Block contents, Color color) { + super(CreativeTabForestry.tabForestry); this.type = type; this.contents = contents; this.color = color; - setCreativeTab(CreativeTabForestry.tabForestry); if (type == EnumContainerType.BUCKET) { setContainerItem(Items.bucket); this.maxStackSize = 1; diff --git a/src/main/java/forestry/core/items/ItemRegistryFluids.java b/src/main/java/forestry/core/items/ItemRegistryFluids.java new file mode 100644 index 000000000..54fe3d235 --- /dev/null +++ b/src/main/java/forestry/core/items/ItemRegistryFluids.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.core.items; + +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Table; + +import net.minecraft.init.Blocks; + +import forestry.core.fluids.Fluids; + +public class ItemRegistryFluids extends ItemRegistry { + public final ItemLiquidContainer canEmpty; + public final ItemLiquidContainer waxCapsuleEmpty; + public final ItemLiquidContainer refractoryEmpty; + + private final Table containers = HashBasedTable.create(); + + public ItemLiquidContainer getContainer(EnumContainerType type, Fluids fluid) { + return containers.get(type, fluid.getFluid().getID()); + } + + public ItemRegistryFluids() { + canEmpty = registerEmptyContainer(EnumContainerType.CAN, "canEmpty"); + waxCapsuleEmpty = registerEmptyContainer(EnumContainerType.CAPSULE, "waxCapsule"); + refractoryEmpty = registerEmptyContainer(EnumContainerType.REFRACTORY, "refractoryEmpty"); + + + for (Fluids fluidType : Fluids.values()) { + if (fluidType.getFluid() == null) { + continue; + } + for (EnumContainerType type : fluidType.getContainerTypes()) { + ItemLiquidContainer liquidContainer = new ItemLiquidContainer(type, fluidType.getBlock(), fluidType.getColor()); + fluidType.setProperties(liquidContainer); + + String name = type.getContainerNameKey() + fluidType.getContainerNameKey(); + registerItem(liquidContainer, name); + + containers.put(type, fluidType.getFluid().getID(), liquidContainer); + } + } + } + + private static ItemLiquidContainer registerEmptyContainer(EnumContainerType type, String name) { + return registerItem(new ItemLiquidContainer(type, Blocks.air, null), name); + } +} diff --git a/src/main/java/forestry/plugins/PluginApiculture.java b/src/main/java/forestry/plugins/PluginApiculture.java index 1b01a121b..78ac3c528 100644 --- a/src/main/java/forestry/plugins/PluginApiculture.java +++ b/src/main/java/forestry/plugins/PluginApiculture.java @@ -116,7 +116,6 @@ import forestry.core.blocks.BlockBase; import forestry.core.config.Config; import forestry.core.config.Constants; import forestry.core.config.ForestryBlock; -import forestry.core.config.ForestryItem; import forestry.core.config.LocalizedConfiguration; import forestry.core.entities.EntityFXSnow; import forestry.core.fluids.Fluids; @@ -541,13 +540,13 @@ public class PluginApiculture extends ForestryPlugin { RecipeUtil.addRecipe(foodItems.honeyPot, "# #", " X ", "# #", '#', items.honeyDrop, - 'X', ForestryItem.waxCapsule); + 'X', PluginFluids.items.waxCapsuleEmpty); RecipeUtil.addRecipe(foodItems.ambrosia, "#Y#", "XXX", "###", '#', items.honeydew, 'X', items.royalJelly, - 'Y', ForestryItem.waxCapsule); + 'Y', PluginFluids.items.waxCapsuleEmpty); } // / CAPSULES diff --git a/src/main/java/forestry/plugins/PluginCore.java b/src/main/java/forestry/plugins/PluginCore.java index 40ea6892f..9a938d245 100644 --- a/src/main/java/forestry/plugins/PluginCore.java +++ b/src/main/java/forestry/plugins/PluginCore.java @@ -46,10 +46,11 @@ import forestry.core.commands.RootCommand; import forestry.core.config.Config; import forestry.core.config.Constants; import forestry.core.config.ForestryBlock; -import forestry.core.config.ForestryItem; +import forestry.core.fluids.Fluids; import forestry.core.genetics.alleles.AlleleFactory; import forestry.core.genetics.alleles.AlleleHelper; import forestry.core.genetics.alleles.AlleleRegistry; +import forestry.core.items.EnumContainerType; import forestry.core.items.ItemBlockForestry; import forestry.core.items.ItemBlockTyped; import forestry.core.items.ItemRegistryCore; @@ -309,9 +310,12 @@ public class PluginCore extends ForestryPlugin { } if (ForestryAPI.activeMode.getStackSetting("recipe.output.bogearth.can").stackSize > 0) { - RecipeUtil.addRecipe(ForestryAPI.activeMode.getStackSetting("recipe.output.bogearth.can"), "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', ForestryItem.canWater, 'Y', "sand"); - RecipeUtil.addRecipe(ForestryAPI.activeMode.getStackSetting("recipe.output.bogearth.can"), "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', ForestryItem.waxCapsuleWater, 'Y', "sand"); - RecipeUtil.addRecipe(ForestryAPI.activeMode.getStackSetting("recipe.output.bogearth.can"), "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', ForestryItem.refractoryWater, 'Y', "sand"); + ItemStack canWater = PluginFluids.items.getContainer(EnumContainerType.CAN, Fluids.WATER).getItemStack(); + ItemStack waxCapsuleWater = PluginFluids.items.getContainer(EnumContainerType.CAPSULE, Fluids.WATER).getItemStack(); + ItemStack refractoryWater = PluginFluids.items.getContainer(EnumContainerType.REFRACTORY, Fluids.WATER).getItemStack(); + RecipeUtil.addRecipe(ForestryAPI.activeMode.getStackSetting("recipe.output.bogearth.can"), "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', canWater, 'Y', "sand"); + RecipeUtil.addRecipe(ForestryAPI.activeMode.getStackSetting("recipe.output.bogearth.can"), "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', waxCapsuleWater, 'Y', "sand"); + RecipeUtil.addRecipe(ForestryAPI.activeMode.getStackSetting("recipe.output.bogearth.can"), "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', refractoryWater, 'Y', "sand"); } // Crafting Material diff --git a/src/main/java/forestry/plugins/PluginFactory.java b/src/main/java/forestry/plugins/PluginFactory.java index 23af04d7e..b63085753 100644 --- a/src/main/java/forestry/plugins/PluginFactory.java +++ b/src/main/java/forestry/plugins/PluginFactory.java @@ -41,7 +41,6 @@ import forestry.core.circuits.EnumCircuitBoardType; import forestry.core.circuits.ItemCircuitBoard; import forestry.core.config.Constants; import forestry.core.config.ForestryBlock; -import forestry.core.config.ForestryItem; import forestry.core.fluids.Fluids; import forestry.core.items.EnumElectronTube; import forestry.core.items.ItemBlockForestry; @@ -217,7 +216,7 @@ public class PluginFactory extends ForestryPlugin { "#Y#", "X#X", '#', "blockGlass", - 'X', ForestryItem.canEmpty, + 'X', PluginFluids.items.canEmpty, 'Y', coreItems.sturdyCasing))); definitionCarpenter = factoryTESR.addDefinition(new MachineDefinition(Constants.DEFINITION_CARPENTER_META, "forestry.Carpenter", TileCarpenter.class, @@ -528,7 +527,7 @@ public class PluginFactory extends ForestryPlugin { "X#X", '#', beeItems.pollenCluster.getWildcard(), 'X', Items.gunpowder, - 'Y', ForestryItem.canEmpty, + 'Y', PluginFluids.items.canEmpty, 'Z', beeItems.honeyDrop); RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.getFluid(1000), null, PluginCore.items.craftingMaterial.getDissipationCharge(), "Z#Z", @@ -536,7 +535,7 @@ public class PluginFactory extends ForestryPlugin { "X#X", '#', beeItems.royalJelly, 'X', Items.gunpowder, - 'Y', ForestryItem.canEmpty, + 'Y', PluginFluids.items.canEmpty, 'Z', beeItems.honeydew); } diff --git a/src/main/java/forestry/plugins/PluginFluids.java b/src/main/java/forestry/plugins/PluginFluids.java index 3ab00f8a5..1955d0c9f 100644 --- a/src/main/java/forestry/plugins/PluginFluids.java +++ b/src/main/java/forestry/plugins/PluginFluids.java @@ -14,7 +14,6 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.block.Block; -import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -39,21 +38,22 @@ import forestry.api.fuels.GeneratorFuel; import forestry.api.recipes.RecipeManagers; import forestry.core.config.Config; import forestry.core.config.Constants; -import forestry.core.config.ForestryItem; import forestry.core.fluids.BlockForestryFluid; import forestry.core.fluids.Fluids; import forestry.core.fluids.LiquidRegistryHelper; +import forestry.core.items.EnumContainerType; import forestry.core.items.ItemLiquidContainer; +import forestry.core.items.ItemRegistryFluids; import forestry.core.utils.Log; import forestry.core.utils.StringUtil; -import static forestry.core.items.ItemLiquidContainer.EnumContainerType; - @Plugin(pluginID = "Fluids", name = "Fluids", author = "mezz", url = Constants.URL, unlocalizedDescription = "for.plugin.fluids.description") public class PluginFluids extends ForestryPlugin { private static final List forestryFluidsWithBlocks = new ArrayList<>(); + public static ItemRegistryFluids items; + private static void createFluid(Fluids forestryFluid) { if (forestryFluid.getFluid() == null && Config.isFluidEnabled(forestryFluid)) { String fluidName = forestryFluid.getTag(); @@ -92,31 +92,7 @@ public class PluginFluids extends ForestryPlugin { createFluid(fluidType); } - for (EnumContainerType type : EnumContainerType.values()) { - Item emptyContainer = new ItemLiquidContainer(type, Blocks.air, null); - switch (type) { - case CAN: - ForestryItem.canEmpty.registerItem(emptyContainer, "canEmpty"); - break; - case CAPSULE: - ForestryItem.waxCapsule.registerItem(emptyContainer, "waxCapsule"); - break; - case REFRACTORY: - ForestryItem.refractoryEmpty.registerItem(emptyContainer, "refractoryEmpty"); - break; - } - - for (Fluids fluidType : Fluids.values()) { - ForestryItem container = fluidType.getContainerForType(type); - if (container == null) { - continue; - } - - ItemLiquidContainer liquidContainer = new ItemLiquidContainer(type, fluidType.getBlock(), fluidType.getColor()); - fluidType.setProperties(liquidContainer); - container.registerItem(liquidContainer, container.toString()); - } - } + items = new ItemRegistryFluids(); } @Override @@ -133,7 +109,7 @@ public class PluginFluids extends ForestryPlugin { } for (EnumContainerType type : EnumContainerType.values()) { - ForestryItem container = fluidType.getContainerForType(type); + ItemLiquidContainer container = items.getContainer(type, fluidType); if (container == null) { continue; } @@ -147,9 +123,9 @@ public class PluginFluids extends ForestryPlugin { } if (RecipeManagers.squeezerManager != null) { - RecipeManagers.squeezerManager.addContainerRecipe(10, ForestryItem.canEmpty.getItemStack(), PluginCore.items.ingotTin.getItemStack(), 0.05f); - RecipeManagers.squeezerManager.addContainerRecipe(10, ForestryItem.waxCapsule.getItemStack(), PluginCore.items.beeswax.getItemStack(), 0.10f); - RecipeManagers.squeezerManager.addContainerRecipe(10, ForestryItem.refractoryEmpty.getItemStack(), PluginCore.items.refractoryWax.getItemStack(), 0.10f); + RecipeManagers.squeezerManager.addContainerRecipe(10, items.canEmpty.getItemStack(), PluginCore.items.ingotTin.getItemStack(), 0.05f); + RecipeManagers.squeezerManager.addContainerRecipe(10, items.waxCapsuleEmpty.getItemStack(), PluginCore.items.beeswax.getItemStack(), 0.10f); + RecipeManagers.squeezerManager.addContainerRecipe(10, items.refractoryEmpty.getItemStack(), PluginCore.items.refractoryWax.getItemStack(), 0.10f); } FluidStack ethanol = Fluids.ETHANOL.getFluid(1);