Remove bits of APIs that are unneeded. First step in attempting to Do It Right™
This commit is contained in:
parent
d5812b63ec
commit
82a708c7b2
142 changed files with 18 additions and 7774 deletions
|
@ -1,76 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.blueprints;
|
||||
|
||||
public class BlockSignature {
|
||||
|
||||
public String blockClassName;
|
||||
public String tileClassName;
|
||||
public String blockName;
|
||||
public String mod;
|
||||
public String modVersion;
|
||||
public String customField;
|
||||
|
||||
public BlockSignature(String str) {
|
||||
String[] values = str.split("/");
|
||||
|
||||
int i = 0;
|
||||
|
||||
if (values[0].equals("#B")) {
|
||||
i++;
|
||||
}
|
||||
|
||||
blockClassName = values[i];
|
||||
tileClassName = values[i + 1];
|
||||
blockName = values[i + 2];
|
||||
mod = values[i + 3];
|
||||
modVersion = values[i + 4];
|
||||
customField = values[i + 5];
|
||||
|
||||
replaceNullWithStar();
|
||||
|
||||
}
|
||||
|
||||
public BlockSignature() {
|
||||
replaceNullWithStar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
replaceNullWithStar();
|
||||
|
||||
return "#B/" + blockClassName + "/" + tileClassName + "/" + blockName + "/" + mod + "/" + modVersion + "/" + customField;
|
||||
}
|
||||
|
||||
public void replaceNullWithStar() {
|
||||
if (blockClassName == null) {
|
||||
blockClassName = "*";
|
||||
}
|
||||
|
||||
if (tileClassName == null) {
|
||||
tileClassName = "*";
|
||||
}
|
||||
|
||||
if (blockName == null) {
|
||||
blockName = "*";
|
||||
}
|
||||
|
||||
if (mod == null) {
|
||||
mod = "*";
|
||||
}
|
||||
|
||||
if (modVersion == null) {
|
||||
modVersion = "*";
|
||||
}
|
||||
|
||||
if (customField == null) {
|
||||
customField = "*";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.blueprints;
|
||||
|
||||
import buildcraft.api.core.BuildCraftAPI;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Deprecated
|
||||
public class BlueprintManager {
|
||||
|
||||
//public static BptBlock[] blockBptProps = new BptBlock[Block.blocksList.length];
|
||||
|
||||
public static ItemSignature getItemSignature(Item item) {
|
||||
ItemSignature sig = new ItemSignature();
|
||||
|
||||
//if (item.itemID >= Block.blocksList.length + BuildCraftAPI.LAST_ORIGINAL_ITEM) {
|
||||
// sig.itemClassName = item.getClass().getSimpleName();
|
||||
//}
|
||||
|
||||
sig.itemName = item.getUnlocalizedName(new ItemStack(item));
|
||||
|
||||
return sig;
|
||||
}
|
||||
|
||||
public static BlockSignature getBlockSignature(Block block) {
|
||||
//return BlueprintManager.blockBptProps[0].getSignature(block);
|
||||
return null;
|
||||
}
|
||||
|
||||
static {
|
||||
// Initialize defaults for block properties.
|
||||
//for (int i = 0; i < BlueprintManager.blockBptProps.length; ++i) {
|
||||
// new BptBlock(i);
|
||||
//}
|
||||
}
|
||||
}
|
|
@ -1,234 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.blueprints;
|
||||
|
||||
import buildcraft.api.core.BuildCraftAPI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* This class allow to specify specific behavior for blocks stored in blueprints:
|
||||
*
|
||||
* - what items needs to be used to create that block - how the block has to be built on the world - how to rotate the block - what extra data to store / load
|
||||
* in the blueprint
|
||||
*
|
||||
* Default implementations of this can be seen in the package buildcraft.api.bptblocks. The class BptBlockUtils provide some additional utilities.
|
||||
*
|
||||
* Blueprints perform "id translation" in case the block ids between a blueprint and the world installation are different. In order to translate block ids,
|
||||
* blocks needs to be uniquely identified. By default, this identification is done by:
|
||||
*
|
||||
* - the block simple class name - the tile simple class name (if any) - the block name
|
||||
*
|
||||
* In certain circumstances, the above is not enough (e.g. if several blocks share the same class and the same name, with no tile). In this case, additional
|
||||
* data may be provided by children of this class:
|
||||
*
|
||||
* - mod name - custom signature
|
||||
*
|
||||
* At blueprint load time, BuildCraft will check that each block id of the blueprint corresponds to the block id in the installation. If not, it will perform a
|
||||
* search through the block list, and upon matching signature, it will translate all blocks ids of the blueprint to the installation ones. If no such block id
|
||||
* is found, BuildCraft will assume that the block is not installed and will not load the blueprint.
|
||||
*/
|
||||
|
||||
@Deprecated
|
||||
public class BptBlock {
|
||||
|
||||
public final int blockId;
|
||||
|
||||
public BptBlock(int blockId) {
|
||||
this.blockId = blockId;
|
||||
|
||||
//BlueprintManager.blockBptProps[blockId] = this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the requirements needed to build this block. When the requirements are met, they will be removed all at once from the builder, before calling
|
||||
* buildBlock.
|
||||
*/
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
if (slot.block != null) {
|
||||
if (slot.storedRequirements.size() != 0) {
|
||||
requirements.addAll(slot.storedRequirements);
|
||||
} else {
|
||||
// requirements.add(new ItemStack(slot.blockId, 1, slot.meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called each time an item matches a reqquirement, that is: (req id == stack id) for damageable items (req id == stack id && req dmg == stack dmg)
|
||||
* for other items by default, it will increase damage of damageable items by the amount of damage of the requirement, and remove the intended amount of non
|
||||
* damageable item.
|
||||
*
|
||||
* Client may override this behavior for default items. Note that this subprogram may be called twice with the same parameters, once with a copy of
|
||||
* requirements and stack to check if the entire requirements can be fullfilled, and once with the real inventory. Implementer is responsible for updating
|
||||
* req (with the remaining requirements if any) and stack (after usage)
|
||||
*
|
||||
* returns: what was used (similer to req, but created from stack, so that any NBT based differences are drawn from the correct source)
|
||||
*/
|
||||
public ItemStack useItem(BptSlotInfo slot, IBptContext context, ItemStack req, ItemStack stack) {
|
||||
ItemStack result = stack.copy();
|
||||
if (stack.isItemStackDamageable()) {
|
||||
if (req.getItemDamage() + stack.getItemDamage() <= stack.getMaxDamage()) {
|
||||
stack.setItemDamage(req.getItemDamage() + stack.getItemDamage());
|
||||
result.setItemDamage(req.getItemDamage());
|
||||
req.stackSize = 0;
|
||||
}
|
||||
|
||||
if (stack.getItemDamage() >= stack.getMaxDamage()) {
|
||||
stack.stackSize = 0;
|
||||
}
|
||||
} else {
|
||||
if (stack.stackSize >= req.stackSize) {
|
||||
result.stackSize = req.stackSize;
|
||||
stack.stackSize -= req.stackSize;
|
||||
req.stackSize = 0;
|
||||
} else {
|
||||
req.stackSize -= stack.stackSize;
|
||||
stack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (stack.stackSize == 0 && stack.getItem().getContainerItem() != null) {
|
||||
Item container = stack.getItem().getContainerItem();
|
||||
|
||||
//stack.itemID = container.itemID;
|
||||
stack.stackSize = 1;
|
||||
stack.setItemDamage(0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the block on the world correspond to the block stored in the blueprint at the location given by the slot. By default, this subprogram is
|
||||
* permissive and doesn't take into account metadata.
|
||||
*
|
||||
* Added metadata sensitivity //Krapht
|
||||
*/
|
||||
public boolean isValid(BptSlotInfo slot, IBptContext context) {
|
||||
//return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z) && slot.meta == context.world().getBlockMetadata(slot.x, slot.y, slot.z);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a 90 degree rotation to the slot.
|
||||
*/
|
||||
public void rotateLeft(BptSlotInfo slot, IBptContext context) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Places the block in the world, at the location specified in the slot.
|
||||
*/
|
||||
public void buildBlock(BptSlotInfo slot, IBptContext context) {
|
||||
// Meta needs to be specified twice, depending on the block behavior
|
||||
context.world().setBlock(slot.x, slot.y, slot.z, slot.block, slot.meta, 0);
|
||||
//context.world().setBlockMetadataWithNotify(slot.x, slot.y, slot.z, slot.meta,3);
|
||||
|
||||
if (slot.block instanceof BlockContainer) {
|
||||
TileEntity tile = context.world().getTileEntity(slot.x, slot.y, slot.z);
|
||||
|
||||
//slot.cpt.setInteger("x", slot.x);
|
||||
//slot.cpt.setInteger("y", slot.y);
|
||||
//slot.cpt.setInteger("z", slot.z);
|
||||
|
||||
//if (tile != null) {
|
||||
// tile.readFromNBT(slot.cpt);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the block should not be placed to the world. Requirements will not be asked on such a block, and building will not be called.
|
||||
*/
|
||||
public boolean ignoreBuilding(BptSlotInfo slot) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a slot from the blueprint according to an objet placed on {x, y, z} on the world. This typically means adding entries in slot.cpt. Note that
|
||||
* "id" and "meta" will be set automatically, corresponding to the block id and meta.
|
||||
*
|
||||
* By default, if the block is a BlockContainer, tile information will be to save / load the block.
|
||||
*/
|
||||
public void initializeFromWorld(BptSlotInfo slot, IBptContext context, int x, int y, int z) {
|
||||
/*if (Block.blocksList[slot.blockId] instanceof BlockContainer) {
|
||||
TileEntity tile = context.world().getTileEntity(x, y, z);
|
||||
|
||||
if (tile != null) {
|
||||
tile.writeToNBT(slot.cpt);
|
||||
}
|
||||
}
|
||||
|
||||
if (Block.blocksList[slot.blockId] != null) {
|
||||
ArrayList<ItemStack> req = Block.blocksList[slot.blockId].getBlockDropped(context.world(), x, y, z, context.world().getBlockMetadata(x, y, z), 0);
|
||||
|
||||
if (req != null) {
|
||||
slot.storedRequirements.addAll(req);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on a block when the blueprint has finished to place all the blocks. This may be useful to adjust variable depending on surrounding blocks that may
|
||||
* not be there already at initial building.
|
||||
*/
|
||||
public void postProcessing(BptSlotInfo slot, IBptContext context) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* By default, block class name, block tile name and block name are used to define block signature. Overriding this subprogram may allow to replace some of
|
||||
* these with stars, specify the mod that this block kind is coming from or add custom data to the signature.
|
||||
*/
|
||||
public BlockSignature getSignature(Block block) {
|
||||
BlockSignature sig = new BlockSignature();
|
||||
|
||||
/*if (block.blockID > BuildCraftAPI.LAST_ORIGINAL_BLOCK) {
|
||||
sig.blockClassName = block.getClass().getSimpleName();
|
||||
|
||||
if (block instanceof BlockContainer) {
|
||||
// TODO: Try to see if we can get a world instance to call with instead of null
|
||||
TileEntity tile = ((BlockContainer) block).createNewTileEntity(null);
|
||||
|
||||
if (tile != null) {
|
||||
sig.tileClassName = tile.getClass().getSimpleName();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
sig.blockName = block.getUnlocalizedName();
|
||||
sig.replaceNullWithStar();
|
||||
|
||||
return sig;
|
||||
}
|
||||
|
||||
/**
|
||||
* By default, block name, block and tile classes, mod name and custom signature are matched to verify if a blueprint block corresponds to the installation
|
||||
* block - except for the default blocks which don't check for classes. For any value, * means match with anything. For compatibilty and evolution reasons,
|
||||
* mods may want to write a different policy, allowing to migrate one format to the other.
|
||||
*/
|
||||
public boolean match(Block block, BlockSignature sig) {
|
||||
if (block == null)
|
||||
return false;
|
||||
|
||||
BlockSignature inst = BlueprintManager.getBlockSignature(block);
|
||||
|
||||
return starMatch(sig.blockName, inst.blockName) && starMatch(sig.blockClassName, inst.blockClassName)
|
||||
&& starMatch(sig.tileClassName, inst.tileClassName) && starMatch(sig.customField, inst.customField) && starMatch(sig.mod, inst.mod);
|
||||
}
|
||||
|
||||
private boolean starMatch(String s1, String s2) {
|
||||
return s1.equals("*") || s2.equals("*") || s1.equals(s2);
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.blueprints;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockUtils {
|
||||
|
||||
public static void requestInventoryContents(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
ItemStack[] stacks = getItemStacks(slot, context);
|
||||
|
||||
for (ItemStack stack : stacks) {
|
||||
if (stack != null) {
|
||||
requirements.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void initializeInventoryContents(BptSlotInfo slot, IBptContext context, IInventory inventory) {
|
||||
ItemStack[] stacks = new ItemStack[inventory.getSizeInventory()];
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); ++i) {
|
||||
stacks[i] = inventory.getStackInSlot(i);
|
||||
}
|
||||
|
||||
setItemStacks(slot, context, stacks);
|
||||
}
|
||||
|
||||
public static void buildInventoryContents(BptSlotInfo slot, IBptContext context, IInventory inventory) {
|
||||
ItemStack[] stacks = getItemStacks(slot, context);
|
||||
|
||||
for (int i = 0; i < stacks.length; ++i) {
|
||||
inventory.setInventorySlotContents(i, stacks[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack[] getItemStacks(BptSlotInfo slot, IBptContext context) {
|
||||
NBTTagList list = (NBTTagList) slot.cpt.getTag("inv");
|
||||
|
||||
if (list == null)
|
||||
return new ItemStack[0];
|
||||
|
||||
ItemStack stacks[] = new ItemStack[list.tagCount()];
|
||||
|
||||
for (int i = 0; i < list.tagCount(); ++i) {
|
||||
//ItemStack stack = ItemStack.loadItemStackFromNBT((NBTTagCompound) list.tagAt(i));
|
||||
|
||||
//if (stack != null && stack.itemID != 0 && stack.stackSize > 0) {
|
||||
// stacks[i] = context.mapItemStack(stack);
|
||||
//}
|
||||
}
|
||||
|
||||
return stacks;
|
||||
}
|
||||
|
||||
public static void setItemStacks(BptSlotInfo slot, IBptContext context, ItemStack[] stacks) {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < stacks.length; ++i) {
|
||||
NBTTagCompound cpt = new NBTTagCompound();
|
||||
nbttaglist.appendTag(cpt);
|
||||
ItemStack stack = stacks[i];
|
||||
|
||||
if (stack != null && stack.stackSize != 0) {
|
||||
stack.writeToNBT(cpt);
|
||||
//context.storeId(stack.itemID);
|
||||
}
|
||||
}
|
||||
|
||||
slot.cpt.setTag("inv", nbttaglist);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.blueprints;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* This class records a slot, either from a blueprint or from a block placed in the world.
|
||||
*/
|
||||
|
||||
@Deprecated
|
||||
public class BptSlotInfo {
|
||||
|
||||
public Block block = null;
|
||||
public int meta = 0;
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
|
||||
/**
|
||||
* This field contains requirements for a given block when stored in the blueprint. Modders can either rely on this list or compute their own int BptBlock.
|
||||
*/
|
||||
public LinkedList<ItemStack> storedRequirements = new LinkedList<ItemStack>();
|
||||
|
||||
/**
|
||||
* This tree contains additional data to be stored in the blueprint. By default, it will be initialized from BptBlock.initializeFromWorld with the standard
|
||||
* readNBT function of the corresponding tile (if any) and will be loaded from BptBlock.buildBlock using the standard writeNBT function.
|
||||
*/
|
||||
public NBTTagCompound cpt = new NBTTagCompound();
|
||||
|
||||
@Override
|
||||
public BptSlotInfo clone() {
|
||||
BptSlotInfo obj = new BptSlotInfo();
|
||||
|
||||
obj.x = x;
|
||||
obj.y = y;
|
||||
obj.z = z;
|
||||
obj.block = block;
|
||||
obj.meta = meta;
|
||||
obj.cpt = (NBTTagCompound) cpt.copy();
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.blueprints;
|
||||
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.api.core.Position;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* This interface provide contextual information when building or initializing blueprint slots.
|
||||
*/
|
||||
|
||||
@Deprecated
|
||||
public interface IBptContext {
|
||||
|
||||
/**
|
||||
* If bptItemStack is an ItemStack extracted from the blueprint containing this mapping, this will return an item stack with the id of the current world
|
||||
*/
|
||||
public ItemStack mapItemStack(ItemStack bptItemStack);
|
||||
|
||||
/**
|
||||
* Blueprints may be created in a world with a given id setting, and then ported to a world with different ids. Heuristics are used to retreive these new
|
||||
* ids automatically. This interface provide services to map ids from a blueprints to current ids in the world, and should be used whenever storing block
|
||||
* numbers or item stacks in blueprints..
|
||||
*/
|
||||
public int mapWorldId(int bptWorldId);
|
||||
|
||||
/**
|
||||
* This asks the id mapping to store a mapping from this Id, which may be either an itemId or a blockId. In effect, the blueprint will record it and make it
|
||||
* available upon blueprint load. Note that block present in the blueprint are automatically stored upon blueprint save, so this is really only needed when
|
||||
* writing ids that are e.g. in inventory stacks.
|
||||
*/
|
||||
public void storeId(int worldId);
|
||||
|
||||
public Position rotatePositionLeft(Position pos);
|
||||
|
||||
public IBox surroundingBox();
|
||||
|
||||
public World world();
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.blueprints;
|
||||
|
||||
@Deprecated
|
||||
public class ItemSignature {
|
||||
|
||||
public String itemClassName;
|
||||
public String itemName;
|
||||
|
||||
public ItemSignature(String str) {
|
||||
String[] values = str.split("/");
|
||||
|
||||
itemClassName = values[1];
|
||||
itemName = values[2];
|
||||
|
||||
replaceNullWithStar();
|
||||
|
||||
}
|
||||
|
||||
public ItemSignature() {
|
||||
replaceNullWithStar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
replaceNullWithStar();
|
||||
|
||||
return "#I/" + itemClassName + "/" + itemName;
|
||||
}
|
||||
|
||||
public void replaceNullWithStar() {
|
||||
if (itemClassName == null) {
|
||||
itemClassName = "*";
|
||||
}
|
||||
|
||||
if (itemName == null) {
|
||||
itemName = "*";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
@API(apiVersion="1.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|blueprints")
|
||||
package buildcraft.api.blueprints;
|
||||
import cpw.mods.fml.common.API;
|
|
@ -1,88 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockBed extends BptBlock {
|
||||
|
||||
public BptBlockBed(int blockId) {
|
||||
super(blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
if ((slot.meta & 8) == 0) {
|
||||
requirements.add(new ItemStack(Items.bed));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateLeft(BptSlotInfo slot, IBptContext context) {
|
||||
int orientation = (slot.meta & 7);
|
||||
int others = slot.meta - orientation;
|
||||
|
||||
switch (orientation) {
|
||||
case 0:
|
||||
slot.meta = 1 + others;
|
||||
break;
|
||||
case 1:
|
||||
slot.meta = 2 + others;
|
||||
break;
|
||||
case 2:
|
||||
slot.meta = 3 + others;
|
||||
break;
|
||||
case 3:
|
||||
slot.meta = 0 + others;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildBlock(BptSlotInfo slot, IBptContext context) {
|
||||
if ((slot.meta & 8) != 0)
|
||||
return;
|
||||
|
||||
//context.world().setBlock(slot.x, slot.y, slot.z, slot.block, slot.meta,1);
|
||||
|
||||
int x2 = slot.x;
|
||||
int z2 = slot.z;
|
||||
|
||||
switch (slot.meta) {
|
||||
case 0:
|
||||
z2++;
|
||||
break;
|
||||
case 1:
|
||||
x2--;
|
||||
break;
|
||||
case 2:
|
||||
z2--;
|
||||
break;
|
||||
case 3:
|
||||
x2++;
|
||||
break;
|
||||
}
|
||||
|
||||
//context.world().setBlock(x2, slot.y, z2, slot.block, slot.meta + 8,1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoreBuilding(BptSlotInfo slot) {
|
||||
return (slot.meta & 8) != 0;
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockCustomStack extends BptBlock {
|
||||
|
||||
final ItemStack customStack;
|
||||
|
||||
public BptBlockCustomStack(int blockId, ItemStack customStack) {
|
||||
super(blockId);
|
||||
|
||||
this.customStack = customStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
requirements.add(customStack.copy());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BlueprintManager;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockDelegate extends BptBlock {
|
||||
|
||||
final Block delegateTo;
|
||||
|
||||
public BptBlockDelegate(int blockId, Block delegateTo) {
|
||||
super(blockId);
|
||||
|
||||
this.delegateTo = delegateTo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
BptSlotInfo newSlot = slot.clone();
|
||||
slot.block = delegateTo;
|
||||
|
||||
//if (BlueprintManager.blockBptProps[delegateTo] != null) {
|
||||
// BlueprintManager.blockBptProps[delegateTo].addRequirements(newSlot, context, requirements);
|
||||
//} else {
|
||||
// super.addRequirements(newSlot, context, requirements);
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(BptSlotInfo slot, IBptContext context) {
|
||||
BptSlotInfo newSlot = slot.clone();
|
||||
slot.block = delegateTo;
|
||||
|
||||
//if (BlueprintManager.blockBptProps[delegateTo] != null)
|
||||
// return BlueprintManager.blockBptProps[delegateTo].isValid(newSlot, context);
|
||||
//else
|
||||
// return super.isValid(newSlot, context);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateLeft(BptSlotInfo slot, IBptContext context) {
|
||||
BptSlotInfo newSlot = slot.clone();
|
||||
slot.block = delegateTo;
|
||||
|
||||
//if (BlueprintManager.blockBptProps[delegateTo] != null) {
|
||||
// BlueprintManager.blockBptProps[delegateTo].rotateLeft(newSlot, context);
|
||||
//} else {
|
||||
// super.rotateLeft(newSlot, context);
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockDirt extends BptBlock {
|
||||
|
||||
public BptBlockDirt(int blockId) {
|
||||
super(blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
//requirements.add(new ItemStack(Block.dirt));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildBlock(BptSlotInfo slot, IBptContext context) {
|
||||
//context.world().setBlock(slot.x, slot.y, slot.z, Block.dirt.blockID, slot.meta,1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(BptSlotInfo slot, IBptContext context) {
|
||||
//int id = context.world().getBlockId(slot.x, slot.y, slot.z);
|
||||
|
||||
//return id == Block.dirt.blockID || id == Block.grass.blockID || id == Block.tilledField.blockID;
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockDoor extends BptBlock {
|
||||
|
||||
final ItemStack stack;
|
||||
|
||||
public BptBlockDoor(int blockId, ItemStack stack) {
|
||||
super(blockId);
|
||||
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
if ((slot.meta & 8) == 0) {
|
||||
requirements.add(stack.copy());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateLeft(BptSlotInfo slot, IBptContext context) {
|
||||
int orientation = (slot.meta & 3);
|
||||
int others = slot.meta - orientation;
|
||||
|
||||
switch (orientation) {
|
||||
case 0:
|
||||
slot.meta = 1 + others;
|
||||
break;
|
||||
case 1:
|
||||
slot.meta = 2 + others;
|
||||
break;
|
||||
case 2:
|
||||
slot.meta = 3 + others;
|
||||
break;
|
||||
case 3:
|
||||
slot.meta = 0 + others;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoreBuilding(BptSlotInfo slot) {
|
||||
return (slot.meta & 8) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildBlock(BptSlotInfo slot, IBptContext context) {
|
||||
//context.world().setBlock(slot.x, slot.y, slot.z, slot.blockId, slot.meta,1);
|
||||
//context.world().setBlock(slot.x, slot.y + 1, slot.z, slot.blockId, slot.meta + 8,1);
|
||||
|
||||
context.world().setBlockMetadataWithNotify(slot.x, slot.y + 1, slot.z, slot.meta + 8,1);
|
||||
context.world().setBlockMetadataWithNotify(slot.x, slot.y, slot.z, slot.meta,1);
|
||||
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockFluid extends BptBlock {
|
||||
|
||||
private final ItemStack bucketStack;
|
||||
|
||||
public BptBlockFluid(int blockId, ItemStack bucketStack) {
|
||||
super(blockId);
|
||||
|
||||
this.bucketStack = bucketStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
if (slot.meta == 0) {
|
||||
requirements.add(bucketStack.copy());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(BptSlotInfo slot, IBptContext context) {
|
||||
//if (slot.meta == 0)
|
||||
// return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z) && context.world().getBlockMetadata(slot.x, slot.y, slot.z) == 0;
|
||||
//else
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateLeft(BptSlotInfo slot, IBptContext context) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoreBuilding(BptSlotInfo slot) {
|
||||
return slot.meta != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildBlock(BptSlotInfo slot, IBptContext context) {
|
||||
//if (slot.meta == 0) {
|
||||
// context.world().setBlock(slot.x, slot.y, slot.z, slot.blockId, 0,1);
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockIgnore extends BptBlock {
|
||||
|
||||
public BptBlockIgnore(int blockId) {
|
||||
super(blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
//requirements.add(new ItemStack(slot.blockId, 0, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(BptSlotInfo slot, IBptContext context) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateLeft(BptSlotInfo slot, IBptContext context) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoreBuilding(BptSlotInfo slot) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockIgnoreMeta extends BptBlock {
|
||||
|
||||
public BptBlockIgnoreMeta(int blockId) {
|
||||
super(blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
//requirements.add(new ItemStack(slot.blockId, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(BptSlotInfo slot, IBptContext context) {
|
||||
//return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z);
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
|
||||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockInventory extends BptBlock {
|
||||
|
||||
public BptBlockInventory(int blockId) {
|
||||
super(blockId);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildBlock(BptSlotInfo slot, IBptContext context) {
|
||||
super.buildBlock(slot, context);
|
||||
|
||||
IInventory inv = (IInventory) context.world().getTileEntity(slot.x, slot.y, slot.z);
|
||||
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
inv.setInventorySlotContents(i, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockLever extends BptBlockWallSide {
|
||||
|
||||
public BptBlockLever(int blockId) {
|
||||
super(blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
//requirements.add(new ItemStack(slot.blockId, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateLeft(BptSlotInfo slot, IBptContext context) {
|
||||
int status = slot.meta - (slot.meta & 7);
|
||||
|
||||
slot.meta -= status;
|
||||
super.rotateLeft(slot, context);
|
||||
slot.meta += status;
|
||||
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockPiston extends BptBlockRotateMeta {
|
||||
|
||||
public BptBlockPiston(int blockId) {
|
||||
super(blockId, new int[] { 2, 5, 3, 4 }, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildBlock(BptSlotInfo slot, IBptContext context) {
|
||||
int meta = slot.meta & 7;
|
||||
|
||||
//context.world().setBlock(slot.x, slot.y, slot.z, slot.blockId, meta,1);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockPumpkin extends BptBlock {
|
||||
|
||||
public BptBlockPumpkin(int blockId) {
|
||||
super(blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
//requirements.add(new ItemStack(slot.blockId, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(BptSlotInfo slot, IBptContext context) {
|
||||
//return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateLeft(BptSlotInfo slot, IBptContext context) {
|
||||
switch (slot.meta) {
|
||||
case 0:
|
||||
slot.meta = 1;
|
||||
break;
|
||||
case 1:
|
||||
slot.meta = 2;
|
||||
break;
|
||||
case 2:
|
||||
slot.meta = 3;
|
||||
break;
|
||||
case 3:
|
||||
slot.meta = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockRedstoneRepeater extends BptBlock {
|
||||
|
||||
public BptBlockRedstoneRepeater(int blockId) {
|
||||
super(blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
//requirements.add(new ItemStack(Item.redstoneRepeater));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateLeft(BptSlotInfo slot, IBptContext context) {
|
||||
int step = slot.meta - (slot.meta & 3);
|
||||
|
||||
switch (slot.meta - step) {
|
||||
case 0:
|
||||
slot.meta = 1 + step;
|
||||
break;
|
||||
case 1:
|
||||
slot.meta = 2 + step;
|
||||
break;
|
||||
case 2:
|
||||
slot.meta = 3 + step;
|
||||
break;
|
||||
case 3:
|
||||
slot.meta = 0 + step;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockRotateInventory extends BptBlockRotateMeta {
|
||||
|
||||
public BptBlockRotateInventory(int blockId, int[] rotations, boolean rotateForward) {
|
||||
super(blockId, rotations, rotateForward);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildBlock(BptSlotInfo slot, IBptContext context) {
|
||||
super.buildBlock(slot, context);
|
||||
|
||||
IInventory inv = (IInventory) context.world().getTileEntity(slot.x, slot.y, slot.z);
|
||||
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
inv.setInventorySlotContents(i, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockRotateMeta extends BptBlock {
|
||||
|
||||
int[] rot;
|
||||
boolean rotateForward;
|
||||
|
||||
int infoMask = 0;
|
||||
|
||||
public BptBlockRotateMeta(int blockId, int[] rotations, boolean rotateForward) {
|
||||
super(blockId);
|
||||
|
||||
rot = rotations;
|
||||
|
||||
for (int i = 0; i < rot.length; ++i) {
|
||||
if (rot[i] < 4) {
|
||||
infoMask = (infoMask < 3 ? 3 : infoMask);
|
||||
} else if (rot[i] < 8) {
|
||||
infoMask = (infoMask < 7 ? 7 : infoMask);
|
||||
} else if (rot[i] < 16) {
|
||||
infoMask = (infoMask < 15 ? 15 : infoMask);
|
||||
}
|
||||
}
|
||||
|
||||
this.rotateForward = rotateForward;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
//requirements.add(new ItemStack(slot.blockId, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(BptSlotInfo slot, IBptContext context) {
|
||||
//return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateLeft(BptSlotInfo slot, IBptContext context) {
|
||||
int pos = slot.meta & infoMask;
|
||||
int others = slot.meta - pos;
|
||||
|
||||
if (rotateForward) {
|
||||
if (pos == rot[0]) {
|
||||
pos = rot[1];
|
||||
} else if (pos == rot[1]) {
|
||||
pos = rot[2];
|
||||
} else if (pos == rot[2]) {
|
||||
pos = rot[3];
|
||||
} else if (pos == rot[3]) {
|
||||
pos = rot[0];
|
||||
}
|
||||
} else {
|
||||
if (pos == rot[0]) {
|
||||
pos = rot[3];
|
||||
} else if (pos == rot[1]) {
|
||||
pos = rot[2];
|
||||
} else if (pos == rot[2]) {
|
||||
pos = rot[0];
|
||||
} else if (pos == rot[3]) {
|
||||
pos = rot[1];
|
||||
}
|
||||
}
|
||||
|
||||
slot.meta = pos + others;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BlockSignature;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockSign extends BptBlock {
|
||||
|
||||
boolean isWall;
|
||||
|
||||
public BptBlockSign(int blockId, boolean isWall) {
|
||||
super(blockId);
|
||||
|
||||
this.isWall = isWall;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
//requirements.add(new ItemStack(Item.sign));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateLeft(BptSlotInfo slot, IBptContext context) {
|
||||
if (!isWall) {
|
||||
double angle = ((slot.meta) * 360.0) / 16.0;
|
||||
angle += 90.0;
|
||||
if (angle >= 360) {
|
||||
angle -= 360;
|
||||
}
|
||||
slot.meta = (int) (angle / 360.0 * 16.0);
|
||||
} else {
|
||||
// slot.meta = ForgeDirection.values()[slot.meta].rotateLeft().ordinal();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockSignature getSignature(Block block) {
|
||||
BlockSignature sig = super.getSignature(block);
|
||||
|
||||
if (isWall) {
|
||||
sig.customField = "wall";
|
||||
} else {
|
||||
sig.customField = "floor";
|
||||
}
|
||||
|
||||
return sig;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockStairs extends BptBlock {
|
||||
|
||||
public BptBlockStairs(int blockId) {
|
||||
super(blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
//requirements.add(new ItemStack(slot.blockId, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(BptSlotInfo slot, IBptContext context) {
|
||||
//return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateLeft(BptSlotInfo slot, IBptContext context) {
|
||||
switch (slot.meta) {
|
||||
case 0:
|
||||
slot.meta = 2;
|
||||
break;
|
||||
case 1:
|
||||
slot.meta = 3;
|
||||
break;
|
||||
case 2:
|
||||
slot.meta = 1;
|
||||
break;
|
||||
case 3:
|
||||
slot.meta = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.bptblocks;
|
||||
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Deprecated
|
||||
public class BptBlockWallSide extends BptBlock {
|
||||
|
||||
public BptBlockWallSide(int blockId) {
|
||||
super(blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
//requirements.add(new ItemStack(slot.blockId, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateLeft(BptSlotInfo slot, IBptContext context) {
|
||||
final int XPos = 2;
|
||||
final int XNeg = 1;
|
||||
final int ZPos = 4;
|
||||
final int ZNeg = 3;
|
||||
|
||||
switch (slot.meta) {
|
||||
case XPos:
|
||||
slot.meta = ZPos;
|
||||
break;
|
||||
case ZNeg:
|
||||
slot.meta = XPos;
|
||||
break;
|
||||
case XNeg:
|
||||
slot.meta = ZNeg;
|
||||
break;
|
||||
case ZPos:
|
||||
slot.meta = XNeg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
@API(apiVersion="1.0",owner="BuildCraftAPI|blueprints",provides="BuildCraftAPI|bptblocks")
|
||||
package buildcraft.api.bptblocks;
|
||||
import cpw.mods.fml.common.API;
|
|
@ -1,22 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.core;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class BuildCraftAPI {
|
||||
|
||||
public static final int LAST_ORIGINAL_BLOCK = 122;
|
||||
public static final int LAST_ORIGINAL_ITEM = 126;
|
||||
|
||||
public static final Set <Block> softBlocks = new HashSet<Block>();
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.core;
|
||||
|
||||
/**
|
||||
* To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers.
|
||||
*/
|
||||
public interface IAreaProvider {
|
||||
|
||||
public int xMin();
|
||||
|
||||
public int yMin();
|
||||
|
||||
public int zMin();
|
||||
|
||||
public int xMax();
|
||||
|
||||
public int yMax();
|
||||
|
||||
public int zMax();
|
||||
|
||||
/**
|
||||
* Remove from the world all objects used to define the area.
|
||||
*/
|
||||
public void removeFromWorld();
|
||||
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.core;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IBox {
|
||||
|
||||
public void expand(int amount);
|
||||
|
||||
public void contract(int amount);
|
||||
|
||||
public boolean contains(int x, int y, int z);
|
||||
|
||||
public Position pMin();
|
||||
|
||||
public Position pMax();
|
||||
|
||||
public void createLasers(World world, LaserKind kind);
|
||||
|
||||
public void deleteLasers();
|
||||
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.core;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public interface IIconProvider {
|
||||
|
||||
/**
|
||||
* @param iconIndex
|
||||
* @return
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int iconIndex);
|
||||
|
||||
/**
|
||||
* A call for the provider to register its Icons. This may be called multiple times but should only be executed once per provider
|
||||
* @param iconRegister
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister);
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.core;
|
||||
|
||||
public enum LaserKind {
|
||||
Red, Blue, Stripes
|
||||
}
|
|
@ -1,141 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.core;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class Position {
|
||||
|
||||
public double x, y, z;
|
||||
public ForgeDirection orientation;
|
||||
|
||||
public Position(double ci, double cj, double ck) {
|
||||
x = ci;
|
||||
y = cj;
|
||||
z = ck;
|
||||
orientation = ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
public Position(double ci, double cj, double ck, ForgeDirection corientation) {
|
||||
x = ci;
|
||||
y = cj;
|
||||
z = ck;
|
||||
orientation = corientation;
|
||||
}
|
||||
|
||||
public Position(Position p) {
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
z = p.z;
|
||||
orientation = p.orientation;
|
||||
}
|
||||
|
||||
public Position(NBTTagCompound nbttagcompound) {
|
||||
x = nbttagcompound.getDouble("i");
|
||||
y = nbttagcompound.getDouble("j");
|
||||
z = nbttagcompound.getDouble("k");
|
||||
|
||||
orientation = ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
public Position(TileEntity tile) {
|
||||
x = tile.xCoord;
|
||||
y = tile.yCoord;
|
||||
z = tile.zCoord;
|
||||
}
|
||||
|
||||
public void moveRight(double step) {
|
||||
switch (orientation) {
|
||||
case SOUTH:
|
||||
x = x - step;
|
||||
break;
|
||||
case NORTH:
|
||||
x = x + step;
|
||||
break;
|
||||
case EAST:
|
||||
z = z + step;
|
||||
break;
|
||||
case WEST:
|
||||
z = z - step;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
public void moveLeft(double step) {
|
||||
moveRight(-step);
|
||||
}
|
||||
|
||||
public void moveForwards(double step) {
|
||||
switch (orientation) {
|
||||
case UP:
|
||||
y = y + step;
|
||||
break;
|
||||
case DOWN:
|
||||
y = y - step;
|
||||
break;
|
||||
case SOUTH:
|
||||
z = z + step;
|
||||
break;
|
||||
case NORTH:
|
||||
z = z - step;
|
||||
break;
|
||||
case EAST:
|
||||
x = x + step;
|
||||
break;
|
||||
case WEST:
|
||||
x = x - step;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
public void moveBackwards(double step) {
|
||||
moveForwards(-step);
|
||||
}
|
||||
|
||||
public void moveUp(double step) {
|
||||
switch (orientation) {
|
||||
case SOUTH:
|
||||
case NORTH:
|
||||
case EAST:
|
||||
case WEST:
|
||||
y = y + step;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void moveDown(double step) {
|
||||
moveUp(-step);
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setDouble("i", x);
|
||||
nbttagcompound.setDouble("j", y);
|
||||
nbttagcompound.setDouble("k", z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" + x + ", " + y + ", " + z + "}";
|
||||
}
|
||||
|
||||
public Position min(Position p) {
|
||||
return new Position(p.x > x ? x : p.x, p.y > y ? y : p.y, p.z > z ? z : p.z);
|
||||
}
|
||||
|
||||
public Position max(Position p) {
|
||||
return new Position(p.x < x ? x : p.x, p.y < y ? y : p.y, p.z < z ? z : p.z);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.core;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class StackWrapper {
|
||||
|
||||
public final ItemStack stack;
|
||||
|
||||
public StackWrapper(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 5;
|
||||
|
||||
hash = 67 * hash + stack.getItem().hashCode();
|
||||
|
||||
hash = 67 * hash + stack.getItemDamage();
|
||||
|
||||
if (stack.stackTagCompound != null) {
|
||||
hash = 67 * hash + stack.stackTagCompound.hashCode();
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
final StackWrapper other = (StackWrapper) obj;
|
||||
if (stack.getItem() != other.stack.getItem())
|
||||
return false;
|
||||
if (stack.getHasSubtypes() && stack.getItemDamage() != other.stack.getItemDamage())
|
||||
return false;
|
||||
if (stack.stackTagCompound != null && !stack.stackTagCompound.equals(other.stack.stackTagCompound))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
@API(apiVersion="1.0",owner="BuildCraft|Core",provides="BuildCraftAPI|core")
|
||||
package buildcraft.api.core;
|
||||
import cpw.mods.fml.common.API;
|
|
@ -1,15 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.filler;
|
||||
|
||||
public class FillerManager {
|
||||
|
||||
public static IFillerRegistry registry;
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.filler;
|
||||
|
||||
import buildcraft.api.core.IBox;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IFillerPattern {
|
||||
|
||||
public String getUniqueTag();
|
||||
|
||||
/**
|
||||
* Creates the object that does the pattern iteration. This object may be
|
||||
* state-full and will be used until the pattern is done or changes.
|
||||
*
|
||||
* @param tile the Filler
|
||||
* @param box the area to fill
|
||||
* @param orientation not currently used, but may be in the future (the filler needs some orientation code)
|
||||
* @return
|
||||
*/
|
||||
public IPatternIterator createPatternIterator(TileEntity tile, IBox box, ForgeDirection orientation);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon();
|
||||
|
||||
public String getDisplayName();
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.filler;
|
||||
|
||||
import buildcraft.api.gates.IAction;
|
||||
import java.util.Set;
|
||||
|
||||
public interface IFillerRegistry {
|
||||
|
||||
public void addPattern(IFillerPattern pattern);
|
||||
|
||||
public IFillerPattern getPattern(String patternName);
|
||||
|
||||
public IFillerPattern getNextPattern(IFillerPattern currentPattern);
|
||||
|
||||
public IFillerPattern getPreviousPattern(IFillerPattern currentPattern);
|
||||
|
||||
public Set<? extends IAction> getActions();
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.filler;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IPatternIterator {
|
||||
|
||||
public boolean iteratePattern(ItemStack stackToPlace);
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
@API(apiVersion="2.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|filler")
|
||||
package buildcraft.api.filler;
|
||||
import cpw.mods.fml.common.API;
|
|
@ -1,91 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.fuels;
|
||||
|
||||
import buildcraft.api.core.StackWrapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public final class IronEngineCoolant {
|
||||
|
||||
public static Map<String, Coolant> liquidCoolants = new HashMap<String, Coolant>();
|
||||
public static Map<StackWrapper, FluidStack> solidCoolants = new HashMap<StackWrapper, FluidStack>();
|
||||
|
||||
public static FluidStack getFluidCoolant(ItemStack stack) {
|
||||
return solidCoolants.get(new StackWrapper(stack));
|
||||
}
|
||||
|
||||
public static Coolant getCoolant(ItemStack stack) {
|
||||
return getCoolant(getFluidCoolant(stack));
|
||||
}
|
||||
|
||||
public static Coolant getCoolant(FluidStack fluidStack) {
|
||||
return fluidStack != null && fluidStack.getFluid() != null ? liquidCoolants.get(fluidStack.getFluid().getName()) : null;
|
||||
}
|
||||
|
||||
private IronEngineCoolant() {
|
||||
}
|
||||
|
||||
public static interface Coolant {
|
||||
|
||||
float getDegreesCoolingPerMB(float currentHeat);
|
||||
}
|
||||
|
||||
public static void addCoolant(final Fluid fluid, final float degreesCoolingPerMB) {
|
||||
if (fluid != null) {
|
||||
liquidCoolants.put(fluid.getName(), new Coolant() {
|
||||
@Override
|
||||
public float getDegreesCoolingPerMB(float currentHeat) {
|
||||
return degreesCoolingPerMB;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a solid coolant like Ice Blocks. The FluidStack must contain a registered
|
||||
* Coolant Fluid or nothing will happen. You do not need to call this for
|
||||
* Fluid Containers.
|
||||
*
|
||||
* @param stack
|
||||
* @param coolant
|
||||
*/
|
||||
public static void addCoolant(final ItemStack stack, final FluidStack coolant) {
|
||||
if (stack != null && stack.getItem() != null && coolant != null) {
|
||||
solidCoolants.put(new StackWrapper(stack), coolant);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a solid coolant like Ice Blocks. The FluidStack must contain a registered
|
||||
* Coolant Fluid or nothing will happen. You do not need to call this for
|
||||
* Fluid Containers.
|
||||
*
|
||||
* @param stack
|
||||
* @param coolant
|
||||
*/
|
||||
public static void addCoolant(final Item item, final int metadata, final FluidStack coolant) {
|
||||
addCoolant(new ItemStack(item, 1, metadata), coolant);
|
||||
}
|
||||
|
||||
public static void addCoolant(final Block block, final int metadata, final FluidStack coolant) {
|
||||
addCoolant(new ItemStack(block, 1, metadata), coolant);
|
||||
}
|
||||
|
||||
public static boolean isCoolant(Fluid fluid) {
|
||||
return liquidCoolants.containsKey(fluid.getName());
|
||||
}
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.gates;
|
||||
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class ActionManager {
|
||||
|
||||
public static Map<String, ITrigger> triggers = new HashMap<String, ITrigger>();
|
||||
public static Map<String, IAction> actions = new HashMap<String, IAction>();
|
||||
private static List<ITriggerProvider> triggerProviders = new LinkedList<ITriggerProvider>();
|
||||
private static List<IActionProvider> actionProviders = new LinkedList<IActionProvider>();
|
||||
|
||||
public static void registerTriggerProvider(ITriggerProvider provider) {
|
||||
if (provider != null && !triggerProviders.contains(provider)) {
|
||||
triggerProviders.add(provider);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerTrigger(ITrigger trigger) {
|
||||
triggers.put(trigger.getUniqueTag(), trigger);
|
||||
}
|
||||
|
||||
public static void registerAction(IAction action) {
|
||||
actions.put(action.getUniqueTag(), action);
|
||||
}
|
||||
|
||||
public static List<ITrigger> getNeighborTriggers(Block block, TileEntity entity) {
|
||||
List<ITrigger> triggers = new LinkedList<ITrigger>();
|
||||
|
||||
for (ITriggerProvider provider : triggerProviders) {
|
||||
List<ITrigger> toAdd = provider.getNeighborTriggers(block, entity);
|
||||
|
||||
if (toAdd != null) {
|
||||
for (ITrigger t : toAdd) {
|
||||
if (!triggers.contains(t)) {
|
||||
triggers.add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return triggers;
|
||||
}
|
||||
|
||||
public static void registerActionProvider(IActionProvider provider) {
|
||||
if (provider != null && !actionProviders.contains(provider)) {
|
||||
actionProviders.add(provider);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<IAction> getNeighborActions(Block block, TileEntity entity) {
|
||||
List<IAction> actions = new LinkedList<IAction>();
|
||||
|
||||
for (IActionProvider provider : actionProviders) {
|
||||
List<IAction> toAdd = provider.getNeighborActions(block, entity);
|
||||
|
||||
if (toAdd != null) {
|
||||
for (IAction t : toAdd) {
|
||||
if (!actions.contains(t)) {
|
||||
actions.add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
public static List<ITrigger> getPipeTriggers(IPipeTile pipe) {
|
||||
List<ITrigger> triggers = new LinkedList<ITrigger>();
|
||||
|
||||
for (ITriggerProvider provider : triggerProviders) {
|
||||
List<ITrigger> toAdd = provider.getPipeTriggers(pipe);
|
||||
|
||||
if (toAdd != null) {
|
||||
for (ITrigger t : toAdd) {
|
||||
if (!triggers.contains(t)) {
|
||||
triggers.add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return triggers;
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.gates;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public abstract class GateExpansionController {
|
||||
|
||||
public final IGateExpansion type;
|
||||
public final TileEntity pipeTile;
|
||||
|
||||
public GateExpansionController(IGateExpansion type, TileEntity pipeTile) {
|
||||
this.pipeTile = pipeTile;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public IGateExpansion getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
}
|
||||
|
||||
public void startResolution() {
|
||||
}
|
||||
|
||||
public boolean resolveAction(IAction action, int count) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isTriggerActive(ITrigger trigger, ITriggerParameter parameter) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addTriggers(List<ITrigger> list) {
|
||||
}
|
||||
|
||||
public void addActions(List<IAction> list) {
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.gates;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public final class GateExpansions {
|
||||
|
||||
private static final Map<String, IGateExpansion> expansions = new HashMap<String, IGateExpansion>();
|
||||
private static final BiMap<Byte, String> serverIDMap = HashBiMap.create();
|
||||
private static final BiMap<Byte, String> clientIDMap = HashBiMap.create();
|
||||
private static byte nextID = 0;
|
||||
|
||||
private GateExpansions() {
|
||||
}
|
||||
|
||||
public static void registerExpansion(IGateExpansion expansion) {
|
||||
registerExpansion(expansion.getUniqueIdentifier(), expansion);
|
||||
}
|
||||
|
||||
public static void registerExpansion(String identifier, IGateExpansion expansion) {
|
||||
expansions.put(identifier, expansion);
|
||||
serverIDMap.put(nextID++, identifier);
|
||||
}
|
||||
|
||||
public static IGateExpansion getExpansion(String identifier) {
|
||||
return expansions.get(identifier);
|
||||
}
|
||||
|
||||
public static IGateExpansion getExpansionClient(int id) {
|
||||
if (id < 0 || id >= 128)
|
||||
return null;
|
||||
return expansions.get(clientIDMap.get((byte) id));
|
||||
}
|
||||
|
||||
public static byte getServerExpansionID(String identifier) {
|
||||
return serverIDMap.inverse().get(identifier);
|
||||
}
|
||||
|
||||
public static Set<IGateExpansion> getExpansions() {
|
||||
Set<IGateExpansion> set = new HashSet<IGateExpansion>();
|
||||
set.addAll(expansions.values());
|
||||
return set;
|
||||
}
|
||||
|
||||
public static BiMap<Byte, String> getServerMap() {
|
||||
return serverIDMap;
|
||||
}
|
||||
|
||||
public static void setClientMap(BiMap<Byte, String> map) {
|
||||
clientIDMap.clear();
|
||||
clientIDMap.putAll(map);
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.gates;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public interface IAction {
|
||||
|
||||
String getUniqueTag();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
IIcon getIcon();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerIcons(IIconRegister iconRegister);
|
||||
|
||||
boolean hasParameter();
|
||||
|
||||
String getDescription();
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.gates;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public interface IActionProvider {
|
||||
|
||||
/**
|
||||
* Returns the list of actions available to a gate next to the given block.
|
||||
*/
|
||||
public abstract LinkedList<IAction> getNeighborActions(Block block, TileEntity tile);
|
||||
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.gates;
|
||||
|
||||
public interface IActionReceptor {
|
||||
|
||||
public void actionActivated(IAction action);
|
||||
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.gates;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public interface IGateExpansion {
|
||||
|
||||
String getUniqueIdentifier();
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
GateExpansionController makeController(TileEntity pipeTile);
|
||||
|
||||
void registerBlockOverlay(IIconRegister iconRegister);
|
||||
|
||||
void registerItemOverlay(IIconRegister iconRegister);
|
||||
|
||||
IIcon getOverlayBlock();
|
||||
|
||||
IIcon getOverlayItem();
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.gates;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
/**
|
||||
* This interface has to be implemented by a TileEntity or a Pipe that wants to provide triggers different from the ones installed by default with BuildCraft.
|
||||
*/
|
||||
public interface IOverrideDefaultTriggers {
|
||||
|
||||
LinkedList<ITrigger> getTriggers();
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.gates;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface ITileTrigger extends ITrigger {
|
||||
|
||||
/**
|
||||
* Return true if the tile given in parameter activates the trigger, given
|
||||
* the parameters.
|
||||
*/
|
||||
boolean isTriggerActive(ForgeDirection side, TileEntity tile, ITriggerParameter parameter);
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.gates;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public interface ITrigger {
|
||||
|
||||
/**
|
||||
* Every trigger needs a unique tag, it should be in the format of
|
||||
* "<modid>:<name>".
|
||||
*
|
||||
* @return the unique id
|
||||
*/
|
||||
String getUniqueTag();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
IIcon getIcon();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerIcons(IIconRegister iconRegister);
|
||||
|
||||
/**
|
||||
* Return true if this trigger can accept parameters
|
||||
*/
|
||||
boolean hasParameter();
|
||||
|
||||
/**
|
||||
* Return true if this trigger requires a parameter
|
||||
*/
|
||||
boolean requiresParameter();
|
||||
|
||||
/**
|
||||
* Return the trigger description in the UI
|
||||
*/
|
||||
String getDescription();
|
||||
|
||||
/**
|
||||
* Create parameters for the trigger. As for now, there is only one kind of
|
||||
* trigger parameter available so this subprogram is final.
|
||||
*/
|
||||
ITriggerParameter createParameter();
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.gates;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public interface ITriggerParameter {
|
||||
|
||||
public abstract ItemStack getItemStack();
|
||||
|
||||
public abstract void set(ItemStack stack);
|
||||
|
||||
public abstract void writeToNBT(NBTTagCompound compound);
|
||||
|
||||
public abstract void readFromNBT(NBTTagCompound compound);
|
||||
|
||||
@Deprecated
|
||||
public abstract ItemStack getItem();
|
||||
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.gates;
|
||||
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public interface ITriggerProvider {
|
||||
|
||||
/**
|
||||
* Returns the list of triggers that are available from the pipe holding the gate.
|
||||
*/
|
||||
public abstract LinkedList<ITrigger> getPipeTriggers(IPipeTile pipe);
|
||||
|
||||
/**
|
||||
* Returns the list of triggers available to a gate next to the given block.
|
||||
*/
|
||||
public abstract LinkedList<ITrigger> getNeighborTriggers(Block block, TileEntity tile);
|
||||
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.gates;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class TriggerParameter implements ITriggerParameter {
|
||||
|
||||
protected ItemStack stack;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITriggerParameter#getItemStack()
|
||||
*/
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return stack;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITriggerParameter#set(net.minecraft.src.ItemStack)
|
||||
*/
|
||||
@Override
|
||||
public void set(ItemStack stack) {
|
||||
if (stack != null) {
|
||||
this.stack = stack.copy();
|
||||
this.stack.stackSize = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITriggerParameter#writeToNBT(net.minecraft.src.NBTTagCompound)
|
||||
*/
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
if (stack != null) {
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
stack.writeToNBT(tagCompound);
|
||||
compound.setTag("stack", tagCompound);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITriggerParameter#readFromNBT(net.minecraft.src.NBTTagCompound)
|
||||
*/
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
// Legacy code to prevent existing gates from losing their contents
|
||||
int itemID = compound.getInteger("itemID");
|
||||
if (itemID != 0) {
|
||||
stack = new ItemStack((Item) Item.itemRegistry.getObject(itemID), 1, compound.getInteger("itemDMG"));
|
||||
return;
|
||||
}
|
||||
|
||||
stack = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("stack"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public ItemStack getItem() {
|
||||
return stack;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
@API(apiVersion="2.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|gates")
|
||||
package buildcraft.api.gates;
|
||||
import cpw.mods.fml.common.API;
|
|
@ -1,45 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.inventory;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Deprecated
|
||||
public interface ISpecialInventory extends IInventory {
|
||||
|
||||
/**
|
||||
* Offers an ItemStack for addition to the inventory.
|
||||
*
|
||||
* @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.
|
||||
* @return Amount of items used from the passed stack.
|
||||
*/
|
||||
int addItem(ItemStack stack, boolean doAdd, ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Requests items to be extracted from the inventory
|
||||
*
|
||||
* @param doRemove
|
||||
* If false no actual extraction may occur. Implementors should simulate.
|
||||
* Can be used to "peek" at what the result would be
|
||||
* @param from
|
||||
* Orientation the ItemStack is requested from.
|
||||
* @param maxItemCount
|
||||
* Maximum amount of items to extract (spread over all returned item stacks)
|
||||
* @return Array of item stacks that were/would be extracted from the inventory
|
||||
*/
|
||||
ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount);
|
||||
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
@API(apiVersion="1.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|inventory")
|
||||
package buildcraft.api.inventory;
|
||||
import cpw.mods.fml.common.API;
|
|
@ -1,41 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.power;
|
||||
|
||||
public interface ILaserTarget {
|
||||
|
||||
/**
|
||||
* Returns true if the target currently needs power. For example, if the Advanced
|
||||
* Crafting Table has work to do.
|
||||
*
|
||||
* @return true if needs power
|
||||
*/
|
||||
boolean requiresLaserEnergy();
|
||||
|
||||
/**
|
||||
* Transfers energy from the laser to the target.
|
||||
*
|
||||
* @param energy
|
||||
*/
|
||||
void receiveLaserEnergy(double energy);
|
||||
|
||||
/**
|
||||
* Return true if the Tile Entity object is no longer a valid target. For
|
||||
* example, if its been invalidated.
|
||||
*
|
||||
* @return true if no longer a valid target object
|
||||
*/
|
||||
boolean isInvalidTarget();
|
||||
|
||||
int getXCoord();
|
||||
|
||||
int getYCoord();
|
||||
|
||||
int getZCoord();
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.recipes;
|
||||
|
||||
public final class BuildcraftRecipes {
|
||||
|
||||
public static IAssemblyRecipeManager assemblyTable;
|
||||
public static IIntegrationRecipeManager integrationTable;
|
||||
public static IRefineryRecipeManager refinery;
|
||||
|
||||
private BuildcraftRecipes() {
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.recipes;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IAssemblyRecipeManager {
|
||||
|
||||
public static interface IAssemblyRecipe {
|
||||
|
||||
ItemStack getOutput();
|
||||
|
||||
Object[] getInputs();
|
||||
|
||||
double getEnergyCost();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an Assembly Table recipe.
|
||||
*
|
||||
* @param input Object... containing either an ItemStack, or a paired string
|
||||
* and integer(ex: "dyeBlue", 1)
|
||||
* @param energy MJ cost to produce
|
||||
* @param output resulting ItemStack
|
||||
*/
|
||||
void addRecipe(double energyCost, ItemStack output, Object... input);
|
||||
|
||||
List<? extends IAssemblyRecipe> getRecipes();
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.recipes;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* The Integration Table's primary purpose is to modify an input item's NBT
|
||||
* data. As such its not a "traditional" type of recipe. Rather than predefined
|
||||
* inputs and outputs, it takes an input and transforms it.
|
||||
*/
|
||||
public interface IIntegrationRecipeManager {
|
||||
|
||||
public static interface IIntegrationRecipe {
|
||||
|
||||
double getEnergyCost();
|
||||
|
||||
boolean isValidInputA(ItemStack inputA);
|
||||
|
||||
boolean isValidInputB(ItemStack inputB);
|
||||
|
||||
ItemStack getOutputForInputs(ItemStack inputA, ItemStack inputB);
|
||||
|
||||
ItemStack[] getExampleInputsA();
|
||||
|
||||
ItemStack[] getExampleInputsB();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an Integration Table recipe.
|
||||
*
|
||||
*/
|
||||
void addRecipe(IIntegrationRecipe recipe);
|
||||
|
||||
List<? extends IIntegrationRecipe> getRecipes();
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.recipes;
|
||||
|
||||
import java.util.SortedSet;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface IRefineryRecipeManager {
|
||||
|
||||
void addRecipe(FluidStack ingredient, FluidStack result, int energy, int delay);
|
||||
|
||||
void addRecipe(FluidStack ingredient1, FluidStack ingredient2, FluidStack result, int energy, int delay);
|
||||
|
||||
SortedSet<? extends IRefineryRecipe> getRecipes();
|
||||
|
||||
IRefineryRecipe findRefineryRecipe(FluidStack ingredient1, FluidStack ingredient2);
|
||||
|
||||
public static interface IRefineryRecipe {
|
||||
|
||||
FluidStack getIngredient1();
|
||||
|
||||
FluidStack getIngredient2();
|
||||
|
||||
FluidStack getResult();
|
||||
|
||||
int getEnergyCost();
|
||||
|
||||
int getTimeRequired();
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
@API(apiVersion="2.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|recipes")
|
||||
package buildcraft.api.recipes;
|
||||
import cpw.mods.fml.common.API;
|
|
@ -1,48 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface IToolPipette {
|
||||
|
||||
/**
|
||||
* @param pipette
|
||||
* ItemStack of the pipette.
|
||||
* @return Capacity of the pipette.
|
||||
*/
|
||||
int getCapacity(ItemStack pipette);
|
||||
|
||||
/**
|
||||
* @param pipette
|
||||
* @return true if the pipette can pipette.
|
||||
*/
|
||||
boolean canPipette(ItemStack pipette);
|
||||
|
||||
/**
|
||||
* Fills the pipette with the given liquid stack.
|
||||
*
|
||||
* @param pipette
|
||||
* @param liquid
|
||||
* @param doFill
|
||||
* @return Amount of liquid used in filling the pipette.
|
||||
*/
|
||||
int fill(ItemStack pipette, FluidStack liquid, boolean doFill);
|
||||
|
||||
/**
|
||||
* Drains liquid from the pipette
|
||||
*
|
||||
* @param pipette
|
||||
* @param maxDrain
|
||||
* @param doDrain
|
||||
* @return Fluid stack representing the liquid and amount drained from the pipette.
|
||||
*/
|
||||
FluidStack drain(ItemStack pipette, int maxDrain, boolean doDrain);
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Implement and register with the PipeManager if you want to suppress connections from wooden pipes.
|
||||
*/
|
||||
public interface IExtractionHandler {
|
||||
|
||||
/**
|
||||
* Can this pipe extract items from the block located at these coordinates?
|
||||
* param extractor can be null
|
||||
*/
|
||||
boolean canExtractItems(Object extractor, World world, int i, int j, int k);
|
||||
|
||||
/**
|
||||
* Can this pipe extract liquids from the block located at these coordinates?
|
||||
* param extractor can be null
|
||||
*/
|
||||
boolean canExtractFluids(Object extractor, World world, int i, int j, int k);
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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;
|
||||
|
||||
import buildcraft.api.transport.IPipeTile.PipeType;
|
||||
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.
|
||||
*/
|
||||
public ConnectOverride overridePipeConnection(PipeType type, ForgeDirection with);
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public interface IPipeDefinition {
|
||||
|
||||
String getUniqueTag();
|
||||
|
||||
void registerIcons(IIconRegister iconRegister);
|
||||
|
||||
IIcon getIcon(int index);
|
||||
|
||||
IIcon getItemIcon();
|
||||
|
||||
PipeBehavior makePipeBehavior(TileEntity tile);
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public abstract class PipeBehavior {
|
||||
|
||||
public final TileEntity tile;
|
||||
|
||||
public PipeBehavior(TileEntity tile) {
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
}
|
||||
|
||||
public int getIconIndex(ForgeDirection side) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
}
|
||||
|
||||
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean blockActivated(EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(int blockId) {
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class PipeManager {
|
||||
|
||||
public static List<IExtractionHandler> extractionHandlers = new ArrayList<IExtractionHandler>();
|
||||
|
||||
public static void registerExtractionHandler(IExtractionHandler handler) {
|
||||
extractionHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* param extractor can be null
|
||||
*/
|
||||
public static boolean canExtractItems(Object extractor, World world, int i, int j, int k) {
|
||||
for (IExtractionHandler handler : extractionHandlers)
|
||||
if (!handler.canExtractItems(extractor, world, i, j, k))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* param extractor can be null
|
||||
*/
|
||||
public static boolean canExtractFluids(Object extractor, World world, int i, int j, int k) {
|
||||
for (IExtractionHandler handler : extractionHandlers)
|
||||
if (!handler.canExtractFluids(extractor, world, i, j, k))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package cofh.api.block;
|
||||
|
||||
import cofh.api.tileentity.ITileDebug;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on blocks which have some debug method which can be activated via a tool or other means. If the block contains Tile Entities, then
|
||||
* it is recommended that this function serve as a passthrough for {@link ITileDebug}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IBlockDebug {
|
||||
|
||||
/**
|
||||
* This function debugs a block.
|
||||
*
|
||||
* @param world
|
||||
* Reference to the world.
|
||||
* @param x
|
||||
* X coordinate of the block.
|
||||
* @param y
|
||||
* Y coordinate of the block.
|
||||
* @param z
|
||||
* Z coordinate of the block.
|
||||
* @param side
|
||||
* The side of the block.
|
||||
* @param player
|
||||
* Player doing the debugging.
|
||||
*/
|
||||
void debugBlock(IBlockAccess world, int x, int y, int z, ForgeDirection side, EntityPlayer player);
|
||||
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package cofh.api.block;
|
||||
|
||||
import cofh.api.tileentity.ITileInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on blocks which can provide information about themselves. If the block contains Tile Entities, then it is recommended that this
|
||||
* function serve as a passthrough for {@link ITileInfo}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IBlockInfo {
|
||||
|
||||
/**
|
||||
* This function appends information to a list provided to it.
|
||||
*
|
||||
* @param world
|
||||
* Reference to the world.
|
||||
* @param x
|
||||
* X coordinate of the block.
|
||||
* @param y
|
||||
* Y coordinate of the block.
|
||||
* @param z
|
||||
* Z coordinate of the block.
|
||||
* @param side
|
||||
* The side of the block that is being queried.
|
||||
* @param player
|
||||
* Player doing the querying - this can be NULL.
|
||||
* @param info
|
||||
* The list that the information should be appended to.
|
||||
* @param debug
|
||||
* If true, the block should return "debug" information.
|
||||
*/
|
||||
void getBlockInfo(IBlockAccess world, int x, int y, int z, ForgeDirection side, EntityPlayer player, List<String> info, boolean debug);
|
||||
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package cofh.api.block;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Implemented on Blocks which have some method of being instantly dismantled.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IDismantleable {
|
||||
|
||||
/**
|
||||
* Dismantles the block. If returnBlock is true, the drop(s) should be placed into the player's inventory.
|
||||
*/
|
||||
ItemStack dismantleBlock(EntityPlayer player, World world, int x, int y, int z, boolean returnBlock);
|
||||
|
||||
/**
|
||||
* Return true if the block can be dismantled. The criteria for this is entirely up to the block.
|
||||
*/
|
||||
boolean canDismantle(EntityPlayer player, World world, int x, int y, int z);
|
||||
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package cofh.api.core;
|
||||
|
||||
/**
|
||||
* Interface which can be put on just about anything to allow for iteration during initialization.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IInitializer {
|
||||
|
||||
boolean preInit();
|
||||
|
||||
boolean initialize();
|
||||
|
||||
boolean postInit();
|
||||
|
||||
}
|
|
@ -1,158 +0,0 @@
|
|||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyStorage}. Use/extend this or implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class EnergyStorage implements IEnergyStorage {
|
||||
|
||||
protected int energy;
|
||||
protected int capacity;
|
||||
protected int maxReceive;
|
||||
protected int maxExtract;
|
||||
|
||||
public EnergyStorage(int capacity) {
|
||||
|
||||
this(capacity, capacity, capacity);
|
||||
}
|
||||
|
||||
public EnergyStorage(int capacity, int maxTransfer) {
|
||||
|
||||
this(capacity, maxTransfer, maxTransfer);
|
||||
}
|
||||
|
||||
public EnergyStorage(int capacity, int maxReceive, int maxExtract) {
|
||||
|
||||
this.capacity = capacity;
|
||||
this.maxReceive = maxReceive;
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public EnergyStorage readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
this.energy = nbt.getInteger("Energy");
|
||||
|
||||
if (energy > capacity) {
|
||||
energy = capacity;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
||||
|
||||
if (energy < 0) {
|
||||
energy = 0;
|
||||
}
|
||||
nbt.setInteger("Energy", energy);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public void setCapacity(int capacity) {
|
||||
|
||||
this.capacity = capacity;
|
||||
|
||||
if (energy > capacity) {
|
||||
energy = capacity;
|
||||
}
|
||||
}
|
||||
|
||||
public void setMaxTransfer(int maxTransfer) {
|
||||
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
}
|
||||
|
||||
public void setMaxReceive(int maxReceive) {
|
||||
|
||||
this.maxReceive = maxReceive;
|
||||
}
|
||||
|
||||
public void setMaxExtract(int maxExtract) {
|
||||
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public int getMaxReceive() {
|
||||
|
||||
return maxReceive;
|
||||
}
|
||||
|
||||
public int getMaxExtract() {
|
||||
|
||||
return maxExtract;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is included to allow for server -> client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers are
|
||||
* guaranteed to have it.
|
||||
*
|
||||
* @param energy
|
||||
*/
|
||||
public void setEnergyStored(int energy) {
|
||||
|
||||
this.energy = energy;
|
||||
|
||||
if (this.energy > capacity) {
|
||||
this.energy = capacity;
|
||||
} else if (this.energy < 0) {
|
||||
this.energy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is included to allow the containing tile to directly and efficiently modify the energy contained in the EnergyStorage. Do not rely on this
|
||||
* externally, as not all IEnergyHandlers are guaranteed to have it.
|
||||
*
|
||||
* @param energy
|
||||
*/
|
||||
public void modifyEnergyStored(int energy) {
|
||||
|
||||
this.energy += energy;
|
||||
|
||||
if (this.energy > capacity) {
|
||||
this.energy = capacity;
|
||||
} else if (this.energy < 0) {
|
||||
this.energy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* IEnergyStorage */
|
||||
@Override
|
||||
public int receiveEnergy(int maxReceive, boolean simulate) {
|
||||
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
|
||||
if (!simulate) {
|
||||
energy += energyReceived;
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(int maxExtract, boolean simulate) {
|
||||
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
|
||||
if (!simulate) {
|
||||
energy -= energyExtracted;
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored() {
|
||||
|
||||
return energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored() {
|
||||
|
||||
return capacity;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
package cofh.api.energy;
|
||||
|
||||
/**
|
||||
* An energy storage is the unit of interaction with Energy inventories.
|
||||
*
|
||||
* A reference implementation can be found at {@link EnergyStorage}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyStorage {
|
||||
|
||||
/**
|
||||
* Adds energy to the storage. Returns quantity of energy that was accepted.
|
||||
*
|
||||
* @param maxReceive
|
||||
* Maximum amount of energy to be inserted.
|
||||
* @param simulate
|
||||
* If TRUE, the insertion will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) accepted by the storage.
|
||||
*/
|
||||
int receiveEnergy(int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Removes energy from the storage. Returns quantity of energy that was removed.
|
||||
*
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to be extracted.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted from the storage.
|
||||
*/
|
||||
int extractEnergy(int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
int getEnergyStored();
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
int getMaxEnergyStored();
|
||||
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyContainerItem}. Use/extend this or implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
|
||||
|
||||
protected int capacity;
|
||||
protected int maxReceive;
|
||||
protected int maxExtract;
|
||||
|
||||
public ItemEnergyContainer() {
|
||||
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity) {
|
||||
|
||||
this(capacity, capacity, capacity);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity, int maxTransfer) {
|
||||
|
||||
this(capacity, maxTransfer, maxTransfer);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity, int maxReceive, int maxExtract) {
|
||||
|
||||
this.capacity = capacity;
|
||||
this.maxReceive = maxReceive;
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public ItemEnergyContainer setCapacity(int capacity) {
|
||||
|
||||
this.capacity = capacity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setMaxTransfer(int maxTransfer) {
|
||||
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
}
|
||||
|
||||
public void setMaxReceive(int maxReceive) {
|
||||
|
||||
this.maxReceive = maxReceive;
|
||||
}
|
||||
|
||||
public void setMaxExtract(int maxExtract) {
|
||||
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
/* IEnergyContainerItem */
|
||||
@Override
|
||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
|
||||
if (container.stackTagCompound == null) {
|
||||
container.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
|
||||
if (!simulate) {
|
||||
energy += energyReceived;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
|
||||
if (!simulate) {
|
||||
energy -= energyExtracted;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ItemStack container) {
|
||||
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
return container.stackTagCompound.getInteger("Energy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ItemStack container) {
|
||||
|
||||
return capacity;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyHandler}. Use/extend this or implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class TileEnergyHandler extends TileEntity implements IEnergyHandler {
|
||||
|
||||
protected EnergyStorage storage = new EnergyStorage(32000);
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
super.readFromNBT(nbt);
|
||||
storage.readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
|
||||
super.writeToNBT(nbt);
|
||||
storage.writeToNBT(nbt);
|
||||
}
|
||||
|
||||
/* IEnergyHandler */
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
|
||||
return storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
|
||||
return storage.extractEnergy(maxExtract, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from) {
|
||||
|
||||
return storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from) {
|
||||
|
||||
return storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
}
|
9
src/main/java/cofh/api/energy/package-info.java
Normal file
9
src/main/java/cofh/api/energy/package-info.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
||||
* http://www.teamcofh.com
|
||||
*/
|
||||
@API(apiVersion = "1.0", owner = "CoFHCore", provides = "CoFHAPI|energy")
|
||||
package cofh.api.energy;
|
||||
|
||||
import cpw.mods.fml.common.API;
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
package cofh.api.item;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on Item classes which may be "Empowered" - what that means is completely up to you. This just provides a uniform way of dealing with
|
||||
* them.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEmpowerableItem {
|
||||
|
||||
/**
|
||||
* Check whether or not a given item is currently in an empowered state.
|
||||
*/
|
||||
boolean isEmpowered(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Attempt to set the empowered state of the item.
|
||||
*
|
||||
* @param stack
|
||||
* ItemStack to be empowered/disempowered.
|
||||
* @param state
|
||||
* Desired state.
|
||||
* @return TRUE if the operation was successful, FALSE if it was not.
|
||||
*/
|
||||
boolean setEmpoweredState(ItemStack stack, boolean state);
|
||||
|
||||
/**
|
||||
* Callback method for reacting to a state change. Useful in KeyBinding handlers.
|
||||
*
|
||||
* @param player
|
||||
* Player holding the item, if applicable.
|
||||
* @param stack
|
||||
* The item being held.
|
||||
*/
|
||||
void onStateChange(EntityPlayer player, ItemStack stack);
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package cofh.api.item;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on TileEntities which should connect to item transportation blocks.
|
||||
*
|
||||
* Note that {@link IInventoryHandler} is an extension of this.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IInventoryConnection {
|
||||
|
||||
/**
|
||||
* Returns TRUE if the TileEntity can connect on a given side.
|
||||
*/
|
||||
boolean canConnectInventory(ForgeDirection from);
|
||||
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
package cofh.api.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on Item classes that are themselves inventories.
|
||||
*
|
||||
* A reference implementation is provided {@link ItemInventoryContainer}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IInventoryContainerItem {
|
||||
|
||||
/**
|
||||
* Add an ItemStack to the inventory of this container item. This returns what is remaining of the original stack - a null return means that the entire
|
||||
* stack was accepted!
|
||||
*
|
||||
* @param container
|
||||
* ItemStack with the inventory.
|
||||
* @param item
|
||||
* ItemStack to be inserted. The size of this stack corresponds to the maximum amount to insert.
|
||||
* @param simulate
|
||||
* If TRUE, the insertion will only be simulated.
|
||||
* @return An ItemStack representing how much is remaining after the item was inserted (or would have been, if simulated) into the container inventory.
|
||||
*/
|
||||
ItemStack insertItem(ItemStack container, ItemStack item, boolean simulate);
|
||||
|
||||
/**
|
||||
* Extract an ItemStack from the inventory of this container item. This returns the resulting stack - a null return means that nothing was extracted!
|
||||
*
|
||||
* @param container
|
||||
* ItemStack with the inventory.
|
||||
* @param item
|
||||
* ItemStack to be extracted. The size of this stack corresponds to the maximum amount to extract. If this is null, then a null ItemStack should
|
||||
* immediately be returned.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return An ItemStack representing how much was extracted (or would have been, if simulated) from the container inventory.
|
||||
*/
|
||||
ItemStack extractItem(ItemStack container, ItemStack item, boolean simulate);
|
||||
|
||||
/**
|
||||
* Extract an ItemStack from the inventory of this container item. This returns the resulting stack - a null return means that nothing was extracted!
|
||||
*
|
||||
* @param container
|
||||
* ItemStack with the inventory.
|
||||
* @param maxExtract
|
||||
* Maximum number of items to extract. (The returned ItemStack should have a stackSize no higher than this.)
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return An ItemStack representing how much was extracted (or would have been, if simulated) from the container inventory.
|
||||
*/
|
||||
ItemStack extractItem(ItemStack container, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Get the contents of the container item's inventory. This should only return non-null ItemStacks, and an empty List if the inventory has nothing.
|
||||
*/
|
||||
List<ItemStack> getInventoryContents(ItemStack container);
|
||||
|
||||
/**
|
||||
* Get the size of this inventory of this container item.
|
||||
*/
|
||||
int getSizeInventory(ItemStack container);
|
||||
|
||||
/**
|
||||
* Returns whether or not the container item's inventory is empty.
|
||||
*/
|
||||
boolean isEmpty(ItemStack container);
|
||||
|
||||
/**
|
||||
* Returns whether or not the container item's inventory is full.
|
||||
*/
|
||||
boolean isFull(ItemStack container);
|
||||
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
package cofh.api.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on TileEntities which should handle items.
|
||||
*
|
||||
* A reference implementation is provided {@link TileInventoryHandler}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IInventoryHandler extends IInventoryConnection {
|
||||
|
||||
/**
|
||||
* Insert an ItemStack into the IInventoryHandler, internal distribution is left entirely to the IInventoryHandler. This returns what is remaining of the
|
||||
* original stack - a null return means that the entire stack was accepted!
|
||||
*
|
||||
* @param from
|
||||
* Orientation the item is inserted from.
|
||||
* @param item
|
||||
* ItemStack to be inserted. The size of this stack corresponds to the maximum amount to insert.
|
||||
* @param simulate
|
||||
* If TRUE, the insertion will only be simulated.
|
||||
* @return An ItemStack representing how much is remaining after the item was inserted (or would have been, if simulated) into the container inventory.
|
||||
*/
|
||||
ItemStack insertItem(ForgeDirection from, ItemStack item, boolean simulate);
|
||||
|
||||
/**
|
||||
* Extract an ItemStack from an IInventoryHandler, internal distribution is left entirely to the IInventoryHandler. This returns the resulting stack - a
|
||||
* null return means that nothing was extracted!
|
||||
*
|
||||
* @param from
|
||||
* Orientation the item is extracted from.
|
||||
* @param item
|
||||
* ItemStack to be extracted. The size of this stack corresponds to the maximum amount to extract. If this is null, then a null ItemStack should
|
||||
* immediately be returned.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return An ItemStack representing how much was extracted (or would have been, if simulated) from the container inventory.
|
||||
*/
|
||||
ItemStack extractItem(ForgeDirection from, ItemStack item, boolean simulate);
|
||||
|
||||
/**
|
||||
* Extract an ItemStack from an IInventoryHandler, internal distribution is left entirely to the IInventoryHandler. This returns the resulting stack - a
|
||||
* null return means that nothing was extracted!
|
||||
*
|
||||
* @param from
|
||||
* Orientation the item is extracted from.
|
||||
* @param maxExtract
|
||||
* Maximum number of items to extract. (The returned ItemStack should have a stackSize no higher than this.)
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return An ItemStack representing how much was extracted (or would have been, if simulated) from the container inventory.
|
||||
*/
|
||||
ItemStack extractItem(ForgeDirection from, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Get the contents of the IInventoryHandler's inventory. This returns a COPY. This should only return non-null ItemStacks, and an empty List if the
|
||||
* inventory has nothing.
|
||||
*/
|
||||
List<ItemStack> getInventoryContents(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Get the size (number of internal slots) of the IInventoryHandler's inventory.
|
||||
*/
|
||||
int getSizeInventory(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Returns whether or not the IInventoryHandler's inventory is empty (for a given side).
|
||||
*/
|
||||
boolean isEmpty(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Returns whether or not the IInventoryHandler's inventory is full (for a given side).
|
||||
*/
|
||||
boolean isFull(ForgeDirection from);
|
||||
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package cofh.api.item;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on Item classes which are Secure - linked to a specific player or group of players.
|
||||
*
|
||||
* Obviously, this relies on people using this interface properly. The Wheaton Rule is in effect here - don't be a jerk.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface ISecureItem {
|
||||
|
||||
/**
|
||||
* Check whether or not a given player can use this item.
|
||||
*/
|
||||
boolean canPlayerAccess(ItemStack stack, EntityPlayer player);
|
||||
|
||||
/**
|
||||
* Get the Owner of this item. This function is intentionally nebulous and is not guaranteed to be a player name.
|
||||
*/
|
||||
String getOwnerString();
|
||||
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package cofh.api.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on Item classes which can be externally modified through tinkering.
|
||||
*
|
||||
* Basically a catch all for "upgrading" a given ItemStack, which may represent an Item or a Block.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface ITinkerableItem {
|
||||
|
||||
/**
|
||||
* Returns a list of valid ItemStacks which may be used to upgrade this Tinkerable.
|
||||
*/
|
||||
List<ItemStack> getValidTinkers(ItemStack container);
|
||||
|
||||
/**
|
||||
* Applies a tinker to this item.
|
||||
*
|
||||
* @param container
|
||||
* The ItemStack (Tinkerable) to which the tinker is being applied.
|
||||
* @param tinker
|
||||
* The ItemStack representing the upgrade.
|
||||
* @return True if the application was successful, false if it was not.
|
||||
*/
|
||||
boolean applyTinker(ItemStack container, ItemStack tinker);
|
||||
|
||||
}
|
9
src/main/java/cofh/api/package-info.java
Normal file
9
src/main/java/cofh/api/package-info.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
||||
* http://www.teamcofh.com
|
||||
*/
|
||||
@API(apiVersion = "1.0", owner = "CoFHCore", provides = "CoFHAPI")
|
||||
package cofh.api;
|
||||
|
||||
import cpw.mods.fml.common.API;
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
package cofh.api.tileentity;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implemented on TileEntities which support Augments.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IAugmentableTile {
|
||||
|
||||
/**
|
||||
* Attempt to reconfigure the tile based on the Augmentations present. Return TRUE if it was successful; FALSE if a condition was not met.
|
||||
*/
|
||||
boolean augmentTile();
|
||||
|
||||
/**
|
||||
* Returns an array of the Augment slots for this Tile Entity.
|
||||
*/
|
||||
ItemStack[] getAugmentSlots();
|
||||
|
||||
/**
|
||||
* Returns a status array for the Augmentations installed in the Tile Entity.
|
||||
*/
|
||||
boolean[] getAugmentStatus();
|
||||
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which can report information about their energy usage.
|
||||
*
|
||||
* This is used for reporting purposes - Energy transactions are handled through IEnergyHandler!
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyInfo {
|
||||
|
||||
/**
|
||||
* Returns energy usage/generation per tick (RF/t).
|
||||
*/
|
||||
int getInfoEnergyPerTick();
|
||||
|
||||
/**
|
||||
* Returns maximum energy usage/generation per tick (RF/t).
|
||||
*/
|
||||
int getInfoMaxEnergyPerTick();
|
||||
|
||||
/**
|
||||
* Returns energy stored (RF).
|
||||
*/
|
||||
int getInfoEnergyStored();
|
||||
|
||||
/**
|
||||
* Returns maximum energy stored (RF).
|
||||
*/
|
||||
int getInfoMaxEnergyStored();
|
||||
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which allow for reconfiguration of their facing.
|
||||
*
|
||||
* Coordination with the containing block is required.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IReconfigurableFacing {
|
||||
|
||||
/**
|
||||
* Returns the current facing of the block.
|
||||
*/
|
||||
int getFacing();
|
||||
|
||||
/**
|
||||
* Returns whether or not the block's face can be aligned with the Y Axis.
|
||||
*/
|
||||
boolean allowYAxisFacing();
|
||||
|
||||
/**
|
||||
* Attempt to rotate the block. Arbitrary based on implementation.
|
||||
*
|
||||
* @return True if rotation was successful, false otherwise.
|
||||
*/
|
||||
boolean rotateBlock();
|
||||
|
||||
/**
|
||||
* Set the facing of the block.
|
||||
*
|
||||
* @param side
|
||||
* The side to set the facing to.
|
||||
* @return True if the facing was set, false otherwise.
|
||||
*/
|
||||
boolean setFacing(int side);
|
||||
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which allow for reconfiguration of their sides.
|
||||
*
|
||||
* Coordination with the containing block is required.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IReconfigurableSides {
|
||||
|
||||
/**
|
||||
* Decrement the config for a given side.
|
||||
*
|
||||
* @param side
|
||||
* The side to decrement.
|
||||
* @return True if config was changed, false otherwise.
|
||||
*/
|
||||
boolean decrSide(int side);
|
||||
|
||||
/**
|
||||
* Increment the config for a given side.
|
||||
*
|
||||
* @param side
|
||||
* The side to decrement.
|
||||
* @return True if config was changed, false otherwise.
|
||||
*/
|
||||
boolean incrSide(int side);
|
||||
|
||||
/**
|
||||
* Set the config for a given side.
|
||||
*
|
||||
* @param side
|
||||
* The side to set.
|
||||
* @param config
|
||||
* The config value to use.
|
||||
* @return True of config was set, false otherwise.
|
||||
*/
|
||||
boolean setSide(int side, int config);
|
||||
|
||||
/**
|
||||
* Reset configs on all sides to their base values.
|
||||
*
|
||||
* @return True if reset was successful, false otherwise.
|
||||
*/
|
||||
boolean resetSides();
|
||||
|
||||
/**
|
||||
* Returns the number of possible config settings for a given side.
|
||||
*/
|
||||
int getNumConfig(int side);
|
||||
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which cache their redstone status.
|
||||
*
|
||||
* Note that {@link IRedstoneControl} is an extension of this.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IRedstoneCache {
|
||||
|
||||
void setPowered(boolean isPowered);
|
||||
|
||||
boolean isPowered();
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which have Redstone Control functionality. This means that a tile can be set to ignore redstone entirely, or
|
||||
* respond to a low or high redstone state.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IRedstoneControl extends IRedstoneCache {
|
||||
|
||||
public static enum ControlMode {
|
||||
DISABLED(true), LOW(false), HIGH(true);
|
||||
|
||||
private final boolean state;
|
||||
|
||||
private ControlMode(boolean state) {
|
||||
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public boolean isDisabled() {
|
||||
|
||||
return this == DISABLED;
|
||||
}
|
||||
|
||||
public boolean isLow() {
|
||||
|
||||
return this == LOW;
|
||||
}
|
||||
|
||||
public boolean isHigh() {
|
||||
|
||||
return this == HIGH;
|
||||
}
|
||||
|
||||
public boolean getState() {
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
public static ControlMode stepForward(ControlMode curControl) {
|
||||
|
||||
return curControl == DISABLED ? LOW : curControl == HIGH ? DISABLED : HIGH;
|
||||
}
|
||||
|
||||
public static ControlMode stepBackward(ControlMode curControl) {
|
||||
|
||||
return curControl == DISABLED ? HIGH : curControl == HIGH ? LOW : DISABLED;
|
||||
}
|
||||
}
|
||||
|
||||
void setControl(ControlMode control);
|
||||
|
||||
ControlMode getControl();
|
||||
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which have access restrictions.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface ISecureTile {
|
||||
|
||||
/**
|
||||
* Enum for Access Modes - Restricted is Friends Only, Private is Owner only.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public static enum AccessMode {
|
||||
PUBLIC, RESTRICTED, PRIVATE;
|
||||
|
||||
public boolean isPublic() {
|
||||
|
||||
return this == PUBLIC;
|
||||
}
|
||||
|
||||
public boolean isRestricted() {
|
||||
|
||||
return this == RESTRICTED;
|
||||
}
|
||||
|
||||
public boolean isPrivate() {
|
||||
|
||||
return this == PRIVATE;
|
||||
}
|
||||
|
||||
public static AccessMode stepForward(AccessMode curAccess) {
|
||||
|
||||
return curAccess == PUBLIC ? RESTRICTED : curAccess == PRIVATE ? PUBLIC : PRIVATE;
|
||||
}
|
||||
|
||||
public static AccessMode stepBackward(AccessMode curAccess) {
|
||||
|
||||
return curAccess == PUBLIC ? PRIVATE : curAccess == PRIVATE ? RESTRICTED : PUBLIC;
|
||||
}
|
||||
}
|
||||
|
||||
boolean setAccess(AccessMode access);
|
||||
|
||||
boolean setOwnerName(String name);
|
||||
|
||||
AccessMode getAccess();
|
||||
|
||||
String getOwnerName();
|
||||
|
||||
boolean canPlayerAccess(String name);
|
||||
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package cofh.api.tileentity;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which can change their block's texture based on the current render pass. The block must defer the call to its Tile
|
||||
* Entity.
|
||||
*
|
||||
* @author Zeldo Kavira
|
||||
*
|
||||
*/
|
||||
public interface ISidedTexture {
|
||||
|
||||
/**
|
||||
* Returns the icon to use for a given side and render pass.
|
||||
*
|
||||
* @param side
|
||||
* Block side to get the texture for.
|
||||
* @param pass
|
||||
* Render pass.
|
||||
* @return The icon to use.
|
||||
*/
|
||||
IIcon getTexture(int side, int pass);
|
||||
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package cofh.api.tileentity;
|
||||
|
||||
import cofh.api.block.IBlockDebug;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which can be debugged via some in-game method, such as a tool. The containing block should be an instance of
|
||||
* {@link IBlockDebug} and defer the call to the tile.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface ITileDebug {
|
||||
|
||||
/**
|
||||
* This function debugs a tile entity.
|
||||
*
|
||||
* @param side
|
||||
* The side of the block.
|
||||
* @param player
|
||||
* Player doing the debugging.
|
||||
*/
|
||||
void debugTile(ForgeDirection side, EntityPlayer player);
|
||||
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package cofh.api.tileentity;
|
||||
|
||||
import cofh.api.block.IBlockInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which can provide information about themselves. The containing block should be an instance of {@link IBlockInfo}
|
||||
* and defer the call to the tile.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface ITileInfo {
|
||||
|
||||
/**
|
||||
* This function appends information to a list provided to it.
|
||||
*
|
||||
* @param info
|
||||
* The list that the information should be appended to.
|
||||
* @param side
|
||||
* The side of the block that is being queried.
|
||||
* @param player
|
||||
* Player doing the querying - this can be NULL.
|
||||
* @param debug
|
||||
* If true, the tile should return "debug" information.
|
||||
*/
|
||||
void getTileInfo(List<String> info, ForgeDirection side, EntityPlayer player, boolean debug);
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package cofh.api.transport;
|
||||
|
||||
interface IEnderAttuned {
|
||||
|
||||
public String getOwnerString();
|
||||
|
||||
public int getFrequency();
|
||||
|
||||
public boolean setFrequency(int frequency);
|
||||
|
||||
public boolean clearFrequency();
|
||||
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package cofh.api.transport;
|
||||
|
||||
/**
|
||||
* This interface is implemented on Ender Attuned objects which can receive Energy (Redstone Flux).
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnderEnergyHandler extends IEnderAttuned {
|
||||
|
||||
/**
|
||||
* Return whether or not the Ender Attuned object can currently send energy (Redstone Flux).
|
||||
*/
|
||||
boolean canSendEnergy();
|
||||
|
||||
/**
|
||||
* This should be checked to see if the Ender Attuned object can currently receive energy (Redstone Flux).
|
||||
*
|
||||
* Note: In practice, this can (and should) be used to ensure that something does not send to itself.
|
||||
*/
|
||||
boolean canReceiveEnergy();
|
||||
|
||||
/**
|
||||
* This tells the Ender Attuned object to receive energy. This returns the amount remaining, *not* the amount received - a return of 0 means that all energy
|
||||
* was received!
|
||||
*
|
||||
* @param energy
|
||||
* Amount of energy to be received.
|
||||
* @param simulate
|
||||
* If TRUE, the result will only be simulated.
|
||||
* @return Amount of energy that is remaining (or would be remaining, if simulated).
|
||||
*/
|
||||
int receiveEnergy(int energy, boolean simulate);
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package cofh.api.transport;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
/**
|
||||
* This interface is implemented on Ender Attuned objects which can receive Fluid.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnderFluidHandler extends IEnderAttuned {
|
||||
|
||||
/**
|
||||
* Return whether or not the Ender Attuned object can currently send FluidStacks.
|
||||
*/
|
||||
boolean canSendFluid();
|
||||
|
||||
/**
|
||||
* This should be checked to see if the Ender Attuned object can currently receive a FluidStack.
|
||||
*
|
||||
* Note: In practice, this can (and should) be used to ensure that something does not send to itself.
|
||||
*/
|
||||
boolean canReceiveFluid();
|
||||
|
||||
/**
|
||||
* This tells the Ender Attuned object to receive a FluidStack. This returns what remains of the original stack, *not* the amount received - a null return
|
||||
* means that the entire stack was received!
|
||||
*
|
||||
* @param fluid
|
||||
* FluidStack to be received.
|
||||
* @param simulate
|
||||
* If TRUE, the result will only be simulated.
|
||||
* @return FluidStack representing how much fluid is remaining (or would be remaining, if simulated).
|
||||
*/
|
||||
FluidStack receiveFluid(FluidStack fluid, boolean simulate);
|
||||
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package cofh.api.transport;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* This interface is implemented on Ender Attuned objects which can receive Items.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnderItemHandler extends IEnderAttuned {
|
||||
|
||||
/**
|
||||
* Return whether or not the Ender Attuned object can currently send ItemStacks.
|
||||
*/
|
||||
boolean canSendItems();
|
||||
|
||||
/**
|
||||
* This should be checked to see if the Ender Attuned object can currently receive an ItemStack.
|
||||
*
|
||||
* Note: In practice, this can (and should) be used to ensure that something does not send to itself.
|
||||
*/
|
||||
boolean canReceiveItems();
|
||||
|
||||
/**
|
||||
* This tells the Ender Attuned object to receive an ItemStack. This returns what remains of the original stack, *not* the amount received - a null return
|
||||
* means that the entire stack was received!
|
||||
*
|
||||
* This function does not support simulation because Inventory manipulation in Minecraft is an absolute mess and it would be a computational liability to do
|
||||
* so.
|
||||
*
|
||||
* @param item
|
||||
* ItemStack to be received.
|
||||
* @return An ItemStack representing how much is remaining.
|
||||
*/
|
||||
ItemStack receiveItem(ItemStack item);
|
||||
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package cofh.api.transport;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* This interface is implemented on ItemDucts. Use it to attempt to eject items into an entry point.
|
||||
*
|
||||
* @author Zeldo Kavira, King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IItemDuct {
|
||||
|
||||
/**
|
||||
* Insert an ItemStack into the IItemDuct. Will only accept items if there is a valid destination. This returns what is remaining of the original stack - a
|
||||
* null return means that the entire stack was accepted/routed!
|
||||
*
|
||||
* @param from
|
||||
* Orientation the item is inserted from.
|
||||
* @param item
|
||||
* ItemStack to be inserted. The size of this stack corresponds to the maximum amount to insert.
|
||||
* @return An ItemStack representing how much is remaining after the item was inserted into the Duct.
|
||||
*/
|
||||
public ItemStack insertItem(ForgeDirection from, ItemStack item);
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue