mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-22 12:59:44 +00:00
First 1.8.9 Version
This commit is contained in:
1 parent
d35cc1df09
commit
5a3850c264
1657 files changed
+26844
-13269
No files matched your search
@@ -14,6 +14,6 @@ import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockFactoryPlain extends BlockBase<BlockFactoryPlainType> {
|
||||
public BlockFactoryPlain() {
|
||||
super();
|
||||
super(BlockFactoryPlainType.class);
|
||||
}
|
||||
}
|
||||
@@ -50,4 +50,9 @@ public enum BlockFactoryPlainType implements IMachineProperties {
|
||||
public Class<? extends TileForestry> getTeClass() {
|
||||
return teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,6 @@ import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockFactoryTESR extends BlockBase<BlockFactoryTesrType> {
|
||||
public BlockFactoryTESR() {
|
||||
super(true);
|
||||
super(true, BlockFactoryTesrType.class);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import org.apache.commons.lang3.text.WordUtils;
|
||||
import forestry.core.blocks.IMachinePropertiesTESR;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.IBlockRenderer;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.factory.tiles.TileBottler;
|
||||
import forestry.factory.tiles.TileCarpenter;
|
||||
@@ -27,6 +26,7 @@ import forestry.factory.tiles.TileMillRainmaker;
|
||||
import forestry.factory.tiles.TileMoistener;
|
||||
import forestry.factory.tiles.TileSqueezer;
|
||||
import forestry.factory.tiles.TileStill;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
||||
public enum BlockFactoryTesrType implements IMachinePropertiesTESR {
|
||||
BOTTLER(TileBottler.class),
|
||||
@@ -38,7 +38,7 @@ public enum BlockFactoryTesrType implements IMachinePropertiesTESR {
|
||||
STILL(TileStill.class),
|
||||
RAINMAKER(TileMillRainmaker.class) {
|
||||
@Override
|
||||
public IBlockRenderer getRenderer() {
|
||||
public TileEntitySpecialRenderer getRenderer() {
|
||||
return Proxies.render.getRenderMill(Constants.TEXTURE_PATH_BLOCKS + "/rainmaker_");
|
||||
}
|
||||
};
|
||||
@@ -72,7 +72,12 @@ public enum BlockFactoryTesrType implements IMachinePropertiesTESR {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockRenderer getRenderer() {
|
||||
public TileEntitySpecialRenderer getRenderer() {
|
||||
return Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/" + name + "_");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
@@ -10,21 +10,20 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.gui.widgets;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import forestry.core.gui.widgets.ItemStackWidgetBase;
|
||||
import forestry.core.gui.widgets.WidgetManager;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.SpriteSheet;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.factory.gui.ContainerWorktable;
|
||||
import forestry.factory.recipes.RecipeMemory;
|
||||
|
||||
public class MemorizedRecipeSlot extends ItemStackWidgetBase {
|
||||
private static final IIcon lockIcon = TextureManager.getInstance().getDefault("slots/locked");
|
||||
private static final TextureAtlasSprite lockIcon = TextureManager.getInstance().getDefault("slots/locked");
|
||||
private final RecipeMemory recipeMemory;
|
||||
private final int slotNumber;
|
||||
|
||||
@@ -50,8 +49,8 @@ public class MemorizedRecipeSlot extends ItemStackWidgetBase {
|
||||
|
||||
if (recipeMemory.isLocked(slotNumber)) {
|
||||
manager.gui.setZLevel(110f);
|
||||
Proxies.render.bindTexture(SpriteSheet.ITEMS);
|
||||
manager.gui.drawTexturedModelRectFromIcon(startX + xPos, startY + yPos, lockIcon, 16, 16);
|
||||
Proxies.render.bindTexture(TextureMap.locationBlocksTexture);
|
||||
manager.gui.drawTexturedModalRect(startX + xPos, startY + yPos, lockIcon, 16, 16);
|
||||
manager.gui.setZLevel(0f);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
package forestry.factory.inventory;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class InventoryBottler extends InventoryAdapterTile<TileBottler> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, EnumFacing side) {
|
||||
return slotIndex == SLOT_OUTPUT;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
package forestry.factory.inventory;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
@@ -47,7 +47,7 @@ public class InventoryCarpenter extends InventoryAdapterTile<TileCarpenter> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, EnumFacing side) {
|
||||
return slotIndex == SLOT_PRODUCT;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
package forestry.factory.inventory;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import forestry.core.inventory.InventoryAdapterTile;
|
||||
import forestry.core.utils.SlotUtil;
|
||||
import forestry.factory.recipes.CentrifugeRecipeManager;
|
||||
@@ -32,7 +32,7 @@ public class InventoryCentrifuge extends InventoryAdapterTile<TileCentrifuge> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, EnumFacing side) {
|
||||
return SlotUtil.isSlotInRange(slotIndex, SLOT_PRODUCT_1, SLOT_PRODUCT_COUNT);
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
package forestry.factory.inventory;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import forestry.core.inventory.InventoryAdapterTile;
|
||||
import forestry.core.utils.SlotUtil;
|
||||
import forestry.factory.recipes.FabricatorRecipeManager;
|
||||
@@ -51,7 +51,7 @@ public class InventoryFabricator extends InventoryAdapterTile<TileFabricator> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack stack, int side) {
|
||||
public boolean canExtractItem(int slotIndex, ItemStack stack, EnumFacing side) {
|
||||
return slotIndex == SLOT_RESULT;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
package forestry.factory.inventory;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import forestry.api.fuels.FuelManager;
|
||||
@@ -47,7 +47,7 @@ public class InventoryFermenter extends InventoryAdapterTile<TileFermenter> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, EnumFacing side) {
|
||||
return slotIndex == SLOT_CAN_OUTPUT;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
package forestry.factory.inventory;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import forestry.api.fuels.FuelManager;
|
||||
@@ -53,7 +53,7 @@ public class InventoryMoistener extends InventoryAdapterTile<TileMoistener> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, EnumFacing side) {
|
||||
if (slotIndex == SLOT_PRODUCT) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
package forestry.factory.inventory;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.inventory.InventoryAdapterTile;
|
||||
@@ -34,7 +34,7 @@ public class InventoryRaintank extends InventoryAdapterTile<TileRaintank> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, EnumFacing side) {
|
||||
return slotIndex == SLOT_PRODUCT;
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ package forestry.factory.inventory;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
@@ -56,7 +56,7 @@ public class InventorySqueezer extends InventoryAdapterTile<TileSqueezer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, EnumFacing side) {
|
||||
return slotIndex == SLOT_REMNANT || slotIndex == SLOT_CAN_OUTPUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
package forestry.factory.inventory;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
@@ -39,7 +39,7 @@ public class InventoryStill extends InventoryAdapterTile<TileStill> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, EnumFacing side) {
|
||||
return slotIndex == SLOT_PRODUCT;
|
||||
}
|
||||
}
|
||||
@@ -12,13 +12,11 @@ package forestry.factory.network;
|
||||
|
||||
import forestry.core.network.PacketRegistry;
|
||||
import forestry.factory.network.packets.PacketWorktableMemoryUpdate;
|
||||
import forestry.factory.network.packets.PacketWorktableNEISelect;
|
||||
import forestry.factory.network.packets.PacketWorktableRecipeUpdate;
|
||||
|
||||
public class PacketRegistryFactory extends PacketRegistry {
|
||||
@Override
|
||||
public void registerPackets() {
|
||||
registerServerPacket(new PacketWorktableNEISelect());
|
||||
|
||||
registerClientPacket(new PacketWorktableMemoryUpdate());
|
||||
registerClientPacket(new PacketWorktableRecipeUpdate());
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.factory.network.packets;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.core.gui.slots.SlotCraftMatrix;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.IForestryPacketServer;
|
||||
import forestry.core.network.PacketIdServer;
|
||||
import forestry.core.network.packets.PacketNBT;
|
||||
import forestry.core.recipes.nei.SetRecipeCommandHandler;
|
||||
import forestry.factory.gui.ContainerWorktable;
|
||||
|
||||
public class PacketWorktableNEISelect extends PacketNBT implements IForestryPacketServer {
|
||||
private static final SetRecipeCommandHandler worktableNEISelectHandler = new SetRecipeCommandHandler(ContainerWorktable.class, SlotCraftMatrix.class);
|
||||
|
||||
public PacketWorktableNEISelect() {
|
||||
}
|
||||
|
||||
public PacketWorktableNEISelect(NBTTagCompound nbttagcompound) {
|
||||
super(nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketData(DataInputStreamForestry data, EntityPlayerMP player) throws IOException {
|
||||
worktableNEISelectHandler.handle(getTagCompound(), player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketIdServer getPacketId() {
|
||||
return PacketIdServer.WORKTABLE_NEI_SELECT;
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ public class CarpenterRecipe implements ICarpenterRecipe {
|
||||
this.internal = internal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPackagingTime() {
|
||||
return packagingTime;
|
||||
}
|
||||
|
||||
@@ -12,15 +12,12 @@ package forestry.factory.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.IFabricatorRecipe;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.recipes.ShapedRecipeCustom;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class FabricatorRecipe implements IFabricatorRecipe {
|
||||
|
||||
@@ -38,16 +35,6 @@ public class FabricatorRecipe implements IFabricatorRecipe {
|
||||
this.internal = internal;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean matches(@Nullable ItemStack plan, ItemStack[][] resources) {
|
||||
if (this.plan != null && !ItemStackUtil.isCraftingEquivalent(this.plan, plan)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return RecipeUtil.matches(internal.getIngredients(), internal.getWidth(), internal.getHeight(), resources);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getIngredients() {
|
||||
return internal.getIngredients();
|
||||
@@ -63,11 +50,6 @@ public class FabricatorRecipe implements IFabricatorRecipe {
|
||||
return internal.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preservesNbt() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack getPlan() {
|
||||
@@ -79,11 +61,6 @@ public class FabricatorRecipe implements IFabricatorRecipe {
|
||||
return molten;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(IInventory craftingInventory) {
|
||||
return internal.getRecipeOutput().copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return internal.getRecipeOutput();
|
||||
|
||||
@@ -35,14 +35,17 @@ public class FabricatorSmeltingRecipe implements IFabricatorSmeltingRecipe {
|
||||
this.meltingPoint = meltingPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeltingPoint() {
|
||||
return meltingPoint;
|
||||
}
|
||||
|
||||
@@ -26,14 +26,17 @@ public class MoistenerRecipe implements IMoistenerRecipe {
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimePerItem() {
|
||||
return timePerItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package forestry.factory.recipes.jei.bottler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class BottlerRecipeCategory extends ForestryRecipeCategory{
|
||||
|
||||
private static final int emptySlot = 0;
|
||||
private static final int outputSlot = 1;
|
||||
private static final int inputTank = 2;
|
||||
|
||||
private final static ResourceLocation guiTexture = new ResourceLocation("forestry", "textures/gui/bottler.png");
|
||||
@Nonnull
|
||||
protected final IDrawableAnimated arrow;
|
||||
@Nonnull
|
||||
protected final IDrawable tankOverlay;
|
||||
|
||||
public BottlerRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 48, 11, 123, 65), "tile.for.factory.0.name");
|
||||
|
||||
IDrawableStatic arrowDrawable = guiHelper.createDrawable(guiTexture, 176, 74, 24, 17);
|
||||
this.arrow = guiHelper.createAnimatedDrawable(arrowDrawable, 200, IDrawableAnimated.StartDirection.LEFT, false);
|
||||
this.tankOverlay = guiHelper.createDrawable(guiTexture, 176, 0, 16, 58);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUid() {
|
||||
return ForestryRecipeCategoryUid.BOTTLER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(Minecraft minecraft) {
|
||||
arrow.draw(minecraft, 32, 28);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
guiItemStacks.init(emptySlot, true, 67, 7);
|
||||
guiItemStacks.init(outputSlot, false, 67, 43);
|
||||
|
||||
guiFluidStacks.init(inputTank, true, 5, 6, 16, 58, 10000, false, tankOverlay);
|
||||
|
||||
guiItemStacks.set(emptySlot, recipeWrapper.getInputs());
|
||||
guiItemStacks.set(outputSlot, recipeWrapper.getOutputs());
|
||||
|
||||
guiFluidStacks.set(inputTank, recipeWrapper.getFluidInputs());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package forestry.factory.recipes.jei.bottler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import forestry.factory.recipes.BottlerRecipe;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class BottlerRecipeHandler implements IRecipeHandler<BottlerRecipeWrapper> {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<BottlerRecipeWrapper> getRecipeClass() {
|
||||
return BottlerRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid() {
|
||||
return ForestryRecipeCategoryUid.BOTTLER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull BottlerRecipeWrapper recipe) {
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull BottlerRecipeWrapper wrapper) {
|
||||
BottlerRecipe recipe = wrapper.getRecipe();
|
||||
if(recipe.input == null || recipe.input.amount <= 0){
|
||||
return false;
|
||||
}
|
||||
if(recipe.empty == null){
|
||||
return false;
|
||||
}
|
||||
return recipe.input != null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package forestry.factory.recipes.jei.bottler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.factory.recipes.BottlerRecipe;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
|
||||
public class BottlerRecipeMaker {
|
||||
|
||||
private BottlerRecipeMaker() {
|
||||
}
|
||||
|
||||
public static List<BottlerRecipeWrapper> getBottlerRecipes() {
|
||||
List<BottlerRecipeWrapper> recipes = new ArrayList<>();
|
||||
for (FluidContainerData container : FluidContainerRegistry.getRegisteredFluidContainerData()) {
|
||||
BottlerRecipe recipe = BottlerRecipe.getRecipe(container.fluid, container.emptyContainer);
|
||||
if (recipe != null) {
|
||||
recipes.add(new BottlerRecipeWrapper(recipe));
|
||||
}
|
||||
}
|
||||
return recipes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package forestry.factory.recipes.jei.bottler;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import forestry.factory.recipes.BottlerRecipe;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class BottlerRecipeWrapper extends ForestryRecipeWrapper<BottlerRecipe> {
|
||||
|
||||
public BottlerRecipeWrapper(BottlerRecipe recipe) {
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return Collections.singletonList(recipe.input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs() {
|
||||
return Collections.singletonList(recipe.empty);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getOutputs() {
|
||||
return Collections.singletonList(recipe.filled);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package forestry.factory.recipes.jei.carpenter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.ICraftingGridHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class CarpenterRecipeCategory extends ForestryRecipeCategory {
|
||||
|
||||
private static final int boxSlot = 0;
|
||||
private static final int craftOutputSlot = 1;
|
||||
private static final int craftInputSlot = 2;
|
||||
|
||||
private static final int inputTank = 0;
|
||||
|
||||
private final static ResourceLocation guiTexture = new ResourceLocation("forestry", "textures/gui/carpenter.png");
|
||||
@Nonnull
|
||||
private final ICraftingGridHelper craftingGridHelper;
|
||||
@Nonnull
|
||||
protected final IDrawableAnimated arrow;
|
||||
@Nonnull
|
||||
protected final IDrawable tankOverlay;
|
||||
|
||||
public CarpenterRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 9, 16, 158, 61), "tile.for.factory.1.name");
|
||||
|
||||
craftingGridHelper = guiHelper.createCraftingGridHelper(craftInputSlot, craftOutputSlot);
|
||||
IDrawableStatic arrowDrawable = guiHelper.createDrawable(guiTexture, 176, 59, 4, 17);
|
||||
this.arrow = guiHelper.createAnimatedDrawable(arrowDrawable, 200, IDrawableAnimated.StartDirection.BOTTOM, false);
|
||||
this.tankOverlay = guiHelper.createDrawable(guiTexture, 176, 0, 16, 58);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return ForestryRecipeCategoryUid.CARPENTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(Minecraft minecraft) {
|
||||
arrow.draw(minecraft, 89, 34);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
guiItemStacks.init(boxSlot, true, 73, 3);
|
||||
|
||||
guiItemStacks.init(craftOutputSlot, false, 70, 34);
|
||||
|
||||
for (int y = 0; y < 3; ++y) {
|
||||
for (int x = 0; x < 3; ++x) {
|
||||
int index = craftInputSlot + x + (y * 3);
|
||||
guiItemStacks.init(index, true, x * 18, 3 + y * 18);
|
||||
}
|
||||
}
|
||||
|
||||
guiFluidStacks.init(inputTank, true, 141, 1, 16, 58, 10000, false, tankOverlay);
|
||||
|
||||
CarpenterRecipeWrapper wrapper = (CarpenterRecipeWrapper) recipeWrapper;
|
||||
guiItemStacks.set(boxSlot, wrapper.getRecipe().getBox());
|
||||
|
||||
craftingGridHelper.setOutput(guiItemStacks, wrapper.getOutputs());
|
||||
List<Object> inputs = new ArrayList<>();
|
||||
for(Object ingredient : wrapper.getRecipe().getCraftingGridRecipe().getIngredients()){
|
||||
inputs.add(ingredient);
|
||||
}
|
||||
craftingGridHelper.setInput(guiItemStacks, inputs, wrapper.getRecipe().getCraftingGridRecipe().getWidth(), wrapper.getRecipe().getCraftingGridRecipe().getHeight());
|
||||
|
||||
guiFluidStacks.set(inputTank, wrapper.getFluidInputs());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package forestry.factory.recipes.jei.carpenter;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.recipes.ICarpenterRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class CarpenterRecipeHandler implements IRecipeHandler<CarpenterRecipeWrapper> {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<CarpenterRecipeWrapper> getRecipeClass() {
|
||||
return CarpenterRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid() {
|
||||
return ForestryRecipeCategoryUid.CARPENTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(CarpenterRecipeWrapper recipe) {
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(CarpenterRecipeWrapper wrapper) {
|
||||
ICarpenterRecipe recipe = wrapper.getRecipe();
|
||||
if(recipe.getPackagingTime() <= 0){
|
||||
return false;
|
||||
}
|
||||
if(recipe.getCraftingGridRecipe() == null || recipe.getCraftingGridRecipe().getIngredients() == null){
|
||||
return false;
|
||||
}
|
||||
int inputCount = 0;
|
||||
for(Object ingredient : recipe.getCraftingGridRecipe().getIngredients()){
|
||||
inputCount++;
|
||||
}
|
||||
return inputCount > 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package forestry.factory.recipes.jei.carpenter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.recipes.ICarpenterRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
|
||||
public class CarpenterRecipeMaker {
|
||||
|
||||
private CarpenterRecipeMaker() {
|
||||
}
|
||||
|
||||
public static List<CarpenterRecipeWrapper> getCrapenterRecipes() {
|
||||
List<CarpenterRecipeWrapper> recipes = new ArrayList<>();
|
||||
for(ICarpenterRecipe recipe : RecipeManagers.carpenterManager.recipes())
|
||||
recipes.add(new CarpenterRecipeWrapper(recipe));
|
||||
return recipes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package forestry.factory.recipes.jei.carpenter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.recipes.ICarpenterRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class CarpenterRecipeWrapper extends ForestryRecipeWrapper<ICarpenterRecipe>{
|
||||
|
||||
public CarpenterRecipeWrapper(@Nonnull ICarpenterRecipe recipe) {
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs() {
|
||||
List<Object> inputs = new ArrayList<>();
|
||||
for(Object ingredient : recipe.getCraftingGridRecipe().getIngredients()){
|
||||
inputs.add(ingredient);
|
||||
}
|
||||
inputs.add(recipe.getBox());
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return Collections.singletonList(recipe.getFluidResource());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getOutputs() {
|
||||
return Collections.singletonList(recipe.getCraftingGridRecipe().getRecipeOutput());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package forestry.factory.recipes.jei.centrifuge;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.gui.ingredients.GuiItemStackGroup;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
|
||||
|
||||
public static final int[][] OUTPUTS = new int[][]{{0, 0}, {1, 0}, {2, 0}, {0, 1}, {1, 1}, {2, 1}, {0, 2}, {1, 2}, {2, 2}};
|
||||
|
||||
public static final Comparator<Entry<ItemStack, Float>> highestChanceComparator = new Comparator<Entry<ItemStack, Float>>() {
|
||||
@Override
|
||||
public int compare(Entry<ItemStack, Float> o1, Entry<ItemStack, Float> o2) {
|
||||
return o2.getValue().compareTo(o1.getValue());
|
||||
}
|
||||
};
|
||||
|
||||
private static final int inputSlot = 0;
|
||||
private static final int outputSlot = 1;
|
||||
|
||||
private final static ResourceLocation guiTexture = new ResourceLocation("forestry", "textures/gui/squeezersocket.png");
|
||||
@Nonnull
|
||||
protected final IDrawableAnimated arrow;
|
||||
|
||||
public CentrifugeRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 5, 14, 166, 65), "tile.for.factory.2.name");
|
||||
|
||||
IDrawableStatic arrowDrawable = guiHelper.createDrawable(guiTexture, 176, 0, 4, 17);
|
||||
this.arrow = guiHelper.createAnimatedDrawable(arrowDrawable, 200, IDrawableAnimated.StartDirection.LEFT, false);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return ForestryRecipeCategoryUid.CENTRIFUGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(Minecraft minecraft) {
|
||||
arrow.draw(minecraft, 53, 25);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) {
|
||||
super.setRecipe(recipeLayout, recipeWrapper);
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
guiItemStacks.init(inputSlot, true, 25, 26);
|
||||
guiItemStacks.set(inputSlot, recipeWrapper.getInputs());
|
||||
CentrifugeRecipeWrapper centrifugeWrapper = (CentrifugeRecipeWrapper) recipeWrapper;
|
||||
setResults(centrifugeWrapper.getRecipe().getAllProducts(), (GuiItemStackGroup) guiItemStacks);
|
||||
guiItemStacks.addTooltipCallback(tooltip);
|
||||
}
|
||||
|
||||
private void setResults(Map<ItemStack, Float> outputs, GuiItemStackGroup guiItemStacks) {
|
||||
Set<Entry<ItemStack, Float>> entrySet = outputs.entrySet();
|
||||
if (entrySet.size() == 0) {
|
||||
return;
|
||||
}
|
||||
PriorityQueue<Entry<ItemStack, Float>> sortByChance = new PriorityQueue<>(entrySet.size(), highestChanceComparator);
|
||||
sortByChance.addAll(entrySet);
|
||||
|
||||
int i = 0;
|
||||
float[] chances = new float[sortByChance.size()];
|
||||
while (!sortByChance.isEmpty()) {
|
||||
Entry<ItemStack, Float> stack = sortByChance.poll();
|
||||
if (i >= OUTPUTS.length) {
|
||||
return;
|
||||
}
|
||||
int x = 3 + OUTPUTS[i][0] * 18;
|
||||
int y = 8 + OUTPUTS[i][1] * 18;
|
||||
int ID = outputSlot + i;
|
||||
guiItemStacks.init(ID, false, x, y);
|
||||
guiItemStacks.set(ID, stack.getKey());
|
||||
tooltip.addChanceTooltip(ID, stack.getValue());
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package forestry.factory.recipes.jei.centrifuge;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.recipes.ICentrifugeRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CentrifugeRecipeHandler implements IRecipeHandler<CentrifugeRecipeWrapper> {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<CentrifugeRecipeWrapper> getRecipeClass() {
|
||||
return CentrifugeRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid() {
|
||||
return ForestryRecipeCategoryUid.CENTRIFUGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(CentrifugeRecipeWrapper recipe) {
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(CentrifugeRecipeWrapper wrapper){
|
||||
ICentrifugeRecipe recipe = wrapper.getRecipe();
|
||||
if(recipe.getProcessingTime() <= 0){
|
||||
return false;
|
||||
}
|
||||
if(recipe.getInput() == null){
|
||||
return false;
|
||||
}
|
||||
int inputCount = 0;
|
||||
for(ItemStack ingredient : recipe.getAllProducts().keySet()){
|
||||
inputCount++;
|
||||
}
|
||||
return inputCount > 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package forestry.factory.recipes.jei.centrifuge;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.recipes.ICentrifugeRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
|
||||
public class CentrifugeRecipeMaker {
|
||||
|
||||
private CentrifugeRecipeMaker() {
|
||||
}
|
||||
|
||||
public static List<CentrifugeRecipeWrapper> getCentrifugeRecipe() {
|
||||
List<CentrifugeRecipeWrapper> recipes = new ArrayList<>();
|
||||
for(ICentrifugeRecipe recipe : RecipeManagers.centrifugeManager.recipes())
|
||||
recipes.add(new CentrifugeRecipeWrapper(recipe));
|
||||
return recipes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package forestry.factory.recipes.jei.centrifuge;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.recipes.ICentrifugeRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
|
||||
public class CentrifugeRecipeWrapper extends ForestryRecipeWrapper<ICentrifugeRecipe>{
|
||||
|
||||
public CentrifugeRecipeWrapper(@Nonnull ICentrifugeRecipe recipe) {
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs() {
|
||||
return Collections.singletonList(recipe.getInput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getOutputs() {
|
||||
return Collections.singletonList(recipe.getAllProducts().keySet());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package forestry.factory.recipes.jei.fabricator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.recipes.IFabricatorSmeltingRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import forestry.factory.recipes.FabricatorSmeltingRecipeManager;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.ICraftingGridHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public class FabricatorRecipeCategory extends ForestryRecipeCategory {
|
||||
|
||||
private static final int planSlot = 0;
|
||||
private static final int smeltingInputSlot = 1;
|
||||
private static final int craftOutputSlot = 2;
|
||||
private static final int craftInputSlot = 3;
|
||||
|
||||
private static final int inputTank = 0;
|
||||
|
||||
private final static ResourceLocation guiTexture = new ResourceLocation("forestry", "textures/gui/fabricator.png");
|
||||
@Nonnull
|
||||
private final ICraftingGridHelper craftingGridHelper;
|
||||
@Nonnull
|
||||
protected final IDrawable tankOverlay;
|
||||
|
||||
public FabricatorRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 0, 0, 166, 65), "tile.for.factory2.0.name");
|
||||
|
||||
craftingGridHelper = guiHelper.createCraftingGridHelper(craftInputSlot, craftOutputSlot);
|
||||
this.tankOverlay = guiHelper.createDrawable(guiTexture, 176, 0, 16, 58);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return ForestryRecipeCategoryUid.FABRICATOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(Minecraft minecraft) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
guiItemStacks.init(planSlot, true, 134, 6);
|
||||
|
||||
guiItemStacks.init(smeltingInputSlot, true, 21, 10);
|
||||
|
||||
guiItemStacks.init(craftOutputSlot, false, 134, 42);
|
||||
|
||||
for (int y = 0; y < 3; ++y) {
|
||||
for (int x = 0; x < 3; ++x) {
|
||||
int index = craftInputSlot + x + (y * 3);
|
||||
guiItemStacks.init(index, true, 62 + x * 18, 6 + y * 18);
|
||||
}
|
||||
}
|
||||
|
||||
guiFluidStacks.init(inputTank, true, 21, 37, 16, 16, 10000, false, tankOverlay);
|
||||
|
||||
FabricatorRecipeWrapper wrapper = (FabricatorRecipeWrapper) recipeWrapper;
|
||||
guiItemStacks.set(planSlot, wrapper.getRecipe().getPlan());
|
||||
|
||||
List<ItemStack> smeltingInput = new ArrayList<>();
|
||||
for (IFabricatorSmeltingRecipe s : getSmeltingInputs().get(wrapper.getRecipe().getLiquid().getFluid())) {
|
||||
smeltingInput.add(s.getResource());
|
||||
}
|
||||
if (!smeltingInput.isEmpty()) {
|
||||
guiItemStacks.set(smeltingInputSlot, smeltingInput);
|
||||
}
|
||||
|
||||
craftingGridHelper.setOutput(guiItemStacks, wrapper.getOutputs());
|
||||
List<Object> inputs = new ArrayList<>();
|
||||
for(Object ingredient : wrapper.getRecipe().getIngredients()){
|
||||
inputs.add(ingredient);
|
||||
}
|
||||
craftingGridHelper.setInput(guiItemStacks, inputs, wrapper.getRecipe().getWidth(), wrapper.getRecipe().getHeight());
|
||||
|
||||
guiFluidStacks.set(inputTank, wrapper.getFluidInputs());
|
||||
|
||||
}
|
||||
|
||||
private static Map<Fluid, List<IFabricatorSmeltingRecipe>> getSmeltingInputs() {
|
||||
Map<Fluid, List<IFabricatorSmeltingRecipe>> smeltingInputs = new HashMap<>();
|
||||
for (IFabricatorSmeltingRecipe smelting : FabricatorSmeltingRecipeManager.recipes) {
|
||||
Fluid fluid = smelting.getProduct().getFluid();
|
||||
if (!smeltingInputs.containsKey(fluid)) {
|
||||
smeltingInputs.put(fluid, new ArrayList<IFabricatorSmeltingRecipe>());
|
||||
}
|
||||
smeltingInputs.get(fluid).add(smelting);
|
||||
}
|
||||
return smeltingInputs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package forestry.factory.recipes.jei.fabricator;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.recipes.IFabricatorRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class FabricatorRecipeHandler implements IRecipeHandler<FabricatorRecipeWrapper> {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<FabricatorRecipeWrapper> getRecipeClass() {
|
||||
return FabricatorRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid() {
|
||||
return ForestryRecipeCategoryUid.FABRICATOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(FabricatorRecipeWrapper recipe) {
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(FabricatorRecipeWrapper wrapper) {
|
||||
IFabricatorRecipe recipe = wrapper.getRecipe();
|
||||
if(recipe.getIngredients() == null){
|
||||
return false;
|
||||
}
|
||||
if(recipe.getPlan() == null){
|
||||
return false;
|
||||
}
|
||||
if(recipe.getLiquid() == null){
|
||||
return false;
|
||||
}
|
||||
if(recipe.getRecipeOutput() == null){
|
||||
return false;
|
||||
}
|
||||
int inputCount = 0;
|
||||
for(Object ingredient : recipe.getIngredients()){
|
||||
inputCount++;
|
||||
}
|
||||
return inputCount > 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package forestry.factory.recipes.jei.fabricator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.recipes.IFabricatorRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
|
||||
public class FabricatorRecipeMaker {
|
||||
|
||||
private FabricatorRecipeMaker() {
|
||||
}
|
||||
|
||||
public static List<FabricatorRecipeWrapper> getFabricatorRecipes() {
|
||||
List<FabricatorRecipeWrapper> recipes = new ArrayList<>();
|
||||
for(IFabricatorRecipe recipe : RecipeManagers.fabricatorManager.recipes())
|
||||
recipes.add(new FabricatorRecipeWrapper(recipe));
|
||||
return recipes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package forestry.factory.recipes.jei.fabricator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.recipes.IFabricatorRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class FabricatorRecipeWrapper extends ForestryRecipeWrapper<IFabricatorRecipe>{
|
||||
|
||||
public FabricatorRecipeWrapper(@Nonnull IFabricatorRecipe recipe) {
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs() {
|
||||
List<Object> inputs = new ArrayList<>();
|
||||
for(Object ingredient : recipe.getIngredients()){
|
||||
inputs.add(ingredient);
|
||||
}
|
||||
inputs.add(recipe.getPlan());
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return Collections.singletonList(recipe.getLiquid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getOutputs() {
|
||||
return Collections.singletonList(recipe.getRecipeOutput());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package forestry.factory.recipes.jei.fermenter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.fuels.FermenterFuel;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class FermenterRecipeCategory extends ForestryRecipeCategory {
|
||||
|
||||
private static final int resourceSlot = 0;
|
||||
private static final int fuelSlot = 1;
|
||||
|
||||
private static final int inputTank = 0;
|
||||
private static final int outputTank = 1;
|
||||
|
||||
private final static ResourceLocation guiTexture = new ResourceLocation("forestry", "textures/gui/fermenter.png");
|
||||
@Nonnull
|
||||
protected final IDrawableAnimated progressBar0;
|
||||
@Nonnull
|
||||
protected final IDrawableAnimated progressBar1;
|
||||
@Nonnull
|
||||
protected final IDrawable tankOverlay;
|
||||
|
||||
public FermenterRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 30, 15, 116, 65), "tile.for.factory.3.name");
|
||||
|
||||
IDrawableStatic progressBarDrawable0 = guiHelper.createDrawable(guiTexture, 176, 60, 4, 18);
|
||||
this.progressBar0 = guiHelper.createAnimatedDrawable(progressBarDrawable0, 40, IDrawableAnimated.StartDirection.BOTTOM, false);
|
||||
IDrawableStatic progressBarDrawable1 = guiHelper.createDrawable(guiTexture, 176, 78, 4, 18);
|
||||
this.progressBar1 = guiHelper.createAnimatedDrawable(progressBarDrawable1, 80, IDrawableAnimated.StartDirection.BOTTOM, false);
|
||||
this.tankOverlay = guiHelper.createDrawable(guiTexture, 176, 0, 16, 58);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return ForestryRecipeCategoryUid.FERMENTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(Minecraft minecraft) {
|
||||
progressBar0.draw(minecraft, 65, 17);
|
||||
progressBar1.draw(minecraft, 89, 31);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
guiItemStacks.init(resourceSlot, true, 80, 8);
|
||||
guiItemStacks.init(fuelSlot, true, 70, 42);
|
||||
|
||||
guiFluidStacks.init(inputTank, true, 5, 4, 16, 58, 10000, false, tankOverlay);
|
||||
guiFluidStacks.init(outputTank, false, 95, 4, 16, 58, 10000, false, tankOverlay);
|
||||
|
||||
guiItemStacks.set(inputTank, recipeWrapper.getInputs());
|
||||
List<ItemStack> fuels = new ArrayList<>();
|
||||
for (FermenterFuel fuel : FuelManager.fermenterFuel.values()) {
|
||||
fuels.add(fuel.item);
|
||||
}
|
||||
guiItemStacks.set(fuelSlot, fuels);
|
||||
|
||||
FermenterRecipeWrapper wrapper = (FermenterRecipeWrapper) recipeWrapper;
|
||||
|
||||
guiFluidStacks.set(inputTank, wrapper.getFluidInputs());
|
||||
guiFluidStacks.set(outputTank, wrapper.getFluidOutputs());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package forestry.factory.recipes.jei.fermenter;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.recipes.IFermenterRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class FermenterRecipeHandler implements IRecipeHandler<FermenterRecipeWrapper> {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<FermenterRecipeWrapper> getRecipeClass() {
|
||||
return FermenterRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid() {
|
||||
return ForestryRecipeCategoryUid.FERMENTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(FermenterRecipeWrapper recipe) {
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(FermenterRecipeWrapper wrapper) {
|
||||
IFermenterRecipe recipe = wrapper.getRecipe();
|
||||
if(recipe.getFermentationValue() <= 0){
|
||||
return false;
|
||||
}
|
||||
if(recipe.getModifier() <= 0 ){
|
||||
return false;
|
||||
}
|
||||
if(recipe.getFluidResource() == null){
|
||||
return false;
|
||||
}
|
||||
if(recipe.getResource() == null){
|
||||
return false;
|
||||
}
|
||||
return recipe.getOutput() != null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package forestry.factory.recipes.jei.fermenter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.recipes.IFermenterRecipe;
|
||||
import forestry.api.recipes.IVariableFermentable;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.recipes.jei.JEIUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FermenterRecipeMaker {
|
||||
|
||||
private FermenterRecipeMaker() {
|
||||
}
|
||||
|
||||
public static List<FermenterRecipeWrapper> getFermenterRecipes() {
|
||||
List<FermenterRecipeWrapper> recipes = new ArrayList<>();
|
||||
for(IFermenterRecipe recipe : RecipeManagers.fermenterManager.recipes()){
|
||||
if (recipe.getResource() != null && recipe.getResource().getItem() instanceof IVariableFermentable) {
|
||||
for (ItemStack stack : JEIUtils.getItemVariations(recipe.getResource())) {
|
||||
recipes.add(new FermenterRecipeWrapper(recipe, stack));
|
||||
}
|
||||
}
|
||||
recipes.add(new FermenterRecipeWrapper(recipe, recipe.getResource()));
|
||||
}
|
||||
return recipes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package forestry.factory.recipes.jei.fermenter;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.recipes.IFermenterRecipe;
|
||||
import forestry.api.recipes.IVariableFermentable;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class FermenterRecipeWrapper extends ForestryRecipeWrapper<IFermenterRecipe>{
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack fermentable;
|
||||
|
||||
public FermenterRecipeWrapper(@Nonnull IFermenterRecipe recipe, @Nonnull ItemStack fermentable) {
|
||||
super(recipe);
|
||||
this.fermentable = fermentable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs() {
|
||||
return Collections.singletonList(fermentable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return Collections.singletonList(recipe.getFluidResource());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs() {
|
||||
int amount = Math.round(recipe.getFermentationValue() * recipe.getModifier());
|
||||
if (fermentable.getItem() instanceof IVariableFermentable) {
|
||||
amount *= ((IVariableFermentable) fermentable.getItem()).getFermentationModifier(fermentable);
|
||||
}
|
||||
FluidStack output = new FluidStack(recipe.getOutput(), amount);
|
||||
return Collections.singletonList(output);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package forestry.factory.recipes.jei.moistener;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
public class MoistenerRecipeCategory extends ForestryRecipeCategory {
|
||||
|
||||
private static final int resourceSlot = 0;
|
||||
private static final int productSlot = 1;
|
||||
private static final int fuelItemSlot = 2;
|
||||
private static final int fuelProductSlot = 3;
|
||||
|
||||
private static final int inputTank = 0;
|
||||
|
||||
private final static ResourceLocation guiTexture = new ResourceLocation("forestry", "textures/gui/moistener.png");
|
||||
@Nonnull
|
||||
protected final IDrawableAnimated arrow;
|
||||
@Nonnull
|
||||
protected final IDrawableAnimated progressBar;
|
||||
@Nonnull
|
||||
protected final IDrawable tankOverlay;
|
||||
|
||||
public MoistenerRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 9, 16, 158, 61), "tile.for.factory.4.name");
|
||||
|
||||
IDrawableStatic arrowDrawable = guiHelper.createDrawable(guiTexture, 176, 91, 29, 55);
|
||||
this.arrow = guiHelper.createAnimatedDrawable(arrowDrawable, 80, IDrawableAnimated.StartDirection.BOTTOM, false);
|
||||
IDrawableStatic progressBar = guiHelper.createDrawable(guiTexture, 176, 74, 16, 15);
|
||||
this.progressBar = guiHelper.createAnimatedDrawable(progressBar, 160, IDrawableAnimated.StartDirection.BOTTOM, false);
|
||||
this.tankOverlay = guiHelper.createDrawable(guiTexture, 176, 0, 16, 58);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return ForestryRecipeCategoryUid.MOISTENER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(Minecraft minecraft) {
|
||||
arrow.draw(minecraft, 88, 6);
|
||||
progressBar.draw(minecraft, 119, 25);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
guiItemStacks.init(resourceSlot, true, 138, 8);
|
||||
guiItemStacks.init(fuelItemSlot, true, 34, 47);
|
||||
|
||||
guiItemStacks.init(productSlot, false, 138, 44);
|
||||
guiItemStacks.init(fuelProductSlot, false, 100, 26);
|
||||
|
||||
guiFluidStacks.init(inputTank, true, 11, 5, 16, 58, 10000, false, tankOverlay);
|
||||
|
||||
MoistenerRecipeWrapper wrapper = (MoistenerRecipeWrapper) recipeWrapper;
|
||||
guiItemStacks.set(resourceSlot, wrapper.getRecipe().getResource());
|
||||
guiItemStacks.set(fuelItemSlot, wrapper.getFuel().item);
|
||||
|
||||
guiItemStacks.set(productSlot, wrapper.getRecipe().getProduct());
|
||||
guiItemStacks.set(fuelProductSlot, wrapper.getFuel().product);
|
||||
|
||||
guiFluidStacks.set(inputTank, FluidRegistry.getFluidStack("water", 10000));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package forestry.factory.recipes.jei.moistener;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.recipes.IMoistenerRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class MoistenerRecipeHandler implements IRecipeHandler<MoistenerRecipeWrapper> {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<MoistenerRecipeWrapper> getRecipeClass() {
|
||||
return MoistenerRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid() {
|
||||
return ForestryRecipeCategoryUid.MOISTENER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(MoistenerRecipeWrapper recipe) {
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(MoistenerRecipeWrapper wrapper) {
|
||||
IMoistenerRecipe recipe = wrapper.getRecipe();
|
||||
if(recipe.getTimePerItem() <= 0){
|
||||
return false;
|
||||
}
|
||||
if(recipe.getResource() == null){
|
||||
return false;
|
||||
}
|
||||
if(recipe.getProduct() == null){
|
||||
return false;
|
||||
}
|
||||
return wrapper.getFuel() != null || wrapper.getFuel().item != null|| wrapper.getFuel().product != null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package forestry.factory.recipes.jei.moistener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.fuels.MoistenerFuel;
|
||||
import forestry.api.recipes.IMoistenerRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
|
||||
public class MoistenerRecipeMaker {
|
||||
|
||||
private MoistenerRecipeMaker() {
|
||||
}
|
||||
|
||||
public static List<MoistenerRecipeWrapper> getMoistenerRecipes() {
|
||||
List<MoistenerRecipeWrapper> recipes = new ArrayList<>();
|
||||
for (IMoistenerRecipe recipe : RecipeManagers.moistenerManager.recipes()) {
|
||||
for (MoistenerFuel fuel : FuelManager.moistenerResource.values()) {
|
||||
recipes.add(new MoistenerRecipeWrapper(recipe, fuel));
|
||||
}
|
||||
}
|
||||
return recipes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package forestry.factory.recipes.jei.moistener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.fuels.MoistenerFuel;
|
||||
import forestry.api.recipes.IMoistenerRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MoistenerRecipeWrapper extends ForestryRecipeWrapper<IMoistenerRecipe>{
|
||||
|
||||
@Nonnull
|
||||
private MoistenerFuel fuel;
|
||||
|
||||
public MoistenerRecipeWrapper(@Nonnull IMoistenerRecipe recipe, MoistenerFuel fuel) {
|
||||
super(recipe);
|
||||
this.fuel = fuel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs() {
|
||||
List<ItemStack> inputs = new ArrayList<>();
|
||||
inputs.add(recipe.getProduct());
|
||||
if(fuel.item != null)
|
||||
inputs.add(fuel.item);
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getOutputs() {
|
||||
List<ItemStack> outputs = new ArrayList<>();
|
||||
outputs.add(recipe.getProduct());
|
||||
if(fuel.product != null)
|
||||
outputs.add(fuel.product);
|
||||
return outputs;
|
||||
}
|
||||
|
||||
public MoistenerFuel getFuel() {
|
||||
return fuel;
|
||||
}
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package forestry.factory.recipes.jei.squeezer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import forestry.factory.recipes.ISqueezerContainerRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class SqueezerContainerRecipeWrapper extends ForestryRecipeWrapper<ISqueezerContainerRecipe>{
|
||||
|
||||
public SqueezerContainerRecipeWrapper(@Nonnull ISqueezerContainerRecipe recipe) {
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs() {
|
||||
return FluidHelper.getAllFilledContainers(recipe.getEmptyContainer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs() {
|
||||
List<FluidStack> fluids = new ArrayList<>();
|
||||
for (ItemStack ingredient : FluidHelper.getAllFilledContainers(recipe.getEmptyContainer())) {
|
||||
FluidStack fluidStack = FluidHelper.getFluidStackInContainer(ingredient);
|
||||
fluids.add(fluidStack);
|
||||
}
|
||||
return fluids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getOutputs() {
|
||||
return Collections.singletonList(recipe.getRemnants());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package forestry.factory.recipes.jei.squeezer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.recipes.ISqueezerRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import forestry.factory.recipes.ISqueezerContainerRecipe;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.ICraftingGridHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class SqueezerRecipeCategory extends ForestryRecipeCategory {
|
||||
|
||||
private static final int[][] INPUTS = new int[][]{{0, 0}, {1, 0}, {2, 0}, {0, 1}, {1, 1}, {2, 1}, {0, 2}, {1, 2}, {2, 2}};
|
||||
|
||||
private static final int craftOutputSlot = 0;
|
||||
private static final int craftInputSlot = 1;
|
||||
|
||||
private static final int outputTank = 0;
|
||||
|
||||
private final static ResourceLocation guiTexture = new ResourceLocation("forestry", "textures/gui/squeezersocket.png");
|
||||
@Nonnull
|
||||
private final ICraftingGridHelper craftingGridHelper;
|
||||
@Nonnull
|
||||
protected final IDrawableAnimated arrow;
|
||||
@Nonnull
|
||||
protected final IDrawable tankOverlay;
|
||||
@Nonnull
|
||||
protected final String UID;
|
||||
|
||||
public SqueezerRecipeCategory(IGuiHelper guiHelper, String UID) {
|
||||
super(guiHelper.createDrawable(guiTexture, 9, 16, 158, 61), "tile.for.factory.5.name");
|
||||
|
||||
craftingGridHelper = guiHelper.createCraftingGridHelper(craftInputSlot, craftOutputSlot);
|
||||
IDrawableStatic arrowDrawable = guiHelper.createDrawable(guiTexture, 176, 59, 4, 17);
|
||||
this.arrow = guiHelper.createAnimatedDrawable(arrowDrawable, 200, IDrawableAnimated.StartDirection.BOTTOM, false);
|
||||
this.tankOverlay = guiHelper.createDrawable(guiTexture, 176, 60, 43, 18);
|
||||
this.UID = UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(Minecraft minecraft) {
|
||||
arrow.draw(minecraft, 70, 30);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) {
|
||||
super.setRecipe(recipeLayout, recipeWrapper);
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
ForestryRecipeWrapper wrapper = (ForestryRecipeWrapper) recipeWrapper;
|
||||
|
||||
float chance = 0;
|
||||
if(wrapper.getRecipe() instanceof ISqueezerRecipe){
|
||||
chance = ((ISqueezerRecipe) wrapper.getRecipe()).getRemnantsChance();
|
||||
}else if(wrapper.getRecipe() instanceof ISqueezerContainerRecipe){
|
||||
chance = ((ISqueezerContainerRecipe) wrapper.getRecipe()).getRemnantsChance();
|
||||
}
|
||||
|
||||
guiFluidStacks.init(outputTank, false, 117, 7, 16, 58, 10000, false, tankOverlay);
|
||||
guiFluidStacks.set(outputTank, recipeWrapper.getFluidOutputs());
|
||||
|
||||
guiItemStacks.init(craftOutputSlot, false, 92, 49);
|
||||
craftingGridHelper.setOutput(guiItemStacks, recipeWrapper.getOutputs());
|
||||
setIngredients(guiItemStacks, recipeWrapper.getInputs(), chance);
|
||||
|
||||
guiItemStacks.addTooltipCallback(tooltip);
|
||||
|
||||
}
|
||||
|
||||
public void setIngredients(IGuiItemStackGroup guiItemStacks, List<ItemStack> inputs, float chance) {
|
||||
int i = 0;
|
||||
for (ItemStack stack : inputs) {
|
||||
guiItemStacks.init(craftInputSlot + i, true, 12 + INPUTS[i][0] * 18, 10 + INPUTS[i][1] * 18);
|
||||
tooltip.addChanceTooltip(i, chance);
|
||||
i++;
|
||||
}
|
||||
craftingGridHelper.setInput(guiItemStacks, inputs);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package forestry.factory.recipes.jei.squeezer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.recipes.ISqueezerRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import forestry.factory.recipes.ISqueezerContainerRecipe;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class SqueezerRecipeHandler<R extends ForestryRecipeWrapper> implements IRecipeHandler<R> {
|
||||
|
||||
@Nonnull
|
||||
private Class<R> clazz;
|
||||
@Nonnull
|
||||
private String UID;
|
||||
|
||||
public SqueezerRecipeHandler(@Nonnull Class<R> clazz, @Nonnull String UID) {
|
||||
this.clazz = clazz;
|
||||
this.UID = UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<R> getRecipeClass() {
|
||||
return clazz;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(R recipe) {
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(R wrapper) {
|
||||
if(wrapper.getFluidOutputs() == null || wrapper.getFluidOutputs().isEmpty()){
|
||||
return false;
|
||||
}
|
||||
if(wrapper.getInputs() == null || wrapper.getInputs().isEmpty()){
|
||||
return false;
|
||||
}
|
||||
if(wrapper.getOutputs() == null || wrapper.getOutputs().isEmpty()){
|
||||
return false;
|
||||
}
|
||||
if(wrapper.getRecipe() instanceof ISqueezerContainerRecipe){
|
||||
ISqueezerContainerRecipe recipe = (ISqueezerContainerRecipe) wrapper.getRecipe();
|
||||
return recipe.getProcessingTime() > 0 && recipe.getRemnantsChance() > 0;
|
||||
}else{
|
||||
ISqueezerRecipe recipe = (ISqueezerRecipe) wrapper.getRecipe();
|
||||
return recipe.getProcessingTime() > 0 && recipe.getRemnantsChance() > 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package forestry.factory.recipes.jei.squeezer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.recipes.ISqueezerRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.factory.recipes.ISqueezerContainerRecipe;
|
||||
import forestry.factory.recipes.SqueezerRecipeManager;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
|
||||
public class SqueezerRecipeMaker {
|
||||
|
||||
private SqueezerRecipeMaker() {
|
||||
}
|
||||
|
||||
public static List<SqueezerRecipeWrapper> getSqueezerRecipes() {
|
||||
List<SqueezerRecipeWrapper> recipes = new ArrayList<>();
|
||||
for(ISqueezerRecipe recipe : RecipeManagers.squeezerManager.recipes()){
|
||||
recipes.add(new SqueezerRecipeWrapper(recipe));
|
||||
}
|
||||
return recipes;
|
||||
}
|
||||
|
||||
public static List<SqueezerContainerRecipeWrapper> getSqueezerContainerRecipes() {
|
||||
List<SqueezerContainerRecipeWrapper> recipes = new ArrayList<>();
|
||||
for(FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()){
|
||||
ISqueezerContainerRecipe containerRecipe = SqueezerRecipeManager.findMatchingContainerRecipe(data.filledContainer);
|
||||
if (containerRecipe != null) {
|
||||
recipes.add(new SqueezerContainerRecipeWrapper(containerRecipe));
|
||||
}
|
||||
}
|
||||
return recipes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package forestry.factory.recipes.jei.squeezer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.recipes.ISqueezerRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class SqueezerRecipeWrapper extends ForestryRecipeWrapper<ISqueezerRecipe>{
|
||||
|
||||
public SqueezerRecipeWrapper(@Nonnull ISqueezerRecipe recipe) {
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs() {
|
||||
List<ItemStack> inputs = new ArrayList<>();
|
||||
for(ItemStack ingredient : recipe.getResources()){
|
||||
inputs.add(ingredient);
|
||||
}
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs() {
|
||||
return Collections.singletonList(recipe.getFluidOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getOutputs() {
|
||||
return Collections.singletonList(recipe.getRemnants());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package forestry.factory.recipes.jei.still;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class StillRecipeCategory extends ForestryRecipeCategory {
|
||||
|
||||
private static final int inputTank = 0;
|
||||
private static final int outputTank = 1;
|
||||
|
||||
private final static ResourceLocation guiTexture = new ResourceLocation("forestry", "textures/gui/still.png");
|
||||
|
||||
@Nonnull
|
||||
protected final IDrawable tankOverlay;
|
||||
|
||||
public StillRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 30, 11, 116, 65), "tile.for.factory.6.name");
|
||||
this.tankOverlay = guiHelper.createDrawable(guiTexture, 176, 0, 16, 58);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUid() {
|
||||
return ForestryRecipeCategoryUid.STILL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(Minecraft minecraft) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) {
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
|
||||
guiFluidStacks.init(inputTank, true, 30, 4, 16, 58, 10000, false, tankOverlay);
|
||||
guiFluidStacks.init(outputTank, false, 120, 4, 16, 58, 10000, false, tankOverlay);
|
||||
|
||||
guiFluidStacks.set(inputTank, recipeWrapper.getFluidInputs());
|
||||
guiFluidStacks.set(outputTank, recipeWrapper.getFluidOutputs());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package forestry.factory.recipes.jei.still;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.recipes.IStillRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class StillRecipeHandler implements IRecipeHandler<StillRecipeWrapper> {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<StillRecipeWrapper> getRecipeClass() {
|
||||
return StillRecipeWrapper.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid() {
|
||||
return ForestryRecipeCategoryUid.STILL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(StillRecipeWrapper recipe) {
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(StillRecipeWrapper wrapper) {
|
||||
IStillRecipe recipe = wrapper.getRecipe();
|
||||
if(recipe.getInput() == null){
|
||||
return false;
|
||||
}
|
||||
if(recipe.getOutput() == null){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package forestry.factory.recipes.jei.still;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.recipes.IStillRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
|
||||
public class StillRecipeMaker {
|
||||
|
||||
private StillRecipeMaker() {
|
||||
}
|
||||
|
||||
public static List<StillRecipeWrapper> getStillRecipes() {
|
||||
List<StillRecipeWrapper> recipes = new ArrayList<>();
|
||||
for(IStillRecipe recipe : RecipeManagers.stillManager.recipes())
|
||||
recipes.add(new StillRecipeWrapper(recipe));
|
||||
return recipes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package forestry.factory.recipes.jei.still;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.recipes.IStillRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class StillRecipeWrapper extends ForestryRecipeWrapper<IStillRecipe>{
|
||||
|
||||
public StillRecipeWrapper(@Nonnull IStillRecipe recipe) {
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return Collections.singletonList(recipe.getInput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs() {
|
||||
return Collections.singletonList(recipe.getOutput());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,155 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.factory.recipes.nei;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.core.recipes.nei.NEIUtils;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.factory.gui.GuiBottler;
|
||||
import forestry.factory.recipes.BottlerRecipe;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
|
||||
public class NEIHandlerBottler extends RecipeHandlerBase {
|
||||
|
||||
private static final List<BottlerRecipe> recipes = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
for (FluidContainerData container : FluidContainerRegistry.getRegisteredFluidContainerData()) {
|
||||
BottlerRecipe recipe = BottlerRecipe.getRecipe(container.fluid, container.emptyContainer);
|
||||
if (recipe != null) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CachedBottlerRecipe extends CachedBaseRecipe {
|
||||
|
||||
public PositionedFluidTank fluid;
|
||||
public PositionedStack input;
|
||||
public PositionedStack output;
|
||||
|
||||
public CachedBottlerRecipe(BottlerRecipe recipe) {
|
||||
if (recipe.input != null) {
|
||||
this.fluid = new PositionedFluidTank(recipe.input, 10000, new Rectangle(48, 6, 16, 58), NEIHandlerBottler.this.getGuiTexture(), new Point(176, 0));
|
||||
}
|
||||
if (recipe.empty != null) {
|
||||
this.input = new PositionedStack(recipe.empty, 111, 8);
|
||||
}
|
||||
if (recipe.filled != null) {
|
||||
this.output = new PositionedStack(recipe.filled, 111, 44);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getIngredient() {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedFluidTank getFluidTank() {
|
||||
return this.fluid;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "forestry.bottler";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.for.factory.0.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "forestry:textures/gui/bottler.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
this.addTransferRect(75, 27, 24, 17);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return GuiBottler.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
this.changeToGuiTexture();
|
||||
GuiDraw.drawTexturedModalRect(43, 0, 48, 11, 123, 65);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
this.drawProgressBar(75, 27, 176, 74, 24, 17, 40, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAllRecipes() {
|
||||
for (BottlerRecipe recipe : recipes) {
|
||||
this.arecipes.add(new CachedBottlerRecipe(recipe));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (BottlerRecipe recipe : recipes) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.filled, result)) {
|
||||
this.arecipes.add(new CachedBottlerRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingred) {
|
||||
for (BottlerRecipe recipe : recipes) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.empty, ingred)) {
|
||||
this.arecipes.add(new CachedBottlerRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(FluidStack ingred) {
|
||||
for (BottlerRecipe recipe : recipes) {
|
||||
if (NEIUtils.areFluidsSameType(recipe.input, ingred)) {
|
||||
this.arecipes.add(new CachedBottlerRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.factory.recipes.nei;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.ICarpenterRecipe;
|
||||
import forestry.api.recipes.IDescriptiveRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.recipes.nei.NEIUtils;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.factory.gui.GuiCarpenter;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.API;
|
||||
|
||||
public class NEIHandlerCarpenter extends RecipeHandlerBase {
|
||||
|
||||
private static Class<? extends GuiContainer> guiClass;
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
guiClass = GuiCarpenter.class;
|
||||
API.setGuiOffset(guiClass, 5, 14);
|
||||
}
|
||||
|
||||
public class CachedCarpenterRecipe extends CachedBaseRecipe {
|
||||
|
||||
public List<PositionedStack> inputs = new ArrayList<>();
|
||||
public PositionedFluidTank tank;
|
||||
public PositionedStack output;
|
||||
|
||||
public CachedCarpenterRecipe(ICarpenterRecipe recipe, boolean genPerms) {
|
||||
IDescriptiveRecipe irecipe = recipe.getCraftingGridRecipe();
|
||||
if (irecipe != null) {
|
||||
if (irecipe.getIngredients() != null) {
|
||||
this.setIngredients(irecipe.getWidth(), irecipe.getHeight(), irecipe.getIngredients());
|
||||
}
|
||||
if (recipe.getBox() != null) {
|
||||
this.inputs.add(new PositionedStack(recipe.getBox(), 78, 6));
|
||||
}
|
||||
if (recipe.getFluidResource() != null) {
|
||||
this.tank = new PositionedFluidTank(recipe.getFluidResource(), 10000, new Rectangle(145, 3, 16, 58), NEIHandlerCarpenter.this.getGuiTexture(), new Point(176, 0));
|
||||
}
|
||||
if (recipe.getCraftingGridRecipe().getRecipeOutput() != null) {
|
||||
this.output = new PositionedStack(recipe.getCraftingGridRecipe().getRecipeOutput(), 75, 37);
|
||||
}
|
||||
}
|
||||
|
||||
if (genPerms) {
|
||||
this.generatePermutations();
|
||||
}
|
||||
}
|
||||
|
||||
public CachedCarpenterRecipe(ICarpenterRecipe recipe) {
|
||||
this(recipe, false);
|
||||
}
|
||||
|
||||
public void setIngredients(int width, int height, Object[] items) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
Object item = items[y * width + x];
|
||||
if (item == null) {
|
||||
continue;
|
||||
} else if (item instanceof ItemStack[] && ((ItemStack[]) item).length == 0) {
|
||||
continue;
|
||||
} else if (item instanceof List && ((List) item).size() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PositionedStack stack = new PositionedStack(item, 5 + x * 18, 6 + y * 18, false);
|
||||
stack.setMaxSize(1);
|
||||
this.inputs.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return this.getCycledIngredients(NEIHandlerCarpenter.this.cycleticks / 20, this.inputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedFluidTank getFluidTank() {
|
||||
return this.tank;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
public void generatePermutations() {
|
||||
for (PositionedStack p : this.inputs) {
|
||||
p.generatePermutations();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "forestry.carpenter";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.for.factory.1.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "forestry:textures/gui/carpenter.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
this.addTransferRect(93, 36, 4, 18);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return guiClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
this.changeToGuiTexture();
|
||||
GuiDraw.drawTexturedModalRect(0, 0, 5, 14, 166, 65);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
this.drawProgressBar(93, 36, 176, 59, 4, 17, 80, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAllRecipes() {
|
||||
for (ICarpenterRecipe recipe : RecipeManagers.carpenterManager.recipes()) {
|
||||
this.arecipes.add(new CachedCarpenterRecipe(recipe, true));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (ICarpenterRecipe recipe : RecipeManagers.carpenterManager.recipes()) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getCraftingGridRecipe().getRecipeOutput(), result)) {
|
||||
this.arecipes.add(new CachedCarpenterRecipe(recipe, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingred) {
|
||||
super.loadUsageRecipes(ingred);
|
||||
for (ICarpenterRecipe recipe : RecipeManagers.carpenterManager.recipes()) {
|
||||
CachedCarpenterRecipe crecipe = new CachedCarpenterRecipe(recipe);
|
||||
if (crecipe.inputs != null && crecipe.contains(crecipe.inputs, ingred)) {
|
||||
crecipe.generatePermutations();
|
||||
crecipe.setIngredientPermutation(crecipe.inputs, ingred);
|
||||
this.arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(FluidStack ingredient) {
|
||||
for (ICarpenterRecipe recipe : RecipeManagers.carpenterManager.recipes()) {
|
||||
if (NEIUtils.areFluidsSameType(recipe.getFluidResource(), ingredient)) {
|
||||
this.arecipes.add(new CachedCarpenterRecipe(recipe, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.factory.recipes.nei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import forestry.api.recipes.ICentrifugeRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.recipes.nei.PositionedStackAdv;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.factory.gui.GuiCentrifuge;
|
||||
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
|
||||
public class NEIHandlerCentrifuge extends RecipeHandlerBase {
|
||||
|
||||
private static final int[][] OUTPUTS = new int[][]{{0, 0}, {1, 0}, {2, 0}, {0, 1}, {1, 1}, {2, 1}, {0, 2}, {1, 2}, {2, 2}};
|
||||
|
||||
private static final Comparator<Entry<ItemStack, Float>> highestChanceComparator = new Comparator<Entry<ItemStack, Float>>() {
|
||||
@Override
|
||||
public int compare(Entry<ItemStack, Float> o1, Entry<ItemStack, Float> o2) {
|
||||
return o2.getValue().compareTo(o1.getValue());
|
||||
}
|
||||
};
|
||||
|
||||
public class CachedCentrifugeRecipe extends CachedBaseRecipe {
|
||||
|
||||
public PositionedStack inputs;
|
||||
public List<PositionedStack> outputs = new ArrayList<>();
|
||||
|
||||
public CachedCentrifugeRecipe(ICentrifugeRecipe recipe, boolean genPerms) {
|
||||
if (recipe.getInput() != null) {
|
||||
this.inputs = new PositionedStack(recipe.getInput(), 25, 26);
|
||||
}
|
||||
if (recipe.getAllProducts() != null) {
|
||||
this.setResults(recipe.getAllProducts());
|
||||
}
|
||||
}
|
||||
|
||||
public CachedCentrifugeRecipe(ICentrifugeRecipe recipe) {
|
||||
this(recipe, false);
|
||||
}
|
||||
|
||||
public void setResults(Map<ItemStack, Float> outputs) {
|
||||
Set<Entry<ItemStack, Float>> entrySet = outputs.entrySet();
|
||||
if (entrySet.size() == 0) {
|
||||
return;
|
||||
}
|
||||
PriorityQueue<Entry<ItemStack, Float>> sortByChance = new PriorityQueue<>(entrySet.size(), highestChanceComparator);
|
||||
sortByChance.addAll(entrySet);
|
||||
|
||||
int i = 0;
|
||||
while (!sortByChance.isEmpty()) {
|
||||
Entry<ItemStack, Float> stack = sortByChance.poll();
|
||||
if (i >= OUTPUTS.length) {
|
||||
return;
|
||||
}
|
||||
PositionedStackAdv output = new PositionedStackAdv(stack.getKey(), 93 + OUTPUTS[i][0] * 18, 8 + OUTPUTS[i][1] * 18);
|
||||
output.setChance(stack.getValue());
|
||||
this.outputs.add(output);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getIngredient() {
|
||||
this.randomRenderPermutation(this.inputs, NEIHandlerCentrifuge.this.cycleticks / 20);
|
||||
return this.inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks() {
|
||||
return this.outputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "forestry.centrifuge";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.for.factory.2.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "forestry:textures/gui/centrifugesocket.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
this.addTransferRect(57 - 12, 26 - 8, 16, 24 + 6 + 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return GuiCentrifuge.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
this.drawProgressBar(57 - 4, 25, 176, 0, 4, 17, 80, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAllRecipes() {
|
||||
for (ICentrifugeRecipe recipe : RecipeManagers.centrifugeManager.recipes()) {
|
||||
this.arecipes.add(new CachedCentrifugeRecipe(recipe, true));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (ICentrifugeRecipe recipe : RecipeManagers.centrifugeManager.recipes()) {
|
||||
CachedCentrifugeRecipe crecipe = new CachedCentrifugeRecipe(recipe);
|
||||
if (crecipe.outputs != null && crecipe.contains(crecipe.outputs, result)) {
|
||||
crecipe.setIngredientPermutation(crecipe.outputs, result);
|
||||
this.arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingred) {
|
||||
super.loadCraftingRecipes(ingred);
|
||||
for (ICentrifugeRecipe recipe : RecipeManagers.centrifugeManager.recipes()) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getInput(), ingred)) {
|
||||
this.arecipes.add(new CachedCentrifugeRecipe(recipe, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,231 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.factory.recipes.nei;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.IFabricatorRecipe;
|
||||
import forestry.api.recipes.IFabricatorSmeltingRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.recipes.nei.NEIUtils;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.factory.gui.GuiFabricator;
|
||||
import forestry.factory.recipes.FabricatorSmeltingRecipeManager;
|
||||
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
|
||||
public class NEIHandlerFabricator extends RecipeHandlerBase {
|
||||
|
||||
public class CachedFabricatorRecipe extends CachedBaseRecipe {
|
||||
public List<PositionedStack> smeltingInput = new ArrayList<>();
|
||||
public PositionedFluidTank tank;
|
||||
public List<PositionedStack> inputs = new ArrayList<>();
|
||||
public PositionedStack output;
|
||||
|
||||
public CachedFabricatorRecipe(IFabricatorRecipe recipe, boolean genPerms) {
|
||||
if (recipe.getLiquid() != null) {
|
||||
this.tank = new PositionedFluidTank(recipe.getLiquid(), 2000, new Rectangle(21, 37, 16, 16));
|
||||
List<ItemStack> smeltingInput = new ArrayList<>();
|
||||
for (IFabricatorSmeltingRecipe s : getSmeltingInputs().get(recipe.getLiquid().getFluid())) {
|
||||
smeltingInput.add(s.getResource());
|
||||
}
|
||||
if (!smeltingInput.isEmpty()) {
|
||||
this.smeltingInput.add(new PositionedStack(smeltingInput, 21, 10));
|
||||
}
|
||||
}
|
||||
|
||||
if (recipe != null) {
|
||||
if (recipe.getIngredients() != null) {
|
||||
this.setIngredients(recipe.getWidth(), recipe.getHeight(), recipe.getIngredients());
|
||||
}
|
||||
if (recipe.getPlan() != null) {
|
||||
this.inputs.add(new PositionedStack(recipe.getPlan(), 134, 6));
|
||||
}
|
||||
|
||||
if (recipe.getRecipeOutput() != null) {
|
||||
this.output = new PositionedStack(recipe.getRecipeOutput(), 134, 42);
|
||||
}
|
||||
}
|
||||
|
||||
if (genPerms) {
|
||||
this.generatePermutations();
|
||||
}
|
||||
}
|
||||
|
||||
public CachedFabricatorRecipe(IFabricatorRecipe recipe) {
|
||||
this(recipe, false);
|
||||
}
|
||||
|
||||
public void setIngredients(int width, int height, Object[] items) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
Object item = items[y * width + x];
|
||||
if (item == null) {
|
||||
continue;
|
||||
} else if (item instanceof ItemStack[] && ((ItemStack[]) item).length == 0) {
|
||||
continue;
|
||||
} else if (item instanceof List && ((List) item).size() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PositionedStack stack = new PositionedStack(item, 62 + x * 18, 6 + y * 18, false);
|
||||
stack.setMaxSize(1);
|
||||
this.inputs.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks() {
|
||||
return super.getCycledIngredients(NEIHandlerFabricator.this.cycleticks / 40, this.smeltingInput);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(NEIHandlerFabricator.this.cycleticks / 20, this.inputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedFluidTank getFluidTank() {
|
||||
return this.tank;
|
||||
}
|
||||
|
||||
public void generatePermutations() {
|
||||
for (PositionedStack p : this.inputs) {
|
||||
p.generatePermutations();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredientStacks(int recipe) {
|
||||
return arecipes.get(recipe).getIngredients();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResultStack(int recipe) {
|
||||
return arecipes.get(recipe).getResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "forestry.fabricator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.for.factory2.0.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "forestry:textures/gui/fabricator.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
this.addTransferRect(117, 44, 14, 13);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return GuiFabricator.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAllRecipes() {
|
||||
for (IFabricatorRecipe recipe : RecipeManagers.fabricatorManager.recipes()) {
|
||||
this.arecipes.add(new CachedFabricatorRecipe(recipe, true));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (IFabricatorRecipe recipe : RecipeManagers.fabricatorManager.recipes()) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getRecipeOutput(), result)) {
|
||||
CachedFabricatorRecipe crecipe = new CachedFabricatorRecipe(recipe, true);
|
||||
this.arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingred) {
|
||||
super.loadUsageRecipes(ingred);
|
||||
for (IFabricatorRecipe recipe : RecipeManagers.fabricatorManager.recipes()) {
|
||||
CachedFabricatorRecipe crecipe = new CachedFabricatorRecipe(recipe);
|
||||
if (crecipe.inputs != null && crecipe.contains(crecipe.inputs, ingred) || crecipe.smeltingInput != null && crecipe.contains(crecipe.smeltingInput, ingred)) {
|
||||
crecipe.generatePermutations();
|
||||
crecipe.setIngredientPermutation(crecipe.smeltingInput, ingred);
|
||||
this.arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(FluidStack ingredient) {
|
||||
for (IFabricatorRecipe recipe : RecipeManagers.fabricatorManager.recipes()) {
|
||||
if (NEIUtils.areFluidsSameType(recipe.getLiquid(), ingredient)) {
|
||||
this.arecipes.add(new CachedFabricatorRecipe(recipe, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> provideItemTooltip(GuiRecipe guiRecipe, ItemStack itemStack, List<String> currenttip, CachedBaseRecipe crecipe, Point relMouse) {
|
||||
super.provideItemTooltip(guiRecipe, itemStack, currenttip, crecipe, relMouse);
|
||||
|
||||
if (new Rectangle(20, 9, 18, 18).contains(relMouse)) {
|
||||
for (IFabricatorSmeltingRecipe smelting : FabricatorSmeltingRecipeManager.recipes) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(smelting.getResource(), itemStack) && smelting.getProduct() != null) {
|
||||
currenttip.add(EnumChatFormatting.GRAY + NEIUtils.translate("handler.forestry.fabricator.worth") + " " + smelting.getProduct().amount + " mB");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
private static Map<Fluid, List<IFabricatorSmeltingRecipe>> getSmeltingInputs() {
|
||||
Map<Fluid, List<IFabricatorSmeltingRecipe>> smeltingInputs = new HashMap<>();
|
||||
for (IFabricatorSmeltingRecipe smelting : FabricatorSmeltingRecipeManager.recipes) {
|
||||
Fluid fluid = smelting.getProduct().getFluid();
|
||||
if (!smeltingInputs.containsKey(fluid)) {
|
||||
smeltingInputs.put(fluid, new ArrayList<IFabricatorSmeltingRecipe>());
|
||||
}
|
||||
smeltingInputs.get(fluid).add(smelting);
|
||||
}
|
||||
return smeltingInputs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,204 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.factory.recipes.nei;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.fuels.FermenterFuel;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.recipes.IFermenterRecipe;
|
||||
import forestry.api.recipes.IVariableFermentable;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.recipes.nei.NEIUtils;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.factory.gui.GuiFermenter;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.API;
|
||||
|
||||
public class NEIHandlerFermenter extends RecipeHandlerBase {
|
||||
|
||||
private static Class<? extends GuiContainer> guiClass;
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
guiClass = GuiFermenter.class;
|
||||
API.setGuiOffset(guiClass, 5, 15);
|
||||
}
|
||||
|
||||
public class CachedFermenterRecipe extends CachedBaseRecipe {
|
||||
|
||||
public List<PositionedFluidTank> tanks = new ArrayList<>();
|
||||
public PositionedStack resource;
|
||||
public List<PositionedStack> inputItems = new ArrayList<>();
|
||||
|
||||
public CachedFermenterRecipe(IFermenterRecipe recipe, ItemStack fermentable, boolean genPerms) {
|
||||
if (recipe.getFluidResource() != null) {
|
||||
FluidStack input = recipe.getFluidResource().copy();
|
||||
input.amount = recipe.getFermentationValue();
|
||||
this.tanks.add(new PositionedFluidTank(input, 10000, new Rectangle(30, 4, 16, 58), NEIHandlerFermenter.this.getGuiTexture(), new Point(176, 0)));
|
||||
}
|
||||
if (recipe.getOutput() != null) {
|
||||
int amount = Math.round(recipe.getFermentationValue() * recipe.getModifier());
|
||||
if (fermentable.getItem() instanceof IVariableFermentable) {
|
||||
amount *= ((IVariableFermentable) fermentable.getItem()).getFermentationModifier(fermentable);
|
||||
}
|
||||
FluidStack output = new FluidStack(recipe.getOutput(), amount);
|
||||
this.tanks.add(new PositionedFluidTank(output, 10000, new Rectangle(120, 4, 16, 58), NEIHandlerFermenter.this.getGuiTexture(), new Point(176, 0)));
|
||||
}
|
||||
|
||||
this.inputItems.add(new PositionedStack(fermentable, 80, 8));
|
||||
List<ItemStack> fuels = new ArrayList<>();
|
||||
for (FermenterFuel fuel : FuelManager.fermenterFuel.values()) {
|
||||
fuels.add(fuel.item);
|
||||
}
|
||||
this.inputItems.add(new PositionedStack(fuels, 70, 42));
|
||||
|
||||
if (genPerms) {
|
||||
this.generatePermutations();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return this.getCycledIngredients(NEIHandlerFermenter.this.cycleticks / 40, this.inputItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedFluidTank> getFluidTanks() {
|
||||
return this.tanks;
|
||||
}
|
||||
|
||||
public void generatePermutations() {
|
||||
for (PositionedStack p : this.inputItems) {
|
||||
p.generatePermutations();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "forestry.fermenter";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.for.factory.3.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "forestry:textures/gui/fermenter.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
this.addTransferRect(76, 27, 14, 12);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return guiClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
this.changeToGuiTexture();
|
||||
GuiDraw.drawTexturedModalRect(25, 0, 30, 15, 116, 65);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
this.drawProgressBar(69, 17, 176, 60, 4, 18, 40, 11);
|
||||
this.drawProgressBar(93, 31, 176, 78, 4, 18, 80, 11);
|
||||
}
|
||||
|
||||
private List<CachedFermenterRecipe> getCachedRecipes(IFermenterRecipe recipe, boolean generatePermutations) {
|
||||
if (recipe.getResource() != null && recipe.getResource().getItem() instanceof IVariableFermentable) {
|
||||
List<CachedFermenterRecipe> crecipes = new ArrayList<>();
|
||||
for (ItemStack stack : NEIUtils.getItemVariations(recipe.getResource())) {
|
||||
crecipes.add(new CachedFermenterRecipe(recipe, stack, generatePermutations));
|
||||
}
|
||||
return crecipes;
|
||||
}
|
||||
return Collections.singletonList(new CachedFermenterRecipe(recipe, recipe.getResource(), generatePermutations));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAllRecipes() {
|
||||
for (IFermenterRecipe recipe : RecipeManagers.fermenterManager.recipes()) {
|
||||
this.arecipes.addAll(this.getCachedRecipes(recipe, true));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(FluidStack result) {
|
||||
for (IFermenterRecipe recipe : RecipeManagers.fermenterManager.recipes()) {
|
||||
FluidStack output = new FluidStack(recipe.getOutput(), Constants.BUCKET_VOLUME);
|
||||
if (NEIUtils.areFluidsSameType(output, result)) {
|
||||
this.arecipes.addAll(this.getCachedRecipes(recipe, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingred) {
|
||||
super.loadUsageRecipes(ingred);
|
||||
for (IFermenterRecipe recipe : RecipeManagers.fermenterManager.recipes()) {
|
||||
if (recipe.getResource() != null) {
|
||||
for (ItemStack stack : NEIUtils.getItemVariations(recipe.getResource())) {
|
||||
if (stack.hasTagCompound() && NEIServerUtils.areStacksSameType(stack, ingred) || !stack.hasTagCompound() && NEIServerUtils.areStacksSameTypeCrafting(stack, ingred)) {
|
||||
CachedFermenterRecipe crecipe = new CachedFermenterRecipe(recipe, stack, true);
|
||||
this.arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (FermenterFuel fuel : FuelManager.fermenterFuel.values()) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(fuel.item, ingred)) {
|
||||
for (CachedFermenterRecipe crecipe : this.getCachedRecipes(recipe, true)) {
|
||||
crecipe.setIngredientPermutation(crecipe.inputItems, ingred);
|
||||
this.arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(FluidStack ingred) {
|
||||
for (IFermenterRecipe recipe : RecipeManagers.fermenterManager.recipes()) {
|
||||
if (NEIUtils.areFluidsSameType(recipe.getFluidResource(), ingred)) {
|
||||
this.arecipes.addAll(this.getCachedRecipes(recipe, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,159 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.factory.recipes.nei;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.fuels.MoistenerFuel;
|
||||
import forestry.api.recipes.IMoistenerRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.factory.gui.GuiMoistener;
|
||||
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
|
||||
public class NEIHandlerMoistener extends RecipeHandlerBase {
|
||||
|
||||
public class CachedMoistenerRecipe extends CachedBaseRecipe {
|
||||
|
||||
public PositionedFluidTank tank;
|
||||
public List<PositionedStack> fuels = new ArrayList<>();
|
||||
public PositionedStack input;
|
||||
public PositionedStack output;
|
||||
|
||||
public CachedMoistenerRecipe(IMoistenerRecipe recipe, MoistenerFuel fuel) {
|
||||
this.tank = new PositionedFluidTank(FluidRegistry.getFluidStack("water", 10000), 10000, new Rectangle(11, 5, 16, 58), NEIHandlerMoistener.this.getGuiTexture(), new Point(176, 0));
|
||||
this.tank.showAmount = false;
|
||||
if (fuel.item != null) {
|
||||
this.fuels.add(new PositionedStack(fuel.item, 34, 47));
|
||||
}
|
||||
if (fuel.product != null) {
|
||||
this.fuels.add(new PositionedStack(fuel.product, 100, 26));
|
||||
}
|
||||
if (recipe.getResource() != null) {
|
||||
this.input = new PositionedStack(recipe.getResource(), 138, 8);
|
||||
}
|
||||
if (recipe.getProduct() != null) {
|
||||
this.output = new PositionedStack(recipe.getProduct(), 138, 44);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks() {
|
||||
return this.fuels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getIngredient() {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedFluidTank getFluidTank() {
|
||||
return this.tank;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "forestry.moistener";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.for.factory.4.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "forestry:textures/gui/moistener.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
this.addTransferRect(138, 27, 16, 14);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return GuiMoistener.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
super.drawBackground(recipe);
|
||||
this.drawProgressBar(88, 6, 176, 91, 29, 55, 80, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
this.drawProgressBar(119, 25, 176, 74, 16, 15, 160, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAllRecipes() {
|
||||
for (IMoistenerRecipe recipe : RecipeManagers.moistenerManager.recipes()) {
|
||||
for (MoistenerFuel fuel : FuelManager.moistenerResource.values()) {
|
||||
this.arecipes.add(new CachedMoistenerRecipe(recipe, fuel));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (IMoistenerRecipe recipe : RecipeManagers.moistenerManager.recipes()) {
|
||||
for (MoistenerFuel fuel : FuelManager.moistenerResource.values()) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getProduct(), result) || NEIServerUtils.areStacksSameTypeCrafting(fuel.product, result)) {
|
||||
this.arecipes.add(new CachedMoistenerRecipe(recipe, fuel));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingred) {
|
||||
super.loadUsageRecipes(ingred);
|
||||
for (IMoistenerRecipe recipe : RecipeManagers.moistenerManager.recipes()) {
|
||||
for (MoistenerFuel fuel : FuelManager.moistenerResource.values()) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getResource(), ingred) || NEIServerUtils.areStacksSameTypeCrafting(fuel.item, ingred)) {
|
||||
this.arecipes.add(new CachedMoistenerRecipe(recipe, fuel));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(FluidStack ingredient) {
|
||||
if (ingredient.getFluid() == FluidRegistry.WATER) {
|
||||
this.loadAllRecipes();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,258 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.factory.recipes.nei;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.ISqueezerRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.recipes.nei.NEIUtils;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.PositionedStackAdv;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.factory.gui.GuiSqueezer;
|
||||
import forestry.factory.recipes.ISqueezerContainerRecipe;
|
||||
import forestry.factory.recipes.SqueezerRecipeManager;
|
||||
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
|
||||
public class NEIHandlerSqueezer extends RecipeHandlerBase {
|
||||
|
||||
private static final int[][] INPUTS = new int[][]{{0, 0}, {1, 0}, {2, 0}, {0, 1}, {1, 1}, {2, 1}, {0, 2}, {1, 2}, {2, 2}};
|
||||
|
||||
public class CachedSqueezerRecipe extends CachedBaseRecipe {
|
||||
|
||||
public List<PositionedStack> inputs = new ArrayList<>();
|
||||
public PositionedFluidTank tank;
|
||||
public PositionedStackAdv remnants = null;
|
||||
public int processingTime;
|
||||
public boolean containerRecipe = false;
|
||||
|
||||
public CachedSqueezerRecipe(ISqueezerRecipe recipe, boolean genPerms) {
|
||||
if (recipe.getResources() != null) {
|
||||
this.setIngredients(recipe.getResources());
|
||||
}
|
||||
if (recipe.getFluidOutput() != null) {
|
||||
setTankFluid(recipe.getFluidOutput());
|
||||
}
|
||||
if (recipe.getRemnants() != null) {
|
||||
this.remnants = new PositionedStackAdv(recipe.getRemnants(), 92, 49).setChance(recipe.getRemnantsChance());
|
||||
}
|
||||
|
||||
this.processingTime = recipe.getProcessingTime();
|
||||
|
||||
if (genPerms) {
|
||||
this.generatePermutations();
|
||||
}
|
||||
}
|
||||
|
||||
public CachedSqueezerRecipe(ISqueezerRecipe recipe) {
|
||||
this(recipe, false);
|
||||
}
|
||||
|
||||
public CachedSqueezerRecipe(ISqueezerContainerRecipe recipe, boolean genPerms) {
|
||||
this.containerRecipe = true;
|
||||
|
||||
ItemStack emptyContainer = recipe.getEmptyContainer();
|
||||
List<ItemStack> ingredients = FluidHelper.getAllFilledContainers(emptyContainer);
|
||||
setIngredients(new Object[]{ingredients});
|
||||
List<FluidStack> fluids = new ArrayList<>();
|
||||
for (ItemStack ingredient : ingredients) {
|
||||
FluidStack fluidStack = FluidHelper.getFluidStackInContainer(ingredient);
|
||||
fluids.add(fluidStack);
|
||||
}
|
||||
setTankFluid(fluids);
|
||||
|
||||
if (recipe.getRemnants() != null) {
|
||||
this.remnants = new PositionedStackAdv(recipe.getRemnants(), 92, 49).setChance(recipe.getRemnantsChance());
|
||||
}
|
||||
|
||||
this.processingTime = recipe.getProcessingTime();
|
||||
|
||||
if (genPerms) {
|
||||
this.generatePermutations();
|
||||
}
|
||||
}
|
||||
|
||||
public void setIngredients(Object[] inputs) {
|
||||
this.inputs.clear();
|
||||
int i = 0;
|
||||
for (Object stack : inputs) {
|
||||
if (i >= INPUTS.length) {
|
||||
return;
|
||||
}
|
||||
this.inputs.add(new PositionedStack(stack, 12 + INPUTS[i][0] * 18, 10 + INPUTS[i][1] * 18, false));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public void setTankFluid(FluidStack... fluidStack) {
|
||||
setTankFluid(Arrays.asList(fluidStack));
|
||||
}
|
||||
|
||||
public void setTankFluid(Collection<FluidStack> fluidStacks) {
|
||||
this.tank = new PositionedFluidTank(fluidStacks, 10000, new Rectangle(117, 7, 16, 58), NEIHandlerSqueezer.this.getGuiTexture(), new Point(176, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return this.getCycledIngredients(NEIHandlerSqueezer.this.cycleticks / 20, this.inputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getCycledIngredients(int cycle, List<PositionedStack> ingredients) {
|
||||
if (containerRecipe) {
|
||||
// cycle ingredients and output together
|
||||
Random random = new Random(cycle);
|
||||
cycle = Math.abs(random.nextInt());
|
||||
for (PositionedStack ingredient : ingredients) {
|
||||
ingredient.setPermutationToRender(cycle % ingredient.items.length);
|
||||
}
|
||||
tank.setPermutationToRender(cycle % tank.getPermutationCount());
|
||||
return ingredients;
|
||||
} else {
|
||||
return super.getCycledIngredients(cycle, ingredients);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedFluidTank getFluidTank() {
|
||||
return this.tank;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return this.remnants;
|
||||
}
|
||||
|
||||
public void generatePermutations() {
|
||||
for (PositionedStack p : this.inputs) {
|
||||
p.generatePermutations();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "forestry.squeezer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.for.factory.5.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "forestry:textures/gui/squeezersocket.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
this.addTransferRect(98 - 16 - 6 - 4, 9 + 8 + 8 + 4, 15 + 16 + 6 + 4, 18);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipeIndex) {
|
||||
CachedRecipe recipe = arecipes.get(recipeIndex);
|
||||
if (recipe instanceof CachedSqueezerRecipe) {
|
||||
int processingTime = ((CachedSqueezerRecipe) recipe).processingTime;
|
||||
this.drawProgressBar(70, 30, 176, 60, 43, 18, processingTime * 5, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return GuiSqueezer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAllRecipes() {
|
||||
for (ISqueezerRecipe recipe : RecipeManagers.squeezerManager.recipes()) {
|
||||
this.arecipes.add(new CachedSqueezerRecipe(recipe, true));
|
||||
}
|
||||
for (ISqueezerContainerRecipe containerRecipe : SqueezerRecipeManager.containerRecipes.values()) {
|
||||
this.arecipes.add(new CachedSqueezerRecipe(containerRecipe, true));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (ISqueezerRecipe recipe : RecipeManagers.squeezerManager.recipes()) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getRemnants(), result)) {
|
||||
this.arecipes.add(new CachedSqueezerRecipe(recipe, true));
|
||||
}
|
||||
}
|
||||
for (ISqueezerContainerRecipe containerRecipe : SqueezerRecipeManager.containerRecipes.values()) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(containerRecipe.getRemnants(), result)) {
|
||||
this.arecipes.add(new CachedSqueezerRecipe(containerRecipe, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(FluidStack result) {
|
||||
for (ISqueezerRecipe recipe : RecipeManagers.squeezerManager.recipes()) {
|
||||
if (NEIUtils.areFluidsSameType(recipe.getFluidOutput(), result)) {
|
||||
this.arecipes.add(new CachedSqueezerRecipe(recipe, true));
|
||||
}
|
||||
}
|
||||
for (ISqueezerContainerRecipe containerRecipe : SqueezerRecipeManager.containerRecipes.values()) {
|
||||
ItemStack emptyContainer = containerRecipe.getEmptyContainer();
|
||||
ItemStack filledContainer = FluidHelper.getFilledContainer(result, emptyContainer);
|
||||
if (filledContainer != null) {
|
||||
ISqueezerRecipe recipe = containerRecipe.getSqueezerRecipe(filledContainer);
|
||||
if (recipe != null) {
|
||||
this.arecipes.add(new CachedSqueezerRecipe(recipe, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingred) {
|
||||
ingred.stackSize = 1;
|
||||
|
||||
ISqueezerContainerRecipe containerRecipe = SqueezerRecipeManager.findMatchingContainerRecipe(ingred);
|
||||
if (containerRecipe != null) {
|
||||
CachedSqueezerRecipe crecipe = new CachedSqueezerRecipe(containerRecipe, true);
|
||||
crecipe.setIngredients(new ItemStack[]{ingred});
|
||||
FluidStack fluidStack = FluidHelper.getFluidStackInContainer(ingred);
|
||||
crecipe.setTankFluid(fluidStack);
|
||||
this.arecipes.add(crecipe);
|
||||
return;
|
||||
}
|
||||
|
||||
ISqueezerRecipe recipe = SqueezerRecipeManager.findMatchingRecipe(new ItemStack[]{ingred});
|
||||
if (recipe != null) {
|
||||
CachedSqueezerRecipe crecipe = new CachedSqueezerRecipe(recipe);
|
||||
// Override recipe to show the right input in case it's OD
|
||||
crecipe.setIngredients(new ItemStack[]{ingred});
|
||||
this.arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.factory.recipes.nei;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.IStillRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.recipes.nei.NEIUtils;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.factory.gui.GuiStill;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.PositionedStack;
|
||||
|
||||
public class NEIHandlerStill extends RecipeHandlerBase {
|
||||
|
||||
public class CachedStillRecipe extends CachedBaseRecipe {
|
||||
|
||||
public List<PositionedFluidTank> tanks = new ArrayList<>();
|
||||
|
||||
public CachedStillRecipe(IStillRecipe recipe) {
|
||||
if (recipe.getInput() != null) {
|
||||
this.tanks.add(new PositionedFluidTank(recipe.getInput(), 10000, new Rectangle(30, 4, 16, 58), NEIHandlerStill.this.getGuiTexture(), new Point(176, 0)));
|
||||
}
|
||||
if (recipe.getOutput() != null) {
|
||||
this.tanks.add(new PositionedFluidTank(recipe.getOutput(), 10000, new Rectangle(120, 4, 16, 58), NEIHandlerStill.this.getGuiTexture(), new Point(176, 0)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedFluidTank> getFluidTanks() {
|
||||
return this.tanks;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "forestry.still";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.for.factory.6.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "forestry:textures/gui/still.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
this.addTransferRect(76, 27, 14, 12);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return GuiStill.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
this.changeToGuiTexture();
|
||||
GuiDraw.drawTexturedModalRect(25, 0, 30, 11, 116, 65);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
this.drawProgressBar(79, 6, 176, 74, 4, 18, 80, 11);
|
||||
GuiDraw.drawTexturedModalRect(77, 46, 176, 60, 14, 14);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAllRecipes() {
|
||||
for (IStillRecipe recipe : RecipeManagers.stillManager.recipes()) {
|
||||
this.arecipes.add(new CachedStillRecipe(recipe));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(FluidStack result) {
|
||||
for (IStillRecipe recipe : RecipeManagers.stillManager.recipes()) {
|
||||
if (NEIUtils.areFluidsSameType(recipe.getOutput(), result)) {
|
||||
this.arecipes.add(new CachedStillRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(FluidStack ingred) {
|
||||
for (IStillRecipe recipe : RecipeManagers.stillManager.recipes()) {
|
||||
if (NEIUtils.areFluidsSameType(recipe.getInput(), ingred)) {
|
||||
this.arecipes.add(new CachedStillRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,14 +19,12 @@ import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.core.config.Constants;
|
||||
@@ -168,39 +166,39 @@ public class TileBottler extends TilePowered implements ISidedInventory, ILiquid
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
return tankManager.fill(from, resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
return tankManager.drain(from, resource, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
return tankManager.drain(from, maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
return tankManager.canFill(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tankManager.canDrain(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return tankManager.getTankInfo(from);
|
||||
}
|
||||
|
||||
/* ITRIGGERPROVIDER */
|
||||
@Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
@Override
|
||||
public Collection<ITriggerExternal> getExternalTriggers(ForgeDirection side, TileEntity tile) {
|
||||
public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
LinkedList<ITriggerExternal> res = new LinkedList<>();
|
||||
res.add(FactoryTriggers.lowResource25);
|
||||
res.add(FactoryTriggers.lowResource10);
|
||||
|
||||
@@ -19,8 +19,7 @@ import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.inventory.InventoryCraftResult;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
@@ -242,7 +241,7 @@ public class TileCarpenter extends TilePowered implements ISidedInventory, ILiqu
|
||||
|
||||
// IFLUIDCONTAINER IMPLEMENTATION
|
||||
@Override
|
||||
public int fill(ForgeDirection direction, FluidStack resource, boolean doFill) {
|
||||
public int fill(EnumFacing direction, FluidStack resource, boolean doFill) {
|
||||
return tankManager.fill(direction, resource, doFill);
|
||||
}
|
||||
|
||||
@@ -252,27 +251,27 @@ public class TileCarpenter extends TilePowered implements ISidedInventory, ILiqu
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
return tankManager.drain(from, resource, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
return tankManager.drain(from, maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
return tankManager.canFill(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tankManager.canDrain(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return tankManager.getTankInfo(from);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,11 +21,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
@@ -199,7 +196,7 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn
|
||||
/* ITRIGGERPROVIDER */
|
||||
@Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
@Override
|
||||
public Collection<ITriggerExternal> getExternalTriggers(ForgeDirection side, TileEntity tile) {
|
||||
public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
LinkedList<ITriggerExternal> res = new LinkedList<>();
|
||||
res.add(FactoryTriggers.lowResource25);
|
||||
res.add(FactoryTriggers.lowResource10);
|
||||
|
||||
@@ -20,8 +20,7 @@ import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
@@ -327,32 +326,32 @@ public class TileFabricator extends TilePowered implements ISlotPickupWatcher, I
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
return tankManager.fill(from, resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
return tankManager.drain(from, resource, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
return tankManager.drain(from, maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
return tankManager.canFill(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tankManager.canDrain(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return tankManager.getTankInfo(from);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,14 +21,12 @@ import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.fuels.FermenterFuel;
|
||||
@@ -297,27 +295,27 @@ public class TileFermenter extends TilePowered implements ISidedInventory, ILiqu
|
||||
|
||||
/* ILiquidTankTile */
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
return resourceTank.fill(resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
return tankManager.drain(from, resource, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int quantityMax, boolean doEmpty) {
|
||||
public FluidStack drain(EnumFacing from, int quantityMax, boolean doEmpty) {
|
||||
return tankManager.drain(from, quantityMax, doEmpty);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
return tankManager.canFill(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tankManager.canDrain(from, fluid);
|
||||
}
|
||||
|
||||
@@ -327,14 +325,14 @@ public class TileFermenter extends TilePowered implements ISidedInventory, ILiqu
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return tankManager.getTankInfo(from);
|
||||
}
|
||||
|
||||
/* ITRIGGERPROVIDER */
|
||||
@Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
@Override
|
||||
public Collection<ITriggerExternal> getExternalTriggers(ForgeDirection side, TileEntity tile) {
|
||||
public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
LinkedList<ITriggerExternal> res = new LinkedList<>();
|
||||
res.add(FactoryTriggers.lowResource25);
|
||||
res.add(FactoryTriggers.lowResource10);
|
||||
|
||||
@@ -83,12 +83,12 @@ public class TileMillRainmaker extends TileMill {
|
||||
@Override
|
||||
public void activate() {
|
||||
if (Proxies.render.hasRendering()) {
|
||||
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "ambient.weather.thunder", 4F,
|
||||
worldObj.playSoundEffect(getPos().getX(), getPos().getY(), getPos().getZ(), "ambient.weather.thunder", 4F,
|
||||
(1.0F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
|
||||
|
||||
float f = xCoord + 0.5F;
|
||||
float f1 = yCoord + 0.0F + (worldObj.rand.nextFloat() * 6F) / 16F;
|
||||
float f2 = zCoord + 0.5F;
|
||||
float f = getPos().getX() + 0.5F;
|
||||
float f1 = getPos().getY() + 0.0F + (worldObj.rand.nextFloat() * 6F) / 16F;
|
||||
float f2 = getPos().getZ() + 0.5F;
|
||||
float f3 = 0.52F;
|
||||
float f4 = worldObj.rand.nextFloat() * 0.6F - 0.3F;
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -137,7 +136,7 @@ public class TileMoistener extends TileBase implements ISidedInventory, ILiquidT
|
||||
}
|
||||
|
||||
// Let's get to work
|
||||
int lightvalue = worldObj.getBlockLightValue(xCoord, yCoord + 1, zCoord);
|
||||
int lightvalue = worldObj.getLightFromNeighbors(getPos().add(0, 1, 0));
|
||||
|
||||
IErrorLogic errorLogic = getErrorLogic();
|
||||
|
||||
@@ -479,7 +478,7 @@ public class TileMoistener extends TileBase implements ISidedInventory, ILiquidT
|
||||
|
||||
/* ILiquidTankTile */
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
return tankManager.fill(from, resource, doFill);
|
||||
}
|
||||
|
||||
@@ -489,27 +488,27 @@ public class TileMoistener extends TileBase implements ISidedInventory, ILiquidT
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
return tankManager.drain(from, resource, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
return tankManager.drain(from, maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
return tankManager.canFill(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tankManager.canDrain(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return tankManager.getTankInfo(from);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -65,7 +65,7 @@ public class TileRaintank extends TileBase implements ISidedInventory, ILiquidTa
|
||||
public void validate() {
|
||||
// Raintanks in desert biomes are useless
|
||||
if (worldObj != null) {
|
||||
BiomeGenBase biome = worldObj.getBiomeGenForCoordsBody(xCoord, zCoord);
|
||||
BiomeGenBase biome = worldObj.getBiomeGenForCoordsBody(getPos());
|
||||
isValidBiome = BiomeHelper.canRainOrSnow(biome);
|
||||
getErrorLogic().setCondition(!isValidBiome, EnumErrorCode.NO_RAIN_BIOME);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public class TileRaintank extends TileBase implements ISidedInventory, ILiquidTa
|
||||
|
||||
errorLogic.setCondition(!isValidBiome, EnumErrorCode.NO_RAIN_BIOME);
|
||||
|
||||
boolean hasSky = worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
|
||||
boolean hasSky = worldObj.canBlockSeeSky(getPos().add(0, 1, 0));
|
||||
errorLogic.setCondition(!hasSky, EnumErrorCode.NO_SKY_RAIN_TANK);
|
||||
|
||||
errorLogic.setCondition(!worldObj.isRaining(), EnumErrorCode.NOT_RAINING);
|
||||
@@ -171,27 +171,27 @@ public class TileRaintank extends TileBase implements ISidedInventory, ILiquidTa
|
||||
|
||||
// / ILIQUIDCONTAINER IMPLEMENTATION
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
return tankManager.fill(from, resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
return tankManager.drain(from, resource, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
return tankManager.drain(from, maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
return tankManager.canFill(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tankManager.canDrain(from, fluid);
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ public class TileRaintank extends TileBase implements ISidedInventory, ILiquidTa
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return tankManager.getTankInfo(from);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
@@ -212,32 +211,32 @@ public class TileSqueezer extends TilePowered implements ISocketable, ISidedInve
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
return tankManager.fill(from, resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
return tankManager.drain(from, resource, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
return tankManager.drain(from, maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
return tankManager.canFill(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tankManager.canDrain(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return tankManager.getTankInfo(from);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,13 +15,11 @@ import java.io.IOException;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.recipes.IStillRecipe;
|
||||
import forestry.core.config.Constants;
|
||||
@@ -178,27 +176,27 @@ public class TileStill extends TilePowered implements ISidedInventory, ILiquidTa
|
||||
|
||||
/* IFluidHandler */
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
return tankManager.fill(from, resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
return tankManager.drain(from, resource, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int quantityMax, boolean doEmpty) {
|
||||
public FluidStack drain(EnumFacing from, int quantityMax, boolean doEmpty) {
|
||||
return tankManager.drain(from, quantityMax, doEmpty);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
return tankManager.canFill(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tankManager.canDrain(from, fluid);
|
||||
}
|
||||
|
||||
@@ -208,7 +206,7 @@ public class TileStill extends TilePowered implements ISidedInventory, ILiquidTa
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return tankManager.getTankInfo(from);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,7 @@
|
||||
package forestry.factory.triggers;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.tiles.TilePowered;
|
||||
import forestry.core.triggers.Trigger;
|
||||
@@ -39,7 +37,7 @@ public class TriggerLowFuel extends Trigger {
|
||||
* Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
*/
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
|
||||
if (tile instanceof TilePowered) {
|
||||
return !((TilePowered) tile).hasFuelMin(threshold);
|
||||
|
||||
@@ -11,9 +11,7 @@
|
||||
package forestry.factory.triggers;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import forestry.core.tiles.TilePowered;
|
||||
import forestry.core.triggers.Trigger;
|
||||
|
||||
@@ -38,7 +36,7 @@ public class TriggerLowResource extends Trigger {
|
||||
* Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
*/
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
if (!(tile instanceof TilePowered)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user