Added secure wooden pipe.
This commit is contained in:
parent
e3ce7e9063
commit
a6c357cb23
9 changed files with 33 additions and 13 deletions
|
@ -54,6 +54,8 @@ public class mod_BuildCraftTransport extends NetworkMod implements IItemRenderer
|
||||||
|
|
||||||
MinecraftForgeClient.registerItemRenderer(
|
MinecraftForgeClient.registerItemRenderer(
|
||||||
BuildCraftTransport.pipeItemsSteel.shiftedIndex, this);
|
BuildCraftTransport.pipeItemsSteel.shiftedIndex, this);
|
||||||
|
MinecraftForgeClient.registerItemRenderer(
|
||||||
|
BuildCraftTransport.pipeItemsRedstone.shiftedIndex, this);
|
||||||
|
|
||||||
MinecraftForgeClient.registerItemRenderer(
|
MinecraftForgeClient.registerItemRenderer(
|
||||||
BuildCraftTransport.pipeLiquidsWood.shiftedIndex, this);
|
BuildCraftTransport.pipeLiquidsWood.shiftedIndex, this);
|
||||||
|
|
|
@ -44,6 +44,7 @@ import net.minecraft.src.buildcraft.transport.pipes.PipeItemsDiamond;
|
||||||
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsGold;
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsGold;
|
||||||
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsIron;
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsIron;
|
||||||
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsObsidian;
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsObsidian;
|
||||||
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsRedstone;
|
||||||
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsSteel;
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsSteel;
|
||||||
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsStone;
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsStone;
|
||||||
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsStripes;
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsStripes;
|
||||||
|
@ -89,6 +90,7 @@ public class BuildCraftTransport {
|
||||||
public static Item pipeItemsObsidian;
|
public static Item pipeItemsObsidian;
|
||||||
|
|
||||||
public static Item pipeItemsSteel;
|
public static Item pipeItemsSteel;
|
||||||
|
public static Item pipeItemsRedstone;
|
||||||
|
|
||||||
public static Item pipeLiquidsWood;
|
public static Item pipeLiquidsWood;
|
||||||
public static Item pipeLiquidsCobblestone;
|
public static Item pipeLiquidsCobblestone;
|
||||||
|
@ -214,6 +216,7 @@ public class BuildCraftTransport {
|
||||||
pipeItemsObsidian = createPipe(DefaultProps.PIPE_ITEMS_OBSIDIAN_ID, PipeItemsObsidian.class, "Obsidian Transport Pipe", Block.obsidian, Block.glass, Block.obsidian);
|
pipeItemsObsidian = createPipe(DefaultProps.PIPE_ITEMS_OBSIDIAN_ID, PipeItemsObsidian.class, "Obsidian Transport Pipe", Block.obsidian, Block.glass, Block.obsidian);
|
||||||
|
|
||||||
pipeItemsSteel = createPipe(DefaultProps.PIPE_ITEMS_STEEL_ID, PipeItemsSteel.class, "Steel Transport Pipe", Item.clay, Block.glass, Item.clay);
|
pipeItemsSteel = createPipe(DefaultProps.PIPE_ITEMS_STEEL_ID, PipeItemsSteel.class, "Steel Transport Pipe", Item.clay, Block.glass, Item.clay);
|
||||||
|
pipeItemsRedstone = createPipe(DefaultProps.PIPE_ITEMS_REDSTONE_ID, PipeItemsRedstone.class, "Redstone Transport Pipe", Item.redstone, Block.glass, Item.redstone);
|
||||||
|
|
||||||
pipeLiquidsWood = createPipe(DefaultProps.PIPE_LIQUIDS_WOOD_ID, PipeLiquidsWood.class, "Wooden Waterproof Pipe", pipeWaterproof, pipeItemsWood, null);
|
pipeLiquidsWood = createPipe(DefaultProps.PIPE_LIQUIDS_WOOD_ID, PipeLiquidsWood.class, "Wooden Waterproof Pipe", pipeWaterproof, pipeItemsWood, 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", pipeWaterproof, pipeItemsCobblestone, null);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package net.minecraft.src.buildcraft.core.utils;
|
package net.minecraft.src.buildcraft.api.pipes;
|
||||||
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.src.EntityPlayer;
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package net.minecraft.src.buildcraft.core.utils;
|
package net.minecraft.src.buildcraft.api.pipes;
|
||||||
|
|
||||||
|
import net.minecraft.src.EntityPlayer;
|
||||||
import net.minecraft.src.ItemStack;
|
import net.minecraft.src.ItemStack;
|
||||||
import net.minecraft.src.buildcraft.api.ISpecialInventory;
|
import net.minecraft.src.buildcraft.api.ISpecialInventory;
|
||||||
import net.minecraft.src.buildcraft.api.Orientations;
|
import net.minecraft.src.buildcraft.api.Orientations;
|
||||||
|
|
||||||
public interface ISecuredInventory extends ISpecialInventory {
|
public interface ISecuredInventory extends ISpecialInventory {
|
||||||
|
|
||||||
public String getOwnerName();
|
boolean allowsInteraction(String username);
|
||||||
public boolean addItem (ItemStack stack, boolean doAdd, Orientations from, String owner);
|
public boolean addItem (ItemStack stack, boolean doAdd, Orientations from, String owner);
|
||||||
public ItemStack extractItem(boolean doRemove, Orientations from, String owner);
|
public ItemStack extractItem(boolean doRemove, Orientations from, String owner);
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class DefaultProps {
|
||||||
public static int PIPE_ITEMS_DIAMOND_ID = 4055;
|
public static int PIPE_ITEMS_DIAMOND_ID = 4055;
|
||||||
public static int PIPE_ITEMS_OBSIDIAN_ID = 4056;
|
public static int PIPE_ITEMS_OBSIDIAN_ID = 4056;
|
||||||
public static int PIPE_ITEMS_STEEL_ID = 4073;
|
public static int PIPE_ITEMS_STEEL_ID = 4073;
|
||||||
|
public static int PIPE_ITEMS_REDSTONE_ID = 4074;
|
||||||
|
|
||||||
public static int PIPE_LIQUIDS_WOOD_ID = 4057;
|
public static int PIPE_LIQUIDS_WOOD_ID = 4057;
|
||||||
public static int PIPE_LIQUIDS_COBBLESTONE_ID = 4058;
|
public static int PIPE_LIQUIDS_COBBLESTONE_ID = 4058;
|
||||||
|
@ -67,6 +68,7 @@ public class DefaultProps {
|
||||||
public static int PIPE_STRUCTURE_COBBLESTONE_ID = 4072;
|
public static int PIPE_STRUCTURE_COBBLESTONE_ID = 4072;
|
||||||
|
|
||||||
/// 4073 = PIPE_ITEMS_STEEL_ID
|
/// 4073 = PIPE_ITEMS_STEEL_ID
|
||||||
|
/// 4074 = PIPE_ITEMS_REDSTONE_ID
|
||||||
|
|
||||||
public static int WOODEN_PIPE_ID = 145; // LEGACY
|
public static int WOODEN_PIPE_ID = 145; // LEGACY
|
||||||
public static int STONE_PIPE_ID = 146; // LEGACY
|
public static int STONE_PIPE_ID = 146; // LEGACY
|
||||||
|
|
|
@ -3,9 +3,9 @@ package net.minecraft.src.buildcraft.transport;
|
||||||
import net.minecraft.src.IInventory;
|
import net.minecraft.src.IInventory;
|
||||||
import net.minecraft.src.TileEntity;
|
import net.minecraft.src.TileEntity;
|
||||||
import net.minecraft.src.buildcraft.api.IPipeEntry;
|
import net.minecraft.src.buildcraft.api.IPipeEntry;
|
||||||
|
import net.minecraft.src.buildcraft.api.pipes.IOwnable;
|
||||||
|
import net.minecraft.src.buildcraft.api.pipes.ISecuredInventory;
|
||||||
import net.minecraft.src.buildcraft.core.IMachine;
|
import net.minecraft.src.buildcraft.core.IMachine;
|
||||||
import net.minecraft.src.buildcraft.core.utils.IOwnable;
|
|
||||||
import net.minecraft.src.buildcraft.core.utils.ISecuredInventory;
|
|
||||||
|
|
||||||
public class PipeTransportSecure extends PipeTransportSolids {
|
public class PipeTransportSecure extends PipeTransportSolids {
|
||||||
|
|
||||||
|
@ -20,7 +20,8 @@ public class PipeTransportSecure extends PipeTransportSolids {
|
||||||
|
|
||||||
if(tile instanceof ISecuredInventory) {
|
if(tile instanceof ISecuredInventory) {
|
||||||
ISecuredInventory inventory = (ISecuredInventory)tile;
|
ISecuredInventory inventory = (ISecuredInventory)tile;
|
||||||
return inventory.getOwnerName().equals(container.getOwnerName());
|
if(inventory.allowsInteraction(container.getOwnerName()))
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -32,9 +33,6 @@ public class PipeTransportSecure extends PipeTransportSolids {
|
||||||
if(with instanceof PipeTransportSecure)
|
if(with instanceof PipeTransportSecure)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if(with.container.pipe.logic instanceof PipeLogicWood)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ import net.minecraft.src.buildcraft.api.PowerProvider;
|
||||||
import net.minecraft.src.buildcraft.api.SafeTimeTracker;
|
import net.minecraft.src.buildcraft.api.SafeTimeTracker;
|
||||||
import net.minecraft.src.buildcraft.api.TileNetworkData;
|
import net.minecraft.src.buildcraft.api.TileNetworkData;
|
||||||
import net.minecraft.src.buildcraft.api.Trigger;
|
import net.minecraft.src.buildcraft.api.Trigger;
|
||||||
|
import net.minecraft.src.buildcraft.api.pipes.IOwnable;
|
||||||
import net.minecraft.src.buildcraft.core.BlockIndex;
|
import net.minecraft.src.buildcraft.core.BlockIndex;
|
||||||
import net.minecraft.src.buildcraft.core.CoreProxy;
|
import net.minecraft.src.buildcraft.core.CoreProxy;
|
||||||
import net.minecraft.src.buildcraft.core.IDropControlInventory;
|
import net.minecraft.src.buildcraft.core.IDropControlInventory;
|
||||||
|
@ -47,7 +48,6 @@ import net.minecraft.src.buildcraft.core.network.PacketPayload;
|
||||||
import net.minecraft.src.buildcraft.core.network.PacketPipeDescription;
|
import net.minecraft.src.buildcraft.core.network.PacketPipeDescription;
|
||||||
import net.minecraft.src.buildcraft.core.network.PacketTileUpdate;
|
import net.minecraft.src.buildcraft.core.network.PacketTileUpdate;
|
||||||
import net.minecraft.src.buildcraft.core.network.PacketUpdate;
|
import net.minecraft.src.buildcraft.core.network.PacketUpdate;
|
||||||
import net.minecraft.src.buildcraft.core.utils.IOwnable;
|
|
||||||
|
|
||||||
public class TileGenericPipe extends TileEntity implements IPowerReceptor,
|
public class TileGenericPipe extends TileEntity implements IPowerReceptor,
|
||||||
ILiquidContainer, ISpecialInventory, IPipeEntry, ISynchronizedTile,
|
ILiquidContainer, ISpecialInventory, IPipeEntry, ISynchronizedTile,
|
||||||
|
@ -71,7 +71,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor,
|
||||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||||
super.writeToNBT(nbttagcompound);
|
super.writeToNBT(nbttagcompound);
|
||||||
|
|
||||||
nbttagcompound.setString("owner", owner);
|
if(owner != null && !owner.isEmpty())
|
||||||
|
nbttagcompound.setString("owner", owner);
|
||||||
if (pipe != null) {
|
if (pipe != null) {
|
||||||
nbttagcompound.setInteger("pipeId", pipe.itemID);
|
nbttagcompound.setInteger("pipeId", pipe.itemID);
|
||||||
pipe.writeToNBT(nbttagcompound);
|
pipe.writeToNBT(nbttagcompound);
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package net.minecraft.src.buildcraft.transport.pipes;
|
||||||
|
|
||||||
|
import net.minecraft.src.buildcraft.transport.PipeTransportSecure;
|
||||||
|
import net.minecraft.src.buildcraft.transport.PipeTransportSolids;
|
||||||
|
|
||||||
|
public class PipeItemsRedstone extends PipeItemsWood {
|
||||||
|
|
||||||
|
public PipeItemsRedstone(int itemID) {
|
||||||
|
super(itemID, new PipeTransportSecure());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -25,6 +25,7 @@ import net.minecraft.src.buildcraft.core.Utils;
|
||||||
import net.minecraft.src.buildcraft.transport.Pipe;
|
import net.minecraft.src.buildcraft.transport.Pipe;
|
||||||
import net.minecraft.src.buildcraft.transport.PipeLogicWood;
|
import net.minecraft.src.buildcraft.transport.PipeLogicWood;
|
||||||
import net.minecraft.src.buildcraft.transport.PipeTransportItems;
|
import net.minecraft.src.buildcraft.transport.PipeTransportItems;
|
||||||
|
import net.minecraft.src.buildcraft.transport.PipeTransportSolids;
|
||||||
import net.minecraft.src.forge.ISidedInventory;
|
import net.minecraft.src.forge.ISidedInventory;
|
||||||
|
|
||||||
public class PipeItemsWood extends Pipe implements IPowerReceptor {
|
public class PipeItemsWood extends Pipe implements IPowerReceptor {
|
||||||
|
@ -35,7 +36,7 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
|
||||||
private int plainTexture = 1 * 16 + 15;
|
private int plainTexture = 1 * 16 + 15;
|
||||||
private int nextTexture = baseTexture;
|
private int nextTexture = baseTexture;
|
||||||
|
|
||||||
protected PipeItemsWood(int itemID, PipeTransportItems transport) {
|
protected PipeItemsWood(int itemID, PipeTransportSolids transport) {
|
||||||
super(transport, new PipeLogicWood(), itemID);
|
super(transport, new PipeLogicWood(), itemID);
|
||||||
|
|
||||||
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
||||||
|
@ -122,7 +123,7 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
|
||||||
EntityPassiveItem entity = new EntityPassiveItem(w, entityPos.x,
|
EntityPassiveItem entity = new EntityPassiveItem(w, entityPos.x,
|
||||||
entityPos.y, entityPos.z, stack);
|
entityPos.y, entityPos.z, stack);
|
||||||
|
|
||||||
((PipeTransportItems) transport).entityEntering(entity,
|
((PipeTransportSolids) transport).entityEntering(entity,
|
||||||
entityPos.orientation);
|
entityPos.orientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue