v5 Beta #11
*Updated to MC 1.4.5. *Migrated to Forge's new liquid system. *Updated Railcraft API. *Updated BuildCraft API. *Updated IC2 API. *Updated UniversalElectricity API.
This commit is contained in:
parent
6bf781c7df
commit
35b6e52fa8
163 changed files with 1824 additions and 2082 deletions
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
@ -15,7 +15,6 @@ import buildcraft.api.blueprints.BlockSignature;
|
|||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import buildcraft.api.core.Orientations;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.Item;
|
||||
|
@ -46,7 +45,7 @@ public class BptBlockSign extends BptBlock {
|
|||
}
|
||||
slot.meta = (int) (angle / 360.0 * 16.0);
|
||||
} else {
|
||||
slot.meta = Orientations.values()[slot.meta].rotateLeft().ordinal();
|
||||
// slot.meta = ForgeDirection.values()[slot.meta].rotateLeft().ordinal();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
@ -13,25 +13,23 @@ import net.minecraft.src.Block;
|
|||
import net.minecraft.src.World;
|
||||
|
||||
public class BuildCraftAPI {
|
||||
|
||||
|
||||
@Deprecated
|
||||
// To be removed, see LiquidManager
|
||||
// To be removed, see LiquidContainerRegistry
|
||||
public static final int BUCKET_VOLUME = 1000;
|
||||
public static final int LAST_ORIGINAL_BLOCK = 122;
|
||||
public static final int LAST_ORIGINAL_ITEM = 126;
|
||||
|
||||
public static boolean[] softBlocks = new boolean[Block.blocksList.length];
|
||||
/**
|
||||
* Return true if the block given in parameter is pass through (e.g. air,
|
||||
* water...)
|
||||
*/
|
||||
public static final boolean[] softBlocks = new boolean[Block.blocksList.length];
|
||||
|
||||
@Deprecated
|
||||
// To be removed
|
||||
public static boolean softBlock(int blockId) {
|
||||
return blockId == 0 || softBlocks[blockId] || Block.blocksList[blockId] == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the block cannot be broken, typically bedrock and lava
|
||||
*/
|
||||
@Deprecated
|
||||
// To be removed
|
||||
public static boolean unbreakableBlock(int blockId) {
|
||||
return blockId == Block.bedrock.blockID || blockId == Block.lavaStill.blockID || blockId == Block.lavaMoving.blockID;
|
||||
}
|
||||
|
@ -47,10 +45,4 @@ public class BuildCraftAPI {
|
|||
|
||||
world.setBlockWithNotify(x, y, z, 0);
|
||||
}
|
||||
|
||||
static {
|
||||
for (int i = 0; i < softBlocks.length; ++i) {
|
||||
softBlocks[i] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* 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.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public enum Orientations {
|
||||
YNeg, // 0
|
||||
YPos, // 1
|
||||
ZNeg, // 2
|
||||
ZPos, // 3
|
||||
XNeg, // 4
|
||||
XPos, // 5
|
||||
Unknown;
|
||||
|
||||
public Orientations reverse() {
|
||||
switch (this) {
|
||||
case YPos:
|
||||
return Orientations.YNeg;
|
||||
case YNeg:
|
||||
return Orientations.YPos;
|
||||
case ZPos:
|
||||
return Orientations.ZNeg;
|
||||
case ZNeg:
|
||||
return Orientations.ZPos;
|
||||
case XPos:
|
||||
return Orientations.XNeg;
|
||||
case XNeg:
|
||||
return Orientations.XPos;
|
||||
default:
|
||||
return Orientations.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
public ForgeDirection toDirection(){
|
||||
switch(this){
|
||||
case YNeg:
|
||||
return ForgeDirection.DOWN;
|
||||
case YPos:
|
||||
return ForgeDirection.UP;
|
||||
case ZNeg:
|
||||
return ForgeDirection.NORTH;
|
||||
case ZPos:
|
||||
return ForgeDirection.SOUTH;
|
||||
case XNeg:
|
||||
return ForgeDirection.WEST;
|
||||
case XPos:
|
||||
return ForgeDirection.EAST;
|
||||
default:
|
||||
return ForgeDirection.UNKNOWN;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Orientations rotateLeft() {
|
||||
switch (this) {
|
||||
case XPos:
|
||||
return ZPos;
|
||||
case ZNeg:
|
||||
return XPos;
|
||||
case XNeg:
|
||||
return ZNeg;
|
||||
case ZPos:
|
||||
return XNeg;
|
||||
default:
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public static Orientations[] dirs() {
|
||||
return new Orientations[] { YNeg, YPos, ZNeg, ZPos, XNeg, XPos };
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
@ -11,20 +11,21 @@ package buildcraft.api.core;
|
|||
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class Position {
|
||||
|
||||
public double x, y, z;
|
||||
public Orientations orientation;
|
||||
public ForgeDirection orientation;
|
||||
|
||||
public Position(double ci, double cj, double ck) {
|
||||
x = ci;
|
||||
y = cj;
|
||||
z = ck;
|
||||
orientation = Orientations.Unknown;
|
||||
orientation = ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
public Position(double ci, double cj, double ck, Orientations corientation) {
|
||||
public Position(double ci, double cj, double ck, ForgeDirection corientation) {
|
||||
x = ci;
|
||||
y = cj;
|
||||
z = ck;
|
||||
|
@ -43,7 +44,7 @@ public class Position {
|
|||
y = nbttagcompound.getDouble("j");
|
||||
z = nbttagcompound.getDouble("k");
|
||||
|
||||
orientation = Orientations.Unknown;
|
||||
orientation = ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
public Position(TileEntity tile) {
|
||||
|
@ -54,16 +55,16 @@ public class Position {
|
|||
|
||||
public void moveRight(double step) {
|
||||
switch (orientation) {
|
||||
case ZPos:
|
||||
case SOUTH:
|
||||
x = x - step;
|
||||
break;
|
||||
case ZNeg:
|
||||
case NORTH:
|
||||
x = x + step;
|
||||
break;
|
||||
case XPos:
|
||||
case EAST:
|
||||
z = z + step;
|
||||
break;
|
||||
case XNeg:
|
||||
case WEST:
|
||||
z = z - step;
|
||||
break;
|
||||
default:
|
||||
|
@ -76,22 +77,22 @@ public class Position {
|
|||
|
||||
public void moveForwards(double step) {
|
||||
switch (orientation) {
|
||||
case YPos:
|
||||
case UP:
|
||||
y = y + step;
|
||||
break;
|
||||
case YNeg:
|
||||
case DOWN:
|
||||
y = y - step;
|
||||
break;
|
||||
case ZPos:
|
||||
case SOUTH:
|
||||
z = z + step;
|
||||
break;
|
||||
case ZNeg:
|
||||
case NORTH:
|
||||
z = z - step;
|
||||
break;
|
||||
case XPos:
|
||||
case EAST:
|
||||
x = x + step;
|
||||
break;
|
||||
case XNeg:
|
||||
case WEST:
|
||||
x = x - step;
|
||||
break;
|
||||
default:
|
||||
|
@ -104,10 +105,10 @@ public class Position {
|
|||
|
||||
public void moveUp(double step) {
|
||||
switch (orientation) {
|
||||
case ZPos:
|
||||
case ZNeg:
|
||||
case XPos:
|
||||
case XNeg:
|
||||
case SOUTH:
|
||||
case NORTH:
|
||||
case EAST:
|
||||
case WEST:
|
||||
y = y + step;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -2,7 +2,8 @@ package buildcraft.api.fuels;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import buildcraft.api.liquids.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
|
||||
|
||||
public class IronEngineCoolant {
|
||||
|
|
|
@ -11,8 +11,9 @@ package buildcraft.api.fuels;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import buildcraft.api.liquids.LiquidManager;
|
||||
import buildcraft.api.liquids.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
|
||||
|
||||
public class IronEngineFuel {
|
||||
|
@ -37,7 +38,7 @@ public class IronEngineFuel {
|
|||
public final int totalBurningTime;
|
||||
|
||||
public IronEngineFuel(int liquidId, float powerPerCycle, int totalBurningTime) {
|
||||
this(new LiquidStack(liquidId, LiquidManager.BUCKET_VOLUME, 0), powerPerCycle, totalBurningTime);
|
||||
this(new LiquidStack(liquidId, LiquidContainerRegistry.BUCKET_VOLUME, 0), powerPerCycle, totalBurningTime);
|
||||
}
|
||||
public IronEngineFuel(LiquidStack liquid, float powerPerCycle, int totalBurningTime) {
|
||||
this.liquid = liquid;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package buildcraft.api.inventory;
|
||||
|
||||
import buildcraft.api.core.Orientations;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface ISecuredInventory {
|
||||
|
||||
|
@ -15,6 +15,6 @@ public interface ISecuredInventory {
|
|||
* @param orientation Orientation the transaction will be performed from.
|
||||
* @param name Name of the user/player who owns the transaction.
|
||||
*/
|
||||
void prepareTransaction(Orientations orientation, String name);
|
||||
void prepareTransaction(ForgeDirection orientation, String name);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package buildcraft.api.inventory;
|
||||
|
||||
import buildcraft.api.core.Orientations;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
public interface ISelectiveInventory extends ISpecialInventory {
|
||||
|
@ -13,5 +13,5 @@ public interface ISelectiveInventory extends ISpecialInventory {
|
|||
* @param maxItemCount Maximum amount of items to extract (spread over all returned item stacks)
|
||||
* @return Array of item stacks extracted from the inventory
|
||||
*/
|
||||
ItemStack[] extractItem(Object[] desired, boolean exclusion, boolean doRemove, Orientations from, int maxItemCount);
|
||||
ItemStack[] extractItem(Object[] desired, boolean exclusion, boolean doRemove, ForgeDirection from, int maxItemCount);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package buildcraft.api.inventory;
|
||||
|
||||
import buildcraft.api.core.Orientations;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
|
@ -13,7 +13,7 @@ public interface ISpecialInventory extends IInventory {
|
|||
* @param from Orientation the ItemStack is offered from.
|
||||
* @return Amount of items used from the passed stack.
|
||||
*/
|
||||
int addItem(ItemStack stack, boolean doAdd, Orientations from);
|
||||
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.
|
||||
|
@ -21,6 +21,6 @@ public interface ISpecialInventory extends IInventory {
|
|||
* @param maxItemCount Maximum amount of items to extract (spread over all returned item stacks)
|
||||
* @return Array of item stacks extracted from the inventory
|
||||
*/
|
||||
ItemStack[] extractItem(boolean doRemove, Orientations from, int maxItemCount);
|
||||
ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* 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.liquids;
|
||||
|
||||
public interface ILiquid {
|
||||
|
||||
public int stillLiquidId();
|
||||
|
||||
public boolean isMetaSensitive();
|
||||
|
||||
public int stillLiquidMeta();
|
||||
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package buildcraft.api.liquids;
|
||||
|
||||
public interface ILiquidTank {
|
||||
|
||||
/**
|
||||
* @return LiquidStack representing the liquid contained in the tank, null if empty.
|
||||
*/
|
||||
LiquidStack getLiquid();
|
||||
void setLiquid(LiquidStack liquid);
|
||||
void setCapacity(int capacity);
|
||||
int getCapacity();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param resource
|
||||
* @param doFill
|
||||
* @return Amount of liquid used for filling.
|
||||
*/
|
||||
int fill(LiquidStack resource, boolean doFill);
|
||||
/**
|
||||
*
|
||||
* @param maxDrain
|
||||
* @param doDrain
|
||||
* @return Null if nothing was drained, otherwise a LiquidStack containing the drained.
|
||||
*/
|
||||
LiquidStack drain(int maxDrain, boolean doDrain);
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package buildcraft.api.liquids;
|
||||
|
||||
import buildcraft.api.core.Orientations;
|
||||
|
||||
public interface ITankContainer {
|
||||
|
||||
/**
|
||||
* Fills liquid into internal tanks, distribution is left to the ITankContainer.
|
||||
* @param from Orientation the liquid is pumped in from.
|
||||
* @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer
|
||||
* @param doFill If false filling will only be simulated.
|
||||
* @return Amount of resource that was filled into internal tanks.
|
||||
*/
|
||||
int fill(Orientations from, LiquidStack resource, boolean doFill);
|
||||
/**
|
||||
* Fills liquid into the specified internal tank.
|
||||
* @param from Orientation the liquid is pumped in from.
|
||||
* @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer
|
||||
* @param doFill If false filling will only be simulated.
|
||||
* @return Amount of resource that was filled into internal tanks.
|
||||
*/
|
||||
int fill(int tankIndex, LiquidStack resource, boolean doFill);
|
||||
|
||||
/**
|
||||
* Drains liquid out of internal tanks, distribution is left to the ITankContainer.
|
||||
* @param from Orientation the liquid is drained to.
|
||||
* @param maxDrain Maximum amount of liquid to drain.
|
||||
* @param doDrain If false draining will only be simulated.
|
||||
* @return LiquidStack representing the liquid and amount actually drained from the ITankContainer
|
||||
*/
|
||||
LiquidStack drain(Orientations from, int maxDrain, boolean doDrain);
|
||||
/**
|
||||
* Drains liquid out of the specified internal tank.
|
||||
* @param from Orientation the liquid is drained to.
|
||||
* @param maxDrain Maximum amount of liquid to drain.
|
||||
* @param doDrain If false draining will only be simulated.
|
||||
* @return LiquidStack representing the liquid and amount actually drained from the ITankContainer
|
||||
*/
|
||||
LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain);
|
||||
|
||||
/**
|
||||
* @return Array of {@link LiquidTank}s contained in this ITankContainer
|
||||
*/
|
||||
ILiquidTank[] getTanks();
|
||||
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* 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.liquids;
|
||||
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
public class LiquidData {
|
||||
|
||||
public final LiquidStack stillLiquid;
|
||||
public final LiquidStack movingLiquid;
|
||||
|
||||
public final ItemStack filled;
|
||||
public final ItemStack container;
|
||||
|
||||
public LiquidData(int stillLiquidId, int movingLiquidId, Item filled) {
|
||||
this(new LiquidStack(stillLiquidId, LiquidManager.BUCKET_VOLUME), new LiquidStack(movingLiquidId, LiquidManager.BUCKET_VOLUME), new ItemStack(filled, 1), new ItemStack(Item.bucketEmpty));
|
||||
}
|
||||
|
||||
public LiquidData(int stillLiquidId, int movingLiquidId, ItemStack filled) {
|
||||
this(new LiquidStack(stillLiquidId, LiquidManager.BUCKET_VOLUME), new LiquidStack(movingLiquidId, LiquidManager.BUCKET_VOLUME), filled, new ItemStack(Item.bucketEmpty));
|
||||
}
|
||||
|
||||
public LiquidData(LiquidStack stillLiquid, ItemStack filled, ItemStack container) {
|
||||
this(stillLiquid, stillLiquid, filled, container);
|
||||
}
|
||||
|
||||
public LiquidData(LiquidStack stillLiquid, LiquidStack movingLiquid, ItemStack filled, ItemStack container) {
|
||||
this.stillLiquid = stillLiquid;
|
||||
this.movingLiquid = movingLiquid;
|
||||
this.filled = filled;
|
||||
this.container = container;
|
||||
|
||||
if(stillLiquid == null || filled == null || container == null)
|
||||
throw new RuntimeException("stillLiquid, filled, or container is null, this is an error");
|
||||
}
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
package buildcraft.api.liquids;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When creating liquids you should register them with this class.
|
||||
*
|
||||
* @author CovertJaguar <railcraft.wikispaces.com>
|
||||
*/
|
||||
public abstract class LiquidDictionary
|
||||
{
|
||||
|
||||
private static Map<String, LiquidStack> liquids = new HashMap<String, LiquidStack>();
|
||||
|
||||
/**
|
||||
* When creating liquids you should call this function.
|
||||
*
|
||||
* Upon passing it a name and liquid item it will return either
|
||||
* a preexisting implementation of that liquid or the liquid passed in.
|
||||
*
|
||||
*
|
||||
* @param name the name of the liquid
|
||||
* @param liquid the liquid to use if one doesn't exist
|
||||
* @return
|
||||
*/
|
||||
public static LiquidStack getOrCreateLiquid(String name, LiquidStack liquid)
|
||||
{
|
||||
LiquidStack existing = liquids.get(name);
|
||||
if(existing != null) {
|
||||
return existing.copy();
|
||||
}
|
||||
liquids.put(name, liquid.copy());
|
||||
return liquid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the liquid matching the name,
|
||||
* if such a liquid exists.
|
||||
*
|
||||
* Can return null.
|
||||
*
|
||||
* @param name the name of the liquid
|
||||
* @param amount the amout of liquid
|
||||
* @return
|
||||
*/
|
||||
public static LiquidStack getLiquid(String name, int amount)
|
||||
{
|
||||
LiquidStack liquid = liquids.get(name);
|
||||
if(liquid == null)
|
||||
return null;
|
||||
|
||||
liquid = liquid.copy();
|
||||
liquid.amount = amount;
|
||||
return liquid;
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package buildcraft.api.liquids;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
public class LiquidManager {
|
||||
|
||||
public static final int BUCKET_VOLUME = 1000;
|
||||
public static LinkedList<LiquidData> liquids = new LinkedList<LiquidData>();
|
||||
|
||||
public static LiquidStack getLiquidForFilledItem(ItemStack filledItem) {
|
||||
if (filledItem == null)
|
||||
return null;
|
||||
|
||||
for (LiquidData liquid : liquids)
|
||||
if (liquid.filled.isItemEqual(filledItem))
|
||||
return liquid.stillLiquid;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getLiquidIDForFilledItem(ItemStack filledItem) {
|
||||
LiquidStack liquidForFilledItem = getLiquidForFilledItem(filledItem);
|
||||
|
||||
if (liquidForFilledItem == null)
|
||||
return 0;
|
||||
|
||||
return liquidForFilledItem.itemID;
|
||||
}
|
||||
|
||||
public static ItemStack getFilledItemForLiquid(LiquidStack liquid) {
|
||||
for (LiquidData data : liquids)
|
||||
if(data.stillLiquid.isLiquidEqual(liquid))
|
||||
return data.filled.copy();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ItemStack fillLiquidContainer(int liquidId, int quantity, ItemStack emptyContainer) {
|
||||
return fillLiquidContainer(new LiquidStack(liquidId, quantity, 0), emptyContainer);
|
||||
}
|
||||
|
||||
public static ItemStack fillLiquidContainer(LiquidStack liquid, ItemStack emptyContainer) {
|
||||
for(LiquidData data : liquids)
|
||||
if(liquid.containsLiquid(data.stillLiquid)
|
||||
&& data.container.isItemEqual(emptyContainer))
|
||||
return data.filled.copy();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isLiquid(ItemStack block) {
|
||||
if (block.itemID == 0)
|
||||
return false;
|
||||
|
||||
for (LiquidData liquid : liquids)
|
||||
if (liquid.stillLiquid.isLiquidEqual(block) || liquid.movingLiquid.isLiquidEqual(block))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
package buildcraft.api.liquids;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* ItemStack substitute for liquids
|
||||
* @author SirSengir
|
||||
*/
|
||||
public class LiquidStack {
|
||||
public int itemID;
|
||||
public int amount;
|
||||
public int itemMeta;
|
||||
|
||||
private LiquidStack() {
|
||||
}
|
||||
|
||||
public LiquidStack(int itemID, int amount) {
|
||||
this(itemID, amount, 0);
|
||||
}
|
||||
|
||||
public LiquidStack(Item item, int amount) {
|
||||
this(item.shiftedIndex, amount, 0);
|
||||
}
|
||||
|
||||
public LiquidStack(Block block, int amount) {
|
||||
this(block.blockID, amount, 0);
|
||||
}
|
||||
|
||||
public LiquidStack(int itemID, int amount, int itemDamage) {
|
||||
this.itemID = itemID;
|
||||
this.amount = amount;
|
||||
this.itemMeta = itemDamage;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setShort("Id", (short) itemID);
|
||||
nbttagcompound.setInteger("Amount", amount);
|
||||
nbttagcompound.setShort("Meta", (short) itemMeta);
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
itemID = nbttagcompound.getShort("Id");
|
||||
amount = nbttagcompound.getInteger("Amount");
|
||||
itemMeta = nbttagcompound.getShort("Meta");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A copy of this LiquidStack
|
||||
*/
|
||||
public LiquidStack copy() {
|
||||
return new LiquidStack(itemID, amount, itemMeta);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param other
|
||||
* @return true if this LiquidStack contains the same liquid as the one passed in.
|
||||
*/
|
||||
public boolean isLiquidEqual(LiquidStack other) {
|
||||
if(other == null)
|
||||
return false;
|
||||
|
||||
return itemID == other.itemID && itemMeta == other.itemMeta;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param other
|
||||
* @return true if this LiquidStack contains the other liquid (liquids are equal and amount >= other.amount).
|
||||
*/
|
||||
public boolean containsLiquid(LiquidStack other) {
|
||||
if(!isLiquidEqual(other))
|
||||
return false;
|
||||
|
||||
return amount >= other.amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param other ItemStack containing liquids.
|
||||
* @return true if this LiquidStack contains the same liquid as the one passed in.
|
||||
*/
|
||||
public boolean isLiquidEqual(ItemStack other) {
|
||||
if(other == null)
|
||||
return false;
|
||||
|
||||
return itemID == other.itemID && itemMeta == other.getItemDamage();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ItemStack representation of this LiquidStack
|
||||
*/
|
||||
public ItemStack asItemStack() {
|
||||
return new ItemStack(itemID, 1, itemMeta);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a liquid stack from the passed nbttagcompound and returns it.
|
||||
*
|
||||
* @param nbttagcompound
|
||||
* @return
|
||||
*/
|
||||
public static LiquidStack loadLiquidStackFromNBT(NBTTagCompound nbttagcompound) {
|
||||
LiquidStack liquidstack = new LiquidStack();
|
||||
liquidstack.readFromNBT(nbttagcompound);
|
||||
return liquidstack.itemID == 0 ? null : liquidstack;
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
package buildcraft.api.liquids;
|
||||
|
||||
/**
|
||||
* Reference implementation of ILiquidTank. Use this or implement your own.
|
||||
*/
|
||||
public class LiquidTank implements ILiquidTank {
|
||||
private LiquidStack liquid;
|
||||
private int capacity;
|
||||
|
||||
public LiquidTank(int capacity) {
|
||||
this(null, capacity);
|
||||
}
|
||||
|
||||
public LiquidTank(int liquidId, int quantity, int capacity) {
|
||||
this(new LiquidStack(liquidId, quantity), capacity);
|
||||
}
|
||||
public LiquidTank(LiquidStack liquid, int capacity) {
|
||||
this.liquid = liquid;
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack getLiquid() {
|
||||
return this.liquid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLiquid(LiquidStack liquid) {
|
||||
this.liquid = liquid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCapacity(int capacity) {
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return this.capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(LiquidStack resource, boolean doFill) {
|
||||
if(resource == null || resource.itemID <= 0)
|
||||
return 0;
|
||||
|
||||
if(liquid == null || liquid.itemID <= 0) {
|
||||
if(resource.amount <= capacity) {
|
||||
if(doFill)
|
||||
this.liquid = resource.copy();
|
||||
return resource.amount;
|
||||
} else {
|
||||
if(doFill) {
|
||||
this.liquid = resource.copy();
|
||||
this.liquid.amount = capacity;
|
||||
}
|
||||
return capacity;
|
||||
}
|
||||
}
|
||||
|
||||
if(!liquid.isLiquidEqual(resource))
|
||||
return 0;
|
||||
|
||||
int space = capacity - liquid.amount;
|
||||
if(resource.amount <= space) {
|
||||
if(doFill)
|
||||
this.liquid.amount += resource.amount;
|
||||
return resource.amount;
|
||||
} else {
|
||||
|
||||
if(doFill)
|
||||
this.liquid.amount = capacity;
|
||||
return space;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public LiquidStack drain(int maxDrain, boolean doDrain) {
|
||||
if(liquid == null || liquid.itemID <= 0)
|
||||
return null;
|
||||
if(liquid.amount <= 0)
|
||||
return null;
|
||||
|
||||
int used = maxDrain;
|
||||
if(liquid.amount < used)
|
||||
used = liquid.amount;
|
||||
|
||||
if(doDrain) {
|
||||
liquid.amount -= used;
|
||||
}
|
||||
|
||||
LiquidStack drained = new LiquidStack(liquid.itemID, used, liquid.itemMeta);
|
||||
|
||||
// Reset liquid if emptied
|
||||
if(liquid.amount <= 0)
|
||||
liquid = null;
|
||||
|
||||
return drained;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package buildcraft.api.power;
|
||||
|
||||
import buildcraft.api.core.Orientations;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.api.core.SafeTimeTracker;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
|
||||
|
@ -32,9 +32,9 @@ public interface IPowerProvider {
|
|||
|
||||
void writeToNBT(NBTTagCompound nbttagcompound);
|
||||
|
||||
void receiveEnergy(float quantity, Orientations from);
|
||||
void receiveEnergy(float quantity, ForgeDirection from);
|
||||
|
||||
boolean isPowerSource(Orientations from);
|
||||
boolean isPowerSource(ForgeDirection from);
|
||||
|
||||
SafeTimeTracker getTimeTracker();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
package buildcraft.api.power;
|
||||
|
||||
import buildcraft.api.core.Orientations;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.api.core.SafeTimeTracker;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.TileEntity;
|
||||
|
@ -145,7 +145,7 @@ public abstract class PowerProvider implements IPowerProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void receiveEnergy(float quantity, Orientations from) {
|
||||
public void receiveEnergy(float quantity, ForgeDirection from) {
|
||||
powerSources[from.ordinal()] = 2;
|
||||
|
||||
energyStored += quantity;
|
||||
|
@ -156,7 +156,7 @@ public abstract class PowerProvider implements IPowerProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isPowerSource(Orientations from) {
|
||||
public boolean isPowerSource(ForgeDirection from) {
|
||||
return powerSources[from.ordinal()] != 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,14 +9,16 @@
|
|||
|
||||
package buildcraft.api.recipes;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import buildcraft.api.liquids.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
|
||||
public class RefineryRecipe {
|
||||
|
||||
private static LinkedList<RefineryRecipe> recipes = new LinkedList<RefineryRecipe>();
|
||||
public class RefineryRecipe implements Comparable<RefineryRecipe> {
|
||||
|
||||
private static SortedSet<RefineryRecipe> recipes = new TreeSet<RefineryRecipe>();
|
||||
|
||||
public static void registerRefineryRecipe(RefineryRecipe recipe) {
|
||||
if (!recipes.contains(recipe)) {
|
||||
|
@ -44,8 +46,24 @@ public class RefineryRecipe {
|
|||
this(new LiquidStack(ingredientId1, ingredientQty1, 0), new LiquidStack(ingredientId2, ingredientQty2, 0), new LiquidStack(resultId, resultQty, 0), energy, delay);
|
||||
}
|
||||
public RefineryRecipe(LiquidStack ingredient1, LiquidStack ingredient2, LiquidStack result, int energy, int delay) {
|
||||
this.ingredient1 = ingredient1;
|
||||
this.ingredient2 = ingredient2;
|
||||
|
||||
// Sort starting materials.
|
||||
if(ingredient1 != null && ingredient2 != null) {
|
||||
if( (ingredient1.itemID > ingredient2.itemID) || (ingredient1.itemID == ingredient2.itemID && ingredient1.itemMeta > ingredient2.itemMeta) ) {
|
||||
this.ingredient1 = ingredient2;
|
||||
this.ingredient2 = ingredient1;
|
||||
} else {
|
||||
this.ingredient1 = ingredient1;
|
||||
this.ingredient2 = ingredient2;
|
||||
}
|
||||
} else if(ingredient2 != null) {
|
||||
this.ingredient1 = ingredient2;
|
||||
this.ingredient2 = ingredient1;
|
||||
} else {
|
||||
this.ingredient1 = ingredient1;
|
||||
this.ingredient2 = ingredient2;
|
||||
}
|
||||
|
||||
this.result = result;
|
||||
this.energy = energy;
|
||||
this.delay = delay;
|
||||
|
@ -76,4 +94,63 @@ public class RefineryRecipe {
|
|||
return false;
|
||||
|
||||
}
|
||||
|
||||
// Compares to only the types of source materials.
|
||||
// We consider non-null < null in order that one-ingredient recipe is checked after
|
||||
// the failure of matching two-ingredient recipes which include that liquid.
|
||||
@Override
|
||||
public int compareTo(RefineryRecipe other) {
|
||||
|
||||
if(other == null) {
|
||||
return -1;
|
||||
} else if (ingredient1 == null) {
|
||||
if(other.ingredient1 == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
} else if(other.ingredient1 == null) {
|
||||
return -1;
|
||||
} else if(ingredient1.itemID != other.ingredient1.itemID) {
|
||||
return ingredient1.itemID - other.ingredient1.itemID;
|
||||
} else if(ingredient1.itemMeta != other.ingredient1.itemMeta) {
|
||||
return ingredient1.itemMeta - other.ingredient1.itemMeta;
|
||||
} else if(ingredient2 == null) {
|
||||
if(other.ingredient2 == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
} else if(other.ingredient2 == null) {
|
||||
return -1;
|
||||
} else if(ingredient2.itemID != other.ingredient2.itemID) {
|
||||
return ingredient2.itemID - other.ingredient2.itemID;
|
||||
} else if(ingredient2.itemMeta != other.ingredient2.itemMeta) {
|
||||
return ingredient2.itemMeta - other.ingredient2.itemMeta;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// equals() should be consistent with compareTo().
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(obj != null && obj instanceof RefineryRecipe) {
|
||||
return this.compareTo((RefineryRecipe)obj) == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// hashCode() should be overridden because equals() was overridden.
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if(ingredient1 == null) {
|
||||
return 0;
|
||||
} else if(ingredient2 == null) {
|
||||
return ingredient1.itemID ^ ingredient1.itemMeta;
|
||||
}
|
||||
|
||||
return ingredient1.itemID ^ ingredient1.itemMeta ^ ingredient2.itemID ^ ingredient2.itemMeta;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package buildcraft.api.tools;
|
||||
|
||||
import buildcraft.api.liquids.LiquidStack;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
public interface IToolPipette {
|
||||
|
||||
|
|
20
src/common/buildcraft/api/transport/FacadeManager.java
Normal file
20
src/common/buildcraft/api/transport/FacadeManager.java
Normal file
|
@ -0,0 +1,20 @@
|
|||
package buildcraft.api.transport;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
public class FacadeManager
|
||||
{
|
||||
private static Method addFacade;
|
||||
|
||||
public static void addFacade(ItemStack is) {
|
||||
try {
|
||||
if(addFacade == null) {
|
||||
Class facade = Class.forName("buildcraft.transport.ItemFacade");
|
||||
addFacade = facade.getMethod("addFacade", ItemStack.class);
|
||||
}
|
||||
addFacade.invoke(null, is);
|
||||
} catch(Exception ex) {
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,19 +1,19 @@
|
|||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.src.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?
|
||||
*/
|
||||
boolean canExtractItems(IPipe pipe, World world, int i, int j, int k);
|
||||
|
||||
/**
|
||||
* Can this pipe extract liquids from the block located at these coordinates?
|
||||
*/
|
||||
boolean canExtractLiquids(IPipe pipe, World world, int i, int j, int k);
|
||||
}
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.src.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?
|
||||
*/
|
||||
boolean canExtractItems(IPipe pipe, World world, int i, int j, int k);
|
||||
|
||||
/**
|
||||
* Can this pipe extract liquids from the block located at these coordinates?
|
||||
*/
|
||||
boolean canExtractLiquids(IPipe pipe, World world, int i, int j, int k);
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import buildcraft.api.core.Orientations;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface IPipeConnection {
|
||||
|
||||
public boolean isPipeConnected(Orientations with);
|
||||
public boolean isPipeConnected(ForgeDirection with);
|
||||
}
|
||||
|
|
|
@ -10,15 +10,15 @@
|
|||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.src.ItemStack;
|
||||
import buildcraft.api.core.Orientations;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Interface used to put objects into pipes, implemented by pipe tile entities.
|
||||
*/
|
||||
public interface IPipeEntry {
|
||||
|
||||
void entityEntering(ItemStack payload, Orientations orientation);
|
||||
void entityEntering(IPipedItem item, Orientations orientation);
|
||||
void entityEntering(ItemStack payload, ForgeDirection orientation);
|
||||
void entityEntering(IPipedItem item, ForgeDirection orientation);
|
||||
|
||||
boolean acceptItems();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package buildcraft.api.transport;
|
||||
|
||||
import buildcraft.api.core.Orientations;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.api.core.SafeTimeTracker;
|
||||
import net.minecraft.src.EntityItem;
|
||||
|
@ -89,7 +89,7 @@ public interface IPipedItem {
|
|||
|
||||
public abstract void writeToNBT(NBTTagCompound nbttagcompound);
|
||||
|
||||
public abstract EntityItem toEntityItem(Orientations dir);
|
||||
public abstract EntityItem toEntityItem(ForgeDirection dir);
|
||||
|
||||
public abstract float getEntityBrightness(float f);
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public enum Direction {
|
|||
public Direction getInverse() {
|
||||
int inverseDir = dir - getSign();
|
||||
|
||||
for (Direction direction: Direction.values()) {
|
||||
for (Direction direction : directions) {
|
||||
if (direction.dir == inverseDir) return direction;
|
||||
}
|
||||
|
||||
|
@ -102,5 +102,6 @@ public enum Direction {
|
|||
}
|
||||
|
||||
private int dir;
|
||||
private static final Direction[] directions = Direction.values();
|
||||
}
|
||||
|
||||
|
|
28
src/common/ic2/api/IC2Reactor.java
Normal file
28
src/common/ic2/api/IC2Reactor.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package ic2.api;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class IC2Reactor {
|
||||
private static Field energyGeneratorNuclear;
|
||||
|
||||
public int getEUOutput() {
|
||||
try {
|
||||
if (energyGeneratorNuclear == null) energyGeneratorNuclear = Class.forName(getPackage() + ".common.IC2").getDeclaredField("energyGeneratorNuclear");
|
||||
|
||||
return energyGeneratorNuclear.getInt(null);
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base IC2 package name, used internally.
|
||||
*
|
||||
* @return IC2 package name, if unable to be determined defaults to ic2
|
||||
*/
|
||||
private static String getPackage() {
|
||||
Package pkg = NetworkHelper.class.getPackage();
|
||||
if (pkg != null) return pkg.getName().substring(0, pkg.getName().lastIndexOf('.'));
|
||||
else return "ic2";
|
||||
}
|
||||
}
|
|
@ -23,5 +23,5 @@ public interface IEnergyStorage {
|
|||
*
|
||||
* @return Energy output in EU/t
|
||||
*/
|
||||
public int getRate();
|
||||
public int getOutput();
|
||||
}
|
||||
|
|
|
@ -91,9 +91,9 @@ public interface IReactor {
|
|||
public int addOutput(int energy);
|
||||
|
||||
/**
|
||||
* Get's the EU worth of a single basic Uranium pulse
|
||||
* Please use this variable to alter energy output, as it represents the config modifiers as well.
|
||||
* Replaced by IC2Reactor.getEUOutput() - stays at the universal output value of 1 for compatibility
|
||||
*/
|
||||
@Deprecated
|
||||
public int getPulsePower();
|
||||
|
||||
/**
|
||||
|
|
|
@ -81,7 +81,7 @@ public final class NetworkHelper {
|
|||
if (NetworkManager_initiateTileEntityEvent == null) NetworkManager_initiateTileEntityEvent = Class.forName(getPackage() + ".common.NetworkManager").getMethod("initiateTileEntityEvent", TileEntity.class, Integer.TYPE, Boolean.TYPE);
|
||||
if (instance == null) instance = getInstance();
|
||||
|
||||
NetworkManager_initiateTileEntityEvent.invoke(null, te, event, limitRange);
|
||||
NetworkManager_initiateTileEntityEvent.invoke(instance, te, event, limitRange);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -126,8 +126,9 @@ public final class NetworkHelper {
|
|||
public static void announceBlockUpdate(World world, int x, int y, int z) {
|
||||
try {
|
||||
if (NetworkManager_announceBlockUpdate == null) NetworkManager_announceBlockUpdate = Class.forName(getPackage() + ".common.NetworkManager").getMethod("announceBlockUpdate", World.class, Integer.TYPE, Integer.TYPE, Integer.TYPE);
|
||||
if (instance == null) instance = getInstance();
|
||||
|
||||
NetworkManager_announceBlockUpdate.invoke(null, world, x, y, z);
|
||||
NetworkManager_announceBlockUpdate.invoke(instance, world, x, y, z);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -4,9 +4,6 @@ import java.util.List;
|
|||
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
|
||||
import universalelectricity.implement.IElectricityReceiver;
|
||||
import universalelectricity.implement.IJouleStorage;
|
||||
|
||||
import dan200.computer.api.IPeripheral;
|
||||
|
||||
import ic2.api.IEnergySink;
|
||||
|
|
|
@ -3,7 +3,7 @@ package mekanism.common;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import universalelectricity.core.Vector3;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.multiblock.IMultiBlock;
|
||||
|
||||
import cpw.mods.fml.common.Side;
|
||||
|
|
|
@ -142,7 +142,7 @@ public class BlockBasic extends Block
|
|||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving)
|
||||
{
|
||||
world.markBlockAsNeedsUpdate(x, y, z);
|
||||
world.markBlockForRenderUpdate(x, y, z);
|
||||
world.updateAllLightTypes(x, y, z);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package mekanism.common;
|
||||
|
||||
import ic2.api.IElectricItem;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
import mekanism.api.IEnergizedItem;
|
||||
import mekanism.api.ItemMachineUpgrade;
|
||||
import net.minecraft.src.*;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package mekanism.common;
|
||||
|
||||
import ic2.api.IElectricItem;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
import mekanism.api.IEnergizedItem;
|
||||
import net.minecraft.src.*;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package mekanism.common;
|
||||
|
||||
import ic2.api.IElectricItem;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
import mekanism.api.IEnergizedItem;
|
||||
import mekanism.api.ItemMachineUpgrade;
|
||||
import net.minecraft.src.*;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package mekanism.common;
|
||||
|
||||
import ic2.api.IElectricItem;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
import mekanism.api.IEnergizedItem;
|
||||
import mekanism.api.IStorageTank.EnumGas;
|
||||
import mekanism.api.IStorageTank;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package mekanism.common;
|
||||
|
||||
import ic2.api.IElectricItem;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
import mekanism.api.*;
|
||||
import mekanism.api.IStorageTank.EnumGas;
|
||||
import net.minecraft.src.*;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package mekanism.common;
|
||||
|
||||
import ic2.api.IElectricItem;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
import mekanism.api.IEnergizedItem;
|
||||
import net.minecraft.src.*;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package mekanism.common;
|
||||
|
||||
import ic2.api.IElectricItem;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
import mekanism.api.IEnergizedItem;
|
||||
import mekanism.api.IStorageTank;
|
||||
import mekanism.api.IStorageTank.EnumGas;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package mekanism.common;
|
||||
|
||||
import ic2.api.IElectricItem;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
import mekanism.api.*;
|
||||
import net.minecraft.src.*;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package mekanism.common;
|
||||
|
||||
import ic2.api.IElectricItem;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
import mekanism.api.IEnergizedItem;
|
||||
import net.minecraft.src.*;
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package mekanism.common;
|
|||
import java.util.List;
|
||||
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.electricity.ElectricInfo;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.core.electricity.ElectricInfo;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
|
||||
import ic2.api.IElectricItem;
|
||||
import mekanism.api.IEnergizedItem;
|
||||
|
@ -150,7 +150,7 @@ public class ItemEnergized extends ItemMekanism implements IEnergizedItem, IItem
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getMaxJoules()
|
||||
public double getMaxJoules(Object... data)
|
||||
{
|
||||
return MAX_ENERGY*UniversalElectricity.IC2_RATIO;
|
||||
}
|
||||
|
|
|
@ -2,59 +2,89 @@ package mekanism.common;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.Side;
|
||||
import cpw.mods.fml.common.asm.SideOnly;
|
||||
|
||||
import net.minecraft.src.*;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.Event.Result;
|
||||
import net.minecraftforge.event.entity.player.UseHoeEvent;
|
||||
|
||||
public class ItemMekanismHoe extends ItemMekanism
|
||||
{
|
||||
public ItemMekanismHoe(int par1, EnumToolMaterial par2EnumToolMaterial)
|
||||
protected EnumToolMaterial theToolMaterial;
|
||||
|
||||
public ItemMekanismHoe(int id, EnumToolMaterial par2EnumToolMaterial)
|
||||
{
|
||||
super(par1);
|
||||
super(id);
|
||||
theToolMaterial = par2EnumToolMaterial;
|
||||
maxStackSize = 1;
|
||||
setMaxDamage(par2EnumToolMaterial.getMaxUses());
|
||||
setCreativeTab(CreativeTabs.tabTools);
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
|
||||
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS
|
||||
*/
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
if (!par2EntityPlayer.func_82247_a(par4, par5, par6, par7, par1ItemStack))
|
||||
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int i = par3World.getBlockId(par4, par5, par6);
|
||||
int j = par3World.getBlockId(par4, par5 + 1, par6);
|
||||
|
||||
if (par7 != 0 && j == 0 && i == Block.grass.blockID || i == Block.dirt.blockID)
|
||||
{
|
||||
Block block = Block.tilledField;
|
||||
par3World.playSoundEffect((float)par4 + 0.5F, (float)par5 + 0.5F, (float)par6 + 0.5F, block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
|
||||
|
||||
if (par3World.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
par3World.setBlockWithNotify(par4, par5, par6, block.blockID);
|
||||
par1ItemStack.damageItem(1, par2EntityPlayer);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
UseHoeEvent event = new UseHoeEvent(par2EntityPlayer, par1ItemStack, par3World, par4, par5, par6);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (event.getResult() == Result.ALLOW)
|
||||
{
|
||||
par1ItemStack.damageItem(1, par2EntityPlayer);
|
||||
return true;
|
||||
}
|
||||
|
||||
int var11 = par3World.getBlockId(par4, par5, par6);
|
||||
int var12 = par3World.getBlockId(par4, par5 + 1, par6);
|
||||
|
||||
if ((par7 == 0 || var12 != 0 || var11 != Block.grass.blockID) && var11 != Block.dirt.blockID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Block var13 = Block.tilledField;
|
||||
par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), var13.stepSound.getStepSound(), (var13.stepSound.getVolume() + 1.0F) / 2.0F, var13.stepSound.getPitch() * 0.8F);
|
||||
|
||||
if (par3World.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
par3World.setBlockWithNotify(par4, par5, par6, var13.blockID);
|
||||
par1ItemStack.damageItem(1, par2EntityPlayer);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
{
|
||||
list.add("HP: " + (itemstack.getMaxDamage() - itemstack.getItemDamage()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
/**
|
||||
* Returns True is the item is renderer in full 3D when hold.
|
||||
*/
|
||||
public boolean isFull3D()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public String func_77842_f()
|
||||
{
|
||||
return theToolMaterial.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -644,7 +644,7 @@ public class Mekanism
|
|||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.melonSeeds), new ItemStack(BioFuel, 1));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.appleRed), new ItemStack(BioFuel, 3));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.bread), new ItemStack(BioFuel, 3));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.potatoe), new ItemStack(BioFuel, 2));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.potato), new ItemStack(BioFuel, 2));
|
||||
|
||||
for(int i = 0; i < BlockLeaves.LEAF_TYPES.length; i++)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package mekanism.common;
|
||||
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
import ic2.api.IElectricItem;
|
||||
import mekanism.api.IEnergizedItem;
|
||||
import net.minecraft.src.*;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mekanism.common;
|
||||
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import ic2.api.IElectricItem;
|
||||
import mekanism.api.IEnergizedItem;
|
||||
import mekanism.api.IStorageTank;
|
||||
|
|
|
@ -8,8 +8,7 @@ import java.util.List;
|
|||
import mekanism.api.IMachineUpgrade;
|
||||
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.electricity.ElectricInfo;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
|
||||
import buildcraft.api.power.IPowerProvider;
|
||||
import buildcraft.api.power.PowerFramework;
|
||||
|
@ -320,7 +319,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
|
|||
secondaryEnergyStored = dataStream.readInt();
|
||||
currentMaxEnergy = dataStream.readInt();
|
||||
currentTicksRequired = dataStream.readInt();
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[Mekanism] Error while handling tile entity packet.");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package mekanism.common;
|
||||
|
||||
import universalelectricity.core.Vector3;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.multiblock.*;
|
||||
import mekanism.common.BlockGenerator.GeneratorType;
|
||||
import net.minecraft.src.*;
|
||||
|
|
|
@ -2,7 +2,7 @@ package mekanism.common;
|
|||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import universalelectricity.prefab.TileEntityDisableable;
|
||||
import universalelectricity.prefab.tile.TileEntityDisableable;
|
||||
import ic2.api.EnergyNet;
|
||||
import ic2.api.IWrenchable;
|
||||
import mekanism.api.ITileNetwork;
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package mekanism.common;
|
||||
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.electricity.ElectricInfo;
|
||||
import universalelectricity.electricity.ElectricityManager;
|
||||
import universalelectricity.implement.IElectricityReceiver;
|
||||
import universalelectricity.implement.IJouleStorage;
|
||||
import universalelectricity.prefab.TileEntityDisableable;
|
||||
|
||||
import universalelectricity.core.electricity.ElectricInfo;
|
||||
import universalelectricity.core.implement.IElectricityReceiver;
|
||||
import universalelectricity.core.implement.IJouleStorage;
|
||||
import buildcraft.api.power.IPowerProvider;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerFramework;
|
||||
|
@ -209,7 +206,7 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getMaxJoules()
|
||||
public double getMaxJoules(Object... data)
|
||||
{
|
||||
return currentMaxEnergy*UniversalElectricity.IC2_RATIO;
|
||||
}
|
||||
|
|
|
@ -3,13 +3,8 @@ package mekanism.common;
|
|||
import ic2.api.ElectricItem;
|
||||
import ic2.api.IElectricItem;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.electricity.ElectricInfo;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import buildcraft.api.core.Orientations;
|
||||
import buildcraft.api.liquids.ILiquidTank;
|
||||
import buildcraft.api.liquids.ITankContainer;
|
||||
import buildcraft.api.liquids.LiquidStack;
|
||||
import buildcraft.api.liquids.LiquidTank;
|
||||
import universalelectricity.core.electricity.ElectricInfo;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
@ -17,6 +12,10 @@ import dan200.computer.api.IComputerAccess;
|
|||
import mekanism.api.IEnergizedItem;
|
||||
import net.minecraft.src.*;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.ILiquidTank;
|
||||
import net.minecraftforge.liquids.ITankContainer;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidTank;
|
||||
|
||||
public class TileEntityBioGenerator extends TileEntityGenerator implements ITankContainer
|
||||
{
|
||||
|
@ -166,7 +165,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank
|
|||
energyStored = dataStream.readInt();
|
||||
isActive = dataStream.readBoolean();
|
||||
bioFuelSlot.liquidStored = dataStream.readInt();
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[Mekanism] Error while handling tile entity packet.");
|
||||
|
@ -216,9 +215,9 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank
|
|||
}
|
||||
|
||||
@Override
|
||||
public int fill(Orientations from, LiquidStack resource, boolean doFill)
|
||||
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill)
|
||||
{
|
||||
if(from.toDirection() != ForgeDirection.getOrientation(facing))
|
||||
if(from != ForgeDirection.getOrientation(facing))
|
||||
{
|
||||
if(resource.itemID == Mekanism.hooks.ForestryBiofuelID)
|
||||
{
|
||||
|
@ -253,7 +252,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank
|
|||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack drain(Orientations from, int maxDrain, boolean doDrain)
|
||||
public LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -265,8 +264,14 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank
|
|||
}
|
||||
|
||||
@Override
|
||||
public ILiquidTank[] getTanks()
|
||||
public ILiquidTank[] getTanks(ForgeDirection direction)
|
||||
{
|
||||
return new ILiquidTank[] {new LiquidTank(bioFuelSlot.liquidID, bioFuelSlot.liquidStored, bioFuelSlot.MAX_LIQUID)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILiquidTank getTank(ForgeDirection direction, LiquidStack type)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.google.common.io.ByteArrayDataInput;
|
|||
import buildcraft.api.power.IPowerProvider;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerFramework;
|
||||
import universalelectricity.prefab.TileEntityDisableable;
|
||||
import ic2.api.EnergyNet;
|
||||
import ic2.api.IWrenchable;
|
||||
import mekanism.api.ITileNetwork;
|
||||
|
|
|
@ -7,8 +7,7 @@ import java.util.List;
|
|||
|
||||
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.electricity.ElectricInfo;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
|
||||
import buildcraft.api.power.IPowerProvider;
|
||||
import buildcraft.api.power.PowerFramework;
|
||||
|
@ -273,7 +272,7 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine
|
|||
energyStored = dataStream.readInt();
|
||||
currentMaxEnergy = dataStream.readInt();
|
||||
currentTicksRequired = dataStream.readInt();
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[Mekanism] Error while handling tile entity packet.");
|
||||
|
|
|
@ -5,17 +5,10 @@ import ic2.api.ElectricItem;
|
|||
import ic2.api.IElectricItem;
|
||||
import ic2.api.IEnergySink;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.core.Vector3;
|
||||
import universalelectricity.electricity.ElectricInfo;
|
||||
import universalelectricity.implement.IElectricityReceiver;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.implement.IJouleStorage;
|
||||
|
||||
import buildcraft.api.core.Orientations;
|
||||
import buildcraft.api.liquids.ILiquidTank;
|
||||
import buildcraft.api.liquids.ITankContainer;
|
||||
import buildcraft.api.liquids.LiquidStack;
|
||||
import buildcraft.api.liquids.LiquidTank;
|
||||
import universalelectricity.core.electricity.ElectricInfo;
|
||||
import universalelectricity.core.implement.IElectricityReceiver;
|
||||
import universalelectricity.core.implement.IJouleStorage;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
@ -30,6 +23,10 @@ import mekanism.api.IStorageTank.EnumGas;
|
|||
import mekanism.api.ITileNetwork;
|
||||
import net.minecraft.src.*;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.ILiquidTank;
|
||||
import net.minecraftforge.liquids.ITankContainer;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidTank;
|
||||
|
||||
public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock implements IGasStorage, IEnergySink, IJouleStorage, IElectricityReceiver, IEnergyAcceptor, ITankContainer, IPeripheral
|
||||
{
|
||||
|
@ -254,7 +251,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
waterSlot.liquidStored = dataStream.readInt();
|
||||
oxygenStored = dataStream.readInt();
|
||||
hydrogenStored = dataStream.readInt();
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[Mekanism] Error while handling tile entity packet.");
|
||||
|
@ -336,7 +333,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getMaxJoules()
|
||||
public double getMaxJoules(Object... data)
|
||||
{
|
||||
return MAX_ENERGY*UniversalElectricity.IC2_RATIO;
|
||||
}
|
||||
|
@ -426,9 +423,9 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
}
|
||||
|
||||
@Override
|
||||
public int fill(Orientations from, LiquidStack resource, boolean doFill)
|
||||
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill)
|
||||
{
|
||||
if(from.toDirection() != ForgeDirection.getOrientation(facing))
|
||||
if(from != ForgeDirection.getOrientation(facing))
|
||||
{
|
||||
if(resource.itemID == Block.waterStill.blockID)
|
||||
{
|
||||
|
@ -463,7 +460,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack drain(Orientations from, int maxDrain, boolean doDrain)
|
||||
public LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -475,11 +472,17 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
}
|
||||
|
||||
@Override
|
||||
public ILiquidTank[] getTanks()
|
||||
public ILiquidTank[] getTanks(ForgeDirection direction)
|
||||
{
|
||||
return new ILiquidTank[] {new LiquidTank(waterSlot.liquidID, waterSlot.liquidStored, waterSlot.MAX_LIQUID)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILiquidTank getTank(ForgeDirection direction, LiquidStack type)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package mekanism.common;
|
||||
|
||||
import universalelectricity.core.Vector3;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
@ -181,7 +181,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasS
|
|||
facing = dataStream.readInt();
|
||||
gasStored = dataStream.readInt();
|
||||
gasType = EnumGas.getFromName(dataStream.readUTF());
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[Mekanism] Error while handling tile entity packet.");
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mekanism.common;
|
||||
|
||||
import buildcraft.api.core.Orientations;
|
||||
import buildcraft.api.power.IPowerProvider;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerFramework;
|
||||
|
@ -18,14 +17,13 @@ import ic2.api.IElectricItem;
|
|||
import ic2.api.IEnergySource;
|
||||
import ic2.api.IEnergyStorage;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.core.Vector3;
|
||||
import universalelectricity.electricity.ElectricInfo;
|
||||
import universalelectricity.electricity.ElectricityManager;
|
||||
import universalelectricity.implement.IConductor;
|
||||
import universalelectricity.implement.IElectricityReceiver;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.implement.IJouleStorage;
|
||||
import universalelectricity.prefab.TileEntityConductor;
|
||||
import universalelectricity.core.electricity.ElectricInfo;
|
||||
import universalelectricity.core.electricity.ElectricityManager;
|
||||
import universalelectricity.core.implement.IConductor;
|
||||
import universalelectricity.core.implement.IElectricityReceiver;
|
||||
import universalelectricity.core.implement.IJouleStorage;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.tile.TileEntityConductor;
|
||||
import mekanism.api.IEnergizedItem;
|
||||
import mekanism.api.IEnergyAcceptor;
|
||||
import net.minecraft.src.*;
|
||||
|
@ -87,7 +85,7 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
|
|||
IPowerReceptor receptor = (IPowerReceptor)tileEntity;
|
||||
int energyNeeded = Math.min(receptor.getPowerProvider().getMinEnergyReceived(), receptor.getPowerProvider().getMaxEnergyReceived())*10;
|
||||
float transferEnergy = Math.max(Math.min(Math.min(energyNeeded, energyStored), 54000), 0);
|
||||
receptor.getPowerProvider().receiveEnergy((float)(transferEnergy/10), Orientations.dirs()[ForgeDirection.getOrientation(facing).getOpposite().ordinal()]);
|
||||
receptor.getPowerProvider().receiveEnergy((float)(transferEnergy/10), ForgeDirection.getOrientation(facing).getOpposite());
|
||||
setEnergy(energyStored - (int)transferEnergy);
|
||||
}
|
||||
else if(tileEntity instanceof TileEntityConductor)
|
||||
|
@ -238,7 +236,7 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getMaxJoules()
|
||||
public double getMaxJoules(Object... data)
|
||||
{
|
||||
return MAX_ENERGY*UniversalElectricity.IC2_RATIO;
|
||||
}
|
||||
|
@ -274,7 +272,7 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRate()
|
||||
public int getOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
|
|
@ -5,13 +5,8 @@ import java.io.DataOutputStream;
|
|||
import ic2.api.ElectricItem;
|
||||
import ic2.api.IElectricItem;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.electricity.ElectricInfo;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import buildcraft.api.core.Orientations;
|
||||
import buildcraft.api.liquids.ILiquidTank;
|
||||
import buildcraft.api.liquids.ITankContainer;
|
||||
import buildcraft.api.liquids.LiquidStack;
|
||||
import buildcraft.api.liquids.LiquidTank;
|
||||
import universalelectricity.core.electricity.ElectricInfo;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
import buildcraft.api.power.PowerFramework;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
@ -21,6 +16,10 @@ import dan200.computer.api.IComputerAccess;
|
|||
import mekanism.api.IEnergizedItem;
|
||||
import net.minecraft.src.*;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.ILiquidTank;
|
||||
import net.minecraftforge.liquids.ITankContainer;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidTank;
|
||||
|
||||
public class TileEntityHeatGenerator extends TileEntityGenerator implements ITankContainer
|
||||
{
|
||||
|
@ -187,7 +186,7 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
|
|||
energyStored = dataStream.readInt();
|
||||
isActive = dataStream.readBoolean();
|
||||
fuelSlot.liquidStored = dataStream.readInt();
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[Mekanism] Error while handling tile entity packet.");
|
||||
|
@ -237,9 +236,9 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
|
|||
}
|
||||
|
||||
@Override
|
||||
public int fill(Orientations from, LiquidStack resource, boolean doFill)
|
||||
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill)
|
||||
{
|
||||
if(from.toDirection() != ForgeDirection.getOrientation(facing))
|
||||
if(from != ForgeDirection.getOrientation(facing))
|
||||
{
|
||||
if(resource.itemID == Mekanism.hooks.BuildCraftFuelID)
|
||||
{
|
||||
|
@ -274,7 +273,7 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
|
|||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack drain(Orientations from, int maxDrain, boolean doDrain)
|
||||
public LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -286,8 +285,14 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
|
|||
}
|
||||
|
||||
@Override
|
||||
public ILiquidTank[] getTanks()
|
||||
public ILiquidTank[] getTanks(ForgeDirection direction)
|
||||
{
|
||||
return new ILiquidTank[] {new LiquidTank(fuelSlot.liquidID, fuelSlot.liquidStored, fuelSlot.MAX_LIQUID)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILiquidTank getTank(ForgeDirection direction, LiquidStack type)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@ package mekanism.common;
|
|||
import ic2.api.ElectricItem;
|
||||
import ic2.api.IElectricItem;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.electricity.ElectricInfo;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.core.electricity.ElectricInfo;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
@ -188,7 +188,7 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
|
|||
energyStored = dataStream.readInt();
|
||||
hydrogenStored = dataStream.readInt();
|
||||
isActive = dataStream.readBoolean();
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[Mekanism] Error while handling tile entity packet.");
|
||||
|
|
|
@ -4,23 +4,20 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.core.Vector3;
|
||||
import universalelectricity.electricity.ElectricInfo;
|
||||
import universalelectricity.electricity.ElectricityManager;
|
||||
import universalelectricity.implement.IConductor;
|
||||
import universalelectricity.implement.IElectricityReceiver;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.implement.IJouleStorage;
|
||||
import universalelectricity.prefab.TileEntityConductor;
|
||||
import universalelectricity.prefab.TileEntityDisableable;
|
||||
import universalelectricity.core.electricity.ElectricInfo;
|
||||
import universalelectricity.core.electricity.ElectricityManager;
|
||||
import universalelectricity.core.implement.IConductor;
|
||||
import universalelectricity.core.implement.IElectricityReceiver;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
import universalelectricity.core.implement.IJouleStorage;
|
||||
import universalelectricity.prefab.tile.TileEntityConductor;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
import buildcraft.api.power.IPowerProvider;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerFramework;
|
||||
import buildcraft.api.power.PowerProvider;
|
||||
import buildcraft.api.core.Orientations;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
@ -193,7 +190,7 @@ public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEne
|
|||
IPowerReceptor receptor = (IPowerReceptor)tileEntity;
|
||||
int energyNeeded = Math.min(receptor.getPowerProvider().getMinEnergyReceived(), receptor.getPowerProvider().getMaxEnergyReceived())*10;
|
||||
float transferEnergy = Math.max(Math.min(Math.min(energyNeeded, energyStored), 54000), 0);
|
||||
receptor.getPowerProvider().receiveEnergy((float)(transferEnergy/10), Orientations.dirs()[ForgeDirection.getOrientation(facing).getOpposite().ordinal()]);
|
||||
receptor.getPowerProvider().receiveEnergy((float)(transferEnergy/10), ForgeDirection.getOrientation(facing).getOpposite());
|
||||
setEnergy(energyStored - (int)transferEnergy);
|
||||
}
|
||||
else if(tileEntity instanceof TileEntityConductor)
|
||||
|
@ -257,7 +254,7 @@ public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEne
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRate()
|
||||
public int getOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
@ -311,7 +308,7 @@ public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEne
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getMaxJoules()
|
||||
public double getMaxJoules(Object... data)
|
||||
{
|
||||
return MAX_ENERGY*UniversalElectricity.IC2_RATIO;
|
||||
}
|
||||
|
@ -468,7 +465,7 @@ public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEne
|
|||
try {
|
||||
facing = dataStream.readInt();
|
||||
energyStored = dataStream.readInt();
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[Mekanism] Error while handling tile entity packet.");
|
||||
|
|
|
@ -3,8 +3,8 @@ package mekanism.common;
|
|||
import ic2.api.ElectricItem;
|
||||
import ic2.api.IElectricItem;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.electricity.ElectricInfo;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.core.electricity.ElectricInfo;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
@ -134,7 +134,7 @@ public class TileEntitySolarGenerator extends TileEntityGenerator
|
|||
energyStored = dataStream.readInt();
|
||||
isActive = dataStream.readBoolean();
|
||||
seesSun = dataStream.readBoolean();
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[Mekanism] Error while handling tile entity packet.");
|
||||
|
|
0
src/common/railcraft/common/api/carts/CartBase.java
Executable file → Normal file
0
src/common/railcraft/common/api/carts/CartBase.java
Executable file → Normal file
2
src/common/railcraft/common/api/carts/CartTools.java
Executable file → Normal file
2
src/common/railcraft/common/api/carts/CartTools.java
Executable file → Normal file
|
@ -1,6 +1,5 @@
|
|||
package railcraft.common.api.carts;
|
||||
|
||||
import railcraft.common.api.core.items.IMinecartItem;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -12,6 +11,7 @@ import net.minecraft.src.ItemMinecart;
|
|||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import railcraft.common.api.core.items.IMinecartItem;
|
||||
|
||||
public abstract class CartTools
|
||||
{
|
||||
|
|
0
src/common/railcraft/common/api/carts/ICartRenderInterface.java
Executable file → Normal file
0
src/common/railcraft/common/api/carts/ICartRenderInterface.java
Executable file → Normal file
0
src/common/railcraft/common/api/carts/IEnergyTransfer.java
Executable file → Normal file
0
src/common/railcraft/common/api/carts/IEnergyTransfer.java
Executable file → Normal file
0
src/common/railcraft/common/api/carts/IExplosiveCart.java
Executable file → Normal file
0
src/common/railcraft/common/api/carts/IExplosiveCart.java
Executable file → Normal file
6
src/common/railcraft/common/api/carts/IItemTransfer.java
Executable file → Normal file
6
src/common/railcraft/common/api/carts/IItemTransfer.java
Executable file → Normal file
|
@ -1,7 +1,7 @@
|
|||
package railcraft.common.api.carts;
|
||||
|
||||
import net.minecraft.src.ItemStack;
|
||||
import railcraft.common.api.core.items.EnumItemType;
|
||||
import railcraft.common.api.core.items.IItemType;
|
||||
|
||||
/**
|
||||
* This interface allows items to be passed around with out needing
|
||||
|
@ -55,11 +55,11 @@ public interface IItemTransfer
|
|||
* determine which ItemStack to return, or none at all.
|
||||
* However, if the return value is not null
|
||||
* it should fulfill the following condition:<br/>
|
||||
* EnumItemType.isItemType(it.requestItem(this,request), request) == true
|
||||
* IItemType.isItemType(it.requestItem(this,request), request) == true
|
||||
*
|
||||
* @param source The Object submitting the request
|
||||
* @param request The type of item requested
|
||||
* @return An ItemStack to fulfill the request or null if refused.
|
||||
*/
|
||||
public ItemStack requestItem(Object source, EnumItemType request);
|
||||
public ItemStack requestItem(Object source, IItemType request);
|
||||
}
|
||||
|
|
0
src/common/railcraft/common/api/carts/ILinkableCart.java
Executable file → Normal file
0
src/common/railcraft/common/api/carts/ILinkableCart.java
Executable file → Normal file
0
src/common/railcraft/common/api/carts/ILinkageManager.java
Executable file → Normal file
0
src/common/railcraft/common/api/carts/ILinkageManager.java
Executable file → Normal file
29
src/common/railcraft/common/api/carts/ILiquidTransfer.java
Executable file → Normal file
29
src/common/railcraft/common/api/carts/ILiquidTransfer.java
Executable file → Normal file
|
@ -1,23 +1,23 @@
|
|||
package railcraft.common.api.carts;
|
||||
|
||||
import buildcraft.api.liquids.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
/**
|
||||
* This interface allows carts to transfer liquid between each other
|
||||
* as well as adding a couple other functions related to liquids.
|
||||
* This interface allows carts to transfer liquid between each other as well as
|
||||
* adding a couple other functions related to liquids.
|
||||
*
|
||||
* @author CovertJaguar <railcraft.wikispaces.com>
|
||||
*/
|
||||
public interface ILiquidTransfer
|
||||
{
|
||||
public interface ILiquidTransfer {
|
||||
|
||||
/**
|
||||
* Offers liquid to this object.
|
||||
*
|
||||
* Is not used by the Liquid Loader to load carts,
|
||||
* the traditional ILiquidContainer is used for that.
|
||||
* Is not used by the Liquid Loader to load carts, the traditional
|
||||
* ILiquidContainer is used for that.
|
||||
*
|
||||
* @param source The Object offering the liquid, used to prevent request loops in trains
|
||||
* @param source The Object offering the liquid, used to prevent request
|
||||
* loops in trains
|
||||
* @param quantity The quantity offered
|
||||
* @param id The liquid id offered
|
||||
* @return the liquid used
|
||||
|
@ -27,10 +27,11 @@ public interface ILiquidTransfer
|
|||
/**
|
||||
* Requests liquid from this object.
|
||||
*
|
||||
* Is not used by the Liquid Unloader to drain carts,
|
||||
* the traditional ILiquidContainer is used for that.
|
||||
* Is not used by the Liquid Unloader to drain carts, the traditional
|
||||
* ILiquidContainer is used for that.
|
||||
*
|
||||
* @param source The Object requesting the liquid, used to prevent request loops in trains
|
||||
* @param source The Object requesting the liquid, used to prevent request
|
||||
* loops in trains
|
||||
* @param quantity The quantity requested
|
||||
* @param id The liquid type requested
|
||||
* @return the liquid provided
|
||||
|
@ -38,9 +39,9 @@ public interface ILiquidTransfer
|
|||
public int requestLiquid(Object source, LiquidStack request);
|
||||
|
||||
/**
|
||||
* Set by the Liquid Loader while filling,
|
||||
* primarily used for rendering a visible
|
||||
* change while being filled.
|
||||
* Set by the Liquid Loader while filling, primarily used for rendering a
|
||||
* visible change while being filled.
|
||||
*
|
||||
* @param filling
|
||||
*/
|
||||
public void setFilling(boolean filling);
|
||||
|
|
0
src/common/railcraft/common/api/carts/IMinecart.java
Executable file → Normal file
0
src/common/railcraft/common/api/carts/IMinecart.java
Executable file → Normal file
6
src/common/railcraft/common/api/carts/TransferCartBase.java
Executable file → Normal file
6
src/common/railcraft/common/api/carts/TransferCartBase.java
Executable file → Normal file
|
@ -4,7 +4,7 @@ import net.minecraft.src.EntityMinecart;
|
|||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.World;
|
||||
import railcraft.common.api.core.items.EnumItemType;
|
||||
import railcraft.common.api.core.items.IItemType;
|
||||
|
||||
/**
|
||||
* Abstract minecart class that implements the IItemTransfer
|
||||
|
@ -124,7 +124,7 @@ public abstract class TransferCartBase extends CartBase implements IItemTransfer
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack requestItem(Object source, EnumItemType request)
|
||||
public ItemStack requestItem(Object source, IItemType request)
|
||||
{
|
||||
ItemStack result = null;
|
||||
if(!passThrough && getSizeInventory() > 0) {
|
||||
|
@ -192,7 +192,7 @@ public abstract class TransferCartBase extends CartBase implements IItemTransfer
|
|||
* @param filter EnumItemType to match against
|
||||
* @return An ItemStack
|
||||
*/
|
||||
protected final ItemStack removeOneItem(IInventory inv, EnumItemType filter)
|
||||
protected final ItemStack removeOneItem(IInventory inv, IItemType filter)
|
||||
{
|
||||
for(int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
ItemStack slot = inv.getStackInSlot(i);
|
||||
|
|
0
src/common/railcraft/common/api/carts/bore/IBoreHead.java
Executable file → Normal file
0
src/common/railcraft/common/api/carts/bore/IBoreHead.java
Executable file → Normal file
0
src/common/railcraft/common/api/carts/bore/IMineable.java
Executable file → Normal file
0
src/common/railcraft/common/api/carts/bore/IMineable.java
Executable file → Normal file
0
src/common/railcraft/common/api/core/INetworkedObject.java
Executable file → Normal file
0
src/common/railcraft/common/api/core/INetworkedObject.java
Executable file → Normal file
0
src/common/railcraft/common/api/core/IPostConnection.java
Executable file → Normal file
0
src/common/railcraft/common/api/core/IPostConnection.java
Executable file → Normal file
0
src/common/railcraft/common/api/core/WorldCoordinate.java
Executable file → Normal file
0
src/common/railcraft/common/api/core/WorldCoordinate.java
Executable file → Normal file
|
@ -1,93 +0,0 @@
|
|||
package railcraft.common.api.core.items;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.ItemBlock;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
/**
|
||||
* Register an item here to designate it as a possible
|
||||
* ballast that can be used in the Bore.
|
||||
*
|
||||
* It is expected that ballast is affected by gravity.
|
||||
*
|
||||
* @author CovertJaguar <railcraft.wikispaces.com>
|
||||
*/
|
||||
public abstract class BallastRegistry
|
||||
{
|
||||
|
||||
private static Set<ItemWrapper> ballastRegistry = new HashSet<ItemWrapper>();
|
||||
|
||||
private static class ItemWrapper
|
||||
{
|
||||
|
||||
public int itemID;
|
||||
public int itemDamage;
|
||||
public ItemStack stack;
|
||||
|
||||
public ItemWrapper(ItemStack stack)
|
||||
{
|
||||
itemID = stack.itemID;
|
||||
itemDamage = stack.getItemDamage();
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if(obj == null) {
|
||||
return false;
|
||||
}
|
||||
if(getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ItemWrapper other = (ItemWrapper)obj;
|
||||
if(this.itemID != other.itemID) {
|
||||
return false;
|
||||
}
|
||||
if(this.itemDamage != other.itemDamage) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int hash = 3;
|
||||
hash = 47 * hash + this.itemID;
|
||||
hash = 47 * hash + this.itemDamage;
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
registerBallast(new ItemStack(Block.gravel));
|
||||
}
|
||||
|
||||
public static void registerBallast(ItemStack ballast)
|
||||
{
|
||||
if(ballast.getItem() instanceof ItemBlock) {
|
||||
ballastRegistry.add(new ItemWrapper(ballast));
|
||||
} else {
|
||||
throw new RuntimeException("Attempted to register an invalid ballast, must be an ItemBlock item.");
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isItemBallast(ItemStack ballast)
|
||||
{
|
||||
return ballastRegistry.contains(new ItemWrapper(ballast));
|
||||
}
|
||||
|
||||
public static List<ItemStack> getRegisteredBallasts()
|
||||
{
|
||||
List<ItemStack> list = new ArrayList<ItemStack>();
|
||||
for(ItemWrapper item : ballastRegistry) {
|
||||
list.add(item.stack);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package railcraft.common.api.core.items;
|
||||
|
||||
import net.minecraft.src.BlockRail;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemBlock;
|
||||
import net.minecraft.src.ItemFood;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.TileEntityFurnace;
|
||||
import net.minecraftforge.common.MinecartRegistry;
|
||||
|
||||
/**
|
||||
* This interface is used with several of the functions in IItemTransfer
|
||||
* to provide a convenient means of dealing with entire classes of items without
|
||||
* having to specify each item individually.
|
||||
* @author CovertJaguar <railcraft.wikispaces.com>
|
||||
*/
|
||||
public enum EnumItemType
|
||||
{
|
||||
|
||||
FUEL, RAIL, MINECART, BALLAST, FOOD;
|
||||
|
||||
public static boolean isItemType(ItemStack stack, EnumItemType filter)
|
||||
{
|
||||
return filter.isItemType(stack);
|
||||
}
|
||||
|
||||
public boolean isItemType(ItemStack stack)
|
||||
{
|
||||
if(stack == null) {
|
||||
return false;
|
||||
}
|
||||
switch (this) {
|
||||
case FUEL:
|
||||
return TileEntityFurnace.isItemFuel(stack);
|
||||
case RAIL:
|
||||
return stack.getItem() instanceof ITrackItem || (stack.getItem() instanceof ItemBlock && BlockRail.isRailBlock(stack.itemID));
|
||||
case MINECART:
|
||||
return MinecartRegistry.getCartClassForItem(stack) != null || stack.getItem() instanceof IMinecartItem;
|
||||
case BALLAST:
|
||||
return BallastRegistry.isItemBallast(stack);
|
||||
case FOOD:
|
||||
return stack.getItem() instanceof ItemFood || stack.itemID == Item.wheat.shiftedIndex;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
0
src/common/railcraft/common/api/core/items/ICrowbar.java
Executable file → Normal file
0
src/common/railcraft/common/api/core/items/ICrowbar.java
Executable file → Normal file
23
src/common/railcraft/common/api/core/items/IItemType.java
Normal file
23
src/common/railcraft/common/api/core/items/IItemType.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
package railcraft.common.api.core.items;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
/**
|
||||
* This interface is used with several of the functions in IItemTransfer
|
||||
* to provide a convenient means of dealing with entire classes of items without
|
||||
* having to specify each item individually.
|
||||
* @author CovertJaguar <railcraft.wikispaces.com>
|
||||
*/
|
||||
public interface IItemType
|
||||
{
|
||||
/**
|
||||
* Railcraft adds the following IItemTypes during preInit: FUEL, TRACK, MINECART, BALLAST, FEED
|
||||
*
|
||||
* Feel free to grab them from here or define your own.
|
||||
*/
|
||||
public static final Map<String, IItemType> types = new HashMap<String, IItemType>();
|
||||
|
||||
public boolean isItemType(ItemStack stack);
|
||||
}
|
0
src/common/railcraft/common/api/core/items/IMinecartItem.java
Executable file → Normal file
0
src/common/railcraft/common/api/core/items/IMinecartItem.java
Executable file → Normal file
0
src/common/railcraft/common/api/core/items/ITrackItem.java
Executable file → Normal file
0
src/common/railcraft/common/api/core/items/ITrackItem.java
Executable file → Normal file
0
src/common/railcraft/common/api/core/items/ItemRegistry.java
Executable file → Normal file
0
src/common/railcraft/common/api/core/items/ItemRegistry.java
Executable file → Normal file
0
src/common/railcraft/common/api/crafting/IBlastFurnaceCraftingManager.java
Executable file → Normal file
0
src/common/railcraft/common/api/crafting/IBlastFurnaceCraftingManager.java
Executable file → Normal file
0
src/common/railcraft/common/api/crafting/IBlastFurnaceRecipe.java
Executable file → Normal file
0
src/common/railcraft/common/api/crafting/IBlastFurnaceRecipe.java
Executable file → Normal file
6
src/common/railcraft/common/api/crafting/ICokeOvenCraftingManager.java
Executable file → Normal file
6
src/common/railcraft/common/api/crafting/ICokeOvenCraftingManager.java
Executable file → Normal file
|
@ -1,15 +1,14 @@
|
|||
package railcraft.common.api.crafting;
|
||||
|
||||
import buildcraft.api.liquids.LiquidStack;
|
||||
import java.util.List;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <railcraft.wikispaces.com>
|
||||
*/
|
||||
public interface ICokeOvenCraftingManager
|
||||
{
|
||||
public interface ICokeOvenCraftingManager {
|
||||
|
||||
void addRecipe(ItemStack input, ItemStack output, LiquidStack liquidOutput, int cookTime);
|
||||
|
||||
|
@ -22,5 +21,4 @@ public interface ICokeOvenCraftingManager
|
|||
ICokeOvenRecipe getRecipe(int inputId, int inputDamage);
|
||||
|
||||
List<ICokeOvenRecipe> getRecipes();
|
||||
|
||||
}
|
||||
|
|
2
src/common/railcraft/common/api/crafting/ICokeOvenRecipe.java
Executable file → Normal file
2
src/common/railcraft/common/api/crafting/ICokeOvenRecipe.java
Executable file → Normal file
|
@ -1,7 +1,7 @@
|
|||
package railcraft.common.api.crafting;
|
||||
|
||||
import buildcraft.api.liquids.LiquidStack;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
0
src/common/railcraft/common/api/crafting/IRockCrusherCraftingManager.java
Executable file → Normal file
0
src/common/railcraft/common/api/crafting/IRockCrusherCraftingManager.java
Executable file → Normal file
0
src/common/railcraft/common/api/crafting/IRockCrusherRecipe.java
Executable file → Normal file
0
src/common/railcraft/common/api/crafting/IRockCrusherRecipe.java
Executable file → Normal file
0
src/common/railcraft/common/api/crafting/IRollingMachineCraftingManager.java
Executable file → Normal file
0
src/common/railcraft/common/api/crafting/IRollingMachineCraftingManager.java
Executable file → Normal file
0
src/common/railcraft/common/api/crafting/RailcraftCraftingManager.java
Executable file → Normal file
0
src/common/railcraft/common/api/crafting/RailcraftCraftingManager.java
Executable file → Normal file
35
src/common/railcraft/common/api/fuel/FuelManager.java
Normal file
35
src/common/railcraft/common/api/fuel/FuelManager.java
Normal file
|
@ -0,0 +1,35 @@
|
|||
package railcraft.common.api.fuel;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <railcraft.wikispaces.com>
|
||||
*/
|
||||
public class FuelManager
|
||||
{
|
||||
|
||||
public static final Map<LiquidStack, Integer> boilerFuel = new HashMap<LiquidStack, Integer>();
|
||||
|
||||
/**
|
||||
* Register the amount of heat in a bucket of liquid fuel.
|
||||
*
|
||||
* @param liquid
|
||||
* @param heatValuePerBucket
|
||||
*/
|
||||
public static void addBoilerFuel(LiquidStack liquid, int heatValuePerBucket) {
|
||||
boilerFuel.put(liquid, heatValuePerBucket);
|
||||
}
|
||||
|
||||
public static int getBoilerFuelValue(LiquidStack liquid) {
|
||||
for(Entry<LiquidStack, Integer> entry : boilerFuel.entrySet()) {
|
||||
if(entry.getKey().isLiquidEqual(liquid)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
0
src/common/railcraft/common/api/signals/EnumSignalAspect.java
Executable file → Normal file
0
src/common/railcraft/common/api/signals/EnumSignalAspect.java
Executable file → Normal file
0
src/common/railcraft/common/api/signals/IBlockSignal.java
Executable file → Normal file
0
src/common/railcraft/common/api/signals/IBlockSignal.java
Executable file → Normal file
0
src/common/railcraft/common/api/signals/ISignalController.java
Executable file → Normal file
0
src/common/railcraft/common/api/signals/ISignalController.java
Executable file → Normal file
0
src/common/railcraft/common/api/signals/ISignalReceiver.java
Executable file → Normal file
0
src/common/railcraft/common/api/signals/ISignalReceiver.java
Executable file → Normal file
2
src/common/railcraft/common/api/signals/SignalTools.java
Executable file → Normal file
2
src/common/railcraft/common/api/signals/SignalTools.java
Executable file → Normal file
|
@ -7,8 +7,8 @@ import net.minecraft.src.EntityPlayer;
|
|||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import railcraft.common.api.tracks.RailTools;
|
||||
import railcraft.common.api.core.WorldCoordinate;
|
||||
import railcraft.common.api.tracks.RailTools;
|
||||
|
||||
/**
|
||||
* This is not documented and needs some reworking to simplify usage.
|
||||
|
|
0
src/common/railcraft/common/api/tracks/ITrackCustomPlaced.java
Executable file → Normal file
0
src/common/railcraft/common/api/tracks/ITrackCustomPlaced.java
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue