Fixed fluids that have less than 1 bucket stored render only partly in Fluid Grid
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
- Fixed machines breaking on long distances (raoulvdberge)
|
- Fixed machines breaking on long distances (raoulvdberge)
|
||||||
- Fixed controller rebuilding network graph on energy change (raoulvdberge)
|
- Fixed controller rebuilding network graph on energy change (raoulvdberge)
|
||||||
- Fixed fluids not caring about NBT tags (raoulvdberge)
|
- Fixed fluids not caring about NBT tags (raoulvdberge)
|
||||||
|
- Fixed fluids that have less than 1 bucket stored render only partly in Fluid Grid (raoulvdberge)
|
||||||
|
|
||||||
### 0.9.4
|
### 0.9.4
|
||||||
- Little fixes in German translation (ThexXTURBOXx)
|
- Little fixes in German translation (ThexXTURBOXx)
|
||||||
|
@@ -31,7 +31,7 @@ public class FluidRenderer {
|
|||||||
this.height = height;
|
this.height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Minecraft minecraft, final int xPosition, final int yPosition, FluidStack fluidStack) {
|
public void draw(Minecraft minecraft, int xPosition, int yPosition, FluidStack fluidStack) {
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.enableAlpha();
|
GlStateManager.enableAlpha();
|
||||||
|
|
||||||
@@ -43,11 +43,13 @@ public class FluidRenderer {
|
|||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawFluid(Minecraft minecraft, final int xPosition, final int yPosition, FluidStack fluidStack) {
|
private void drawFluid(Minecraft minecraft, int xPosition, int yPosition, FluidStack fluidStack) {
|
||||||
if (fluidStack == null) {
|
if (fluidStack == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Fluid fluid = fluidStack.getFluid();
|
Fluid fluid = fluidStack.getFluid();
|
||||||
|
|
||||||
if (fluid == null) {
|
if (fluid == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -55,32 +57,40 @@ public class FluidRenderer {
|
|||||||
TextureMap textureMapBlocks = minecraft.getTextureMapBlocks();
|
TextureMap textureMapBlocks = minecraft.getTextureMapBlocks();
|
||||||
ResourceLocation fluidStill = fluid.getStill();
|
ResourceLocation fluidStill = fluid.getStill();
|
||||||
TextureAtlasSprite fluidStillSprite = null;
|
TextureAtlasSprite fluidStillSprite = null;
|
||||||
|
|
||||||
if (fluidStill != null) {
|
if (fluidStill != null) {
|
||||||
fluidStillSprite = textureMapBlocks.getTextureExtry(fluidStill.toString());
|
fluidStillSprite = textureMapBlocks.getTextureExtry(fluidStill.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fluidStillSprite == null) {
|
if (fluidStillSprite == null) {
|
||||||
fluidStillSprite = textureMapBlocks.getMissingSprite();
|
fluidStillSprite = textureMapBlocks.getMissingSprite();
|
||||||
}
|
}
|
||||||
|
|
||||||
int fluidColor = fluid.getColor(fluidStack);
|
int fluidColor = fluid.getColor(fluidStack);
|
||||||
|
|
||||||
int scaledAmount = (fluidStack.amount * height) / capacityMb;
|
int scaledAmount = height;
|
||||||
|
|
||||||
|
if (capacityMb != -1) {
|
||||||
|
scaledAmount = (fluidStack.amount * height) / capacityMb;
|
||||||
|
|
||||||
if (fluidStack.amount > 0 && scaledAmount < MIN_FLUID_HEIGHT) {
|
if (fluidStack.amount > 0 && scaledAmount < MIN_FLUID_HEIGHT) {
|
||||||
scaledAmount = MIN_FLUID_HEIGHT;
|
scaledAmount = MIN_FLUID_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scaledAmount > height) {
|
if (scaledAmount > height) {
|
||||||
scaledAmount = height;
|
scaledAmount = height;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
minecraft.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
minecraft.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||||
setGLColorFromInt(fluidColor);
|
setGLColorFromInt(fluidColor);
|
||||||
|
|
||||||
final int xTileCount = width / TEX_WIDTH;
|
int xTileCount = width / TEX_WIDTH;
|
||||||
final int xRemainder = width - (xTileCount * TEX_WIDTH);
|
int xRemainder = width - (xTileCount * TEX_WIDTH);
|
||||||
final int yTileCount = scaledAmount / TEX_HEIGHT;
|
int yTileCount = scaledAmount / TEX_HEIGHT;
|
||||||
final int yRemainder = scaledAmount - (yTileCount * TEX_HEIGHT);
|
int yRemainder = scaledAmount - (yTileCount * TEX_HEIGHT);
|
||||||
|
|
||||||
final int yStart = yPosition + height;
|
int yStart = yPosition + height;
|
||||||
|
|
||||||
for (int xTile = 0; xTile <= xTileCount; xTile++) {
|
for (int xTile = 0; xTile <= xTileCount; xTile++) {
|
||||||
for (int yTile = 0; yTile <= yTileCount; yTile++) {
|
for (int yTile = 0; yTile <= yTileCount; yTile++) {
|
||||||
@@ -88,6 +98,7 @@ public class FluidRenderer {
|
|||||||
int height = (yTile == yTileCount) ? yRemainder : TEX_HEIGHT;
|
int height = (yTile == yTileCount) ? yRemainder : TEX_HEIGHT;
|
||||||
int x = xPosition + (xTile * TEX_WIDTH);
|
int x = xPosition + (xTile * TEX_WIDTH);
|
||||||
int y = yStart - ((yTile + 1) * TEX_HEIGHT);
|
int y = yStart - ((yTile + 1) * TEX_HEIGHT);
|
||||||
|
|
||||||
if (width > 0 && height > 0) {
|
if (width > 0 && height > 0) {
|
||||||
int maskTop = TEX_HEIGHT - height;
|
int maskTop = TEX_HEIGHT - height;
|
||||||
int maskRight = TEX_WIDTH - width;
|
int maskRight = TEX_WIDTH - width;
|
||||||
@@ -115,6 +126,7 @@ public class FluidRenderer {
|
|||||||
vMax = vMax - (maskTop / 16.0 * (vMax - vMin));
|
vMax = vMax - (maskTop / 16.0 * (vMax - vMin));
|
||||||
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
|
|
||||||
VertexBuffer vertexBuffer = tessellator.getBuffer();
|
VertexBuffer vertexBuffer = tessellator.getBuffer();
|
||||||
vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||||
vertexBuffer.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex();
|
vertexBuffer.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex();
|
||||||
|
@@ -16,6 +16,7 @@ public class ContainerFluidInterface extends ContainerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addSlotToContainer(new SlotItemHandler(fluidInterface.getIn(), 0, 44, 32));
|
addSlotToContainer(new SlotItemHandler(fluidInterface.getIn(), 0, 44, 32));
|
||||||
|
// @TODO: Fix shift click bug void
|
||||||
addSlotToContainer(new SlotSpecimenFluid(!fluidInterface.getWorld().isRemote, fluidInterface.getOut(), 0, 116, 32));
|
addSlotToContainer(new SlotSpecimenFluid(!fluidInterface.getWorld().isRemote, fluidInterface.getOut(), 0, 116, 32));
|
||||||
|
|
||||||
addPlayerInventory(8, 122);
|
addPlayerInventory(8, 122);
|
||||||
|
@@ -8,7 +8,6 @@ import net.minecraft.inventory.Container;
|
|||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fml.client.config.GuiCheckBox;
|
import net.minecraftforge.fml.client.config.GuiCheckBox;
|
||||||
import net.minecraftforge.items.SlotItemHandler;
|
import net.minecraftforge.items.SlotItemHandler;
|
||||||
@@ -24,7 +23,7 @@ import java.util.*;
|
|||||||
public abstract class GuiBase extends GuiContainer {
|
public abstract class GuiBase extends GuiContainer {
|
||||||
private static final Map<String, ResourceLocation> TEXTURE_CACHE = new HashMap<>();
|
private static final Map<String, ResourceLocation> TEXTURE_CACHE = new HashMap<>();
|
||||||
|
|
||||||
public static final FluidRenderer FLUID_RENDERER = new FluidRenderer(Fluid.BUCKET_VOLUME, 16, 16);
|
public static final FluidRenderer FLUID_RENDERER = new FluidRenderer(-1, 16, 16);
|
||||||
|
|
||||||
protected static final int SIDE_BUTTON_WIDTH = 20;
|
protected static final int SIDE_BUTTON_WIDTH = 20;
|
||||||
protected static final int SIDE_BUTTON_HEIGHT = 20;
|
protected static final int SIDE_BUTTON_HEIGHT = 20;
|
||||||
|
Reference in New Issue
Block a user