Merge branch '6.4.x' of github.com:BuildCraft/BuildCraft into 6.5.x
This commit is contained in:
commit
b6ac3bb406
9 changed files with 154 additions and 85 deletions
|
@ -243,8 +243,12 @@ public class MappingRegistry {
|
|||
|
||||
for (Block b : idToBlock) {
|
||||
NBTTagCompound sub = new NBTTagCompound();
|
||||
sub.setString("name",
|
||||
Block.blockRegistry.getNameForObject(b));
|
||||
String name = Block.blockRegistry.getNameForObject(b);
|
||||
if (name == null || name.length() == 0) {
|
||||
BCLog.logger.error("Block " + b.getUnlocalizedName() + " (" + b.getClass().getName() + ") has an empty registry name! This is a bug!");
|
||||
} else {
|
||||
sub.setString("name", name);
|
||||
}
|
||||
blocksMapping.appendTag(sub);
|
||||
}
|
||||
|
||||
|
@ -254,8 +258,12 @@ public class MappingRegistry {
|
|||
|
||||
for (Item i : idToItem) {
|
||||
NBTTagCompound sub = new NBTTagCompound();
|
||||
sub.setString("name",
|
||||
Item.itemRegistry.getNameForObject(i));
|
||||
String name = Item.itemRegistry.getNameForObject(i);
|
||||
if (name == null || name.length() == 0) {
|
||||
BCLog.logger.error("Item " + i.getUnlocalizedName() + " (" + i.getClass().getName() + ") has an empty registry name! This is a bug!");
|
||||
} else {
|
||||
sub.setString("name", name);
|
||||
}
|
||||
itemsMapping.appendTag(sub);
|
||||
}
|
||||
|
||||
|
@ -278,6 +286,12 @@ public class MappingRegistry {
|
|||
|
||||
for (int i = 0; i < blocksMapping.tagCount(); ++i) {
|
||||
NBTTagCompound sub = blocksMapping.getCompoundTagAt(i);
|
||||
if (!sub.hasKey("name")) {
|
||||
// Keeping the order correct
|
||||
idToBlock.add(null);
|
||||
BCLog.logger.log(Level.WARN, "Can't load a block - corrupt blueprint!");
|
||||
continue;
|
||||
}
|
||||
String name = sub.getString("name");
|
||||
Block b = null;
|
||||
|
||||
|
@ -299,6 +313,12 @@ public class MappingRegistry {
|
|||
|
||||
for (int i = 0; i < itemsMapping.tagCount(); ++i) {
|
||||
NBTTagCompound sub = itemsMapping.getCompoundTagAt(i);
|
||||
if (!sub.hasKey("name")) {
|
||||
// Keeping the order correct
|
||||
idToItem.add(null);
|
||||
BCLog.logger.log(Level.WARN, "Can't load an item - corrupt blueprint!");
|
||||
continue;
|
||||
}
|
||||
String name = sub.getString("name");
|
||||
Item item = null;
|
||||
|
||||
|
|
4
buildcraft_resources/changelog/6.4.9
Normal file
4
buildcraft_resources/changelog/6.4.9
Normal file
|
@ -0,0 +1,4 @@
|
|||
Bugfixes:
|
||||
[#2621] FluidStack crash with Forge 1355+ (asie)
|
||||
Crash on invalid mapping - instead reports error to console (asie)
|
||||
Fluid dupe bug with pump robot (hea3ven)
|
|
@ -1,3 +1,3 @@
|
|||
1.6.4:BuildCraft:4.2.2
|
||||
1.7.2:BuildCraft:6.0.16
|
||||
1.7.10:BuildCraft:6.4.8
|
||||
1.7.10:BuildCraft:6.4.9
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package buildcraft.core.tablet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import buildcraft.api.tablet.ITablet;
|
||||
import buildcraft.api.tablet.TabletBitmap;
|
||||
|
@ -16,28 +18,58 @@ public class TabletProgramMenu extends TabletProgram {
|
|||
this.tablet = tablet;
|
||||
}
|
||||
|
||||
public String[] split(String text, TabletFont font, int width) {
|
||||
List<String> lines = new ArrayList<String>();
|
||||
|
||||
int x = 0;
|
||||
String line = "";
|
||||
boolean first = true;
|
||||
|
||||
for (String s : text.split(" ")) {
|
||||
String ts = first ? s : " " + s;
|
||||
int w = font.getStringWidth(ts);
|
||||
if (x + w > width) {
|
||||
x = 0;
|
||||
ts = s;
|
||||
lines.add(line);
|
||||
line = "";
|
||||
}
|
||||
x += w;
|
||||
line += ts;
|
||||
first = false;
|
||||
}
|
||||
if (line.length() > 0) {
|
||||
lines.add(line);
|
||||
}
|
||||
return lines.toArray(new String[lines.size()]);
|
||||
}
|
||||
|
||||
public void tick(float time) {
|
||||
t+=time;
|
||||
if (!init && t > 2 && tablet.getSide() == Side.CLIENT) {
|
||||
TabletBitmap bitmap = new TabletBitmap(244, 306);
|
||||
try {
|
||||
TabletFont text = TabletFontManager.INSTANCE.register("DejaVu11", TabletProgramMenu.class.getClassLoader().getResourceAsStream("assets/buildcraftcore/tablet/11.pf2"));
|
||||
TabletFont font = TabletFontManager.INSTANCE.register("DejaVu11", TabletProgramMenu.class.getClassLoader().getResourceAsStream("assets/buildcraftcore/tablet/11.pf2"));
|
||||
String lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque condimentum, nulla in tincidunt finibus, dolor enim condimentum felis, vitae vulputate lorem turpis nec purus. Nulla iaculis sed turpis in lacinia. Aliquam consectetur leo sit amet placerat blandit. Maecenas euismod magna eros, quis efficitur quam luctus mollis. Nulla facilisi. Quisque tempor turpis ipsum, ut auctor diam hendrerit dictum. Phasellus id viverra purus. Ut sagittis felis eu odio sagittis, vitae mollis felis feugiat. Morbi mi elit, varius id fringilla vel, vehicula ac risus. Curabitur aliquam orci at mollis posuere. Nam vitae neque tincidunt orci rhoncus rutrum.";
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
boolean first = true;
|
||||
|
||||
for (String s : lorem.split(" ")) {
|
||||
String ts = first ? s : " " + s;
|
||||
int width = text.getStringWidth(ts);
|
||||
if (x + width > 244) {
|
||||
x = 0;
|
||||
y += text.getHeight() + 1;
|
||||
ts = s;
|
||||
String[] lines = split(lorem, font, 244);
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
String line = lines[i];
|
||||
String[] words = line.split(" ");
|
||||
float justifyValue = 0;
|
||||
if (i < lines.length - 1) {
|
||||
int widthNoSpaces = 0;
|
||||
for (String s : words) {
|
||||
widthNoSpaces += font.getStringWidth(s);
|
||||
}
|
||||
justifyValue = (244 - widthNoSpaces) / (float) (words.length - 1);
|
||||
}
|
||||
x += text.draw(bitmap, ts, x, y, 7);
|
||||
first = false;
|
||||
float x = 0;
|
||||
for (String s: words) {
|
||||
x += font.draw(bitmap, s, (int) x, y, 7);
|
||||
x += justifyValue;
|
||||
}
|
||||
y += font.getHeight() + 1;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -9,13 +9,11 @@
|
|||
package buildcraft.robotics.ai;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.core.lib.utils.BlockUtils;
|
||||
|
||||
public class AIRobotPumpBlock extends AIRobot {
|
||||
|
||||
|
@ -48,18 +46,13 @@ public class AIRobotPumpBlock extends AIRobot {
|
|||
if (waited < 40) {
|
||||
waited++;
|
||||
} else {
|
||||
Fluid fluid = FluidRegistry.lookupFluidForBlock(robot.worldObj.getBlock(blockToPump.x, blockToPump.y,
|
||||
blockToPump.z));
|
||||
|
||||
if (fluid != null) {
|
||||
pumped = robot.fill(ForgeDirection.UNKNOWN,
|
||||
new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME), true);
|
||||
|
||||
if (pumped > 0) {
|
||||
robot.worldObj.setBlockToAir(blockToPump.x, blockToPump.y, blockToPump.z);
|
||||
FluidStack fluidStack = BlockUtils.drainBlock(robot.worldObj, blockToPump.x, blockToPump.y, blockToPump.z, false);
|
||||
if (fluidStack != null) {
|
||||
if (robot.fill(ForgeDirection.UNKNOWN, fluidStack, true) > 0) {
|
||||
BlockUtils.drainBlock(robot.worldObj, blockToPump.x, blockToPump.y,
|
||||
blockToPump.z, true);
|
||||
}
|
||||
}
|
||||
|
||||
terminate();
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ import buildcraft.transport.pipes.PipeFluidsStone;
|
|||
import buildcraft.transport.pipes.PipeFluidsVoid;
|
||||
import buildcraft.transport.pipes.PipeFluidsWood;
|
||||
import buildcraft.transport.pipes.events.PipeEventFluid;
|
||||
import buildcraft.transport.utils.FluidRenderData;
|
||||
|
||||
public class PipeTransportFluids extends PipeTransport implements IFluidHandler {
|
||||
public static final Map<Class<? extends Pipe<?>>, Integer> fluidCapacities = new HashMap<Class<? extends Pipe<?>>, Integer>();
|
||||
|
@ -160,8 +161,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
public byte initClient = 0;
|
||||
public int travelDelay = 12;
|
||||
public int flowRate;
|
||||
public FluidStack[] renderCache = new FluidStack[orientations.length];
|
||||
public int[] colorRenderCache = new int[orientations.length];
|
||||
public FluidRenderData[] renderCache = new FluidRenderData[orientations.length];
|
||||
public final PipeSection[] internalTanks = new PipeSection[orientations.length];
|
||||
private final TransferState[] transferState = new TransferState[directions.length];
|
||||
private final int[] inputPerTick = new int[directions.length];
|
||||
|
@ -258,12 +258,11 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
}
|
||||
}
|
||||
|
||||
FluidStack[] renderCacheCopy = this.renderCache.clone();
|
||||
int[] colorRenderCacheCopy = this.colorRenderCache.clone();
|
||||
FluidRenderData[] renderCacheCopy = this.renderCache.clone();
|
||||
|
||||
for (ForgeDirection dir : orientations) {
|
||||
FluidStack current = internalTanks[dir.ordinal()].getFluid();
|
||||
FluidStack prev = renderCacheCopy[dir.ordinal()];
|
||||
FluidStack prev = renderCacheCopy[dir.ordinal()] != null ? renderCacheCopy[dir.ordinal()].getFluidStack() : null;
|
||||
|
||||
if (current != null && current.getFluid() == null) {
|
||||
continue;
|
||||
|
@ -276,11 +275,9 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
if (prev == null ^ current == null) {
|
||||
changed = true;
|
||||
if (current != null) {
|
||||
renderCacheCopy[dir.ordinal()] = current.copy();
|
||||
colorRenderCacheCopy[dir.ordinal()] = current.getFluid().getColor(current);
|
||||
renderCacheCopy[dir.ordinal()] = new FluidRenderData(current);
|
||||
} else {
|
||||
renderCacheCopy[dir.ordinal()] = null;
|
||||
colorRenderCacheCopy[dir.ordinal()] = 0xFFFFFF;
|
||||
}
|
||||
delta.set(dir.ordinal() * PacketFluidUpdate.FLUID_DATA_NUM + PacketFluidUpdate.FLUID_ID_BIT);
|
||||
delta.set(dir.ordinal() * PacketFluidUpdate.FLUID_DATA_NUM + PacketFluidUpdate.FLUID_AMOUNT_BIT);
|
||||
|
@ -293,8 +290,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
|
||||
if (!prev.equals(current) || initPacket) {
|
||||
changed = true;
|
||||
renderCacheCopy[dir.ordinal()] = current;
|
||||
colorRenderCacheCopy[dir.ordinal()] = current.getFluid().getColor(current);
|
||||
renderCacheCopy[dir.ordinal()] = new FluidRenderData(current);
|
||||
delta.set(dir.ordinal() * PacketFluidUpdate.FLUID_DATA_NUM + PacketFluidUpdate.FLUID_ID_BIT);
|
||||
}
|
||||
|
||||
|
@ -313,13 +309,11 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
|
||||
if (persistChange) {
|
||||
this.renderCache = renderCacheCopy;
|
||||
this.colorRenderCache = colorRenderCacheCopy;
|
||||
}
|
||||
|
||||
if (changed || initPacket) {
|
||||
PacketFluidUpdate packet = new PacketFluidUpdate(container.xCoord, container.yCoord, container.zCoord, initPacket);
|
||||
packet.renderCache = renderCacheCopy;
|
||||
packet.colorRenderCache = colorRenderCacheCopy;
|
||||
packet.delta = delta;
|
||||
return packet;
|
||||
}
|
||||
|
@ -528,7 +522,6 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
internalTanks[direction.ordinal()].reset();
|
||||
transferState[direction.ordinal()] = TransferState.None;
|
||||
renderCache[direction.ordinal()] = null;
|
||||
colorRenderCache[direction.ordinal()] = 0xFFFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,13 +13,13 @@ import io.netty.buffer.ByteBuf;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import buildcraft.core.lib.network.PacketCoordinates;
|
||||
import buildcraft.core.lib.utils.BitSetUtils;
|
||||
import buildcraft.core.network.PacketIds;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.transport.PipeTransportFluids;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
import buildcraft.transport.utils.FluidRenderData;
|
||||
|
||||
public class PacketFluidUpdate extends PacketCoordinates {
|
||||
|
||||
|
@ -27,8 +27,7 @@ public class PacketFluidUpdate extends PacketCoordinates {
|
|||
public static int FLUID_AMOUNT_BIT = 1;
|
||||
public static int FLUID_DATA_NUM = 2;
|
||||
|
||||
public FluidStack[] renderCache = new FluidStack[ForgeDirection.values().length];
|
||||
public int[] colorRenderCache = new int[ForgeDirection.values().length];
|
||||
public FluidRenderData[] renderCache = new FluidRenderData[ForgeDirection.values().length];
|
||||
public BitSet delta;
|
||||
|
||||
public PacketFluidUpdate(int xCoord, int yCoord, int zCoord) {
|
||||
|
@ -69,7 +68,6 @@ public class PacketFluidUpdate extends PacketCoordinates {
|
|||
PipeTransportFluids transLiq = (PipeTransportFluids) pipe.pipe.transport;
|
||||
|
||||
renderCache = transLiq.renderCache;
|
||||
colorRenderCache = transLiq.colorRenderCache;
|
||||
|
||||
byte[] dBytes = new byte[2];
|
||||
data.readBytes(dBytes);
|
||||
|
@ -79,15 +77,21 @@ public class PacketFluidUpdate extends PacketCoordinates {
|
|||
|
||||
for (ForgeDirection dir : ForgeDirection.values()) {
|
||||
if (delta.get(dir.ordinal() * FLUID_DATA_NUM + FLUID_ID_BIT)) {
|
||||
int id = data.readShort();
|
||||
int amt = renderCache[dir.ordinal()] != null ? renderCache[dir.ordinal()].amount : 0;
|
||||
renderCache[dir.ordinal()] = new FluidStack(data.readShort(), amt);
|
||||
colorRenderCache[dir.ordinal()] = data.readInt();
|
||||
int color = id != 0 ? data.readInt() : 0xFFFFFF;
|
||||
|
||||
renderCache[dir.ordinal()] = new FluidRenderData(id, amt, color);
|
||||
}
|
||||
|
||||
if (delta.get(dir.ordinal() * FLUID_DATA_NUM + FLUID_AMOUNT_BIT)) {
|
||||
if (renderCache[dir.ordinal()] == null) {
|
||||
renderCache[dir.ordinal()] = new FluidStack(0, 0);
|
||||
}
|
||||
renderCache[dir.ordinal()].amount = Math.min(transLiq.getCapacity(), data.readUnsignedShort());
|
||||
int amt = Math.min(transLiq.getCapacity(), data.readUnsignedShort());
|
||||
|
||||
if (renderCache[dir.ordinal()] != null) {
|
||||
renderCache[dir.ordinal()].amount = amt;
|
||||
} else {
|
||||
renderCache[dir.ordinal()] = new FluidRenderData(0, amt, 0xFFFFFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -101,15 +105,14 @@ public class PacketFluidUpdate extends PacketCoordinates {
|
|||
data.writeBytes(dBytes);
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.values()) {
|
||||
FluidStack liquid = renderCache[dir.ordinal()];
|
||||
FluidRenderData liquid = renderCache[dir.ordinal()];
|
||||
|
||||
if (delta.get(dir.ordinal() * FLUID_DATA_NUM + FLUID_ID_BIT)) {
|
||||
if (liquid != null) {
|
||||
if (liquid != null && liquid.fluidID != 0) {
|
||||
data.writeShort(liquid.fluidID);
|
||||
data.writeInt(colorRenderCache[dir.ordinal()]);
|
||||
data.writeInt(liquid.color);
|
||||
} else {
|
||||
data.writeShort(0);
|
||||
data.writeInt(0xFFFFFF);
|
||||
}
|
||||
}
|
||||
if (delta.get(dir.ordinal() * FLUID_DATA_NUM + FLUID_AMOUNT_BIT)) {
|
||||
|
|
|
@ -27,7 +27,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.BuildCraftCore.RenderMode;
|
||||
import buildcraft.BuildCraftTransport;
|
||||
|
@ -50,6 +50,7 @@ import buildcraft.transport.PipeTransportPower;
|
|||
import buildcraft.transport.TileGenericPipe;
|
||||
import buildcraft.transport.TravelingItem;
|
||||
import buildcraft.transport.gates.GatePluggable;
|
||||
import buildcraft.transport.utils.FluidRenderData;
|
||||
|
||||
public class PipeRendererTESR extends TileEntitySpecialRenderer {
|
||||
public static final float DISPLAY_MULTIPLIER = 0.1f;
|
||||
|
@ -100,17 +101,23 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
|
|||
return displayFluidLists.get(liquidId);
|
||||
}
|
||||
|
||||
Fluid fluid = FluidRegistry.getFluid(liquidId);
|
||||
|
||||
if (fluid == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
DisplayFluidList d = new DisplayFluidList();
|
||||
displayFluidLists.put(liquidId, d);
|
||||
|
||||
RenderInfo block = new RenderInfo();
|
||||
|
||||
Fluid fluid = FluidRegistry.getFluid(liquidId);
|
||||
if (fluid.getBlock() != null) {
|
||||
block.baseBlock = fluid.getBlock();
|
||||
} else {
|
||||
block.baseBlock = Blocks.water;
|
||||
}
|
||||
|
||||
block.texture = fluid.getStillIcon();
|
||||
|
||||
float size = CoreConstants.PIPE_MAX_POS - CoreConstants.PIPE_MIN_POS;
|
||||
|
@ -661,8 +668,8 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
|
|||
|
||||
boolean needsRender = false;
|
||||
for (int i = 0; i < 7; ++i) {
|
||||
FluidStack fluidStack = trans.renderCache[i];
|
||||
if (fluidStack != null && fluidStack.amount > 0) {
|
||||
FluidRenderData renderData = trans.renderCache[i];
|
||||
if (renderData != null && renderData.amount > 0) {
|
||||
needsRender = true;
|
||||
break;
|
||||
}
|
||||
|
@ -688,9 +695,9 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
|
|||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
int i = side.ordinal();
|
||||
|
||||
FluidStack fluidStack = trans.renderCache[i];
|
||||
FluidRenderData fluidRenderData = trans.renderCache[i];
|
||||
|
||||
if (fluidStack == null || fluidStack.amount <= 0) {
|
||||
if (fluidRenderData == null || fluidRenderData.amount <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -698,13 +705,13 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
|
|||
continue;
|
||||
}
|
||||
|
||||
DisplayFluidList d = getListFromBuffer(fluidStack, pipe.container.getWorldObj());
|
||||
DisplayFluidList d = getDisplayFluidLists(fluidRenderData.fluidID, pipe.container.getWorldObj());
|
||||
|
||||
if (d == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int stage = (int) ((float) fluidStack.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1));
|
||||
int stage = (int) ((float) fluidRenderData.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1));
|
||||
|
||||
GL11.glPushMatrix();
|
||||
int list = 0;
|
||||
|
@ -733,21 +740,21 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
|
|||
default:
|
||||
}
|
||||
bindTexture(TextureMap.locationBlocksTexture);
|
||||
RenderUtils.setGLColorFromInt(trans.colorRenderCache[i]);
|
||||
RenderUtils.setGLColorFromInt(fluidRenderData.color);
|
||||
GL11.glCallList(list);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
// CENTER
|
||||
FluidStack fluidStack = trans.renderCache[ForgeDirection.UNKNOWN.ordinal()];
|
||||
FluidRenderData fluidRenderData = trans.renderCache[ForgeDirection.UNKNOWN.ordinal()];
|
||||
|
||||
if (fluidStack != null && fluidStack.amount > 0) {
|
||||
DisplayFluidList d = getListFromBuffer(fluidStack, pipe.container.getWorldObj());
|
||||
if (fluidRenderData != null && fluidRenderData.amount > 0) {
|
||||
DisplayFluidList d = getDisplayFluidLists(fluidRenderData.fluidID, pipe.container.getWorldObj());
|
||||
|
||||
if (d != null) {
|
||||
int stage = (int) ((float) fluidStack.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1));
|
||||
int stage = (int) ((float) fluidRenderData.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1));
|
||||
|
||||
bindTexture(TextureMap.locationBlocksTexture);
|
||||
RenderUtils.setGLColorFromInt(trans.colorRenderCache[ForgeDirection.UNKNOWN.ordinal()]);
|
||||
RenderUtils.setGLColorFromInt(fluidRenderData.color);
|
||||
|
||||
if (above) {
|
||||
GL11.glCallList(d.centerVertical[stage]);
|
||||
|
@ -764,17 +771,6 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
|
|||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private DisplayFluidList getListFromBuffer(FluidStack stack, World world) {
|
||||
|
||||
int liquidId = stack.fluidID;
|
||||
|
||||
if (liquidId == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return getDisplayFluidLists(liquidId, world);
|
||||
}
|
||||
|
||||
private void renderSolids(Pipe<PipeTransportItems> pipe, double x, double y, double z, float f) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
|
|
28
common/buildcraft/transport/utils/FluidRenderData.java
Normal file
28
common/buildcraft/transport/utils/FluidRenderData.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package buildcraft.transport.utils;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class FluidRenderData {
|
||||
public int fluidID, amount, color;
|
||||
|
||||
public FluidRenderData(int fluidID, int amount, int color) {
|
||||
this.fluidID = fluidID;
|
||||
this.amount = amount;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public FluidRenderData(FluidStack stack) {
|
||||
this(stack.getFluid().getID(), stack.amount, stack.getFluid().getColor(stack));
|
||||
}
|
||||
|
||||
public FluidStack getFluidStack() {
|
||||
Fluid fluid = FluidRegistry.getFluid(fluidID);
|
||||
if (fluid != null) {
|
||||
return new FluidStack(fluid, amount);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue