Merge branch 'master' into LiquidPipeRewrite
Conflicts: common/net/minecraft/src/buildcraft/transport/PipeLogicDiamond.java
This commit is contained in:
commit
5db9fb2e72
22 changed files with 463 additions and 499 deletions
|
@ -17,6 +17,7 @@ import net.minecraft.src.Item;
|
|||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.TileEntitySpecialRenderer;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.buildcraft.api.liquids.LiquidStack;
|
||||
import net.minecraft.src.buildcraft.core.RenderEntityBlock;
|
||||
import net.minecraft.src.buildcraft.core.RenderEntityBlock.BlockInterface;
|
||||
import net.minecraft.src.forge.ITextureProvider;
|
||||
|
@ -30,7 +31,7 @@ public class RenderTank extends TileEntitySpecialRenderer {
|
|||
|
||||
private HashMap<Integer, int[]> stage = new HashMap<Integer, int[]>();
|
||||
|
||||
private int[] getDisplayLists(int liquidId, World world) {
|
||||
private int[] getDisplayLists(int liquidId, int damage, World world) {
|
||||
|
||||
if (stage.containsKey(liquidId))
|
||||
return stage.get(liquidId);
|
||||
|
@ -42,7 +43,7 @@ public class RenderTank extends TileEntitySpecialRenderer {
|
|||
if (liquidId < Block.blocksList.length && Block.blocksList[liquidId] != null)
|
||||
block.texture = Block.blocksList[liquidId].blockIndexInTexture;
|
||||
else
|
||||
block.texture = Item.itemsList[liquidId].getIconFromDamage(0);
|
||||
block.texture = Item.itemsList[liquidId].getIconFromDamage(damage);
|
||||
|
||||
for (int s = 0; s < displayStages; ++s) {
|
||||
d[s] = GLAllocation.generateDisplayLists(1);
|
||||
|
@ -69,31 +70,32 @@ public class RenderTank extends TileEntitySpecialRenderer {
|
|||
|
||||
TileTank tank = ((TileTank) tileentity);
|
||||
|
||||
int liquidId = tank.getLiquidId();
|
||||
LiquidStack liquid = tank.getLiquid();
|
||||
|
||||
if (tank.getLiquidQuantity() == 0 || liquidId == 0)
|
||||
if (liquid == null || liquid.amount <= 0
|
||||
|| liquid.itemID <= 0)
|
||||
return;
|
||||
|
||||
int[] d = getDisplayLists(tank.getLiquidId(), tileentity.worldObj);
|
||||
int[] displayList = getDisplayLists(liquid.itemID, liquid.itemMeta, tileentity.worldObj);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(2896 /* GL_LIGHTING */);
|
||||
|
||||
Object o = null;
|
||||
Object obj = null;
|
||||
|
||||
if (liquidId < Block.blocksList.length && Block.blocksList[liquidId] != null)
|
||||
o = Block.blocksList[liquidId];
|
||||
if (liquid.itemID < Block.blocksList.length && Block.blocksList[liquid.itemID] != null)
|
||||
obj = Block.blocksList[liquid.itemID];
|
||||
else
|
||||
o = Item.itemsList[liquidId];
|
||||
obj = Item.itemsList[liquid.itemID];
|
||||
|
||||
if (o instanceof ITextureProvider)
|
||||
MinecraftForgeClient.bindTexture(((ITextureProvider) o).getTextureFile());
|
||||
if (obj instanceof ITextureProvider)
|
||||
MinecraftForgeClient.bindTexture(((ITextureProvider) obj).getTextureFile());
|
||||
else
|
||||
MinecraftForgeClient.bindTexture("/terrain.png");
|
||||
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
|
||||
|
||||
GL11.glCallList(d[(int) ((float) tank.getLiquidQuantity() / (float) (tank.getTankCapacity()) * (displayStages - 1))]);
|
||||
GL11.glCallList(displayList[(int) ((float) liquid.amount / (float) (tank.getTankCapacity()) * (displayStages - 1))]);
|
||||
|
||||
GL11.glEnable(2896 /* GL_LIGHTING */);
|
||||
GL11.glPopMatrix();
|
||||
|
|
|
@ -49,6 +49,10 @@ public class RenderPipe extends TileEntitySpecialRenderer {
|
|||
|
||||
final static private int displayLiquidStages = 40;
|
||||
|
||||
final static private int renderDistanceSq = 24 * 24;
|
||||
|
||||
final static private int numItemsToRender = 10;
|
||||
|
||||
private final static EntityItem dummyEntityItem = new EntityItem(null);
|
||||
|
||||
private class DisplayLiquidList {
|
||||
|
@ -218,6 +222,9 @@ public class RenderPipe extends TileEntitySpecialRenderer {
|
|||
if (BuildCraftCore.render == RenderMode.NoDynamic)
|
||||
return;
|
||||
|
||||
if(tileentity.getDistanceFrom(tileEntityRenderer.playerX, tileEntityRenderer.playerY, tileEntityRenderer.playerZ) >= renderDistanceSq)
|
||||
return;
|
||||
|
||||
initializeDisplayPowerList(tileentity.worldObj);
|
||||
|
||||
TileGenericPipe pipe = ((TileGenericPipe) tileentity);
|
||||
|
@ -225,14 +232,15 @@ public class RenderPipe extends TileEntitySpecialRenderer {
|
|||
if (pipe.pipe == null)
|
||||
return;
|
||||
|
||||
if (pipe.pipe.transport instanceof PipeTransportLiquids)
|
||||
renderLiquids(pipe.pipe, x, y, z);
|
||||
|
||||
if (pipe.pipe.transport instanceof PipeTransportItems)
|
||||
renderSolids(pipe.pipe, x, y, z);
|
||||
|
||||
if (pipe.pipe.transport instanceof PipeTransportPower)
|
||||
else if (pipe.pipe.transport instanceof PipeTransportLiquids)
|
||||
renderLiquids(pipe.pipe, x, y, z);
|
||||
|
||||
else if (pipe.pipe.transport instanceof PipeTransportPower)
|
||||
renderPower(pipe.pipe, x, y, z);
|
||||
|
||||
}
|
||||
|
||||
private void renderPower(Pipe pipe, double x, double y, double z) {
|
||||
|
@ -360,10 +368,9 @@ public class RenderPipe extends TileEntitySpecialRenderer {
|
|||
else
|
||||
o = Item.itemsList[liquidId];
|
||||
|
||||
if (o instanceof ITextureProvider)
|
||||
// should be safe, items and block all implement ITextureProvider now
|
||||
// and if o is null, something else is wrong somewhere
|
||||
MinecraftForgeClient.bindTexture(((ITextureProvider) o).getTextureFile());
|
||||
else
|
||||
MinecraftForgeClient.bindTexture("/terrain.png");
|
||||
|
||||
return getDisplayLiquidLists(liquidId, stack.itemMeta, world);
|
||||
}
|
||||
|
@ -372,9 +379,17 @@ public class RenderPipe extends TileEntitySpecialRenderer {
|
|||
GL11.glPushMatrix();
|
||||
GL11.glDisable(2896 /* GL_LIGHTING */);
|
||||
|
||||
for (EntityData data : ((PipeTransportItems) pipe.transport).travelingEntities.values())
|
||||
float light = pipe.worldObj.getLightBrightness(pipe.xCoord, pipe.yCoord, pipe.zCoord);
|
||||
|
||||
int count = 0;
|
||||
for (EntityData data : ((PipeTransportItems) pipe.transport).travelingEntities.values()) {
|
||||
if(count >= numItemsToRender)
|
||||
break;
|
||||
|
||||
doRenderItem(data.item, x + data.item.posX - pipe.xCoord, y + data.item.posY - pipe.yCoord, z + data.item.posZ
|
||||
- pipe.zCoord, pipe.worldObj.getLightBrightness(pipe.xCoord, pipe.yCoord, pipe.zCoord));
|
||||
- pipe.zCoord, light);
|
||||
count++;
|
||||
}
|
||||
|
||||
GL11.glEnable(2896 /* GL_LIGHTING */);
|
||||
GL11.glPopMatrix();
|
||||
|
@ -395,10 +410,6 @@ public class RenderPipe extends TileEntitySpecialRenderer {
|
|||
byte quantity = 1;
|
||||
if (entityitem.item.stackSize > 1)
|
||||
quantity = 2;
|
||||
if (entityitem.item.stackSize > 5)
|
||||
quantity = 3;
|
||||
if (entityitem.item.stackSize > 20)
|
||||
quantity = 4;
|
||||
|
||||
GL11.glTranslatef((float) d, (float) d1, (float) d2);
|
||||
GL11.glEnable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
|
|
|
@ -594,6 +594,8 @@ public class mod_BuildCraftCore extends NetworkMod {
|
|||
x += 0.5D;
|
||||
z += 0.5D;
|
||||
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(iblockaccess, xCoord, yCoord, zCoord));
|
||||
|
||||
double s = 0.0625D;
|
||||
|
||||
if (meta == 5) {
|
||||
|
|
|
@ -35,7 +35,7 @@ public class BuildCraftAPI {
|
|||
/**
|
||||
* This does not do anything anymore. Use buildcraft.api.liquids.LiquidManager!
|
||||
*/
|
||||
@Deprecated public static LinkedList<LiquidData> liquids = new LinkedList<LiquidData>();
|
||||
//@Deprecated public static LinkedList<LiquidData> liquids = new LinkedList<LiquidData>();
|
||||
/**
|
||||
* This does not do anything anymore. Use buildcraft.api.fuels.IronEngineFuel!
|
||||
*/
|
||||
|
@ -47,13 +47,14 @@ public class BuildCraftAPI {
|
|||
/**
|
||||
* This does not do anything anymore. Use buildcraft.api.recipes.RefineryRecipe!
|
||||
*/
|
||||
@Deprecated private static LinkedList<RefineryRecipe> refineryRecipe = new LinkedList<RefineryRecipe>();
|
||||
//@Deprecated private static LinkedList<RefineryRecipe> refineryRecipe = new LinkedList<RefineryRecipe>();
|
||||
private static LinkedList<ITriggerProvider> triggerProviders = new LinkedList<ITriggerProvider>();
|
||||
private static LinkedList<IActionProvider> actionProviders = new LinkedList<IActionProvider>();
|
||||
|
||||
/**
|
||||
* This does not do anything anymore. Use buildcraft.api.liquids.LiquidManager!
|
||||
*/
|
||||
/*
|
||||
@Deprecated
|
||||
public static int getLiquidForFilledItem(ItemStack filledItem) {
|
||||
if (filledItem == null) {
|
||||
|
@ -67,11 +68,12 @@ public class BuildCraftAPI {
|
|||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* This does not do anything anymore. Use buildcraft.api.liquids.LiquidManager!
|
||||
*/
|
||||
/*
|
||||
@Deprecated
|
||||
public static ItemStack getFilledItemForLiquid(int liquidId) {
|
||||
for (LiquidData d : liquids) {
|
||||
|
@ -81,11 +83,12 @@ public class BuildCraftAPI {
|
|||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
} */
|
||||
|
||||
/**
|
||||
* This does not do anything anymore. Use buildcraft.api.liquids.LiquidManager!
|
||||
*/
|
||||
/*
|
||||
@Deprecated
|
||||
public static boolean isLiquid(int blockId) {
|
||||
if (blockId == 0) {
|
||||
|
@ -99,7 +102,7 @@ public class BuildCraftAPI {
|
|||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
} */
|
||||
|
||||
/**
|
||||
* Return true if the block given in parameter is pass through (e.g. air,
|
||||
|
@ -139,16 +142,18 @@ public class BuildCraftAPI {
|
|||
/**
|
||||
* This does not do anything anymore. Use buildcraft.api.recipes.RefineryRecipe!
|
||||
*/
|
||||
/*
|
||||
@Deprecated
|
||||
public static void registerRefineryRecipe(RefineryRecipe recipe) {
|
||||
if (!refineryRecipe.contains(recipe)) {
|
||||
refineryRecipe.add(recipe);
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
/**
|
||||
* This does not do anything anymore. Use buildcraft.api.recipes.RefineryRecipe!
|
||||
*/
|
||||
/*
|
||||
@Deprecated
|
||||
public static RefineryRecipe findRefineryRecipe(int liquid1, int qty1, int liquid2, int qty2) {
|
||||
int l1 = qty1 > 0 ? liquid1 : 0;
|
||||
|
@ -177,6 +182,7 @@ public class BuildCraftAPI {
|
|||
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
|
||||
public static BlockSignature getBlockSignature(Block block) {
|
||||
return blockBptProps[0].getSignature(block);
|
||||
|
|
|
@ -1,5 +1,20 @@
|
|||
package net.minecraft.src.buildcraft.api.inventory;
|
||||
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
|
||||
public interface ISecuredInventory {
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @return true if the user/player with the given name has access permissions on this machine.
|
||||
*/
|
||||
boolean canAccess(String name);
|
||||
|
||||
/**
|
||||
* Informs the inventory with whose permissions the next item or liquid transaction will be performed. It is up to the inventory to determine the effect.
|
||||
* @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);
|
||||
|
||||
}
|
||||
|
|
|
@ -6,12 +6,12 @@ import net.minecraft.src.buildcraft.api.Orientations;
|
|||
public interface ISelectiveInventory extends ISpecialInventory {
|
||||
/**
|
||||
* Requests specified items to be extracted from the inventory
|
||||
* @param desired Array which can contain ItemStacks, Items, or classes describing the type of item accepted.
|
||||
* @param desired Array which can contain ItemStacks, Items, or classes describing the type of item accepted or excluded.
|
||||
* @param exclusion If true desired items are not eligible for returning.
|
||||
* @param doRemove If false no actual extraction may occur.
|
||||
* @param from Orientation the ItemStack is requested from.
|
||||
* @param maxItemCount Maximum amount of items to extract (spread over all returned item stacks)
|
||||
* @return Array of item stacks extracted from the inventory
|
||||
*/
|
||||
ItemStack[] extractItem(Object[] desired, boolean doRemove, Orientations from, int maxItemCount);
|
||||
|
||||
ItemStack[] extractItem(Object[] desired, boolean exclusion, boolean doRemove, Orientations from, int maxItemCount);
|
||||
}
|
||||
|
|
|
@ -17,12 +17,12 @@ import net.minecraft.src.buildcraft.api.APIProxy;
|
|||
import net.minecraft.src.buildcraft.api.Action;
|
||||
import net.minecraft.src.buildcraft.api.IActionReceptor;
|
||||
import net.minecraft.src.buildcraft.api.IAreaProvider;
|
||||
import net.minecraft.src.buildcraft.api.ISpecialInventory;
|
||||
import net.minecraft.src.buildcraft.api.LaserKind;
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.api.TileNetworkData;
|
||||
import net.minecraft.src.buildcraft.api.filler.FillerManager;
|
||||
import net.minecraft.src.buildcraft.api.filler.IFillerPattern;
|
||||
import net.minecraft.src.buildcraft.api.inventory.ISpecialInventory;
|
||||
import net.minecraft.src.buildcraft.api.power.IPowerProvider;
|
||||
import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
|
||||
import net.minecraft.src.buildcraft.api.power.PowerFramework;
|
||||
|
@ -302,70 +302,6 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addItem(ItemStack stack, boolean doAdd, Orientations from) {
|
||||
StackUtil stackUtil = new StackUtil(stack);
|
||||
|
||||
boolean added = false;
|
||||
|
||||
for (int i = 9; i < contents.length; ++i) {
|
||||
if (stackUtil.tryAdding(this, i, doAdd, false)) {
|
||||
added = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (added) {
|
||||
if (!doAdd) {
|
||||
return true;
|
||||
} else if (stack.stackSize == 0) {
|
||||
return true;
|
||||
} else {
|
||||
addItem(stack, added, from);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!added) {
|
||||
for (int i = 9; i < contents.length; ++i) {
|
||||
if (stackUtil.tryAdding(this, i, doAdd, true)) {
|
||||
added = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (added) {
|
||||
if (!doAdd) {
|
||||
return true;
|
||||
} else if (stack.stackSize == 0) {
|
||||
return true;
|
||||
} else {
|
||||
addItem(stack, added, from);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack extractItem(boolean doRemove, Orientations from) {
|
||||
for (int i = 9; i < contents.length; ++i) {
|
||||
if (contents[i] != null) {
|
||||
if (doRemove) {
|
||||
return decrStackSize(i, 1);
|
||||
} else {
|
||||
return contents[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleDescriptionPacket(PacketUpdate packet) {
|
||||
boolean initialized = box.isInitialized();
|
||||
|
@ -453,4 +389,70 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
|
|||
public boolean allowActions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ISPECIALINVENTORY */
|
||||
@Override
|
||||
public int addItem(ItemStack stack, boolean doAdd, Orientations from) {
|
||||
StackUtil stackUtil = new StackUtil(stack);
|
||||
|
||||
boolean added = false;
|
||||
|
||||
for (int i = 9; i < contents.length; ++i) {
|
||||
if (stackUtil.tryAdding(this, i, doAdd, false)) {
|
||||
added = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (added) {
|
||||
if (!doAdd) {
|
||||
return stackUtil.itemsAdded;
|
||||
} else if (stack.stackSize - stackUtil.itemsAdded <= 0) {
|
||||
return stackUtil.itemsAdded;
|
||||
} else {
|
||||
addItem(stack, added, from);
|
||||
|
||||
return stackUtil.itemsAdded;
|
||||
}
|
||||
}
|
||||
|
||||
if (!added) {
|
||||
for (int i = 9; i < contents.length; ++i) {
|
||||
if (stackUtil.tryAdding(this, i, doAdd, true)) {
|
||||
added = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (added) {
|
||||
if (!doAdd) {
|
||||
return stackUtil.itemsAdded;
|
||||
} else if (stack.stackSize - stackUtil.itemsAdded <= 0) {
|
||||
return stackUtil.itemsAdded;
|
||||
} else {
|
||||
addItem(stack, added, from);
|
||||
|
||||
return stackUtil.itemsAdded;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] extractItem(boolean doRemove, Orientations from, int maxItemCount) {
|
||||
for (int i = 9; i < contents.length; ++i) {
|
||||
if (contents[i] != null) {
|
||||
if (doRemove) {
|
||||
return new ItemStack[] { decrStackSize(i, 1) };
|
||||
} else {
|
||||
return new ItemStack[] { contents[i] };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import net.minecraft.src.Block;
|
|||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.ILiquidContainer;
|
||||
import net.minecraft.src.buildcraft.api.liquids.ITankContainer;
|
||||
import net.minecraft.src.buildcraft.api.IOverrideDefaultTriggers;
|
||||
import net.minecraft.src.buildcraft.api.IPipe;
|
||||
import net.minecraft.src.buildcraft.api.ITriggerProvider;
|
||||
|
@ -28,7 +28,7 @@ public class DefaultTriggerProvider implements ITriggerProvider {
|
|||
res.add(BuildCraftCore.triggerFullInventory);
|
||||
}
|
||||
|
||||
if (tile instanceof ILiquidContainer && ((ILiquidContainer) tile).getLiquidSlots().length > 0) {
|
||||
if (tile instanceof ITankContainer && ((ITankContainer) tile).getTanks().length > 0) {
|
||||
res.add(BuildCraftCore.triggerEmptyLiquid);
|
||||
res.add(BuildCraftCore.triggerContainsLiquid);
|
||||
res.add(BuildCraftCore.triggerSpaceLiquid);
|
||||
|
|
|
@ -15,14 +15,15 @@ import net.minecraft.src.IInventory;
|
|||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.buildcraft.api.ISpecialInventory;
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.api.Position;
|
||||
import net.minecraft.src.buildcraft.api.inventory.ISpecialInventory;
|
||||
import net.minecraft.src.forge.ISidedInventory;
|
||||
|
||||
public class StackUtil {
|
||||
|
||||
public ItemStack items;
|
||||
public int itemsAdded;
|
||||
|
||||
public StackUtil(ItemStack stack) {
|
||||
this.items = stack;
|
||||
|
@ -51,7 +52,7 @@ public class StackUtil {
|
|||
TileEntity tileInventory = w.getBlockTileEntity((int) pos.x, (int) pos.y, (int) pos.z);
|
||||
|
||||
if (tileInventory instanceof ISpecialInventory)
|
||||
if (((ISpecialInventory) tileInventory).addItem(items, false, from))
|
||||
if (((ISpecialInventory) tileInventory).addItem(items, false, from) > 0)
|
||||
possibleInventories.add(pos.orientation);
|
||||
|
||||
if (tileInventory instanceof IInventory)
|
||||
|
@ -87,8 +88,15 @@ public class StackUtil {
|
|||
public boolean checkAvailableSlot(IInventory inventory, boolean add, Orientations from) {
|
||||
// First, look for a similar pile
|
||||
|
||||
if (inventory instanceof ISpecialInventory)
|
||||
return ((ISpecialInventory) inventory).addItem(items, add, from);
|
||||
if (inventory instanceof ISpecialInventory) {
|
||||
int used = ((ISpecialInventory) inventory).addItem(items, add, from);
|
||||
if(used <= 0)
|
||||
return false;
|
||||
|
||||
if(add)
|
||||
items.stackSize -= used;
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean added = false;
|
||||
|
||||
|
@ -136,11 +144,13 @@ public class StackUtil {
|
|||
if (added)
|
||||
if (!add)
|
||||
return true;
|
||||
else if (items.stackSize == 0)
|
||||
return true;
|
||||
else {
|
||||
items.stackSize -= itemsAdded;
|
||||
itemsAdded = 0;
|
||||
if (items.stackSize == 0)
|
||||
return true;
|
||||
else
|
||||
checkAvailableSlot(inventory, added, from);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -179,6 +189,7 @@ public class StackUtil {
|
|||
} else {
|
||||
// This is a generic inventory
|
||||
IInventory inv = Utils.getInventory(inventory);
|
||||
System.out.println("Adding to generic inventory.");
|
||||
|
||||
for (int j = 0; j < inv.getSizeInventory(); ++j)
|
||||
if (tryAdding(inv, j, add, true)) {
|
||||
|
@ -188,13 +199,15 @@ public class StackUtil {
|
|||
}
|
||||
|
||||
// If the inventory if full, return false
|
||||
|
||||
if (added) {
|
||||
if (!add)
|
||||
return true;
|
||||
else if (items.stackSize == 0)
|
||||
return true;
|
||||
else {
|
||||
items.stackSize -= itemsAdded;
|
||||
itemsAdded = 0;
|
||||
if (items.stackSize == 0)
|
||||
return true;
|
||||
else
|
||||
checkAvailableSlot(inventory, added, from);
|
||||
return true;
|
||||
}
|
||||
|
@ -221,7 +234,7 @@ public class StackUtil {
|
|||
|
||||
if (doAdd) {
|
||||
stack.stackSize++;
|
||||
items.stackSize--;
|
||||
itemsAdded++;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -232,7 +245,7 @@ public class StackUtil {
|
|||
stack = items.copy();
|
||||
stack.stackSize = 1;
|
||||
|
||||
items.stackSize--;
|
||||
itemsAdded++;
|
||||
inventory.setInventorySlotContents(stackIndex, stack);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ package net.minecraft.src.buildcraft.core;
|
|||
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
|
||||
import net.minecraft.src.buildcraft.api.ILiquidContainer;
|
||||
import net.minecraft.src.buildcraft.api.LiquidSlot;
|
||||
import net.minecraft.src.buildcraft.api.Trigger;
|
||||
import net.minecraft.src.buildcraft.api.TriggerParameter;
|
||||
import net.minecraft.src.buildcraft.api.liquids.ILiquidTank;
|
||||
import net.minecraft.src.buildcraft.api.liquids.ITankContainer;
|
||||
import net.minecraft.src.buildcraft.api.liquids.LiquidManager;
|
||||
|
||||
public class TriggerLiquidContainer extends Trigger {
|
||||
|
@ -68,15 +68,15 @@ public class TriggerLiquidContainer extends Trigger {
|
|||
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, TriggerParameter parameter) {
|
||||
if (tile instanceof ILiquidContainer) {
|
||||
ILiquidContainer container = (ILiquidContainer) tile;
|
||||
if (tile instanceof ITankContainer) {
|
||||
ITankContainer container = (ITankContainer) tile;
|
||||
|
||||
int seachedLiquidId = 0;
|
||||
|
||||
if (parameter != null && parameter.getItem() != null)
|
||||
seachedLiquidId = LiquidManager.getLiquidIDForFilledItem(parameter.getItem());
|
||||
|
||||
LiquidSlot[] liquids = container.getLiquidSlots();
|
||||
ILiquidTank[] liquids = container.getTanks();
|
||||
|
||||
if (liquids == null || liquids.length == 0)
|
||||
return false;
|
||||
|
@ -85,33 +85,33 @@ public class TriggerLiquidContainer extends Trigger {
|
|||
case Empty:
|
||||
|
||||
if (liquids != null && liquids.length > 0) {
|
||||
for (LiquidSlot c : liquids)
|
||||
if (c.getLiquidQty() != 0)
|
||||
for (ILiquidTank c : liquids)
|
||||
if (c.getLiquid().amount != 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
case Contains:
|
||||
for (LiquidSlot c : liquids)
|
||||
if (c.getLiquidQty() != 0)
|
||||
if (seachedLiquidId == 0 || seachedLiquidId == c.getLiquidId())
|
||||
for (ILiquidTank c : liquids)
|
||||
if (c.getLiquid().amount != 0)
|
||||
if (seachedLiquidId == 0 || seachedLiquidId == c.getLiquid().itemID)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
case Space:
|
||||
for (LiquidSlot c : liquids)
|
||||
if (c.getLiquidQty() == 0)
|
||||
for (ILiquidTank c : liquids)
|
||||
if (c.getLiquid().amount == 0)
|
||||
return true;
|
||||
else if (c.getLiquidQty() < c.getCapacity())
|
||||
if (seachedLiquidId == 0 || seachedLiquidId == c.getLiquidId())
|
||||
else if (c.getLiquid().amount < c.getCapacity())
|
||||
if (seachedLiquidId == 0 || seachedLiquidId == c.getLiquid().itemID)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
case Full:
|
||||
for (LiquidSlot c : liquids)
|
||||
if (c.getLiquidQty() < c.getCapacity())
|
||||
for (ILiquidTank c : liquids)
|
||||
if (c.getLiquid().amount < c.getCapacity())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -13,9 +13,9 @@ import net.minecraft.src.ICrafting;
|
|||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.buildcraft.api.APIProxy;
|
||||
import net.minecraft.src.buildcraft.api.LiquidSlot;
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.api.TileNetworkData;
|
||||
import net.minecraft.src.buildcraft.api.liquids.LiquidTank;
|
||||
|
||||
public abstract class Engine {
|
||||
|
||||
|
@ -146,10 +146,6 @@ public abstract class Engine {
|
|||
|
||||
}
|
||||
|
||||
public LiquidSlot[] getLiquidSlots() {
|
||||
return new LiquidSlot[0];
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
|
@ -166,6 +162,11 @@ public abstract class Engine {
|
|||
return currentOutput;
|
||||
}
|
||||
|
||||
/* ILIQUIDCONTAINER */
|
||||
public LiquidTank[] getLiquidSlots() {
|
||||
return new LiquidTank[0];
|
||||
}
|
||||
|
||||
/* IINVENTORY */
|
||||
public int getSizeInventory() { return 0; }
|
||||
public ItemStack getStackInSlot(int i) { return null; }
|
||||
|
|
|
@ -14,11 +14,11 @@ import net.minecraft.src.ICrafting;
|
|||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
|
||||
import net.minecraft.src.buildcraft.api.LiquidSlot;
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.api.fuels.IronEngineFuel;
|
||||
import net.minecraft.src.buildcraft.api.liquids.LiquidManager;
|
||||
import net.minecraft.src.buildcraft.api.liquids.LiquidStack;
|
||||
import net.minecraft.src.buildcraft.api.liquids.LiquidTank;
|
||||
import net.minecraft.src.buildcraft.core.DefaultProps;
|
||||
import net.minecraft.src.buildcraft.core.Utils;
|
||||
|
||||
|
@ -125,12 +125,11 @@ public class EngineIron extends Engine {
|
|||
super.update();
|
||||
|
||||
if (itemInInventory != null) {
|
||||
int liquidId = LiquidManager.getLiquidIDForFilledItem(itemInInventory);
|
||||
|
||||
if (liquidId != 0) {
|
||||
if (fill(Orientations.Unknown, BuildCraftAPI.BUCKET_VOLUME, liquidId, false) == BuildCraftAPI.BUCKET_VOLUME) {
|
||||
fill(Orientations.Unknown, BuildCraftAPI.BUCKET_VOLUME, liquidId, true);
|
||||
LiquidStack liquid = LiquidManager.getLiquidForFilledItem(itemInInventory);
|
||||
|
||||
if (liquid != null) {
|
||||
if (fill(Orientations.Unknown, liquid, false) == BuildCraftAPI.BUCKET_VOLUME) {
|
||||
fill(Orientations.Unknown, liquid, true);
|
||||
tile.setInventorySlotContents(0, Utils.consumeItem(itemInInventory));
|
||||
}
|
||||
}
|
||||
|
@ -178,65 +177,6 @@ public class EngineIron extends Engine {
|
|||
return (int) (((float) liquidQty / (float) (MAX_LIQUID)) * i);
|
||||
}
|
||||
|
||||
public int fill(Orientations from, int quantity, int id, boolean doFill) {
|
||||
if (id == Block.waterStill.blockID) {
|
||||
return fillCoolant(from, quantity, id, doFill);
|
||||
}
|
||||
|
||||
int res = 0;
|
||||
|
||||
if (liquidQty > 0 && liquidId != id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IronEngineFuel.getFuelForLiquid(new LiquidStack(id, quantity, 0)) == null)
|
||||
return 0;
|
||||
|
||||
if (liquidQty + quantity <= MAX_LIQUID) {
|
||||
if (doFill) {
|
||||
liquidQty += quantity;
|
||||
}
|
||||
|
||||
res = quantity;
|
||||
} else {
|
||||
res = MAX_LIQUID - liquidQty;
|
||||
|
||||
if (doFill) {
|
||||
liquidQty = MAX_LIQUID;
|
||||
}
|
||||
}
|
||||
|
||||
liquidId = id;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
private int fillCoolant(Orientations from, int quantity, int id, boolean doFill) {
|
||||
int res = 0;
|
||||
|
||||
if (coolantQty > 0 && coolantId != id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (coolantQty + quantity <= MAX_LIQUID) {
|
||||
if (doFill) {
|
||||
coolantQty += quantity;
|
||||
}
|
||||
|
||||
res = quantity;
|
||||
} else {
|
||||
res = MAX_LIQUID - coolantQty;
|
||||
|
||||
if (doFill) {
|
||||
coolantQty = MAX_LIQUID;
|
||||
}
|
||||
}
|
||||
|
||||
coolantId = id;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
liquidId = nbttagcompound.getInteger("liquidId");
|
||||
|
@ -319,12 +259,6 @@ public class EngineIron extends Engine {
|
|||
iCrafting.updateCraftingInventoryInfo(containerEngine, 6, coolantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidSlot[] getLiquidSlots() {
|
||||
return new LiquidSlot[] { new LiquidSlot(liquidId, liquidQty, MAX_LIQUID),
|
||||
new LiquidSlot(coolantId, coolantQty, MAX_LIQUID) };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return penaltyCooling <= 0;
|
||||
|
@ -335,6 +269,74 @@ public class EngineIron extends Engine {
|
|||
return heat;
|
||||
}
|
||||
|
||||
/* ITANKCONTAINER */
|
||||
public int fill(Orientations from, LiquidStack resource, boolean doFill) {
|
||||
|
||||
// Handle coolant
|
||||
if (resource.itemID == Block.waterStill.blockID)
|
||||
return fillCoolant(from, resource, doFill);
|
||||
|
||||
int res = 0;
|
||||
|
||||
if (liquidQty > 0 && liquidId != resource.itemID) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IronEngineFuel.getFuelForLiquid(resource) == null)
|
||||
return 0;
|
||||
|
||||
if (liquidQty + resource.amount <= MAX_LIQUID) {
|
||||
if (doFill) {
|
||||
liquidQty += resource.amount;
|
||||
}
|
||||
|
||||
res = resource.amount;
|
||||
} else {
|
||||
res = MAX_LIQUID - liquidQty;
|
||||
|
||||
if (doFill) {
|
||||
liquidQty = MAX_LIQUID;
|
||||
}
|
||||
}
|
||||
|
||||
liquidId = resource.itemID;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
private int fillCoolant(Orientations from, LiquidStack resource, boolean doFill) {
|
||||
int res = 0;
|
||||
|
||||
if (coolantQty > 0 && coolantId != resource.itemID) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (coolantQty + resource.amount <= MAX_LIQUID) {
|
||||
if (doFill) {
|
||||
coolantQty += resource.amount;
|
||||
}
|
||||
|
||||
res = resource.amount;
|
||||
} else {
|
||||
res = MAX_LIQUID - coolantQty;
|
||||
|
||||
if (doFill) {
|
||||
coolantQty = MAX_LIQUID;
|
||||
}
|
||||
}
|
||||
|
||||
coolantId = resource.itemID;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidTank[] getLiquidSlots() {
|
||||
return new LiquidTank[] { new LiquidTank(liquidId, liquidQty, MAX_LIQUID),
|
||||
new LiquidTank(coolantId, coolantQty, MAX_LIQUID) };
|
||||
}
|
||||
|
||||
|
||||
/* IINVENTORY */
|
||||
@Override public int getSizeInventory() { return 1; }
|
||||
@Override public ItemStack getStackInSlot(int i) { return itemInInventory; }
|
||||
|
|
|
@ -20,14 +20,16 @@ import net.minecraft.src.NBTTagCompound;
|
|||
import net.minecraft.src.Packet;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.APIProxy;
|
||||
import net.minecraft.src.buildcraft.api.ILiquidContainer;
|
||||
import net.minecraft.src.buildcraft.api.IOverrideDefaultTriggers;
|
||||
import net.minecraft.src.buildcraft.api.IPipeConnection;
|
||||
import net.minecraft.src.buildcraft.api.LiquidSlot;
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.api.Position;
|
||||
import net.minecraft.src.buildcraft.api.TileNetworkData;
|
||||
import net.minecraft.src.buildcraft.api.Trigger;
|
||||
import net.minecraft.src.buildcraft.api.liquids.ILiquidTank;
|
||||
import net.minecraft.src.buildcraft.api.liquids.ITankContainer;
|
||||
import net.minecraft.src.buildcraft.api.liquids.LiquidStack;
|
||||
import net.minecraft.src.buildcraft.api.liquids.LiquidTank;
|
||||
import net.minecraft.src.buildcraft.api.power.IPowerProvider;
|
||||
import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
|
||||
import net.minecraft.src.buildcraft.api.power.PowerFramework;
|
||||
|
@ -38,7 +40,7 @@ import net.minecraft.src.buildcraft.core.network.PacketUpdate;
|
|||
|
||||
//TODO: All Engines need to take func_48081_b into account
|
||||
|
||||
public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInventory, ILiquidContainer, IEngineProvider,
|
||||
public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInventory, ITankContainer, IEngineProvider,
|
||||
IOverrideDefaultTriggers, IPipeConnection, IBuilderInventory {
|
||||
|
||||
public @TileNetworkData
|
||||
|
@ -378,30 +380,6 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(Orientations from, int quantity, int id, boolean doFill) {
|
||||
if (engine instanceof EngineIron) {
|
||||
return ((EngineIron) engine).fill(from, quantity, id, doFill);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int empty(int quantityMax, boolean doEmpty) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLiquidQuantity() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLiquidId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChest() {
|
||||
|
||||
|
@ -446,15 +424,6 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
|
|||
return triggers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidSlot[] getLiquidSlots() {
|
||||
if (engine == null) {
|
||||
return new LiquidSlot[0];
|
||||
} else {
|
||||
return engine.getLiquidSlots();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPipeConnected(Orientations with) {
|
||||
if (engine instanceof EngineWood) {
|
||||
|
@ -472,4 +441,39 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
|
|||
public void checkRedstonePower() {
|
||||
isRedstonePowered = worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
/* ILIQUIDCONTAINER */
|
||||
@Override
|
||||
public int fill(Orientations from, LiquidStack resource, boolean doFill) {
|
||||
if (engine instanceof EngineIron) {
|
||||
return ((EngineIron) engine).fill(from, resource, doFill);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(int tankIndex, LiquidStack resource, boolean doFill) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack drain(Orientations from, int maxDrain, boolean doDrain) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidTank[] getTanks() {
|
||||
if (engine == null) {
|
||||
return new LiquidTank[0];
|
||||
} else {
|
||||
return engine.getLiquidSlots();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import net.minecraft.src.buildcraft.api.BuildCraftAPI;
|
|||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.api.Position;
|
||||
import net.minecraft.src.buildcraft.api.liquids.LiquidManager;
|
||||
import net.minecraft.src.buildcraft.api.liquids.LiquidStack;
|
||||
import net.minecraft.src.buildcraft.api.tools.IToolWrench;
|
||||
import net.minecraft.src.buildcraft.core.GuiIds;
|
||||
import net.minecraft.src.buildcraft.core.Utils;
|
||||
|
@ -103,11 +104,10 @@ public class BlockRefinery extends BlockContainer {
|
|||
return true;
|
||||
} else {
|
||||
|
||||
int liquidId = LiquidManager.getLiquidIDForFilledItem(entityplayer.getCurrentEquippedItem());
|
||||
LiquidStack liquid = LiquidManager.getLiquidForFilledItem(entityplayer.getCurrentEquippedItem());
|
||||
|
||||
if (liquidId != 0) {
|
||||
int qty = ((TileRefinery) world.getBlockTileEntity(i, j, k)).fill(Orientations.Unknown,
|
||||
BuildCraftAPI.BUCKET_VOLUME, liquidId, true);
|
||||
if (liquid != null) {
|
||||
int qty = ((TileRefinery) world.getBlockTileEntity(i, j, k)).fill(Orientations.Unknown, liquid, true);
|
||||
|
||||
if (qty != 0 && !BuildCraftCore.debugMode) {
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,
|
||||
|
|
|
@ -99,7 +99,7 @@ public class BlockTank extends BlockContainer implements ITextureProvider {
|
|||
|
||||
// Handle filled containers
|
||||
if (liquid != null) {
|
||||
int qty = tank.fill(Orientations.Unknown, liquid.amount, liquid.itemID, true);
|
||||
int qty = tank.fill(Orientations.Unknown, liquid, true);
|
||||
|
||||
if (qty != 0 && !BuildCraftCore.debugMode) {
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,
|
||||
|
@ -111,8 +111,8 @@ public class BlockTank extends BlockContainer implements ITextureProvider {
|
|||
// Handle empty containers
|
||||
} else {
|
||||
|
||||
ItemStack filled = LiquidManager.fillLiquidContainer(new LiquidStack(tank.getLiquidId(),
|
||||
tank.empty(BuildCraftAPI.BUCKET_VOLUME, false)), current);
|
||||
LiquidStack available = tank.drain(Orientations.Unknown, BuildCraftAPI.BUCKET_VOLUME, false);
|
||||
ItemStack filled = LiquidManager.fillLiquidContainer(available, current);
|
||||
|
||||
liquid = LiquidManager.getLiquidForFilledItem(filled);
|
||||
if(liquid != null) {
|
||||
|
@ -129,7 +129,7 @@ public class BlockTank extends BlockContainer implements ITextureProvider {
|
|||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, filled);
|
||||
}
|
||||
|
||||
tank.empty(liquid.amount, true);
|
||||
tank.drain(Orientations.Unknown, liquid.amount, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ import net.minecraft.src.InventoryCrafting;
|
|||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.ISpecialInventory;
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.api.Position;
|
||||
import net.minecraft.src.buildcraft.api.inventory.ISpecialInventory;
|
||||
import net.minecraft.src.buildcraft.core.StackUtil;
|
||||
import net.minecraft.src.buildcraft.core.Utils;
|
||||
|
||||
|
@ -122,38 +122,6 @@ public class TileAutoWorkbench extends TileEntity implements ISpecialInventory {
|
|||
Utils.writeStacksToNBT(nbttagcompound, "stackList", stackList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addItem(ItemStack stack, boolean doAdd, Orientations from) {
|
||||
StackUtil stackUtils = new StackUtil(stack);
|
||||
|
||||
int minSimilar = Integer.MAX_VALUE;
|
||||
int minSlot = -1;
|
||||
|
||||
for (int j = 0; j < getSizeInventory(); ++j) {
|
||||
ItemStack stackInInventory = getStackInSlot(j);
|
||||
|
||||
if (stackInInventory != null && stackInInventory.stackSize > 0 && stackInInventory.itemID == stack.itemID
|
||||
&& stackInInventory.getItemDamage() == stack.getItemDamage() && stackInInventory.stackSize < minSimilar) {
|
||||
minSimilar = stackInInventory.stackSize;
|
||||
minSlot = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (minSlot != -1) {
|
||||
if (stackUtils.tryAdding(this, minSlot, doAdd, false)) {
|
||||
if (doAdd && stack.stackSize != 0) {
|
||||
addItem(stack, doAdd, from);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class StackPointer {
|
||||
|
||||
IInventory inventory;
|
||||
|
@ -229,11 +197,6 @@ public class TileAutoWorkbench extends TileEntity implements ISpecialInventory {
|
|||
return resultStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack extractItem(boolean doRemove, Orientations from) {
|
||||
return extractItem(doRemove, false);
|
||||
}
|
||||
|
||||
public void resetPointers(LinkedList<StackPointer> pointers) {
|
||||
for (StackPointer p : pointers) {
|
||||
ItemStack item = p.inventory.getStackInSlot(p.index);
|
||||
|
@ -316,4 +279,42 @@ public class TileAutoWorkbench extends TileEntity implements ISpecialInventory {
|
|||
|
||||
}
|
||||
|
||||
/* ISPECIALINVENTORY */
|
||||
@Override
|
||||
public int addItem(ItemStack stack, boolean doAdd, Orientations from) {
|
||||
StackUtil stackUtils = new StackUtil(stack);
|
||||
|
||||
int minSimilar = Integer.MAX_VALUE;
|
||||
int minSlot = -1;
|
||||
|
||||
for (int j = 0; j < getSizeInventory(); ++j) {
|
||||
ItemStack stackInInventory = getStackInSlot(j);
|
||||
|
||||
if (stackInInventory != null && stackInInventory.stackSize > 0 && stackInInventory.itemID == stack.itemID
|
||||
&& stackInInventory.getItemDamage() == stack.getItemDamage() && stackInInventory.stackSize < minSimilar) {
|
||||
minSimilar = stackInInventory.stackSize;
|
||||
minSlot = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (minSlot != -1) {
|
||||
if (stackUtils.tryAdding(this, minSlot, doAdd, false)) {
|
||||
if (doAdd && stack.stackSize != 0) {
|
||||
addItem(stack, doAdd, from);
|
||||
}
|
||||
|
||||
return stackUtils.itemsAdded;
|
||||
} else {
|
||||
return stackUtils.itemsAdded;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] extractItem(boolean doRemove, Orientations from, int maxItemCount) {
|
||||
return new ItemStack[] { extractItem(doRemove, false) };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ import net.minecraft.src.ItemStack;
|
|||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.APIProxy;
|
||||
import net.minecraft.src.buildcraft.api.ISpecialInventory;
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.api.inventory.ISpecialInventory;
|
||||
import net.minecraft.src.buildcraft.core.TileBuildCraft;
|
||||
import net.minecraft.src.buildcraft.core.utils.InventoryUtil;
|
||||
import net.minecraft.src.buildcraft.core.utils.SidedInventoryAdapter;
|
||||
|
@ -48,7 +48,7 @@ public class TileHopper extends TileBuildCraft implements IInventory {
|
|||
if (tile instanceof ISpecialInventory) {
|
||||
ISpecialInventory special = (ISpecialInventory) tile;
|
||||
ItemStack clonedStack = _inventory.getStackInSlot(internalSlot).copy().splitStack(1);
|
||||
if (special.addItem(clonedStack, true, Orientations.YPos)) {
|
||||
if (special.addItem(clonedStack, true, Orientations.YPos) > 0) {
|
||||
_inventory.decrStackSize(internalSlot, 1);
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -19,7 +19,6 @@ import net.minecraft.src.NBTTagCompound;
|
|||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.APIProxy;
|
||||
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
|
||||
import net.minecraft.src.buildcraft.api.ILiquidContainer;
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.api.Position;
|
||||
import net.minecraft.src.buildcraft.api.TileNetworkData;
|
||||
|
@ -135,10 +134,6 @@ public class TilePump extends TileMachine implements IMachine, IPowerReceptor {
|
|||
internalLiquid -= ((ITankContainer)tile).fill(p.orientation.reverse(), new LiquidStack(liquidId, internalLiquid), true);
|
||||
if(internalLiquid <= 0)
|
||||
break;
|
||||
} else if (tile instanceof ILiquidContainer) {
|
||||
internalLiquid -= ((ILiquidContainer) tile).fill(p.orientation.reverse(), internalLiquid, liquidId, true);
|
||||
if (internalLiquid <= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,6 @@ import net.minecraft.src.ItemStack;
|
|||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.buildcraft.api.APIProxy;
|
||||
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
|
||||
import net.minecraft.src.buildcraft.api.ILiquidContainer;
|
||||
import net.minecraft.src.buildcraft.api.LiquidSlot;
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.api.SafeTimeTracker;
|
||||
import net.minecraft.src.buildcraft.api.TileNetworkData;
|
||||
|
@ -34,7 +32,7 @@ import net.minecraft.src.buildcraft.api.power.PowerProvider;
|
|||
import net.minecraft.src.buildcraft.api.recipes.RefineryRecipe;
|
||||
import net.minecraft.src.buildcraft.core.IMachine;
|
||||
|
||||
public class TileRefinery extends TileMachine implements ILiquidContainer, ITankContainer, IPowerReceptor, IInventory, IMachine {
|
||||
public class TileRefinery extends TileMachine implements ITankContainer, IPowerReceptor, IInventory, IMachine {
|
||||
|
||||
private int[] filters = new int[2];
|
||||
|
||||
|
@ -388,76 +386,6 @@ public class TileRefinery extends TileMachine implements ILiquidContainer, ITank
|
|||
iCrafting.updateCraftingInventoryInfo(container, 1, filters[1]);
|
||||
}
|
||||
|
||||
/* ILIQUIDCONTAINER */
|
||||
@Override
|
||||
public int fill(Orientations from, int quantity, int id, boolean doFill) {
|
||||
int used = 0;
|
||||
|
||||
if (filters[0] != 0 || filters[1] != 0) {
|
||||
if (filters[0] == id) {
|
||||
used += slot1.fill(from, quantity, id, doFill);
|
||||
}
|
||||
|
||||
if (filters[1] == id) {
|
||||
used += slot2.fill(from, quantity - used, id, doFill);
|
||||
}
|
||||
} else {
|
||||
used += slot1.fill(from, quantity, id, doFill);
|
||||
used += slot2.fill(from, quantity - used, id, doFill);
|
||||
}
|
||||
|
||||
if (doFill && used > 0) {
|
||||
updateNetworkTime.markTime(worldObj);
|
||||
sendNetworkUpdate();
|
||||
}
|
||||
|
||||
return used;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int empty(int quantityMax, boolean doEmpty) {
|
||||
int res = 0;
|
||||
|
||||
if (result.quantity >= quantityMax) {
|
||||
res = quantityMax;
|
||||
|
||||
if (doEmpty) {
|
||||
result.quantity -= quantityMax;
|
||||
}
|
||||
} else {
|
||||
res = result.quantity;
|
||||
|
||||
if (doEmpty) {
|
||||
result.quantity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (doEmpty && res > 0) {
|
||||
updateNetworkTime.markTime(worldObj);
|
||||
sendNetworkUpdate();
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLiquidQuantity() {
|
||||
return result.quantity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLiquidId() {
|
||||
return result.liquidId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidSlot[] getLiquidSlots() {
|
||||
return new LiquidSlot[] { new LiquidSlot(slot1.liquidId, slot1.quantity, LIQUID_PER_SLOT),
|
||||
new LiquidSlot(slot2.liquidId, slot2.quantity, LIQUID_PER_SLOT),
|
||||
new LiquidSlot(result.liquidId, result.quantity, LIQUID_PER_SLOT) };
|
||||
}
|
||||
|
||||
|
||||
/* ITANKCONTAINER */
|
||||
@Override
|
||||
public int fill(Orientations from, LiquidStack resource, boolean doFill) {
|
||||
|
|
|
@ -15,8 +15,6 @@ import net.minecraft.src.NBTTagCompound;
|
|||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.APIProxy;
|
||||
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
|
||||
import net.minecraft.src.buildcraft.api.ILiquidContainer;
|
||||
import net.minecraft.src.buildcraft.api.LiquidSlot;
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.api.SafeTimeTracker;
|
||||
import net.minecraft.src.buildcraft.api.TileNetworkData;
|
||||
|
@ -27,7 +25,7 @@ import net.minecraft.src.buildcraft.api.liquids.LiquidTank;
|
|||
import net.minecraft.src.buildcraft.core.DefaultProps;
|
||||
import net.minecraft.src.buildcraft.core.TileBuildCraft;
|
||||
|
||||
public class TileTank extends TileBuildCraft implements ILiquidContainer, ITankContainer {
|
||||
public class TileTank extends TileBuildCraft implements ITankContainer {
|
||||
|
||||
public @TileNetworkData
|
||||
int stored = 0;
|
||||
|
@ -129,95 +127,6 @@ public class TileTank extends TileBuildCraft implements ILiquidContainer, ITankC
|
|||
|
||||
}
|
||||
|
||||
/* ILIQUIDCONTAINER */
|
||||
@Override
|
||||
public int fill(Orientations from, int quantity, int id, boolean doFill) {
|
||||
return getBottomTank().actualFill(from, quantity, id, doFill);
|
||||
}
|
||||
|
||||
private int actualFill(Orientations from, int quantity, int id, boolean doFill) {
|
||||
if (stored != 0 && id != liquidId)
|
||||
return 0;
|
||||
|
||||
liquidId = id;
|
||||
int used = 0;
|
||||
|
||||
TileTank above = getTankAbove(this);
|
||||
|
||||
if (stored + quantity <= getTankCapacity()) {
|
||||
if (doFill) {
|
||||
stored += quantity;
|
||||
hasUpdate = true;
|
||||
}
|
||||
|
||||
used = quantity;
|
||||
} else if (stored <= getTankCapacity()) {
|
||||
used = getTankCapacity() - stored;
|
||||
|
||||
if (doFill) {
|
||||
stored = getTankCapacity();
|
||||
hasUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (used < quantity && above != null)
|
||||
used = used + above.actualFill(from, quantity - used, id, doFill);
|
||||
|
||||
return used;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLiquidQuantity() {
|
||||
return stored;
|
||||
}
|
||||
|
||||
public int getTankCapacity() {
|
||||
return BuildCraftAPI.BUCKET_VOLUME * 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int empty(int quantityMax, boolean doEmpty) {
|
||||
return getBottomTank().actualEmtpy(quantityMax, doEmpty);
|
||||
}
|
||||
|
||||
private int actualEmtpy(int quantityMax, boolean doEmpty) {
|
||||
|
||||
if (stored >= quantityMax) {
|
||||
if (doEmpty) {
|
||||
stored -= quantityMax;
|
||||
hasUpdate = true;
|
||||
}
|
||||
|
||||
return quantityMax;
|
||||
|
||||
} else {
|
||||
int result = stored;
|
||||
|
||||
if (doEmpty) {
|
||||
stored = 0;
|
||||
hasUpdate = true;
|
||||
}
|
||||
|
||||
TileTank below = getTankBelow(this);
|
||||
|
||||
if (below != null)
|
||||
result += below.actualEmtpy(quantityMax - result, doEmpty);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLiquidId() {
|
||||
return liquidId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidSlot[] getLiquidSlots() {
|
||||
ILiquidTank tank = getTanks()[0];
|
||||
return new LiquidSlot[] { new LiquidSlot(tank.getLiquid().itemID, tank.getLiquid().amount, tank.getCapacity()) };
|
||||
}
|
||||
|
||||
/* ITANKCONTAINER */
|
||||
@Override
|
||||
public int fill(Orientations from, LiquidStack resource, boolean doFill) {
|
||||
|
@ -287,4 +196,70 @@ public class TileTank extends TileBuildCraft implements ILiquidContainer, ITankC
|
|||
return new ILiquidTank[] { new LiquidTank(resultLiquidId, resultLiquidQty, resultCapacity) };
|
||||
}
|
||||
|
||||
private int actualFill(Orientations from, int quantity, int id, boolean doFill) {
|
||||
if (stored != 0 && id != liquidId)
|
||||
return 0;
|
||||
|
||||
liquidId = id;
|
||||
int used = 0;
|
||||
|
||||
TileTank above = getTankAbove(this);
|
||||
|
||||
if (stored + quantity <= getTankCapacity()) {
|
||||
if (doFill) {
|
||||
stored += quantity;
|
||||
hasUpdate = true;
|
||||
}
|
||||
|
||||
used = quantity;
|
||||
} else if (stored <= getTankCapacity()) {
|
||||
used = getTankCapacity() - stored;
|
||||
|
||||
if (doFill) {
|
||||
stored = getTankCapacity();
|
||||
hasUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (used < quantity && above != null)
|
||||
used = used + above.actualFill(from, quantity - used, id, doFill);
|
||||
|
||||
return used;
|
||||
}
|
||||
|
||||
public int getTankCapacity() {
|
||||
return BuildCraftAPI.BUCKET_VOLUME * 16;
|
||||
}
|
||||
|
||||
public LiquidStack getLiquid() {
|
||||
return new LiquidStack(liquidId, stored, 0);
|
||||
}
|
||||
|
||||
private int actualEmtpy(int quantityMax, boolean doEmpty) {
|
||||
|
||||
if (stored >= quantityMax) {
|
||||
if (doEmpty) {
|
||||
stored -= quantityMax;
|
||||
hasUpdate = true;
|
||||
}
|
||||
|
||||
return quantityMax;
|
||||
|
||||
} else {
|
||||
int result = stored;
|
||||
|
||||
if (doEmpty) {
|
||||
stored = 0;
|
||||
hasUpdate = true;
|
||||
}
|
||||
|
||||
TileTank below = getTankBelow(this);
|
||||
|
||||
if (below != null)
|
||||
result += below.actualEmtpy(quantityMax - result, doEmpty);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,16 +14,21 @@ import net.minecraft.src.BuildCraftCore;
|
|||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.NBTTagList;
|
||||
import net.minecraft.src.Packet;
|
||||
import net.minecraft.src.mod_BuildCraftTransport;
|
||||
import net.minecraft.src.buildcraft.api.APIProxy;
|
||||
import net.minecraft.src.buildcraft.api.ISpecialInventory;
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.api.SafeTimeTracker;
|
||||
import net.minecraft.src.buildcraft.api.TileNetworkData;
|
||||
import net.minecraft.src.buildcraft.api.inventory.ISpecialInventory;
|
||||
import net.minecraft.src.buildcraft.core.CoreProxy;
|
||||
import net.minecraft.src.buildcraft.core.DefaultProps;
|
||||
import net.minecraft.src.buildcraft.core.GuiIds;
|
||||
import net.minecraft.src.buildcraft.core.network.PacketIds;
|
||||
import net.minecraft.src.buildcraft.core.network.PacketNBT;
|
||||
import net.minecraft.src.buildcraft.core.network.PacketUpdate;
|
||||
import net.minecraft.src.buildcraft.core.network.TilePacketWrapper;
|
||||
import net.minecraft.src.buildcraft.core.utils.SimpleInventory;
|
||||
|
||||
public class PipeLogicDiamond extends PipeLogic implements ISpecialInventory {
|
||||
|
@ -74,13 +79,12 @@ public class PipeLogicDiamond extends PipeLogic implements ISpecialInventory {
|
|||
|
||||
/* ISPECIALINVENTORY */
|
||||
@Override
|
||||
public boolean addItem(ItemStack stack, boolean doAdd, Orientations from) {
|
||||
return false;
|
||||
public int addItem(ItemStack stack, boolean doAdd, Orientations from) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack extractItem(boolean doRemove, Orientations from) {
|
||||
return null;
|
||||
public ItemStack[] extractItem(boolean doRemove, Orientations from, int maxItemCount) {
|
||||
return new ItemStack[0];
|
||||
}
|
||||
|
||||
/* IINVENTORY IMPLEMENTATION */
|
||||
|
|
|
@ -14,10 +14,10 @@ import net.minecraft.src.ItemStack;
|
|||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.buildcraft.api.EntityPassiveItem;
|
||||
import net.minecraft.src.buildcraft.api.ILiquidContainer;
|
||||
import net.minecraft.src.buildcraft.api.ISpecialInventory;
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.api.Position;
|
||||
import net.minecraft.src.buildcraft.api.inventory.ISpecialInventory;
|
||||
import net.minecraft.src.buildcraft.api.liquids.ITankContainer;
|
||||
import net.minecraft.src.buildcraft.api.power.IPowerProvider;
|
||||
import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
|
||||
import net.minecraft.src.buildcraft.api.power.PowerFramework;
|
||||
|
@ -95,18 +95,19 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
|
|||
int blockId = w.getBlockId((int) pos.x, (int) pos.y, (int) pos.z);
|
||||
TileEntity tile = w.getBlockTileEntity((int) pos.x, (int) pos.y, (int) pos.z);
|
||||
|
||||
if (tile == null || !(tile instanceof IInventory || tile instanceof ILiquidContainer)
|
||||
if (tile == null || !(tile instanceof IInventory || tile instanceof ITankContainer)
|
||||
|| PipeLogicWood.isExcludedFromExtraction(Block.blocksList[blockId]))
|
||||
return;
|
||||
|
||||
if (tile instanceof IInventory) {
|
||||
IInventory inventory = (IInventory) tile;
|
||||
|
||||
ItemStack stack = checkExtract(inventory, true, pos.orientation.reverse());
|
||||
ItemStack[] extracted = checkExtract(inventory, true, pos.orientation.reverse());
|
||||
|
||||
for(ItemStack stack : extracted) {
|
||||
if (stack == null || stack.stackSize == 0) {
|
||||
powerProvider.useEnergy(1, 1, false);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
Position entityPos = new Position(pos.x + 0.5, pos.y + Utils.getPipeFloorOf(stack), pos.z + 0.5,
|
||||
|
@ -119,16 +120,18 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
|
|||
((PipeTransportItems) transport).entityEntering(entity, entityPos.orientation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the itemstack that can be if something can be extracted from this
|
||||
* inventory, null if none. On certain cases, the extractable slot depends
|
||||
* on the position of the pipe.
|
||||
*/
|
||||
public ItemStack checkExtract(IInventory inventory, boolean doRemove, Orientations from) {
|
||||
public ItemStack[] checkExtract(IInventory inventory, boolean doRemove, Orientations from) {
|
||||
|
||||
/// ISPECIALINVENTORY
|
||||
if (inventory instanceof ISpecialInventory)
|
||||
// TAKE INTO ACCOUNT SPECIAL INVENTORIES!!!
|
||||
return ((ISpecialInventory) inventory).extractItem(doRemove, from);
|
||||
return ((ISpecialInventory) inventory).extractItem(doRemove, from, 1);
|
||||
|
||||
if (inventory instanceof ISidedInventory) {
|
||||
ISidedInventory sidedInv = (ISidedInventory) inventory;
|
||||
|
@ -141,7 +144,7 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
|
|||
ItemStack result = checkExtractGeneric(inv, doRemove, from, first, last);
|
||||
|
||||
if (result != null)
|
||||
return result;
|
||||
return new ItemStack[] { result };
|
||||
} else if (inventory.getSizeInventory() == 2) {
|
||||
// This is an input-output inventory
|
||||
|
||||
|
@ -156,9 +159,9 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
|
|||
|
||||
if (slot != null && slot.stackSize > 0)
|
||||
if (doRemove)
|
||||
return inventory.decrStackSize(slotIndex, (int) powerProvider.useEnergy(1, slot.stackSize, true));
|
||||
return new ItemStack[] { inventory.decrStackSize(slotIndex, (int) powerProvider.useEnergy(1, slot.stackSize, true)) };
|
||||
else
|
||||
return slot;
|
||||
return new ItemStack[] { slot };
|
||||
} else if (inventory.getSizeInventory() == 3) {
|
||||
// This is a furnace-like inventory
|
||||
|
||||
|
@ -175,9 +178,9 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
|
|||
|
||||
if (slot != null && slot.stackSize > 0)
|
||||
if (doRemove)
|
||||
return inventory.decrStackSize(slotIndex, (int) powerProvider.useEnergy(1, slot.stackSize, true));
|
||||
return new ItemStack[] { inventory.decrStackSize(slotIndex, (int) powerProvider.useEnergy(1, slot.stackSize, true)) };
|
||||
else
|
||||
return slot;
|
||||
return new ItemStack[] { slot };
|
||||
} else {
|
||||
// This is a generic inventory
|
||||
IInventory inv = Utils.getInventory(inventory);
|
||||
|
@ -185,7 +188,7 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
|
|||
ItemStack result = checkExtractGeneric(inv, doRemove, from, 0, inv.getSizeInventory() - 1);
|
||||
|
||||
if (result != null)
|
||||
return result;
|
||||
return new ItemStack[] { result };
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
Loading…
Reference in a new issue