Merge branch 'development' of https://github.com/aidancbrady/Mekanism into development

This commit is contained in:
Aidan C. Brady 2014-06-26 01:20:15 -04:00
commit ab07313573
221 changed files with 443 additions and 7929 deletions

View file

@ -1,6 +1,6 @@
minecraft_version=1.7.2
forge_version=10.12.1.1112
FMP_version=1.1.0.282
CCLIB_version=1.1.1.81
forge_version=10.12.2.1121
FMP_version=1.1.0.288
CCLIB_version=1.1.1.87
NEI_version=1.0.1
mod_version=7.0.0

View 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;

View 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;

View file

@ -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 = "*";
}
}
}

View file

@ -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);
//}
}
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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;
}
}

View file

@ -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();
}

View file

@ -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 = "*";
}
}
}

View file

@ -1,3 +0,0 @@
@API(apiVersion="1.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|blueprints")
package buildcraft.api.blueprints;
import cpw.mods.fml.common.API;

View file

@ -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;
}
}

View file

@ -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());
}
}

View file

@ -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);
//}
}
}

View file

@ -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;
}
}

View file

@ -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);
}
}

View file

@ -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);
//}
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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);
}
}
}

View file

@ -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;
}
}

View file

@ -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);
}
}

View file

@ -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;
}
}
}

View file

@ -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;
}
}
}

View file

@ -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);
}
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}
}

View file

@ -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;
}
}
}

View file

@ -1,3 +0,0 @@
@API(apiVersion="1.0",owner="BuildCraftAPI|blueprints",provides="BuildCraftAPI|bptblocks")
package buildcraft.api.bptblocks;
import cpw.mods.fml.common.API;

View file

@ -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>();
}

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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);
}

View file

@ -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
}

View file

@ -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);
}
}

View file

@ -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;
}
}

View file

@ -1,3 +0,0 @@
@API(apiVersion="1.0",owner="BuildCraft|Core",provides="BuildCraftAPI|core")
package buildcraft.api.core;
import cpw.mods.fml.common.API;

View file

@ -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;
}

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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);
}

View file

@ -1,3 +0,0 @@
@API(apiVersion="2.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|filler")
package buildcraft.api.filler;
import cpw.mods.fml.common.API;

View file

@ -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());
}
}

View file

@ -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;
}
}

View file

@ -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) {
}
}

View file

@ -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);
}
}

View file

@ -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();
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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);
}

View file

@ -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();
}

View file

@ -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();
}

Some files were not shown because too many files have changed in this diff Show more