begin work on Diamond Liquid Pipes

This commit is contained in:
Adrian Siekierka 2014-11-13 14:39:37 +01:00
parent 43d1e24d50
commit 70396e7e24
17 changed files with 152 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

View file

@ -60,7 +60,7 @@ public class GuiHandler implements IGuiHandler {
switch (id) {
case GuiIds.PIPE_DIAMOND:
return new ContainerDiamondPipe(player.inventory, (PipeItemsDiamond) pipe.pipe);
return new ContainerDiamondPipe(player.inventory, (IDiamondPipe) pipe.pipe);
case GuiIds.PIPE_EMERALD_ITEM:
return new ContainerEmeraldPipe(player.inventory, (PipeItemsEmerald) pipe.pipe);
@ -106,7 +106,7 @@ public class GuiHandler implements IGuiHandler {
switch (id) {
case GuiIds.PIPE_DIAMOND:
return new GuiDiamondPipe(player.inventory, (PipeItemsDiamond) pipe.pipe);
return new GuiDiamondPipe(player.inventory, (IDiamondPipe) pipe.pipe);
case GuiIds.PIPE_EMERALD_ITEM:
return new GuiEmeraldPipe(player.inventory, (PipeItemsEmerald) pipe.pipe);

View file

@ -0,0 +1,9 @@
package buildcraft.transport;
import buildcraft.core.network.IClientState;
import net.minecraft.inventory.IInventory;
public interface IDiamondPipe extends IClientState {
IInventory getFilters();
}

View file

@ -99,6 +99,15 @@ public class PipeIconProvider implements IIconProvider {
PipeFluidsSandstone("pipeFluidsSandstone"),
PipeFluidsStone("pipeFluidsStone"),
PipeFluidsVoid("pipeFluidsVoid"),
//
PipeFluidsDiamond_Item("pipFluidsDiamond_item"),
PipeFluidsDiamond_Center("pipFluidsDiamond_center"),
PipeFluidsDiamond_Down("pipeFluidsDiamond_down"),
PipeFluidsDiamond_Up("pipeFluidsDiamond_up"),
PipeFluidsDiamond_North("pipeFluidsDiamond_north"),
PipeFluidsDiamond_South("pipeFluidsDiamond_south"),
PipeFluidsDiamond_West("pipeFluidsDiamond_west", "pipeFluidsDiamond_west_cb"),
PipeFluidsDiamond_East("pipeFluidsDiamond_east"),
//
PipePowerDiamond("pipePowerDiamond"),
PipePowerGold("pipePowerGold"),

View file

@ -12,6 +12,7 @@ import java.util.BitSet;
import java.util.HashMap;
import java.util.Map;
import buildcraft.transport.pipes.PipeFluidsDiamond;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
@ -599,6 +600,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
static {
fluidCapacities.put(PipeFluidsCobblestone.class, 1 * BuildCraftTransport.pipeFluidsBaseFlowRate);
fluidCapacities.put(PipeFluidsDiamond.class, 8 * BuildCraftTransport.pipeFluidsBaseFlowRate);
fluidCapacities.put(PipeFluidsEmerald.class, 4 * BuildCraftTransport.pipeFluidsBaseFlowRate);
fluidCapacities.put(PipeFluidsGold.class, 8 * BuildCraftTransport.pipeFluidsBaseFlowRate);
fluidCapacities.put(PipeFluidsIron.class, 4 * BuildCraftTransport.pipeFluidsBaseFlowRate);

View file

@ -8,6 +8,8 @@
*/
package buildcraft.transport.gui;
import buildcraft.transport.IDiamondPipe;
import buildcraft.transport.Pipe;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
@ -18,11 +20,11 @@ import buildcraft.transport.pipes.PipeItemsDiamond;
public class ContainerDiamondPipe extends BuildCraftContainer {
private final PipeItemsDiamond pipe;
private final IDiamondPipe pipe;
private final IInventory playerInv;
private final IInventory filterInv;
public ContainerDiamondPipe(IInventory playerInventory, PipeItemsDiamond pipe) {
public ContainerDiamondPipe(IInventory playerInventory, IDiamondPipe pipe) {
super(pipe.getFilters().getSizeInventory());
this.pipe = pipe;
this.playerInv = playerInventory;
@ -47,6 +49,6 @@ public class ContainerDiamondPipe extends BuildCraftContainer {
@Override
public boolean canInteractWith(EntityPlayer entityplayer) {
return pipe.container.isUseableByPlayer(entityplayer);
return ((Pipe) pipe).container.isUseableByPlayer(entityplayer);
}
}

View file

@ -8,6 +8,7 @@
*/
package buildcraft.transport.gui;
import buildcraft.transport.IDiamondPipe;
import org.lwjgl.opengl.GL11;
import net.minecraft.inventory.IInventory;
@ -33,7 +34,7 @@ public class GuiDiamondPipe extends GuiBuildCraft {
}
}
public GuiDiamondPipe(IInventory playerInventory, PipeItemsDiamond pipe) {
public GuiDiamondPipe(IInventory playerInventory, IDiamondPipe pipe) {
super(new ContainerDiamondPipe(playerInventory, pipe), pipe.getFilters(), TEXTURE);
this.playerInventory = playerInventory;
this.filterInventory = pipe.getFilters();

View file

@ -0,0 +1,121 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.transport.pipes;
import buildcraft.BuildCraftTransport;
import buildcraft.api.core.IIconProvider;
import buildcraft.core.GuiIds;
import buildcraft.core.inventory.SimpleInventory;
import buildcraft.core.network.IClientState;
import buildcraft.core.utils.Utils;
import buildcraft.transport.BlockGenericPipe;
import buildcraft.transport.IDiamondPipe;
import buildcraft.transport.Pipe;
import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.PipeTransportFluids;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
public class PipeFluidsDiamond extends Pipe<PipeTransportFluids> implements IDiamondPipe {
private SimpleInventory filters = new SimpleInventory(54, "Filters", 1);
public PipeFluidsDiamond(Item item) {
super(new PipeTransportFluids(), item);
transport.initFromPipe(getClass());
transport.travelDelay = 4;
}
public IInventory getFilters() {
return filters;
}
@Override
@SideOnly(Side.CLIENT)
public IIconProvider getIconProvider() {
return BuildCraftTransport.instance.pipeIconProvider;
}
@Override
public int getIconIndex(ForgeDirection direction) {
switch (direction) {
case UNKNOWN:
return PipeIconProvider.TYPE.PipeFluidsDiamond_Center.ordinal();
case DOWN:
return PipeIconProvider.TYPE.PipeFluidsDiamond_Down.ordinal();
case UP:
return PipeIconProvider.TYPE.PipeFluidsDiamond_Up.ordinal();
case NORTH:
return PipeIconProvider.TYPE.PipeFluidsDiamond_North.ordinal();
case SOUTH:
return PipeIconProvider.TYPE.PipeFluidsDiamond_South.ordinal();
case WEST:
return PipeIconProvider.TYPE.PipeFluidsDiamond_West.ordinal();
case EAST:
return PipeIconProvider.TYPE.PipeFluidsDiamond_East.ordinal();
default:
throw new IllegalArgumentException("direction out of bounds");
}
}
@Override
public int getIconIndexForItem() {
return PipeIconProvider.TYPE.PipeFluidsDiamond_Item.ordinal();
}
@Override
public boolean blockActivated(EntityPlayer entityplayer) {
if (entityplayer.getCurrentEquippedItem() != null) {
if (Block.getBlockFromItem(entityplayer.getCurrentEquippedItem().getItem()) instanceof BlockGenericPipe) {
return false;
}
}
if (!container.getWorldObj().isRemote) {
entityplayer.openGui(BuildCraftTransport.instance, GuiIds.PIPE_DIAMOND, container.getWorldObj(), container.xCoord, container.yCoord, container.zCoord);
}
return true;
}
/* SAVING & LOADING */
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
filters.readFromNBT(nbt);
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
filters.writeToNBT(nbt);
}
// ICLIENTSTATE
@Override
public void writeData(ByteBuf data) {
NBTTagCompound nbt = new NBTTagCompound();
writeToNBT(nbt);
Utils.writeNBT(data, nbt);
}
@Override
public void readData(ByteBuf data) {
NBTTagCompound nbt = Utils.readNBT(data);
readFromNBT(nbt);
}
}

View file

@ -10,6 +10,7 @@ package buildcraft.transport.pipes;
import java.util.LinkedList;
import buildcraft.transport.IDiamondPipe;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
@ -37,7 +38,7 @@ import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.PipeTransportItems;
import buildcraft.transport.pipes.events.PipeEventItem;
public class PipeItemsDiamond extends Pipe<PipeTransportItems> implements IClientState {
public class PipeItemsDiamond extends Pipe<PipeTransportItems> implements IDiamondPipe {
private SimpleInventory filters = new SimpleInventory(54, "Filters", 1);