Improved chemical machines side config
This commit is contained in:
parent
a14b0d77ad
commit
de839808d7
19 changed files with 56 additions and 591 deletions
|
@ -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);
|
|
||||||
}
|
|
|
@ -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 {
|
|
||||||
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -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 {
|
|
||||||
}
|
|
|
@ -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<IStripesHandler> stripesHandlers = new ArrayList<IStripesHandler>();
|
|
||||||
public static ArrayList<Class<? extends PipePluggable>> pipePluggables = new ArrayList<Class<? extends PipePluggable>>();
|
|
||||||
private static Map<String, Class<? extends PipePluggable>> pipePluggableNames =
|
|
||||||
new HashMap<String, Class<? extends PipePluggable>>();
|
|
||||||
private static Map<Class<? extends PipePluggable>, String> pipePluggableByNames =
|
|
||||||
new HashMap<Class<? extends PipePluggable>, String>();
|
|
||||||
private static Map<IStripesHandler, Integer> stripesHandlerPriorities =
|
|
||||||
new HashMap<IStripesHandler, Integer>();
|
|
||||||
|
|
||||||
@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<IStripesHandler>() {
|
|
||||||
@Override
|
|
||||||
public int compare(IStripesHandler o1, IStripesHandler o2) {
|
|
||||||
return stripesHandlerPriorities.get(o2) - stripesHandlerPriorities.get(o1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void registerPipePluggable(Class<? extends PipePluggable> 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<? extends PipePluggable> aClass) {
|
|
||||||
return pipePluggableByNames.get(aClass);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
|
|
|
@ -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();
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,58 +1,23 @@
|
||||||
package mekanism.common.recipe;
|
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.lang.reflect.Constructor;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
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.
|
* Class used to handle machine recipes. This is used for both adding and fetching recipes.
|
||||||
* @author AidanBrady, unpairedbracket
|
* @author AidanBrady, unpairedbracket
|
||||||
|
@ -676,6 +641,27 @@ public final class RecipeHandler
|
||||||
return false;
|
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()
|
public HashMap get()
|
||||||
{
|
{
|
||||||
return recipes;
|
return recipes;
|
||||||
|
|
|
@ -1,31 +1,16 @@
|
||||||
package mekanism.common.tile;
|
package mekanism.common.tile;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
import mekanism.api.EnumColor;
|
import mekanism.api.EnumColor;
|
||||||
import mekanism.api.MekanismConfig.usage;
|
import mekanism.api.MekanismConfig.usage;
|
||||||
import mekanism.api.Range4D;
|
import mekanism.api.Range4D;
|
||||||
import mekanism.api.gas.Gas;
|
import mekanism.api.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.transmitters.TransmissionType;
|
import mekanism.api.transmitters.TransmissionType;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.Mekanism;
|
||||||
import mekanism.common.SideData;
|
import mekanism.common.SideData;
|
||||||
import mekanism.common.Upgrade;
|
import mekanism.common.Upgrade;
|
||||||
import mekanism.common.base.IEjector;
|
import mekanism.common.base.*;
|
||||||
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.block.BlockMachine.MachineType;
|
import mekanism.common.block.BlockMachine.MachineType;
|
||||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||||
import mekanism.common.recipe.RecipeHandler;
|
import mekanism.common.recipe.RecipeHandler;
|
||||||
|
@ -37,13 +22,11 @@ import mekanism.common.tile.component.TileComponentUpgrade;
|
||||||
import mekanism.common.util.ChargeUtils;
|
import mekanism.common.util.ChargeUtils;
|
||||||
import mekanism.common.util.InventoryUtils;
|
import mekanism.common.util.InventoryUtils;
|
||||||
import mekanism.common.util.MekanismUtils;
|
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.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
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
|
public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, ISideConfiguration, IUpgradeTile, ISustainedData, ITankManager
|
||||||
{
|
{
|
||||||
|
@ -327,7 +310,8 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock
|
||||||
@Override
|
@Override
|
||||||
public boolean canReceiveGas(ForgeDirection side, Gas type)
|
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
|
@Override
|
||||||
|
@ -389,7 +373,8 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock
|
||||||
{
|
{
|
||||||
if(slotID == 0)
|
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)
|
else if(slotID == 2)
|
||||||
{
|
{
|
||||||
|
@ -404,7 +389,7 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock
|
||||||
{
|
{
|
||||||
if(slotID == 0)
|
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)
|
else if(slotID == 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,21 +1,10 @@
|
||||||
package mekanism.common.tile;
|
package mekanism.common.tile;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
import mekanism.api.MekanismConfig.usage;
|
import mekanism.api.MekanismConfig.usage;
|
||||||
import mekanism.api.Range4D;
|
import mekanism.api.Range4D;
|
||||||
import mekanism.api.gas.Gas;
|
import mekanism.api.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.common.Mekanism;
|
import mekanism.common.Mekanism;
|
||||||
import mekanism.common.Upgrade;
|
import mekanism.common.Upgrade;
|
||||||
import mekanism.common.Upgrade.IUpgradeInfoHandler;
|
import mekanism.common.Upgrade.IUpgradeInfoHandler;
|
||||||
|
@ -29,25 +18,15 @@ import mekanism.common.recipe.RecipeHandler;
|
||||||
import mekanism.common.recipe.inputs.GasInput;
|
import mekanism.common.recipe.inputs.GasInput;
|
||||||
import mekanism.common.recipe.machines.WasherRecipe;
|
import mekanism.common.recipe.machines.WasherRecipe;
|
||||||
import mekanism.common.tile.component.TileComponentUpgrade;
|
import mekanism.common.tile.component.TileComponentUpgrade;
|
||||||
import mekanism.common.util.ChargeUtils;
|
import mekanism.common.util.*;
|
||||||
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 net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.*;
|
||||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
|
||||||
import net.minecraftforge.fluids.FluidRegistry;
|
import java.util.ArrayList;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import java.util.List;
|
||||||
import net.minecraftforge.fluids.FluidTank;
|
|
||||||
import net.minecraftforge.fluids.FluidTankInfo;
|
|
||||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
|
||||||
import net.minecraftforge.fluids.IFluidHandler;
|
|
||||||
|
|
||||||
public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, IFluidHandler, IUpgradeTile, ISustainedData, IUpgradeInfoHandler, ITankManager
|
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
|
@Override
|
||||||
public boolean canTubeConnect(ForgeDirection side)
|
public boolean canTubeConnect(ForgeDirection side)
|
||||||
{
|
{
|
||||||
return side == MekanismUtils.getLeft(facing) || side == MekanismUtils.getRight(facing);
|
return getTank(side) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canReceiveGas(ForgeDirection side, Gas type)
|
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
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue