mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
* First pass reformatting code to be more readable (common still not done) * Replace google common collect calls with Java calls where possible * Remove a bunch of unnecessary parenthesis leaving clarifying ones * Add some missing @Nonnull annotations * Fix checking wrong type * Remove unnecessary continue/return statements and simplify comparision check * Pass exception instead of directly printing stack trace * Work on cleaning up common, through config so far * Work on cleaning up common, through integration so far * Work on cleaning up common, through network so far * Work on cleaning up common, through tier so far * Remove empty constructors that get created by default anyways * Work on cleaning up common, through transmitters so far * Work on cleaning up common, through utils so far * Finish cleaning up spacing for common
52 lines
2.0 KiB
Java
52 lines
2.0 KiB
Java
package mekanism.client.gui;
|
|
|
|
import mekanism.client.render.MekanismRenderer;
|
|
import mekanism.client.render.MekanismRenderer.FluidType;
|
|
import mekanism.common.tile.prefab.TileEntityContainerBlock;
|
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
|
import net.minecraft.inventory.Container;
|
|
import net.minecraft.util.ResourceLocation;
|
|
import net.minecraftforge.fluids.FluidStack;
|
|
|
|
public abstract class GuiEmbeddedGaugeTile<TILE extends TileEntityContainerBlock> extends GuiMekanismTile<TILE> {
|
|
|
|
protected GuiEmbeddedGaugeTile(TILE tile, Container container) {
|
|
super(tile, container);
|
|
}
|
|
|
|
protected abstract ResourceLocation getGaugeResource();
|
|
|
|
protected void displayGauge(int xPos, int yPos, int scale, FluidStack fluid) {
|
|
displayGauge(xPos, yPos, scale, fluid, 0);
|
|
}
|
|
|
|
protected void displayGauge(int xPos, int yPos, int scale, FluidStack fluid, int side /*0-left, 1-right*/) {
|
|
if (fluid == null) {
|
|
return;
|
|
}
|
|
int guiWidth = (width - xSize) / 2;
|
|
int guiHeight = (height - ySize) / 2;
|
|
int start = 0;
|
|
MekanismRenderer.colorFluidGLSM(fluid);
|
|
TextureAtlasSprite fluidTexture = MekanismRenderer.getFluidTexture(fluid, FluidType.STILL);
|
|
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
|
|
while (true) {
|
|
int renderRemaining;
|
|
if (scale > 16) {
|
|
renderRemaining = 16;
|
|
scale -= 16;
|
|
} else {
|
|
renderRemaining = scale;
|
|
scale = 0;
|
|
}
|
|
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos + 58 - renderRemaining - start, fluidTexture, 16, renderRemaining);
|
|
start += 16;
|
|
if (renderRemaining == 0 || scale == 0) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
mc.renderEngine.bindTexture(getGaugeResource());
|
|
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos, 176, side == 0 ? 0 : 54, 16, 54);
|
|
}
|
|
} |