refactor pipe renderer registration, make fluid pipe capacity scale with the flow multiplier, add clay fluid pipe
This commit is contained in:
parent
72ce20c4ff
commit
0c9ae47bbe
6 changed files with 83 additions and 44 deletions
Binary file not shown.
After Width: | Height: | Size: 421 B |
|
@ -102,6 +102,7 @@ import buildcraft.transport.network.PacketPipeTransportItemStack;
|
|||
import buildcraft.transport.network.PacketPipeTransportItemStackRequest;
|
||||
import buildcraft.transport.network.PacketPipeTransportTraveler;
|
||||
import buildcraft.transport.network.PacketPowerUpdate;
|
||||
import buildcraft.transport.pipes.PipeFluidsClay;
|
||||
import buildcraft.transport.pipes.PipeFluidsCobblestone;
|
||||
import buildcraft.transport.pipes.PipeFluidsDiamond;
|
||||
import buildcraft.transport.pipes.PipeFluidsEmerald;
|
||||
|
@ -230,6 +231,7 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
public static Item pipeFluidsSandstone;
|
||||
public static Item pipeFluidsEmerald;
|
||||
public static Item pipeFluidsDiamond;
|
||||
public static Item pipeFluidsClay;
|
||||
public static Item pipePowerWood;
|
||||
public static Item pipePowerCobblestone;
|
||||
public static Item pipePowerStone;
|
||||
|
@ -355,6 +357,7 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
pipeFluidsDiamond = buildPipe(PipeFluidsDiamond.class, "Diamond Waterproof Pipe", BCCreativeTab.get("pipes"), pipeWaterproof, pipeItemsDiamond);
|
||||
pipeFluidsSandstone = buildPipe(PipeFluidsSandstone.class, "Sandstone Waterproof Pipe", BCCreativeTab.get("pipes"), pipeWaterproof, pipeItemsSandstone);
|
||||
pipeFluidsVoid = buildPipe(PipeFluidsVoid.class, "Void Waterproof Pipe", BCCreativeTab.get("pipes"), pipeWaterproof, pipeItemsVoid);
|
||||
pipeFluidsClay = buildPipe(PipeFluidsClay.class, "Clay Waterproof Pipe", BCCreativeTab.get("pipes"), pipeWaterproof, pipeItemsClay);
|
||||
|
||||
pipePowerWood = buildPipe(PipePowerWood.class, "Wooden Kinesis Pipe", BCCreativeTab.get("pipes"), "dustRedstone", pipeItemsWood);
|
||||
pipePowerCobblestone = buildPipe(PipePowerCobblestone.class, "Cobblestone Kinesis Pipe", BCCreativeTab.get("pipes"), "dustRedstone", pipeItemsCobblestone);
|
||||
|
|
|
@ -98,6 +98,7 @@ public class PipeIconProvider implements IIconProvider {
|
|||
PipeFluidsSandstone("pipeFluidsSandstone"),
|
||||
PipeFluidsStone("pipeFluidsStone"),
|
||||
PipeFluidsVoid("pipeFluidsVoid"),
|
||||
PipeFluidsClay("pipeFluidsClay"),
|
||||
//
|
||||
PipeFluidsDiamond_Item("pipeFluidsDiamond_item"),
|
||||
PipeFluidsDiamond_Center("pipeFluidsDiamond_center"),
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidEvent;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
@ -24,6 +23,7 @@ import buildcraft.api.transport.IPipeTile;
|
|||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.lib.utils.MathUtils;
|
||||
import buildcraft.transport.network.PacketFluidUpdate;
|
||||
import buildcraft.transport.pipes.PipeFluidsClay;
|
||||
import buildcraft.transport.pipes.PipeFluidsCobblestone;
|
||||
import buildcraft.transport.pipes.PipeFluidsDiamond;
|
||||
import buildcraft.transport.pipes.PipeFluidsEmerald;
|
||||
|
@ -44,7 +44,6 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
* The amount of liquid contained by a pipe section. For simplicity, all
|
||||
* pipe sections are assumed to be of the same volume.
|
||||
*/
|
||||
public static int LIQUID_IN_PIPE = FluidContainerRegistry.BUCKET_VOLUME / 4;
|
||||
public static int MAX_TRAVEL_DELAY = 12;
|
||||
public static short INPUT_TTL = 60; // 100
|
||||
public static short OUTPUT_TTL = 80; // 80
|
||||
|
@ -179,7 +178,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
}
|
||||
|
||||
public void initFromPipe(Class<? extends Pipe> pipeClass) {
|
||||
capacity = LIQUID_IN_PIPE;
|
||||
capacity = 25 * Math.min(1000, BuildCraftTransport.pipeFluidsBaseFlowRate);
|
||||
flowRate = fluidCapacities.get(pipeClass);
|
||||
travelDelay = MathUtils.clamp(Math.round(16F / (flowRate / BuildCraftTransport.pipeFluidsBaseFlowRate)), 1, MAX_TRAVEL_DELAY);
|
||||
}
|
||||
|
@ -405,7 +404,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
outputTTL[dirI] = OUTPUT_TTL;
|
||||
continue;
|
||||
}
|
||||
if (canReceiveCache[dirI] && outputOpen(direction)) {
|
||||
if (canReceiveCache[dirI] && container.pipe.outputOpen(direction)) {
|
||||
transferState[dirI] = TransferState.Output;
|
||||
outputCount++;
|
||||
}
|
||||
|
@ -647,6 +646,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
}
|
||||
|
||||
static {
|
||||
fluidCapacities.put(PipeFluidsClay.class, 4 * BuildCraftTransport.pipeFluidsBaseFlowRate);
|
||||
fluidCapacities.put(PipeFluidsCobblestone.class, 1 * BuildCraftTransport.pipeFluidsBaseFlowRate);
|
||||
fluidCapacities.put(PipeFluidsDiamond.class, 8 * BuildCraftTransport.pipeFluidsBaseFlowRate);
|
||||
fluidCapacities.put(PipeFluidsEmerald.class, 4 * BuildCraftTransport.pipeFluidsBaseFlowRate);
|
||||
|
|
|
@ -10,6 +10,7 @@ package buildcraft.transport;
|
|||
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
@ -27,7 +28,6 @@ import buildcraft.transport.render.PlugItemRenderer;
|
|||
import buildcraft.transport.render.TileEntityPickupFX;
|
||||
|
||||
public class TransportProxyClient extends TransportProxy {
|
||||
|
||||
public static final PipeItemRenderer pipeItemRenderer = new PipeItemRenderer();
|
||||
public static final PipeRendererWorld pipeWorldRenderer = new PipeRendererWorld();
|
||||
public static final FacadeItemRenderer facadeItemRenderer = new FacadeItemRenderer();
|
||||
|
@ -52,45 +52,9 @@ public class TransportProxyClient extends TransportProxy {
|
|||
|
||||
@Override
|
||||
public void registerRenderers() {
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsWood, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsCobblestone, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsStone, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsQuartz, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsIron, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsGold, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsDiamond, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsObsidian, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsEmerald, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsLapis, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsDaizuli, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsEmzuli, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsStripes, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsClay, pipeItemRenderer);
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsWood, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsCobblestone, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsStone, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsQuartz, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsIron, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsGold, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsDiamond, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsEmerald, pipeItemRenderer);
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerWood, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerCobblestone, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerStone, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerQuartz, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerIron, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerGold, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerDiamond, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerEmerald, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeStructureCobblestone, pipeItemRenderer);
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsVoid, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsVoid, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsSandstone, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsSandstone, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerSandstone, pipeItemRenderer);
|
||||
for (Item itemPipe : BlockGenericPipe.pipes.keySet()) {
|
||||
MinecraftForgeClient.registerItemRenderer(itemPipe, pipeItemRenderer);
|
||||
}
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.facadeItem, facadeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.plugItem, plugItemRenderer);
|
||||
|
|
71
common/buildcraft/transport/pipes/PipeFluidsClay.java
Normal file
71
common/buildcraft/transport/pipes/PipeFluidsClay.java
Normal file
|
@ -0,0 +1,71 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2015, 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 java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.core.IIconProvider;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
import buildcraft.transport.PipeTransportFluids;
|
||||
import buildcraft.transport.pipes.events.PipeEventFluid;
|
||||
|
||||
public class PipeFluidsClay extends Pipe<PipeTransportFluids> {
|
||||
|
||||
public PipeFluidsClay(Item item) {
|
||||
super(new PipeTransportFluids(), item);
|
||||
|
||||
transport.initFromPipe(getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIconProvider getIconProvider() {
|
||||
return BuildCraftTransport.instance.pipeIconProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconIndex(ForgeDirection direction) {
|
||||
return PipeIconProvider.TYPE.PipeFluidsClay.ordinal();
|
||||
}
|
||||
|
||||
public void eventHandler(PipeEventFluid.FindDest event) {
|
||||
Set<ForgeDirection> machineDirs = new HashSet<ForgeDirection>();
|
||||
Set<ForgeDirection> pipeDirs = new HashSet<ForgeDirection>();
|
||||
|
||||
for (ForgeDirection dir : event.destinations) {
|
||||
if (container.isPipeConnected(dir)) {
|
||||
TileEntity e = container.getTile(dir);
|
||||
if (e instanceof IFluidHandler) {
|
||||
IFluidHandler h = (IFluidHandler) e;
|
||||
if (h.fill(dir.getOpposite(), event.fluidStack, false) > 0) {
|
||||
if (e instanceof IPipeTile) {
|
||||
pipeDirs.add(dir);
|
||||
} else {
|
||||
machineDirs.add(dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event.destinations.clear();
|
||||
event.destinations.addAll(machineDirs.size() > 0 ? machineDirs : pipeDirs);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue