More stuff for Soaryn

This commit is contained in:
CovertJaguar 2013-08-04 17:16:40 -07:00
parent 66481d5b62
commit defc41f5d1
2 changed files with 15 additions and 29 deletions

View file

@ -11,6 +11,7 @@ import buildcraft.core.render.RenderEntityBlock.BlockInterface;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.Icon;
@ -32,21 +33,6 @@ public class FluidRenderer {
public static final int DISPLAY_STAGES = 100;
private static final BlockInterface liquidBlock = new BlockInterface();
public static class MissingFluidTextureException extends RuntimeException {
private final Fluid fluid;
public MissingFluidTextureException(Fluid fluid) {
super();
this.fluid = fluid;
}
@Override
public String getMessage() {
return String.format("Fluid %s has no icon. Please contact the author of the mod the fluid came from.", fluid.getName());
}
}
public static Icon getFluidTexture(FluidStack fluidStack, boolean flowing) {
if (fluidStack == null) {
return null;
@ -60,7 +46,7 @@ public class FluidRenderer {
}
Icon icon = flowing ? fluid.getFlowingIcon() : fluid.getStillIcon();
if (icon == null) {
throw new MissingFluidTextureException(fluid);
icon = ((TextureMap) Minecraft.getMinecraft().func_110434_K().func_110581_b(TextureMap.field_110575_b)).func_110572_b("missingno");
}
return icon;
}

View file

@ -307,8 +307,8 @@ public class RenderPipe extends TileEntitySpecialRenderer {
boolean needsRender = false;
for (int i = 0; i < 7; ++i) {
FluidStack liquid = trans.renderCache[i];
if (liquid != null && liquid.amount > 0) {
FluidStack fluidStack = trans.renderCache[i];
if (fluidStack != null && fluidStack.amount > 0) {
needsRender = true;
break;
}
@ -331,16 +331,16 @@ public class RenderPipe extends TileEntitySpecialRenderer {
boolean sides = false, above = false;
for (int i = 0; i < 6; ++i) {
FluidStack liquid = trans.renderCache[i];
FluidStack fluidStack = trans.renderCache[i];
if (liquid != null && liquid.amount > 0) {
DisplayFluidList d = getListFromBuffer(liquid, pipe.container.worldObj);
if (fluidStack != null && fluidStack.amount > 0) {
DisplayFluidList d = getListFromBuffer(fluidStack, pipe.container.worldObj);
if (d == null) {
continue;
}
int stage = (int) ((float) liquid.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1));
int stage = (int) ((float) fluidStack.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1));
GL11.glPushMatrix();
int list = 0;
@ -369,22 +369,22 @@ public class RenderPipe extends TileEntitySpecialRenderer {
default:
}
func_110628_a(TextureMap.field_110575_b);
FluidRenderer.setColorForFluidStack(liquid);
FluidRenderer.setColorForFluidStack(fluidStack);
GL11.glCallList(list);
GL11.glPopMatrix();
}
}
// CENTER
FluidStack liquid = trans.renderCache[ForgeDirection.UNKNOWN.ordinal()];
FluidStack fluidStack = trans.renderCache[ForgeDirection.UNKNOWN.ordinal()];
if (liquid != null && liquid.amount > 0) {
DisplayFluidList d = getListFromBuffer(liquid, pipe.container.worldObj);
if (fluidStack != null && fluidStack.amount > 0) {
DisplayFluidList d = getListFromBuffer(fluidStack, pipe.container.worldObj);
if (d != null) {
int stage = (int) ((float) liquid.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1));
int stage = (int) ((float) fluidStack.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1));
func_110628_a(TextureMap.field_110575_b);
FluidRenderer.setColorForFluidStack(liquid);
FluidRenderer.setColorForFluidStack(fluidStack);
if (above) {
GL11.glCallList(d.centerVertical[stage]);