use of net.minecraftforge.fluids.FluidStack in project Railcraft by Railcraft.
the class TileTankBase method syncClient.
@SuppressWarnings("ConstantConditions")
private void syncClient() {
FluidStack fluidStack = tankManager.get(0).getFluid();
if (!Fluids.areIdentical(previousFluidStack, fluidStack)) {
previousFluidStack = fluidStack == null ? null : fluidStack.copy();
sendUpdateToClient();
}
}
use of net.minecraftforge.fluids.FluidStack in project Railcraft by Railcraft.
the class TileFluidUnloader method processCart.
@Override
protected void processCart(EntityMinecart cart) {
AdvancedFluidHandler tankCart = getFluidHandler(cart, EnumFacing.DOWN);
if (tankCart != null) {
FluidStack moved = FluidUtil.tryFluidTransfer(tank, tankCart, RailcraftConfig.getTankCartFillRate(), true);
setProcessing(Fluids.isNotEmpty(moved));
}
}
use of net.minecraftforge.fluids.FluidStack in project Railcraft by Railcraft.
the class LiquidSlot method getTooltip.
@Override
public List<String> getTooltip(int x, int y, Object[] data, int dataIndex) {
List<String> tooltip = null;
if (data[dataIndex] instanceof FluidStack) {
tooltip = new ArrayList<String>(1);
FluidStack stack = (FluidStack) data[dataIndex];
tooltip.add(stack.getFluid().getLocalizedName(stack) + " (" + stack.amount + " milliBuckets)");
}
return tooltip;
}
use of net.minecraftforge.fluids.FluidStack in project Railcraft by Railcraft.
the class LiquidSlot method draw.
@Override
public void draw(Renderer renderer, int recipeX, int recipeY, Object[] data, int dataIndex, boolean isMouseOver) {
int x = recipeX + this.x;
int y = recipeY + this.y;
if (data[dataIndex] instanceof FluidStack) {
FluidStack liquid = (FluidStack) data[dataIndex];
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
Fluid fluid = liquid.getFluid();
TextureAtlasSprite icon = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fluid.getStill(liquid).toString());
if (icon != null) {
textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
double u = icon.getInterpolatedU(3.0);
double u2 = icon.getInterpolatedU(13.0);
double v = icon.getInterpolatedV(1.0);
double v2 = icon.getInterpolatedV(15.0);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2d(u, v);
GL11.glVertex2i(x + 3, y + 1);
GL11.glTexCoord2d(u, v2);
GL11.glVertex2i(x + 3, y + 15);
GL11.glTexCoord2d(u2, v2);
GL11.glVertex2i(x + 13, y + 15);
GL11.glTexCoord2d(u2, v);
GL11.glVertex2i(x + 13, y + 1);
GL11.glEnd();
}
}
renderer.renderRect(x - 1, y - 1, 18, 18, containerTexture);
}
use of net.minecraftforge.fluids.FluidStack in project Railcraft by Railcraft.
the class TankManager method setCapacity.
public void setCapacity(int tankIndex, int capacity) {
StandardTank tank = get(tankIndex);
tank.setCapacity(capacity);
FluidStack fluidStack = tank.getFluid();
if (fluidStack != null && fluidStack.amount > capacity)
fluidStack.amount = capacity;
}
Aggregations