Added Emerald Item/Liquid Pipes
Also new texture for the Laser Crafting Table and fixed a bug with Wooden Item Pipes not diplaying items that are being pumped. Emerald Pipes are advanced versions of the Wooden Pipes. The Item Pipe posseses a filter that pulls items from inventories in a blocking Round Robin fashion. The Liquid Pipe has capacity and flow rate equal to a golden pipe. Note: ISpecial and ISelective Inventory interaction with the Emerald Item Pipes is untested, there seems to be nothing decent to test with in Buildcraft.
This commit is contained in:
parent
b4cb75d2d4
commit
e63402b0fa
18 changed files with 611 additions and 50 deletions
Binary file not shown.
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 24 KiB |
BIN
buildcraft_resources/gfx/buildcraft/gui/filter_2.png
Normal file
BIN
buildcraft_resources/gfx/buildcraft/gui/filter_2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
|
@ -40,11 +40,13 @@ import buildcraft.transport.PipeTriggerProvider;
|
||||||
import buildcraft.transport.TransportProxy;
|
import buildcraft.transport.TransportProxy;
|
||||||
import buildcraft.transport.blueprints.BptBlockPipe;
|
import buildcraft.transport.blueprints.BptBlockPipe;
|
||||||
import buildcraft.transport.blueprints.BptItemPipeDiamond;
|
import buildcraft.transport.blueprints.BptItemPipeDiamond;
|
||||||
|
import buildcraft.transport.blueprints.BptItemPipeEmerald;
|
||||||
import buildcraft.transport.blueprints.BptItemPipeIron;
|
import buildcraft.transport.blueprints.BptItemPipeIron;
|
||||||
import buildcraft.transport.blueprints.BptItemPipeWooden;
|
import buildcraft.transport.blueprints.BptItemPipeWooden;
|
||||||
import buildcraft.transport.network.PacketHandlerTransport;
|
import buildcraft.transport.network.PacketHandlerTransport;
|
||||||
import buildcraft.transport.pipes.PipeItemsCobblestone;
|
import buildcraft.transport.pipes.PipeItemsCobblestone;
|
||||||
import buildcraft.transport.pipes.PipeItemsDiamond;
|
import buildcraft.transport.pipes.PipeItemsDiamond;
|
||||||
|
import buildcraft.transport.pipes.PipeItemsEmerald;
|
||||||
import buildcraft.transport.pipes.PipeItemsGold;
|
import buildcraft.transport.pipes.PipeItemsGold;
|
||||||
import buildcraft.transport.pipes.PipeItemsIron;
|
import buildcraft.transport.pipes.PipeItemsIron;
|
||||||
import buildcraft.transport.pipes.PipeItemsObsidian;
|
import buildcraft.transport.pipes.PipeItemsObsidian;
|
||||||
|
@ -53,6 +55,7 @@ import buildcraft.transport.pipes.PipeItemsStone;
|
||||||
import buildcraft.transport.pipes.PipeItemsVoid;
|
import buildcraft.transport.pipes.PipeItemsVoid;
|
||||||
import buildcraft.transport.pipes.PipeItemsWood;
|
import buildcraft.transport.pipes.PipeItemsWood;
|
||||||
import buildcraft.transport.pipes.PipeLiquidsCobblestone;
|
import buildcraft.transport.pipes.PipeLiquidsCobblestone;
|
||||||
|
import buildcraft.transport.pipes.PipeLiquidsEmerald;
|
||||||
import buildcraft.transport.pipes.PipeLiquidsGold;
|
import buildcraft.transport.pipes.PipeLiquidsGold;
|
||||||
import buildcraft.transport.pipes.PipeLiquidsIron;
|
import buildcraft.transport.pipes.PipeLiquidsIron;
|
||||||
import buildcraft.transport.pipes.PipeLiquidsSandstone;
|
import buildcraft.transport.pipes.PipeLiquidsSandstone;
|
||||||
|
@ -110,6 +113,7 @@ public class BuildCraftTransport {
|
||||||
public static Item yellowPipeWire;
|
public static Item yellowPipeWire;
|
||||||
|
|
||||||
public static Item pipeItemsWood;
|
public static Item pipeItemsWood;
|
||||||
|
public static Item pipeItemsEmerald;
|
||||||
public static Item pipeItemsStone;
|
public static Item pipeItemsStone;
|
||||||
public static Item pipeItemsCobblestone;
|
public static Item pipeItemsCobblestone;
|
||||||
public static Item pipeItemsIron;
|
public static Item pipeItemsIron;
|
||||||
|
@ -126,6 +130,7 @@ public class BuildCraftTransport {
|
||||||
public static Item pipeLiquidsGold;
|
public static Item pipeLiquidsGold;
|
||||||
public static Item pipeLiquidsVoid;
|
public static Item pipeLiquidsVoid;
|
||||||
public static Item pipeLiquidsSandstone;
|
public static Item pipeLiquidsSandstone;
|
||||||
|
public static Item pipeLiquidsEmerald;
|
||||||
|
|
||||||
public static Item pipePowerWood;
|
public static Item pipePowerWood;
|
||||||
public static Item pipePowerStone;
|
public static Item pipePowerStone;
|
||||||
|
@ -261,40 +266,26 @@ public class BuildCraftTransport {
|
||||||
|
|
||||||
// Fixing retro-compatiblity
|
// Fixing retro-compatiblity
|
||||||
pipeItemsWood = createPipe(DefaultProps.PIPE_ITEMS_WOOD_ID, PipeItemsWood.class, "Wooden Transport Pipe", "plankWood", Block.glass, "plankWood");
|
pipeItemsWood = createPipe(DefaultProps.PIPE_ITEMS_WOOD_ID, PipeItemsWood.class, "Wooden Transport Pipe", "plankWood", Block.glass, "plankWood");
|
||||||
pipeItemsCobblestone = createPipe(DefaultProps.PIPE_ITEMS_COBBLESTONE_ID, PipeItemsCobblestone.class, "Cobblestone Transport Pipe",
|
pipeItemsEmerald = createPipe(DefaultProps.PIPE_ITEMS_EMERALD_ID, PipeItemsEmerald.class, "Emerald Transport Pipe", Item.emerald, Block.glass, Item.emerald);
|
||||||
Block.cobblestone, Block.glass, Block.cobblestone);
|
pipeItemsCobblestone = createPipe(DefaultProps.PIPE_ITEMS_COBBLESTONE_ID, PipeItemsCobblestone.class, "Cobblestone Transport Pipe", Block.cobblestone, Block.glass, Block.cobblestone);
|
||||||
pipeItemsStone = createPipe(DefaultProps.PIPE_ITEMS_STONE_ID, PipeItemsStone.class, "Stone Transport Pipe", Block.stone, Block.glass, Block.stone);
|
pipeItemsStone = createPipe(DefaultProps.PIPE_ITEMS_STONE_ID, PipeItemsStone.class, "Stone Transport Pipe", Block.stone, Block.glass, Block.stone);
|
||||||
pipeItemsIron = createPipe(DefaultProps.PIPE_ITEMS_IRON_ID, PipeItemsIron.class, "Iron Transport Pipe", Item.ingotIron, Block.glass, Item.ingotIron);
|
pipeItemsIron = createPipe(DefaultProps.PIPE_ITEMS_IRON_ID, PipeItemsIron.class, "Iron Transport Pipe", Item.ingotIron, Block.glass, Item.ingotIron);
|
||||||
pipeItemsGold = createPipe(DefaultProps.PIPE_ITEMS_GOLD_ID, PipeItemsGold.class, "Golden Transport Pipe", Item.ingotGold, Block.glass,
|
pipeItemsGold = createPipe(DefaultProps.PIPE_ITEMS_GOLD_ID, PipeItemsGold.class, "Golden Transport Pipe", Item.ingotGold, Block.glass, Item.ingotGold);
|
||||||
Item.ingotGold);
|
pipeItemsDiamond = createPipe(DefaultProps.PIPE_ITEMS_DIAMOND_ID, PipeItemsDiamond.class, "Diamond Transport Pipe", Item.diamond, Block.glass, Item.diamond);
|
||||||
pipeItemsDiamond = createPipe(DefaultProps.PIPE_ITEMS_DIAMOND_ID, PipeItemsDiamond.class, "Diamond Transport Pipe", Item.diamond, Block.glass,
|
pipeItemsObsidian = createPipe(DefaultProps.PIPE_ITEMS_OBSIDIAN_ID, PipeItemsObsidian.class, "Obsidian Transport Pipe", Block.obsidian, Block.glass, Block.obsidian);
|
||||||
Item.diamond);
|
|
||||||
pipeItemsObsidian = createPipe(DefaultProps.PIPE_ITEMS_OBSIDIAN_ID, PipeItemsObsidian.class, "Obsidian Transport Pipe", Block.obsidian,
|
|
||||||
Block.glass, Block.obsidian);
|
|
||||||
|
|
||||||
pipeLiquidsWood = createPipe(DefaultProps.PIPE_LIQUIDS_WOOD_ID, PipeLiquidsWood.class, "Wooden Waterproof Pipe", pipeWaterproof, pipeItemsWood,
|
pipeLiquidsWood = createPipe(DefaultProps.PIPE_LIQUIDS_WOOD_ID, PipeLiquidsWood.class, "Wooden Waterproof Pipe", pipeWaterproof, pipeItemsWood, null);
|
||||||
null);
|
pipeLiquidsCobblestone = createPipe(DefaultProps.PIPE_LIQUIDS_COBBLESTONE_ID, PipeLiquidsCobblestone.class, "Cobblestone Waterproof Pipe", pipeWaterproof, pipeItemsCobblestone, null);
|
||||||
pipeLiquidsCobblestone = createPipe(DefaultProps.PIPE_LIQUIDS_COBBLESTONE_ID, PipeLiquidsCobblestone.class, "Cobblestone Waterproof Pipe",
|
pipeLiquidsStone = createPipe(DefaultProps.PIPE_LIQUIDS_STONE_ID, PipeLiquidsStone.class, "Stone Waterproof Pipe", pipeWaterproof, pipeItemsStone, null);
|
||||||
pipeWaterproof, pipeItemsCobblestone, null);
|
|
||||||
pipeLiquidsStone = createPipe(DefaultProps.PIPE_LIQUIDS_STONE_ID, PipeLiquidsStone.class, "Stone Waterproof Pipe", pipeWaterproof, pipeItemsStone,
|
|
||||||
null);
|
|
||||||
pipeLiquidsIron = createPipe(DefaultProps.PIPE_LIQUIDS_IRON_ID, PipeLiquidsIron.class, "Iron Waterproof Pipe", pipeWaterproof, pipeItemsIron, null);
|
pipeLiquidsIron = createPipe(DefaultProps.PIPE_LIQUIDS_IRON_ID, PipeLiquidsIron.class, "Iron Waterproof Pipe", pipeWaterproof, pipeItemsIron, null);
|
||||||
pipeLiquidsGold = createPipe(DefaultProps.PIPE_LIQUIDS_GOLD_ID, PipeLiquidsGold.class, "Golden Waterproof Pipe", pipeWaterproof, pipeItemsGold,
|
pipeLiquidsGold = createPipe(DefaultProps.PIPE_LIQUIDS_GOLD_ID, PipeLiquidsGold.class, "Golden Waterproof Pipe", pipeWaterproof, pipeItemsGold, null);
|
||||||
null);
|
pipeLiquidsEmerald = createPipe(DefaultProps.PIPE_LIQUIDS_EMERALD_ID, PipeLiquidsEmerald.class, "Emerald Waterproof Pipe", pipeWaterproof, pipeItemsEmerald, null);
|
||||||
// diamond
|
|
||||||
// obsidian
|
|
||||||
|
|
||||||
pipePowerWood = createPipe(DefaultProps.PIPE_POWER_WOOD_ID, PipePowerWood.class, "Wooden Conductive Pipe", Item.redstone, pipeItemsWood, null);
|
pipePowerWood = createPipe(DefaultProps.PIPE_POWER_WOOD_ID, PipePowerWood.class, "Wooden Conductive Pipe", Item.redstone, pipeItemsWood, null);
|
||||||
// cobblestone
|
|
||||||
pipePowerStone = createPipe(DefaultProps.PIPE_POWER_STONE_ID, PipePowerStone.class, "Stone Conductive Pipe", Item.redstone, pipeItemsStone, null);
|
pipePowerStone = createPipe(DefaultProps.PIPE_POWER_STONE_ID, PipePowerStone.class, "Stone Conductive Pipe", Item.redstone, pipeItemsStone, null);
|
||||||
// iron
|
|
||||||
pipePowerGold = createPipe(DefaultProps.PIPE_POWER_GOLD_ID, PipePowerGold.class, "Golden Conductive Pipe", Item.redstone, pipeItemsGold, null);
|
pipePowerGold = createPipe(DefaultProps.PIPE_POWER_GOLD_ID, PipePowerGold.class, "Golden Conductive Pipe", Item.redstone, pipeItemsGold, null);
|
||||||
// diamond
|
|
||||||
// obsidian
|
|
||||||
|
|
||||||
// Fix name and recipe (Structure pipe insteand of Signal?)
|
pipeStructureCobblestone = createPipe(DefaultProps.PIPE_STRUCTURE_COBBLESTONE_ID, PipeStructureCobblestone.class, "Cobblestone Structure Pipe", Block.gravel, pipeItemsCobblestone, null);
|
||||||
pipeStructureCobblestone = createPipe(DefaultProps.PIPE_STRUCTURE_COBBLESTONE_ID, PipeStructureCobblestone.class, "Cobblestone Structure Pipe",
|
|
||||||
Block.gravel, pipeItemsCobblestone, null);
|
|
||||||
|
|
||||||
// Fix the recipe
|
// Fix the recipe
|
||||||
// pipeItemsStipes = createPipe(DefaultProps.PIPE_ITEMS_STRIPES_ID, PipeItemsStripes.class, "Stripes Transport Pipe", new ItemStack(Item.dyePowder,
|
// pipeItemsStipes = createPipe(DefaultProps.PIPE_ITEMS_STRIPES_ID, PipeItemsStripes.class, "Stripes Transport Pipe", new ItemStack(Item.dyePowder,
|
||||||
|
@ -387,6 +378,7 @@ public class BuildCraftTransport {
|
||||||
BuildCraftCore.itemBptProps[pipeItemsIron.itemID] = new BptItemPipeIron();
|
BuildCraftCore.itemBptProps[pipeItemsIron.itemID] = new BptItemPipeIron();
|
||||||
BuildCraftCore.itemBptProps[pipeLiquidsIron.itemID] = new BptItemPipeIron();
|
BuildCraftCore.itemBptProps[pipeLiquidsIron.itemID] = new BptItemPipeIron();
|
||||||
BuildCraftCore.itemBptProps[pipeItemsDiamond.itemID] = new BptItemPipeDiamond();
|
BuildCraftCore.itemBptProps[pipeItemsDiamond.itemID] = new BptItemPipeDiamond();
|
||||||
|
BuildCraftCore.itemBptProps[pipeItemsEmerald.itemID] = new BptItemPipeEmerald();
|
||||||
|
|
||||||
ActionManager.registerTriggerProvider(new PipeTriggerProvider());
|
ActionManager.registerTriggerProvider(new PipeTriggerProvider());
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class DefaultProps {
|
||||||
public static int PIPE_ITEMS_GOLD_ID = 19164;
|
public static int PIPE_ITEMS_GOLD_ID = 19164;
|
||||||
public static int PIPE_ITEMS_DIAMOND_ID = 19165;
|
public static int PIPE_ITEMS_DIAMOND_ID = 19165;
|
||||||
public static int PIPE_ITEMS_OBSIDIAN_ID = 19166;
|
public static int PIPE_ITEMS_OBSIDIAN_ID = 19166;
|
||||||
|
public static int PIPE_ITEMS_EMERALD_ID = 19167;
|
||||||
|
|
||||||
public static int PIPE_LIQUIDS_WOOD_ID = 19180;
|
public static int PIPE_LIQUIDS_WOOD_ID = 19180;
|
||||||
public static int PIPE_LIQUIDS_COBBLESTONE_ID = 19181;
|
public static int PIPE_LIQUIDS_COBBLESTONE_ID = 19181;
|
||||||
|
@ -70,6 +71,7 @@ public class DefaultProps {
|
||||||
public static int PIPE_LIQUIDS_GOLD_ID = 19184;
|
public static int PIPE_LIQUIDS_GOLD_ID = 19184;
|
||||||
public static int PIPE_LIQUIDS_DIAMOND_ID = 19185;
|
public static int PIPE_LIQUIDS_DIAMOND_ID = 19185;
|
||||||
public static int PIPE_LIQUIDS_OBSIDIAN_ID = 19186;
|
public static int PIPE_LIQUIDS_OBSIDIAN_ID = 19186;
|
||||||
|
public static int PIPE_LIQUIDS_EMERALD_ID = 19187;
|
||||||
|
|
||||||
public static int PIPE_POWER_WOOD_ID = 19200;
|
public static int PIPE_POWER_WOOD_ID = 19200;
|
||||||
public static int PIPE_POWER_COBBLESTONE_ID = 19201;
|
public static int PIPE_POWER_COBBLESTONE_ID = 19201;
|
||||||
|
|
|
@ -18,5 +18,6 @@ public class GuiIds {
|
||||||
|
|
||||||
public static final int PIPE_DIAMOND = 50;
|
public static final int PIPE_DIAMOND = 50;
|
||||||
public static final int GATES = 51;
|
public static final int GATES = 51;
|
||||||
|
public static final int PIPE_EMERALD_ITEM = 52;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ public class PacketIds {
|
||||||
public static final int SELECTION_ASSEMBLY = 21;
|
public static final int SELECTION_ASSEMBLY = 21;
|
||||||
public static final int SELECTION_ASSEMBLY_SEND = 22;
|
public static final int SELECTION_ASSEMBLY_SEND = 22;
|
||||||
public static final int DIAMOND_PIPE_SELECT = 31;
|
public static final int DIAMOND_PIPE_SELECT = 31;
|
||||||
|
public static final int EMERALD_PIPE_SELECT = 32;
|
||||||
public static final int GATE_ACTIONS = 40;
|
public static final int GATE_ACTIONS = 40;
|
||||||
public static final int GATE_REQUEST_INIT = 41;
|
public static final int GATE_REQUEST_INIT = 41;
|
||||||
public static final int GATE_REQUEST_SELECTION = 42;
|
public static final int GATE_REQUEST_SELECTION = 42;
|
||||||
|
|
|
@ -21,7 +21,6 @@ public class BlockAssemblyTable extends BlockContainer {
|
||||||
|
|
||||||
public BlockAssemblyTable(int i) {
|
public BlockAssemblyTable(int i) {
|
||||||
super(i, Material.iron);
|
super(i, Material.iron);
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
|
|
||||||
setBlockBounds(0, 0, 0, 1, 9F / 16F, 1);
|
setBlockBounds(0, 0, 0, 1, 9F / 16F, 1);
|
||||||
setHardness(0.5F);
|
setHardness(0.5F);
|
||||||
|
@ -64,12 +63,13 @@ public class BlockAssemblyTable extends BlockContainer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBlockTextureFromSideAndMetadata(int i, int j) {
|
public int getBlockTextureFromSideAndMetadata(int i, int j) {
|
||||||
if (i == 1)
|
if (i == 1) {
|
||||||
return 16 * 6 + 12;
|
return j == 0 ? 16 * 6 + 12 : 16 * 3 + 15;
|
||||||
else if (i == 0)
|
} else if (i == 0) {
|
||||||
return 16 * 2 + 15;
|
return 16 * 2 + 15;
|
||||||
else
|
} else {
|
||||||
return j == 0 ? 16 * 6 + 11 : 2 * 16 + 12;
|
return j == 0 ? 16 * 6 + 11 : 16 * 3 + 14;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,11 +5,14 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import buildcraft.core.GuiIds;
|
import buildcraft.core.GuiIds;
|
||||||
import buildcraft.transport.gui.ContainerDiamondPipe;
|
import buildcraft.transport.gui.ContainerDiamondPipe;
|
||||||
|
import buildcraft.transport.gui.ContainerEmeraldPipe;
|
||||||
import buildcraft.transport.gui.ContainerGateInterface;
|
import buildcraft.transport.gui.ContainerGateInterface;
|
||||||
import buildcraft.transport.gui.GuiDiamondPipe;
|
import buildcraft.transport.gui.GuiDiamondPipe;
|
||||||
|
import buildcraft.transport.gui.GuiEmeraldPipe;
|
||||||
import buildcraft.transport.gui.GuiGateInterface;
|
import buildcraft.transport.gui.GuiGateInterface;
|
||||||
import buildcraft.transport.pipes.PipeLogicDiamond;
|
import buildcraft.transport.pipes.PipeLogicDiamond;
|
||||||
import cpw.mods.fml.common.network.IGuiHandler;
|
import cpw.mods.fml.common.network.IGuiHandler;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
|
||||||
public class GuiHandler implements IGuiHandler {
|
public class GuiHandler implements IGuiHandler {
|
||||||
|
|
||||||
|
@ -30,6 +33,9 @@ public class GuiHandler implements IGuiHandler {
|
||||||
switch (ID) {
|
switch (ID) {
|
||||||
case GuiIds.PIPE_DIAMOND:
|
case GuiIds.PIPE_DIAMOND:
|
||||||
return new ContainerDiamondPipe(player.inventory, (PipeLogicDiamond) pipe.pipe.logic);
|
return new ContainerDiamondPipe(player.inventory, (PipeLogicDiamond) pipe.pipe.logic);
|
||||||
|
|
||||||
|
case GuiIds.PIPE_EMERALD_ITEM:
|
||||||
|
return new ContainerEmeraldPipe(player.inventory, (IInventory) pipe.pipe);
|
||||||
|
|
||||||
case GuiIds.GATES:
|
case GuiIds.GATES:
|
||||||
return new ContainerGateInterface(player.inventory, pipe.pipe);
|
return new ContainerGateInterface(player.inventory, pipe.pipe);
|
||||||
|
@ -56,6 +62,9 @@ public class GuiHandler implements IGuiHandler {
|
||||||
switch (ID) {
|
switch (ID) {
|
||||||
case GuiIds.PIPE_DIAMOND:
|
case GuiIds.PIPE_DIAMOND:
|
||||||
return new GuiDiamondPipe(player.inventory, pipe);
|
return new GuiDiamondPipe(player.inventory, pipe);
|
||||||
|
|
||||||
|
case GuiIds.PIPE_EMERALD_ITEM:
|
||||||
|
return new GuiEmeraldPipe(player.inventory, pipe);
|
||||||
|
|
||||||
case GuiIds.GATES:
|
case GuiIds.GATES:
|
||||||
return new GuiGateInterface(player.inventory, pipe.pipe);
|
return new GuiGateInterface(player.inventory, pipe.pipe);
|
||||||
|
|
|
@ -33,12 +33,14 @@ public class TransportProxyClient extends TransportProxy {
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsGold.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsGold.itemID, pipeItemRenderer);
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsDiamond.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsDiamond.itemID, pipeItemRenderer);
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsObsidian.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsObsidian.itemID, pipeItemRenderer);
|
||||||
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsEmerald.itemID, pipeItemRenderer);
|
||||||
|
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeLiquidsWood.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeLiquidsWood.itemID, pipeItemRenderer);
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeLiquidsCobblestone.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeLiquidsCobblestone.itemID, pipeItemRenderer);
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeLiquidsStone.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeLiquidsStone.itemID, pipeItemRenderer);
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeLiquidsIron.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeLiquidsIron.itemID, pipeItemRenderer);
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeLiquidsGold.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeLiquidsGold.itemID, pipeItemRenderer);
|
||||||
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeLiquidsEmerald.itemID, pipeItemRenderer);
|
||||||
|
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerWood.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerWood.itemID, pipeItemRenderer);
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerStone.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerStone.itemID, pipeItemRenderer);
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
/**
|
||||||
|
* 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.transport.blueprints;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import buildcraft.api.blueprints.BptBlockUtils;
|
||||||
|
import buildcraft.api.blueprints.BptSlotInfo;
|
||||||
|
import buildcraft.api.blueprints.IBptContext;
|
||||||
|
import buildcraft.core.blueprints.BptItem;
|
||||||
|
|
||||||
|
public class BptItemPipeEmerald extends BptItem {
|
||||||
|
|
||||||
|
public BptItemPipeEmerald() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addRequirements(BptSlotInfo slot, LinkedList<ItemStack> requirements) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initializeFromWorld(BptSlotInfo bptSlot, IBptContext context, int x, int y, int z) {
|
||||||
|
IInventory inventory = (IInventory) context.world().getBlockTileEntity(x, y, z);
|
||||||
|
|
||||||
|
BptBlockUtils.initializeInventoryContents(bptSlot, context, inventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildBlock(BptSlotInfo slot, IBptContext context) {
|
||||||
|
IInventory inventory = (IInventory) context.world().getBlockTileEntity(slot.x, slot.y, slot.z);
|
||||||
|
|
||||||
|
BptBlockUtils.buildInventoryContents(slot, context, inventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
43
common/buildcraft/transport/gui/ContainerEmeraldPipe.java
Normal file
43
common/buildcraft/transport/gui/ContainerEmeraldPipe.java
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/**
|
||||||
|
* 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.transport.gui;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import buildcraft.core.gui.BuildCraftContainer;
|
||||||
|
|
||||||
|
public class ContainerEmeraldPipe extends BuildCraftContainer {
|
||||||
|
|
||||||
|
IInventory playerIInventory;
|
||||||
|
IInventory filterIInventory;
|
||||||
|
|
||||||
|
public ContainerEmeraldPipe(IInventory playerInventory, IInventory filterInventory) {
|
||||||
|
super(filterInventory.getSizeInventory());
|
||||||
|
this.playerIInventory = playerInventory;
|
||||||
|
this.filterIInventory = filterInventory;
|
||||||
|
|
||||||
|
for (int l = 0; l < 3; l++) {
|
||||||
|
for (int k1 = 0; k1 < 9; k1++) {
|
||||||
|
addSlotToContainer(new Slot(playerInventory, k1 + l * 9 + 9, 8 + k1 * 18, 50 + l * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i1 = 0; i1 < 9; i1++) {
|
||||||
|
addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 108));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||||
|
return filterIInventory.isUseableByPlayer(entityplayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
100
common/buildcraft/transport/gui/GuiEmeraldPipe.java
Normal file
100
common/buildcraft/transport/gui/GuiEmeraldPipe.java
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
/**
|
||||||
|
* 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.transport.gui;
|
||||||
|
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import buildcraft.core.DefaultProps;
|
||||||
|
import buildcraft.core.gui.GuiAdvancedInterface;
|
||||||
|
import buildcraft.core.network.PacketIds;
|
||||||
|
import buildcraft.core.network.PacketSlotChange;
|
||||||
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
|
import buildcraft.core.utils.StringUtil;
|
||||||
|
import buildcraft.transport.TileGenericPipe;
|
||||||
|
import buildcraft.transport.pipes.PipeItemsEmerald;
|
||||||
|
|
||||||
|
public class GuiEmeraldPipe extends GuiAdvancedInterface {
|
||||||
|
|
||||||
|
IInventory playerInventory;
|
||||||
|
PipeItemsEmerald filterInventory;
|
||||||
|
|
||||||
|
public GuiEmeraldPipe(IInventory playerInventory, TileGenericPipe tile) {
|
||||||
|
super(new ContainerEmeraldPipe(playerInventory, (IInventory) tile.pipe), (IInventory) tile.pipe);
|
||||||
|
this.playerInventory = playerInventory;
|
||||||
|
this.filterInventory = (PipeItemsEmerald) tile.pipe;
|
||||||
|
xSize = 175;
|
||||||
|
ySize = 132;
|
||||||
|
|
||||||
|
slots = new AdvancedSlot[9];
|
||||||
|
|
||||||
|
for (int i = 0; i < 9; i++) {
|
||||||
|
slots[i] = new IInventorySlot(8 + i * 18, 18, filterInventory, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||||
|
fontRenderer.drawString(filterInventory.getInvName(), getCenteredOffset(filterInventory.getInvName()), 6, 0x404040);
|
||||||
|
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, ySize - 93, 0x404040);
|
||||||
|
|
||||||
|
drawForegroundSelection(par1, par2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
|
||||||
|
int i = mc.renderEngine.getTexture(DefaultProps.TEXTURE_PATH_GUI + "/filter_2.png");
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
mc.renderEngine.bindTexture(i);
|
||||||
|
int j = (width - xSize) / 2;
|
||||||
|
int k = (height - ySize) / 2;
|
||||||
|
drawTexturedModalRect(j, k, 0, 0, xSize, ySize);
|
||||||
|
|
||||||
|
drawBackgroundSlots();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int i, int j, int k) {
|
||||||
|
super.mouseClicked(i, j, k);
|
||||||
|
|
||||||
|
int cornerX = (width - xSize) / 2;
|
||||||
|
int cornerY = (height - ySize) / 2;
|
||||||
|
|
||||||
|
int position = getSlotAtLocation(i - cornerX, j - cornerY);
|
||||||
|
|
||||||
|
IInventorySlot slot = null;
|
||||||
|
|
||||||
|
if (position != -1) {
|
||||||
|
slot = (IInventorySlot) slots[position];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slot != null) {
|
||||||
|
ItemStack playerStack = mc.thePlayer.inventory.getItemStack();
|
||||||
|
|
||||||
|
ItemStack newStack;
|
||||||
|
if (playerStack != null) {
|
||||||
|
newStack = playerStack.copy();
|
||||||
|
newStack.stackSize = 1;
|
||||||
|
} else {
|
||||||
|
newStack = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
filterInventory.setInventorySlotContents(position, newStack);
|
||||||
|
|
||||||
|
if (CoreProxy.proxy.isRenderWorld(filterInventory.worldObj)) {
|
||||||
|
PacketSlotChange packet = new PacketSlotChange(PacketIds.EMERALD_PIPE_SELECT, filterInventory.xCoord, filterInventory.yCoord,
|
||||||
|
filterInventory.zCoord, position, newStack);
|
||||||
|
CoreProxy.proxy.sendToServer(packet.getPacket());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,6 +18,7 @@ import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.PipeTransportPower;
|
import buildcraft.transport.PipeTransportPower;
|
||||||
import buildcraft.transport.TileGenericPipe;
|
import buildcraft.transport.TileGenericPipe;
|
||||||
import buildcraft.transport.gui.ContainerGateInterface;
|
import buildcraft.transport.gui.ContainerGateInterface;
|
||||||
|
import buildcraft.transport.pipes.PipeItemsEmerald;
|
||||||
import buildcraft.transport.pipes.PipeLogicDiamond;
|
import buildcraft.transport.pipes.PipeLogicDiamond;
|
||||||
import cpw.mods.fml.common.network.IPacketHandler;
|
import cpw.mods.fml.common.network.IPacketHandler;
|
||||||
import cpw.mods.fml.common.network.Player;
|
import cpw.mods.fml.common.network.Player;
|
||||||
|
@ -67,11 +68,19 @@ public class PacketHandlerTransport implements IPacketHandler {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/** SERVER SIDE **/
|
/** SERVER SIDE **/
|
||||||
case PacketIds.DIAMOND_PIPE_SELECT:
|
case PacketIds.DIAMOND_PIPE_SELECT: {
|
||||||
PacketSlotChange packet1 = new PacketSlotChange();
|
PacketSlotChange packet1 = new PacketSlotChange();
|
||||||
packet1.readData(data);
|
packet1.readData(data);
|
||||||
onDiamondPipeSelect((EntityPlayer) player, packet1);
|
onDiamondPipeSelect((EntityPlayer) player, packet1);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case PacketIds.EMERALD_PIPE_SELECT: {
|
||||||
|
PacketSlotChange packet1 = new PacketSlotChange();
|
||||||
|
packet1.readData(data);
|
||||||
|
onEmeraldPipeSelect((EntityPlayer) player, packet1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case PacketIds.GATE_REQUEST_INIT:
|
case PacketIds.GATE_REQUEST_INIT:
|
||||||
PacketCoordinates packetU = new PacketCoordinates();
|
PacketCoordinates packetU = new PacketCoordinates();
|
||||||
|
@ -290,5 +299,22 @@ public class PacketHandlerTransport implements IPacketHandler {
|
||||||
|
|
||||||
((PipeLogicDiamond) pipe.pipe.logic).setInventorySlotContents(packet.slot, packet.stack);
|
((PipeLogicDiamond) pipe.pipe.logic).setInventorySlotContents(packet.slot, packet.stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles selection changes on emerald pipe guis.
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
* @param packet
|
||||||
|
*/
|
||||||
|
private void onEmeraldPipeSelect(EntityPlayer player, PacketSlotChange packet) {
|
||||||
|
TileGenericPipe pipe = getPipe(player.worldObj, packet.posX, packet.posY, packet.posZ);
|
||||||
|
if (pipe == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!(pipe.pipe instanceof PipeItemsEmerald))
|
||||||
|
return;
|
||||||
|
|
||||||
|
((PipeItemsEmerald) pipe.pipe).setInventorySlotContents(packet.slot, packet.stack);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
292
common/buildcraft/transport/pipes/PipeItemsEmerald.java
Normal file
292
common/buildcraft/transport/pipes/PipeItemsEmerald.java
Normal file
|
@ -0,0 +1,292 @@
|
||||||
|
/**
|
||||||
|
* BuildCraft is open-source. It is distributed under the terms of the
|
||||||
|
* BuildCraft Open Source License. It grants rights to read, modify, compile or
|
||||||
|
* run the code. It does *NOT* grant the right to redistribute this software or
|
||||||
|
* its modifications in any form, binary or source, except if expressively
|
||||||
|
* granted by the copyright holder.
|
||||||
|
*/
|
||||||
|
package buildcraft.transport.pipes;
|
||||||
|
|
||||||
|
import buildcraft.BuildCraftTransport;
|
||||||
|
import buildcraft.api.inventory.ISelectiveInventory;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
import net.minecraftforge.common.ISidedInventory;
|
||||||
|
import buildcraft.api.inventory.ISpecialInventory;
|
||||||
|
import buildcraft.core.GuiIds;
|
||||||
|
import buildcraft.core.network.IClientState;
|
||||||
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
|
import buildcraft.core.utils.SimpleInventory;
|
||||||
|
import buildcraft.core.utils.Utils;
|
||||||
|
import buildcraft.transport.BlockGenericPipe;
|
||||||
|
import buildcraft.transport.PipeTransportItems;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.nbt.NBTBase;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
public class PipeItemsEmerald extends PipeItemsWood implements IInventory, ISpecialInventory, IClientState {
|
||||||
|
|
||||||
|
private SimpleInventory filters = new SimpleInventory(9, "items", 1);
|
||||||
|
private int currentFilter = 0;
|
||||||
|
|
||||||
|
protected PipeItemsEmerald(int itemID, PipeTransportItems transport) {
|
||||||
|
super(transport, new PipeLogicEmerald(), itemID);
|
||||||
|
|
||||||
|
baseTexture = 6 * 16 + 13;
|
||||||
|
plainTexture = baseTexture + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PipeItemsEmerald(int itemID) {
|
||||||
|
this(itemID, new PipeTransportItems());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean blockActivated(World world, int x, int y, int z, EntityPlayer entityplayer) {
|
||||||
|
if (entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID < Block.blocksList.length) {
|
||||||
|
if (Block.blocksList[entityplayer.getCurrentEquippedItem().itemID] instanceof BlockGenericPipe) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (super.blockActivated(worldObj, x, y, z, entityplayer)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CoreProxy.proxy.isRenderWorld(container.worldObj)) {
|
||||||
|
entityplayer.openGui(BuildCraftTransport.instance, GuiIds.PIPE_EMERALD_ITEM, worldObj, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ItemStack[] checkExtract(IInventory inventory, boolean doRemove, ForgeDirection from) {
|
||||||
|
|
||||||
|
// ISELECTIVEINVENTORY
|
||||||
|
if (inventory instanceof ISelectiveInventory) {
|
||||||
|
ItemStack[] stacks = ((ISelectiveInventory) inventory).extractItem(new ItemStack[]{getCurrentFilter()}, false, doRemove, from, (int) getPowerProvider().getEnergyStored());
|
||||||
|
if (doRemove) {
|
||||||
|
for (ItemStack stack : stacks) {
|
||||||
|
if (stack != null) {
|
||||||
|
getPowerProvider().useEnergy(stack.stackSize, stack.stackSize, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
incrementFilter();
|
||||||
|
}
|
||||||
|
return stacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ISPECIALINVENTORY
|
||||||
|
if (inventory instanceof ISpecialInventory) {
|
||||||
|
ItemStack[] stacks = ((ISpecialInventory) inventory).extractItem(false, from, (int) getPowerProvider().getEnergyStored());
|
||||||
|
if (stacks != null) {
|
||||||
|
for (ItemStack stack : stacks) {
|
||||||
|
boolean matches = false;
|
||||||
|
for (int i = 0; i < filters.getSizeInventory(); i++) {
|
||||||
|
ItemStack filter = filters.getStackInSlot(i);
|
||||||
|
if (filter != null && filter.isItemEqual(stack)) {
|
||||||
|
matches = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!matches) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (doRemove) {
|
||||||
|
stacks = ((ISpecialInventory) inventory).extractItem(true, from, (int) getPowerProvider().getEnergyStored());
|
||||||
|
for (ItemStack stack : stacks) {
|
||||||
|
if (stack != null) {
|
||||||
|
getPowerProvider().useEnergy(stack.stackSize, stack.stackSize, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inventory instanceof ISidedInventory) {
|
||||||
|
ISidedInventory sidedInv = (ISidedInventory) inventory;
|
||||||
|
|
||||||
|
int first = sidedInv.getStartInventorySide(from);
|
||||||
|
int last = first + sidedInv.getSizeInventorySide(from) - 1;
|
||||||
|
|
||||||
|
IInventory inv = Utils.getInventory(inventory);
|
||||||
|
|
||||||
|
ItemStack result = checkExtractGeneric(inv, doRemove, from, first, last);
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
return new ItemStack[]{result};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// This is a generic inventory
|
||||||
|
IInventory inv = Utils.getInventory(inventory);
|
||||||
|
|
||||||
|
ItemStack result = checkExtractGeneric(inv, doRemove, from, 0, inv.getSizeInventory() - 1);
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
return new ItemStack[]{result};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void incrementFilter() {
|
||||||
|
currentFilter++;
|
||||||
|
int count = 0;
|
||||||
|
while (filters.getStackInSlot(currentFilter % filters.getSizeInventory()) == null && count < filters.getSizeInventory()) {
|
||||||
|
currentFilter++;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemStack getCurrentFilter() {
|
||||||
|
ItemStack filter = filters.getStackInSlot(currentFilter % filters.getSizeInventory());
|
||||||
|
if (filter == null) {
|
||||||
|
incrementFilter();
|
||||||
|
}
|
||||||
|
return filters.getStackInSlot(currentFilter % filters.getSizeInventory());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack checkExtractGeneric(IInventory inventory, boolean doRemove, ForgeDirection from, int start, int stop) {
|
||||||
|
for (int i = start; i <= stop; ++i) {
|
||||||
|
ItemStack stack = inventory.getStackInSlot(i);
|
||||||
|
if (stack != null && stack.stackSize > 0) {
|
||||||
|
ItemStack filter = getCurrentFilter();
|
||||||
|
if (filter == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (!filter.isItemEqual(stack)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (doRemove) {
|
||||||
|
incrementFilter();
|
||||||
|
return inventory.decrStackSize(i, (int) getPowerProvider().useEnergy(1, stack.stackSize, true));
|
||||||
|
} else {
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SAVING & LOADING */
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||||
|
super.readFromNBT(nbttagcompound);
|
||||||
|
filters.readFromNBT(nbttagcompound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||||
|
super.writeToNBT(nbttagcompound);
|
||||||
|
filters.writeToNBT(nbttagcompound);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ICLIENTSTATE
|
||||||
|
@Override
|
||||||
|
public void writeData(DataOutputStream data) throws IOException {
|
||||||
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
|
writeToNBT(nbt);
|
||||||
|
NBTBase.writeNamedTag(nbt, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readData(DataInputStream data) throws IOException {
|
||||||
|
NBTBase nbt = NBTBase.readNamedTag(data);
|
||||||
|
if (nbt instanceof NBTTagCompound) {
|
||||||
|
readFromNBT((NBTTagCompound) nbt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ISPECIALINVENTORY */
|
||||||
|
@Override
|
||||||
|
public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) {
|
||||||
|
return new ItemStack[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* IINVENTORY IMPLEMENTATION */
|
||||||
|
@Override
|
||||||
|
public int getSizeInventory() {
|
||||||
|
return filters.getSizeInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlot(int i) {
|
||||||
|
return filters.getStackInSlot(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getInvName() {
|
||||||
|
return "Filters";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInventoryStackLimit() {
|
||||||
|
return filters.getInventoryStackLimit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlotOnClosing(int i) {
|
||||||
|
return filters.getStackInSlotOnClosing(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInventoryChanged() {
|
||||||
|
filters.onInventoryChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUseableByPlayer(EntityPlayer var1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openChest() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeChest() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack decrStackSize(int i, int j) {
|
||||||
|
ItemStack stack = filters.decrStackSize(i, j);
|
||||||
|
|
||||||
|
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
||||||
|
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||||
|
}
|
||||||
|
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||||
|
|
||||||
|
filters.setInventorySlotContents(i, itemstack);
|
||||||
|
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
||||||
|
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -32,16 +32,20 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
|
||||||
|
|
||||||
private IPowerProvider powerProvider;
|
private IPowerProvider powerProvider;
|
||||||
|
|
||||||
private int baseTexture = 1 * 16 + 0;
|
protected int baseTexture = 1 * 16 + 0;
|
||||||
private int plainTexture = 1 * 16 + 15;
|
protected int plainTexture = 1 * 16 + 15;
|
||||||
|
|
||||||
protected PipeItemsWood(int itemID, PipeTransportItems transport) {
|
protected PipeItemsWood(PipeTransportItems transport, PipeLogic logic, int itemID) {
|
||||||
super(transport, new PipeLogicWood(), itemID);
|
super(transport, logic, itemID);
|
||||||
|
|
||||||
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
||||||
powerProvider.configure(50, 1, 64, 1, 64);
|
powerProvider.configure(50, 1, 64, 1, 64);
|
||||||
powerProvider.configurePowerPerdition(64, 1);
|
powerProvider.configurePowerPerdition(64, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected PipeItemsWood(int itemID, PipeTransportItems transport) {
|
||||||
|
this(transport, new PipeLogicWood(), itemID);
|
||||||
|
}
|
||||||
|
|
||||||
public PipeItemsWood(int itemID) {
|
public PipeItemsWood(int itemID) {
|
||||||
this(itemID, new PipeTransportItems());
|
this(itemID, new PipeTransportItems());
|
||||||
|
@ -108,9 +112,9 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Position entityPos = new Position(pos.x + 0.5, pos.y + Utils.getPipeFloorOf(stack), pos.z + 0.5, pos.orientation.getOpposite());
|
Position entityPos = new Position(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5, pos.orientation.getOpposite());
|
||||||
|
|
||||||
entityPos.moveForwards(0.5);
|
entityPos.moveForwards(0.6);
|
||||||
|
|
||||||
IPipedItem entity = new EntityPassiveItem(w, entityPos.x, entityPos.y, entityPos.z, stack);
|
IPipedItem entity = new EntityPassiveItem(w, entityPos.x, entityPos.y, entityPos.z, stack);
|
||||||
|
|
||||||
|
@ -205,15 +209,13 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
|
||||||
|
|
||||||
public ItemStack checkExtractGeneric(IInventory inventory, boolean doRemove, ForgeDirection from, int start, int stop) {
|
public ItemStack checkExtractGeneric(IInventory inventory, boolean doRemove, ForgeDirection from, int start, int stop) {
|
||||||
for (int k = start; k <= stop; ++k) {
|
for (int k = start; k <= stop; ++k) {
|
||||||
if (inventory.getStackInSlot(k) != null && inventory.getStackInSlot(k).stackSize > 0) {
|
ItemStack slot = inventory.getStackInSlot(k);
|
||||||
|
|
||||||
ItemStack slot = inventory.getStackInSlot(k);
|
if (slot != null && slot.stackSize > 0) {
|
||||||
|
if (doRemove) {
|
||||||
if (slot != null && slot.stackSize > 0) {
|
return inventory.decrStackSize(k, (int) powerProvider.useEnergy(1, slot.stackSize, true));
|
||||||
if (doRemove)
|
} else {
|
||||||
return inventory.decrStackSize(k, (int) powerProvider.useEnergy(1, slot.stackSize, true));
|
return slot;
|
||||||
else
|
|
||||||
return slot;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
26
common/buildcraft/transport/pipes/PipeLiquidsEmerald.java
Normal file
26
common/buildcraft/transport/pipes/PipeLiquidsEmerald.java
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* This code is the property of CovertJaguar
|
||||||
|
* and may only be used with explicit written
|
||||||
|
* permission unless otherwise specified on the
|
||||||
|
* license page at railcraft.wikispaces.com.
|
||||||
|
*/
|
||||||
|
package buildcraft.transport.pipes;
|
||||||
|
|
||||||
|
import buildcraft.transport.PipeTransportLiquids;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author CovertJaguar <railcraft.wikispaces.com>
|
||||||
|
*/
|
||||||
|
public class PipeLiquidsEmerald extends PipeLiquidsWood {
|
||||||
|
|
||||||
|
public PipeLiquidsEmerald(int itemID) {
|
||||||
|
super(new PipeLogicEmerald(), itemID);
|
||||||
|
|
||||||
|
baseTexture = 6 * 16 + 15;
|
||||||
|
plainTexture = baseTexture - 1;
|
||||||
|
|
||||||
|
((PipeTransportLiquids) transport).flowRate = 40;
|
||||||
|
((PipeTransportLiquids) transport).travelDelay = 4;
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,17 +31,21 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor {
|
||||||
int liquidToExtract;
|
int liquidToExtract;
|
||||||
|
|
||||||
private IPowerProvider powerProvider;
|
private IPowerProvider powerProvider;
|
||||||
private int baseTexture = 7 * 16 + 0;
|
protected int baseTexture = 7 * 16 + 0;
|
||||||
private int plainTexture = 1 * 16 + 15;
|
protected int plainTexture = 1 * 16 + 15;
|
||||||
|
|
||||||
long lastMining = 0;
|
long lastMining = 0;
|
||||||
boolean lastPower = false;
|
boolean lastPower = false;
|
||||||
|
|
||||||
public PipeLiquidsWood(int itemID) {
|
public PipeLiquidsWood(int itemID) {
|
||||||
super(new PipeTransportLiquids(), new PipeLogicWood(), itemID);
|
this(new PipeLogicWood(), itemID);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected PipeLiquidsWood(PipeLogic logic, int itemID) {
|
||||||
|
super(new PipeTransportLiquids(), logic, itemID);
|
||||||
|
|
||||||
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
||||||
powerProvider.configure(50, 1, 1, 1, 1);
|
powerProvider.configure(50, 1, 100, 1, 250);
|
||||||
powerProvider.configurePowerPerdition(1, 1);
|
powerProvider.configurePowerPerdition(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
common/buildcraft/transport/pipes/PipeLogicEmerald.java
Normal file
16
common/buildcraft/transport/pipes/PipeLogicEmerald.java
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/**
|
||||||
|
* 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.transport.pipes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author CovertJaguar <railcraft.wikispaces.com>
|
||||||
|
*/
|
||||||
|
public class PipeLogicEmerald extends PipeLogicWood {
|
||||||
|
}
|
Loading…
Reference in a new issue