mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-17 02:45:08 +00:00
Fix fluid texture animation (#136)
This commit is contained in:
1 parent
6afa01da74
commit
95a72f0e08
4 files changed
+39
-9
No files matched your search
@@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
@@ -22,7 +23,9 @@ import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.network.CPacketFluidUpdate;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
@@ -94,20 +97,26 @@ public class GuiFluidTerminal extends GuiFluidMonitor {
|
||||
}
|
||||
|
||||
private void drawWidget(int posX, int posY, Fluid fluid) {
|
||||
if (fluid == null) return;
|
||||
IIcon icon = fluid.getIcon();
|
||||
if (icon == null) return;
|
||||
|
||||
if (ModAndClassUtil.HODGEPODGE && icon instanceof IPatchedTextureAtlasSprite) {
|
||||
((IPatchedTextureAtlasSprite) icon).markNeedsAnimationUpdate();
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
if (fluid != null && fluid.getIcon() != null) {
|
||||
GL11.glColor3f(
|
||||
(fluid.getColor() >> 16 & 0xFF) / 255.0F,
|
||||
(fluid.getColor() >> 8 & 0xFF) / 255.0F,
|
||||
(fluid.getColor() & 0xFF) / 255.0F);
|
||||
drawTexturedModelRectFromIcon(posX, posY, fluid.getIcon(), 16, 16);
|
||||
}
|
||||
GL11.glColor3f(
|
||||
(fluid.getColor() >> 16 & 0xFF) / 255.0F,
|
||||
(fluid.getColor() >> 8 & 0xFF) / 255.0F,
|
||||
(fluid.getColor() & 0xFF) / 255.0F);
|
||||
drawTexturedModelRectFromIcon(posX, posY, fluid.getIcon(), 16, 16);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,8 @@ import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.render.tank.ModelCertusTank;
|
||||
import com.glodblock.github.common.tile.TileCertusQuartzTank;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
|
||||
@@ -66,6 +68,9 @@ public class ItemCertusQuartzTankRender implements IItemRenderer {
|
||||
if (storedFluid != null && storedFluid.getFluid() != null) {
|
||||
IIcon fluidIcon = storedFluid.getFluid().getIcon();
|
||||
if (fluidIcon == null) fluidIcon = FluidRegistry.LAVA.getIcon();
|
||||
if (ModAndClassUtil.HODGEPODGE && fluidIcon instanceof IPatchedTextureAtlasSprite) {
|
||||
((IPatchedTextureAtlasSprite) fluidIcon).markNeedsAnimationUpdate();
|
||||
}
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
RenderBlocks renderer = new RenderBlocks();
|
||||
GL11.glScalef(1, 1, -1);
|
||||
|
||||
@@ -3,8 +3,11 @@ package com.glodblock.github.client.render.tank;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -75,7 +78,7 @@ public class FluidTankRenderer {
|
||||
return null;
|
||||
}
|
||||
Map<Fluid, int[]> cache = flowing ? flowingRenderCache : stillRenderCache;
|
||||
int[] diplayLists = cache.get(fluid);
|
||||
int[] diplayLists = getCachedData(fluid, cache);
|
||||
if (diplayLists != null) {
|
||||
return diplayLists;
|
||||
}
|
||||
@@ -118,4 +121,12 @@ public class FluidTankRenderer {
|
||||
|
||||
return diplayLists;
|
||||
}
|
||||
|
||||
private static int[] getCachedData(@Nonnull Fluid fluid, Map<Fluid, int[]> cache) {
|
||||
IIcon icon = fluid.getIcon();
|
||||
if (icon instanceof TextureAtlasSprite sprite && sprite.hasAnimationMetadata()) {
|
||||
return null;
|
||||
}
|
||||
return cache.get(fluid);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user