diff --git a/src/api/java/buildcraft/api/transport/IInjectable.java b/src/api/java/buildcraft/api/transport/IInjectable.java deleted file mode 100755 index 6a05a688a..000000000 --- a/src/api/java/buildcraft/api/transport/IInjectable.java +++ /dev/null @@ -1,23 +0,0 @@ -package buildcraft.api.transport; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import buildcraft.api.core.EnumColor; - -public interface IInjectable { - boolean canInjectItems(ForgeDirection from); - - /** - * Offers an ItemStack for 3addition to the pipe. Will be rejected if the - * pipe doesn't accept items from that side. - * - * @param stack ItemStack offered for addition. Do not manipulate this! - * @param doAdd If false no actual addition should take place. Implementors - * should simulate. - * @param from Orientation the ItemStack is offered from. - * @param color The color of the item to be added to the pipe, or null for no color. - * @return Amount of items used from the passed stack. - */ - int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from, EnumColor color); -} diff --git a/src/api/java/buildcraft/api/transport/IItemPipe.java b/src/api/java/buildcraft/api/transport/IItemPipe.java deleted file mode 100755 index f5f766775..000000000 --- a/src/api/java/buildcraft/api/transport/IItemPipe.java +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public - * License 1.0, or MMPL. Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - */ -package buildcraft.api.transport; - -/** - * To be implemented by the real item pipe in Transport mod, but leaves knowledge for classes that do not have direct dependency on transport. - */ -public interface IItemPipe { - -} diff --git a/src/api/java/buildcraft/api/transport/IPipe.java b/src/api/java/buildcraft/api/transport/IPipe.java deleted file mode 100755 index 94b021d02..000000000 --- a/src/api/java/buildcraft/api/transport/IPipe.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.transport; - -import net.minecraftforge.common.util.ForgeDirection; - -import buildcraft.api.gates.IGate; - -public interface IPipe { - IPipeTile getTile(); - - IGate getGate(ForgeDirection side); - - boolean hasGate(ForgeDirection side); - - boolean isWired(PipeWire wire); - - boolean isWireActive(PipeWire wire); -} diff --git a/src/api/java/buildcraft/api/transport/IPipeConnection.java b/src/api/java/buildcraft/api/transport/IPipeConnection.java deleted file mode 100755 index 4899f24bd..000000000 --- a/src/api/java/buildcraft/api/transport/IPipeConnection.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.transport; - -import net.minecraftforge.common.util.ForgeDirection; - -public interface IPipeConnection { - - enum ConnectOverride { - - CONNECT, DISCONNECT, DEFAULT - } - - /** - * Allows you to override pipe connection logic. - * - * @param type - * @param with - * @return CONNECT to force a connection, DISCONNECT to force no connection, - * and DEFAULT to let the pipe decide. - */ - ConnectOverride overridePipeConnection(IPipeTile.PipeType type, ForgeDirection with); -} diff --git a/src/api/java/buildcraft/api/transport/IPipeTile.java b/src/api/java/buildcraft/api/transport/IPipeTile.java deleted file mode 100755 index 1bdd04f09..000000000 --- a/src/api/java/buildcraft/api/transport/IPipeTile.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.transport; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import buildcraft.api.core.EnumColor; -import buildcraft.api.transport.pluggable.PipePluggable; - -public interface IPipeTile extends IInjectable { - enum PipeType { - ITEM, FLUID, POWER, STRUCTURE - } - - PipeType getPipeType(); - - World getWorld(); - - int x(); - - int y(); - - int z(); - - /** - * True if the pipe is connected to the block/pipe in the specific direction - * - * @param with - * @return true if connect - */ - boolean isPipeConnected(ForgeDirection with); - - Block getNeighborBlock(ForgeDirection dir); - TileEntity getNeighborTile(ForgeDirection dir); - IPipe getNeighborPipe(ForgeDirection dir); - - IPipe getPipe(); - int getPipeColor(); - - PipePluggable getPipePluggable(ForgeDirection direction); // Now in IPluggableProvider - boolean hasPipePluggable(ForgeDirection direction); // Now in IPluggableProvider - boolean hasBlockingPluggable(ForgeDirection direction); - - void scheduleNeighborChange(); - void scheduleRenderUpdate(); - - // For compatibility with BC 6.2.x and below - int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from, EnumColor color); - - @Deprecated // Now in IInjectable - int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from); -} diff --git a/src/api/java/buildcraft/api/transport/IStripesActivator.java b/src/api/java/buildcraft/api/transport/IStripesActivator.java deleted file mode 100755 index 47308ae0a..000000000 --- a/src/api/java/buildcraft/api/transport/IStripesActivator.java +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.transport; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -public interface IStripesActivator { - void sendItem(ItemStack itemStack, ForgeDirection direction); - void dropItem(ItemStack itemStack, ForgeDirection direction); -} diff --git a/src/api/java/buildcraft/api/transport/IStripesHandler.java b/src/api/java/buildcraft/api/transport/IStripesHandler.java deleted file mode 100755 index fd6f4f113..000000000 --- a/src/api/java/buildcraft/api/transport/IStripesHandler.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.transport; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public interface IStripesHandler { - enum StripesHandlerType { - ITEM_USE, - BLOCK_BREAK - } - - StripesHandlerType getType(); - - boolean shouldHandle(ItemStack stack); - - boolean handle(World world, int x, int y, int z, ForgeDirection direction, - ItemStack stack, EntityPlayer player, IStripesActivator activator); -} diff --git a/src/api/java/buildcraft/api/transport/IStripesPipe.java b/src/api/java/buildcraft/api/transport/IStripesPipe.java deleted file mode 100755 index cd9156fa7..000000000 --- a/src/api/java/buildcraft/api/transport/IStripesPipe.java +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.transport; - -import cofh.api.energy.IEnergyHandler; - -public interface IStripesPipe extends IPipe, IStripesActivator, IEnergyHandler { -} diff --git a/src/api/java/buildcraft/api/transport/PipeManager.java b/src/api/java/buildcraft/api/transport/PipeManager.java deleted file mode 100755 index 896f08210..000000000 --- a/src/api/java/buildcraft/api/transport/PipeManager.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.transport; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import net.minecraft.world.World; - -import buildcraft.api.transport.pluggable.PipePluggable; - -public abstract class PipeManager { - - public static List stripesHandlers = new ArrayList(); - public static ArrayList> pipePluggables = new ArrayList>(); - private static Map> pipePluggableNames = - new HashMap>(); - private static Map, String> pipePluggableByNames = - new HashMap, String>(); - private static Map stripesHandlerPriorities = - new HashMap(); - - @Deprecated - public static boolean canExtractItems(Object extractor, World world, int i, int j, int k) { - return true; - } - - @Deprecated - public static boolean canExtractFluids(Object extractor, World world, int i, int j, int k) { - return true; - } - - @Deprecated - public static void registerStripesHandler(IStripesHandler handler) { - registerStripesHandler(handler, 0); - } - - /** - * Register a Stripes Pipe handler. - * @param handler The handler. - * @param priority The priority - 0 is normal, higher numbers have higher priority. - */ - public static void registerStripesHandler(IStripesHandler handler, int priority) { - stripesHandlers.add(handler); - stripesHandlerPriorities.put(handler, priority); - - Collections.sort(stripesHandlers, new Comparator() { - @Override - public int compare(IStripesHandler o1, IStripesHandler o2) { - return stripesHandlerPriorities.get(o2) - stripesHandlerPriorities.get(o1); - } - }); - } - - public static void registerPipePluggable(Class pluggable, String name) { - pipePluggables.add(pluggable); - pipePluggableNames.put(name, pluggable); - pipePluggableByNames.put(pluggable, name); - } - - public static Class getPluggableByName(String pluggableName) { - return pipePluggableNames.get(pluggableName); - } - - public static String getPluggableName(Class aClass) { - return pipePluggableByNames.get(aClass); - } -} diff --git a/src/api/java/buildcraft/api/transport/PipeWire.java b/src/api/java/buildcraft/api/transport/PipeWire.java deleted file mode 100755 index eb8665e15..000000000 --- a/src/api/java/buildcraft/api/transport/PipeWire.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.transport; - -import java.util.Locale; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public enum PipeWire { - - RED, BLUE, GREEN, YELLOW; - public static Item item; - public static final PipeWire[] VALUES = values(); - - public PipeWire reverse() { - switch (this) { - case RED: - return YELLOW; - case BLUE: - return GREEN; - case GREEN: - return BLUE; - default: - return RED; - } - } - - public String getTag() { - return name().toLowerCase(Locale.ENGLISH) + "PipeWire"; - } - - public String getColor() { - String name = this.toString().toLowerCase(Locale.ENGLISH); - char first = Character.toUpperCase(name.charAt(0)); - return first + name.substring(1); - } - - public ItemStack getStack() { - return getStack(1); - } - - public ItemStack getStack(int qty) { - if (item == null) { - return null; - } else { - return new ItemStack(item, qty, ordinal()); - } - } - - public boolean isPipeWire(ItemStack stack) { - if (stack == null) { - return false; - } else if (stack.getItem() != item) { - return false; - } else { - return stack.getItemDamage() == ordinal(); - } - } - - public static PipeWire fromOrdinal(int ordinal) { - if (ordinal < 0 || ordinal >= VALUES.length) { - return RED; - } else { - return VALUES[ordinal]; - } - } -} diff --git a/src/api/java/buildcraft/api/transport/package-info.java b/src/api/java/buildcraft/api/transport/package-info.java deleted file mode 100755 index b670143c6..000000000 --- a/src/api/java/buildcraft/api/transport/package-info.java +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -@API(apiVersion = "4.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|transport") -package buildcraft.api.transport; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/buildcraft/api/transport/pluggable/IFacadePluggable.java b/src/api/java/buildcraft/api/transport/pluggable/IFacadePluggable.java deleted file mode 100755 index 6289714ac..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/IFacadePluggable.java +++ /dev/null @@ -1,13 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import net.minecraft.block.Block; - -public interface IFacadePluggable { - Block getCurrentBlock(); - - int getCurrentMetadata(); - - boolean isTransparent(); - - boolean isHollow(); -} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableDynamicRenderer.java b/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableDynamicRenderer.java deleted file mode 100755 index 614c65ff9..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableDynamicRenderer.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import net.minecraftforge.common.util.ForgeDirection; - -import buildcraft.api.transport.IPipe; - -public interface IPipePluggableDynamicRenderer { - void renderPluggable(IPipe pipe, ForgeDirection side, PipePluggable pipePluggable, double x, double y, double z); -} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableItem.java b/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableItem.java deleted file mode 100755 index 0ac208905..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableItem.java +++ /dev/null @@ -1,10 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import buildcraft.api.transport.IPipe; - -public interface IPipePluggableItem { - PipePluggable createPipePluggable(IPipe pipe, ForgeDirection side, ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableRenderer.java b/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableRenderer.java deleted file mode 100755 index a0072c9d2..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableRenderer.java +++ /dev/null @@ -1,13 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraftforge.common.util.ForgeDirection; - -import buildcraft.api.core.render.ITextureStates; -import buildcraft.api.transport.IPipe; - -public interface IPipePluggableRenderer { - void renderPluggable(RenderBlocks renderblocks, IPipe pipe, ForgeDirection side, - PipePluggable pipePluggable, ITextureStates blockStateMachine, - int renderPass, int x, int y, int z); -} diff --git a/src/api/java/buildcraft/api/transport/pluggable/PipePluggable.java b/src/api/java/buildcraft/api/transport/pluggable/PipePluggable.java deleted file mode 100755 index 223ce7096..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/PipePluggable.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.transport.pluggable; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraftforge.common.util.ForgeDirection; - -import buildcraft.api.core.INBTStoreable; -import buildcraft.api.core.ISerializable; -import buildcraft.api.transport.IPipeTile; - -/** - * An IPipePluggable MUST have an empty constructor for client-side - * rendering! - */ -public abstract class PipePluggable implements INBTStoreable, ISerializable { - public abstract ItemStack[] getDropItems(IPipeTile pipe); - - public void update(IPipeTile pipe, ForgeDirection direction) { - - } - - public void onAttachedPipe(IPipeTile pipe, ForgeDirection direction) { - validate(pipe, direction); - } - - public void onDetachedPipe(IPipeTile pipe, ForgeDirection direction) { - invalidate(); - } - - public abstract boolean isBlocking(IPipeTile pipe, ForgeDirection direction); - - public void invalidate() { - - } - - public void validate(IPipeTile pipe, ForgeDirection direction) { - - } - - public boolean isSolidOnSide(IPipeTile pipe, ForgeDirection direction) { - return false; - } - - public abstract AxisAlignedBB getBoundingBox(ForgeDirection side); - - @SideOnly(Side.CLIENT) - public abstract IPipePluggableRenderer getRenderer(); - - @SideOnly(Side.CLIENT) - public IPipePluggableDynamicRenderer getDynamicRenderer() { - return null; - } - - public boolean requiresRenderUpdate(PipePluggable old) { - return true; - } -} diff --git a/src/main/java/mekanism/common/recipe/RecipeHandler.java b/src/main/java/mekanism/common/recipe/RecipeHandler.java index 07f733a5c..738b9cc35 100644 --- a/src/main/java/mekanism/common/recipe/RecipeHandler.java +++ b/src/main/java/mekanism/common/recipe/RecipeHandler.java @@ -1,58 +1,23 @@ package mekanism.common.recipe; +import mekanism.api.gas.Gas; +import mekanism.api.gas.GasStack; +import mekanism.api.infuse.InfuseType; +import mekanism.api.util.StackUtils; +import mekanism.common.block.BlockMachine.MachineType; +import mekanism.common.recipe.inputs.*; +import mekanism.common.recipe.machines.*; +import mekanism.common.recipe.outputs.*; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + import java.lang.reflect.Constructor; import java.util.HashMap; import java.util.Map; import java.util.Set; -import mekanism.api.gas.GasStack; -import mekanism.api.infuse.InfuseType; -import mekanism.api.util.StackUtils; -import mekanism.common.block.BlockMachine.MachineType; -import mekanism.common.recipe.inputs.AdvancedMachineInput; -import mekanism.common.recipe.inputs.ChemicalPairInput; -import mekanism.common.recipe.inputs.FluidInput; -import mekanism.common.recipe.inputs.GasInput; -import mekanism.common.recipe.inputs.InfusionInput; -import mekanism.common.recipe.inputs.IntegerInput; -import mekanism.common.recipe.inputs.ItemStackInput; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.inputs.PressurizedInput; -import mekanism.common.recipe.machines.AdvancedMachineRecipe; -import mekanism.common.recipe.machines.AmbientGasRecipe; -import mekanism.common.recipe.machines.BasicMachineRecipe; -import mekanism.common.recipe.machines.ChanceMachineRecipe; -import mekanism.common.recipe.machines.ChemicalInfuserRecipe; -import mekanism.common.recipe.machines.CombinerRecipe; -import mekanism.common.recipe.machines.CrusherRecipe; -import mekanism.common.recipe.machines.CrystallizerRecipe; -import mekanism.common.recipe.machines.DissolutionRecipe; -import mekanism.common.recipe.machines.EnrichmentRecipe; -import mekanism.common.recipe.machines.InjectionRecipe; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.machines.MetallurgicInfuserRecipe; -import mekanism.common.recipe.machines.OsmiumCompressorRecipe; -import mekanism.common.recipe.machines.OxidationRecipe; -import mekanism.common.recipe.machines.PressurizedRecipe; -import mekanism.common.recipe.machines.PurificationRecipe; -import mekanism.common.recipe.machines.SawmillRecipe; -import mekanism.common.recipe.machines.SeparatorRecipe; -import mekanism.common.recipe.machines.SmeltingRecipe; -import mekanism.common.recipe.machines.SolarEvaporationRecipe; -import mekanism.common.recipe.machines.SolarNeutronRecipe; -import mekanism.common.recipe.machines.WasherRecipe; -import mekanism.common.recipe.outputs.ChanceOutput; -import mekanism.common.recipe.outputs.ChemicalPairOutput; -import mekanism.common.recipe.outputs.FluidOutput; -import mekanism.common.recipe.outputs.GasOutput; -import mekanism.common.recipe.outputs.ItemStackOutput; -import mekanism.common.recipe.outputs.MachineOutput; -import mekanism.common.recipe.outputs.PressurizedOutput; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - /** * Class used to handle machine recipes. This is used for both adding and fetching recipes. * @author AidanBrady, unpairedbracket @@ -676,6 +641,27 @@ public final class RecipeHandler return false; } + public boolean containsRecipe(Gas input) + { + for(Object obj : get().entrySet()) + { + if(obj instanceof Map.Entry) + { + Map.Entry entry = (Map.Entry)obj; + + if(entry.getKey() instanceof GasInput) + { + if(((GasInput)entry.getKey()).ingredient.getGas() == input) + { + return true; + } + } + } + } + + return false; + } + public HashMap get() { return recipes; diff --git a/src/main/java/mekanism/common/tile/TileEntityChemicalCrystallizer.java b/src/main/java/mekanism/common/tile/TileEntityChemicalCrystallizer.java index 093c85784..9c7acc0ea 100644 --- a/src/main/java/mekanism/common/tile/TileEntityChemicalCrystallizer.java +++ b/src/main/java/mekanism/common/tile/TileEntityChemicalCrystallizer.java @@ -1,31 +1,16 @@ package mekanism.common.tile; import io.netty.buffer.ByteBuf; - -import java.util.ArrayList; - import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.MekanismConfig.usage; import mekanism.api.Range4D; -import mekanism.api.gas.Gas; -import mekanism.api.gas.GasRegistry; -import mekanism.api.gas.GasStack; -import mekanism.api.gas.GasTank; -import mekanism.api.gas.GasTransmission; -import mekanism.api.gas.IGasHandler; -import mekanism.api.gas.IGasItem; -import mekanism.api.gas.ITubeConnection; +import mekanism.api.gas.*; import mekanism.api.transmitters.TransmissionType; import mekanism.common.Mekanism; import mekanism.common.SideData; import mekanism.common.Upgrade; -import mekanism.common.base.IEjector; -import mekanism.common.base.IRedstoneControl; -import mekanism.common.base.ISideConfiguration; -import mekanism.common.base.ISustainedData; -import mekanism.common.base.ITankManager; -import mekanism.common.base.IUpgradeTile; +import mekanism.common.base.*; import mekanism.common.block.BlockMachine.MachineType; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.recipe.RecipeHandler; @@ -37,13 +22,11 @@ import mekanism.common.tile.component.TileComponentUpgrade; import mekanism.common.util.ChargeUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; + +import java.util.ArrayList; public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, ISideConfiguration, IUpgradeTile, ISustainedData, ITankManager { @@ -327,7 +310,8 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock @Override public boolean canReceiveGas(ForgeDirection side, Gas type) { - return configComponent.getOutput(TransmissionType.GAS, side.ordinal(), facing).hasSlot(0) && inputTank.canReceive(type); + return configComponent.getOutput(TransmissionType.GAS, side.ordinal(), facing).hasSlot(0) && inputTank.canReceive(type) && + RecipeHandler.Recipe.CHEMICAL_CRYSTALLIZER.containsRecipe(type); } @Override @@ -389,7 +373,8 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock { if(slotID == 0) { - return FluidContainerRegistry.getFluidForFilledItem(itemstack) != null && FluidContainerRegistry.getFluidForFilledItem(itemstack).getFluid() == FluidRegistry.WATER; + return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).getGas(itemstack) != null && + RecipeHandler.Recipe.CHEMICAL_CRYSTALLIZER.containsRecipe(((IGasItem)itemstack.getItem()).getGas(itemstack).getGas()); } else if(slotID == 2) { @@ -404,7 +389,7 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock { if(slotID == 0) { - return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null); + return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).getGas(itemstack) == null; } else if(slotID == 1) { diff --git a/src/main/java/mekanism/common/tile/TileEntityChemicalWasher.java b/src/main/java/mekanism/common/tile/TileEntityChemicalWasher.java index 8e44c03d5..5b3409a6a 100644 --- a/src/main/java/mekanism/common/tile/TileEntityChemicalWasher.java +++ b/src/main/java/mekanism/common/tile/TileEntityChemicalWasher.java @@ -1,21 +1,10 @@ package mekanism.common.tile; import io.netty.buffer.ByteBuf; - -import java.util.ArrayList; -import java.util.List; - import mekanism.api.Coord4D; import mekanism.api.MekanismConfig.usage; import mekanism.api.Range4D; -import mekanism.api.gas.Gas; -import mekanism.api.gas.GasRegistry; -import mekanism.api.gas.GasStack; -import mekanism.api.gas.GasTank; -import mekanism.api.gas.GasTransmission; -import mekanism.api.gas.IGasHandler; -import mekanism.api.gas.IGasItem; -import mekanism.api.gas.ITubeConnection; +import mekanism.api.gas.*; import mekanism.common.Mekanism; import mekanism.common.Upgrade; import mekanism.common.Upgrade.IUpgradeInfoHandler; @@ -29,25 +18,15 @@ import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.inputs.GasInput; import mekanism.common.recipe.machines.WasherRecipe; import mekanism.common.tile.component.TileComponentUpgrade; -import mekanism.common.util.ChargeUtils; -import mekanism.common.util.FluidContainerUtils; -import mekanism.common.util.InventoryUtils; -import mekanism.common.util.MekanismUtils; -import mekanism.common.util.PipeUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; +import mekanism.common.util.*; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTank; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidContainerItem; -import net.minecraftforge.fluids.IFluidHandler; +import net.minecraftforge.fluids.*; + +import java.util.ArrayList; +import java.util.List; public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, IFluidHandler, IUpgradeTile, ISustainedData, IUpgradeInfoHandler, ITankManager { @@ -434,13 +413,18 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple @Override public boolean canTubeConnect(ForgeDirection side) { - return side == MekanismUtils.getLeft(facing) || side == MekanismUtils.getRight(facing); + return getTank(side) != null; } @Override public boolean canReceiveGas(ForgeDirection side, Gas type) { - return getTank(side) != null && getTank(side) != outputTank ? getTank(side).canReceive(type) : false; + if(getTank(side) == inputTank) + { + return getTank(side).canReceive(type) && RecipeHandler.Recipe.CHEMICAL_WASHER.containsRecipe(type); + } + + return false; } @Override