Skip to content

Commit

Permalink
Inline getBlocksTexture
Browse files Browse the repository at this point in the history
  • Loading branch information
pupnewfster committed Jul 8, 2019
1 parent f1c7196 commit e3fbf55
Show file tree
Hide file tree
Showing 29 changed files with 58 additions and 43 deletions.
Expand Up @@ -16,12 +16,12 @@
import mekanism.client.gui.element.GuiTransporterConfigTab;
import mekanism.client.gui.element.GuiUpgradeTab;
import mekanism.client.render.MekanismRenderHelper;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.inventory.container.ContainerAdvancedElectricMachine;
import mekanism.common.recipe.machines.AdvancedMachineRecipe;
import mekanism.common.tile.prefab.TileEntityAdvancedElectricMachine;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
Expand Down Expand Up @@ -97,7 +97,7 @@ public void displayGauge(int xPos, int yPos, int sizeX, int sizeY, GasStack gas)
}
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
MekanismRenderHelper renderHelper = new MekanismRenderHelper().color(gas);
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos, gas.getGas().getSprite(), sizeX, sizeY);
renderHelper.cleanup();
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/mekanism/client/gui/GuiEmbeddedGaugeTile.java
Expand Up @@ -5,6 +5,7 @@
import mekanism.client.render.MekanismRenderer.FluidType;
import mekanism.common.tile.prefab.TileEntityContainerBlock;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.inventory.Container;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
Expand All @@ -30,7 +31,7 @@ protected void displayGauge(int xPos, int yPos, int scale, FluidStack fluid, int
int start = 0;
MekanismRenderHelper renderHelper = new MekanismRenderHelper().color(fluid);
TextureAtlasSprite fluidTexture = MekanismRenderer.getFluidTexture(fluid, FluidType.STILL);
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
while (true) {
int renderRemaining;
if (scale > 16) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/mekanism/client/gui/GuiFactory.java
Expand Up @@ -14,7 +14,6 @@
import mekanism.client.gui.element.GuiTransporterConfigTab;
import mekanism.client.gui.element.GuiUpgradeTab;
import mekanism.client.render.MekanismRenderHelper;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.base.IFactory.MachineFuelType;
Expand All @@ -27,6 +26,7 @@
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -115,7 +115,7 @@ public void displayGauge(int xPos, int yPos, int sizeX, int sizeY, TextureAtlasS
if (icon != null) {
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos, icon, sizeX, sizeY);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/mekanism/client/gui/GuiInductionMatrix.java
Expand Up @@ -10,6 +10,7 @@
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
Expand Down Expand Up @@ -74,7 +75,7 @@ public void displayGauge(int xPos, int yPos, int scale, int side /*0-left, 1-rig
renderRemaining = scale;
scale = 0;
}
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos + 58 - renderRemaining - start, MekanismRenderer.energyIcon, 16, renderRemaining);
start += 16;
if (renderRemaining == 0 || scale == 0) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/mekanism/client/gui/GuiLogisticalSorter.java
Expand Up @@ -33,6 +33,7 @@
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -439,7 +440,7 @@ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {

if (tileEntity.color != null) {
MekanismRenderHelper renderHelper = new MekanismRenderHelper(true).enableLighting().enableRescaleNormal();
mc.getTextureManager().bindTexture(MekanismRenderer.getBlocksTexture());
mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
drawTexturedRectFromIcon(13, 137, MekanismRenderer.getColorIcon(tileEntity.color), 16, 16);
renderHelper.cleanup();
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/mekanism/client/gui/GuiMetallurgicInfuser.java
Expand Up @@ -16,7 +16,6 @@
import mekanism.client.gui.element.GuiSlot.SlotType;
import mekanism.client.gui.element.GuiTransporterConfigTab;
import mekanism.client.gui.element.GuiUpgradeTab;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerMetallurgicInfuser;
Expand All @@ -25,6 +24,7 @@
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.ResourceLocation;
Expand Down Expand Up @@ -80,7 +80,7 @@ protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, in
int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
if (tileEntity.infuseStored.getType() != null) {
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
int displayInt = tileEntity.getScaledInfuseLevel(52);
drawTexturedRectFromIcon(guiWidth + 7, guiHeight + 17 + 52 - displayInt, tileEntity.infuseStored.getType().sprite, 4, displayInt);
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/mekanism/client/gui/GuiTransporterConfig.java
Expand Up @@ -21,6 +21,7 @@
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.tileentity.TileEntity;
Expand Down Expand Up @@ -95,7 +96,7 @@ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
fontRenderer.drawString(LangUtils.localize("gui.output"), 114, 68, 0x787878);
if (configurable.getEjector().getOutputColor() != null) {
MekanismRenderHelper renderHelper = new MekanismRenderHelper(true).enableLighting().enableRescaleNormal();
mc.getTextureManager().bindTexture(MekanismRenderer.getBlocksTexture());
mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
drawTexturedRectFromIcon(122, 49, MekanismRenderer.getColorIcon(configurable.getEjector().getOutputColor()), 16, 16);
renderHelper.cleanup();
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/mekanism/client/gui/element/GuiGauge.java
Expand Up @@ -5,13 +5,13 @@
import mekanism.client.gui.GuiMekanismTile;
import mekanism.client.gui.IGuiWrapper;
import mekanism.client.render.MekanismRenderHelper;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.SideData;
import mekanism.common.base.ISideConfiguration;
import mekanism.common.item.ItemConfigurator;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
Expand Down Expand Up @@ -87,7 +87,7 @@ public void renderScale(int xAxis, int yAxis, int guiWidth, int guiHeight) {
scale = 0;
}

mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

MekanismRenderHelper renderHelper = applyRenderColor(new MekanismRenderHelper());
for (int i = 0; i < number; i++) {
Expand Down
Expand Up @@ -20,7 +20,7 @@
import mekanism.common.util.TransporterUtils;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -136,7 +136,7 @@ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
}
if (filter.color != null) {
MekanismRenderHelper renderHelper = new MekanismRenderHelper(true).enableLighting().enableRescaleNormal();
mc.getTextureManager().bindTexture(MekanismRenderer.getBlocksTexture());
mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
drawTexturedRectFromIcon(12, 44, MekanismRenderer.getColorIcon(filter.color), 16, 16);
renderHelper.cleanup();
}
Expand Down
Expand Up @@ -17,6 +17,7 @@
import mekanism.common.util.TransporterUtils;
import net.minecraft.block.Block;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.SoundEvents;
Expand Down Expand Up @@ -69,7 +70,7 @@ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
}
if (filter.color != null) {
MekanismRenderHelper renderHelper = new MekanismRenderHelper(true).enableLighting().enableRescaleNormal();
mc.getTextureManager().bindTexture(MekanismRenderer.getBlocksTexture());
mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
drawTexturedRectFromIcon(12, 44, MekanismRenderer.getColorIcon(filter.color), 16, 16);
renderHelper.cleanup();
}
Expand Down
Expand Up @@ -17,6 +17,7 @@
import mekanism.common.util.MekanismUtils.ResourceType;
import mekanism.common.util.TransporterUtils;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.ResourceLocation;
Expand Down Expand Up @@ -57,7 +58,7 @@ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
}
if (filter.color != null) {
MekanismRenderHelper renderHelper = new MekanismRenderHelper(true).enableLighting().enableRescaleNormal();
mc.getTextureManager().bindTexture(MekanismRenderer.getBlocksTexture());
mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
drawTexturedRectFromIcon(12, 44, MekanismRenderer.getColorIcon(filter.color), 16, 16);
renderHelper.cleanup();
}
Expand Down
Expand Up @@ -17,6 +17,7 @@
import mekanism.common.util.MekanismUtils.ResourceType;
import mekanism.common.util.TransporterUtils;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.ResourceLocation;
Expand Down Expand Up @@ -68,7 +69,7 @@ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
}
if (filter.color != null) {
MekanismRenderHelper renderHelper = new MekanismRenderHelper(true).enableLighting().enableRescaleNormal();
mc.getTextureManager().bindTexture(MekanismRenderer.getBlocksTexture());
mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
drawTexturedRectFromIcon(12, 44, MekanismRenderer.getColorIcon(filter.color), 16, 16);
renderHelper.cleanup();
}
Expand Down
Expand Up @@ -4,12 +4,12 @@
import java.util.Collections;
import java.util.List;
import mekanism.client.jei.machine.MekanismRecipeWrapper;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.InfuseStorage;
import mekanism.common.recipe.machines.MetallurgicInfuserRecipe;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.VanillaTypes;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.item.ItemStack;

public class MetallurgicInfuserRecipeWrapper<RECIPE extends MetallurgicInfuserRecipe> extends MekanismRecipeWrapper<RECIPE> {
Expand All @@ -30,7 +30,7 @@ public void getIngredients(IIngredients ingredients) {
@Override
public void drawInfo(Minecraft mc, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
if (mc.currentScreen != null) {
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
mc.currentScreen.drawTexturedModalRect(2, 2, recipe.getInput().infuse.getType().sprite, 4, 52);
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/mekanism/client/render/MekanismRenderer.java
Expand Up @@ -230,11 +230,6 @@ public static float getPartialTick() {
return Minecraft.getMinecraft().getRenderPartialTicks();
}

//TODO: Inline
public static ResourceLocation getBlocksTexture() {
return TextureMap.LOCATION_BLOCKS_TEXTURE;
}

@SubscribeEvent
public void onStitch(TextureStitchEvent.Pre event) {
for (EnumColor color : EnumColor.values()) {
Expand Down
Expand Up @@ -10,6 +10,7 @@
import mekanism.client.render.MekanismRenderer.Model3D;
import mekanism.common.tile.TileEntityDigitalMiner;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.init.Blocks;

Expand All @@ -22,7 +23,7 @@ public final class MinerVisualRenderer {
public static void render(TileEntityDigitalMiner miner) {
MekanismRenderHelper renderHelper = new MekanismRenderHelper(true)
.translate(getX(miner.getPos().getX()), getY(miner.getPos().getY()), getZ(miner.getPos().getZ())).enableBlendPreset().enableGlow().enableCull().colorAlpha(0.8F);
mc.getTextureManager().bindTexture(MekanismRenderer.getBlocksTexture());
mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
getList(new MinerRenderData(miner)).render();
renderHelper.cleanup();
}
Expand Down
Expand Up @@ -14,6 +14,7 @@
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
Expand All @@ -38,7 +39,7 @@ public static void renderStack(@Nonnull ItemStack stack, TransformType transform
MekanismRenderHelper tankRenderHelper = new MekanismRenderHelper(true);
if (fluid != null && fluidScale > 0) {
MekanismRenderHelper fluidRenderHelper = new MekanismRenderHelper(true).enableCull().disableLighting().enableBlendPreset();
MekanismRenderer.bindTexture(MekanismRenderer.getBlocksTexture());
MekanismRenderer.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
fluidRenderHelper.translateAll(-0.5).enableGlow(fluid).color(fluid);

DisplayInteger[] displayList = getListAndRender(fluid);
Expand Down
Expand Up @@ -14,6 +14,7 @@
import mekanism.common.tile.component.TileComponentConfig;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.init.Blocks;
Expand Down Expand Up @@ -52,7 +53,7 @@ public void render(S configurable, double x, double y, double z, float partialTi
SideData data = configurable.getConfig().getOutput(type, pos.sideHit, configurable.getOrientation());
if (data != TileComponentConfig.EMPTY) {
MekanismRenderHelper renderHelper = initHelper().color(data.color, 0.6F);
bindTexture(MekanismRenderer.getBlocksTexture());
bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
renderHelper.translate(x, y, z);
int display = getOverlayDisplay(pos.sideHit, type).display;
GlStateManager.callList(display);
Expand Down
Expand Up @@ -7,6 +7,7 @@
import mekanism.client.render.MekanismRenderer;
import mekanism.common.content.tank.SynchronizedTankData.ValveData;
import mekanism.common.tile.TileEntityDynamicTank;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
Expand All @@ -26,7 +27,7 @@ public void render(TileEntityDynamicTank tileEntity, double x, double y, double
data.width = tileEntity.structure.volWidth;
data.fluidType = tileEntity.structure.fluidStored;

bindTexture(MekanismRenderer.getBlocksTexture());
bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

if (data.location != null && data.height >= 1) {
MekanismRenderHelper renderHelper = FluidRenderer.initHelper();
Expand Down
Expand Up @@ -9,6 +9,7 @@
import mekanism.common.tier.FluidTankTier;
import mekanism.common.tile.TileEntityFluidTank;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.init.Blocks;
import net.minecraftforge.fluids.FluidStack;
Expand Down Expand Up @@ -39,7 +40,7 @@ public void render(TileEntityFluidTank tileEntity, double x, double y, double z,
public void render(FluidTankTier tier, FluidStack fluid, float fluidScale, boolean active, FluidStack valveFluid, double x, double y, double z) {
if (fluid != null && fluidScale > 0) {
MekanismRenderHelper renderHelper = initHelper();
bindTexture(MekanismRenderer.getBlocksTexture());
bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
renderHelper.translate(x, y, z).enableGlow(fluid).color(fluid);

DisplayInteger[] displayList = getListAndRender(fluid);
Expand All @@ -58,7 +59,7 @@ public void render(FluidTankTier tier, FluidStack fluid, float fluidScale, boole

if (valveFluid != null && !valveFluid.getFluid().isGaseous(valveFluid)) {
MekanismRenderHelper renderHelper = initHelper();
bindTexture(MekanismRenderer.getBlocksTexture());
bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
renderHelper.translate(x, y, z).enableGlow(valveFluid).color(valveFluid);
DisplayInteger[] valveList = getValveRender(valveFluid);
valveList[Math.min(stages - 1, (int) (fluidScale * ((float) stages - 1)))].render();
Expand Down

0 comments on commit e3fbf55

Please sign in to comment.