mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-11 15:57:55 +00:00
certus quartz tank item rendering improvements (#355)
This commit is contained in:
1 parent
0207ffe430
commit
8909e28ea3
2 files changed
+25
-18
No files matched your search
@@ -17,6 +17,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.render.tank.ModelCertusTank;
|
||||
import com.glodblock.github.common.item.ItemCertusQuartzTank;
|
||||
import com.glodblock.github.common.tile.TileCertusQuartzTank;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
@@ -35,7 +36,7 @@ public class ItemCertusQuartzTankRender implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type != ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,21 +50,22 @@ public class ItemCertusQuartzTankRender implements IItemRenderer {
|
||||
.bindTexture(FluidCraft.resource("textures/blocks/certus_quartz_tank/map.png"));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
GL11.glScalef(1, -1, -1);
|
||||
this.model.render(0.0625f);
|
||||
GL11.glScalef(1, -1, 1);
|
||||
this.model.render(0.0625f);
|
||||
if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
if (item != null && item.hasTagCompound()) {
|
||||
FluidStack storedFluid = FluidStack
|
||||
.loadFluidStackFromNBT(item.getTagCompound().getCompoundTag("tileEntity"));
|
||||
int tankCapacity = 32000;
|
||||
GL11.glRotatef(180F, 1F, 0F, 0F);
|
||||
this.model.render(0.0625f);
|
||||
GL11.glRotatef(180F, 1F, 0F, 0F);
|
||||
|
||||
if (item.getItem() instanceof ItemCertusQuartzTank itemCertusQuartzTank) {
|
||||
FluidStack storedFluid = itemCertusQuartzTank.getFluid(item);
|
||||
int tankCapacity = itemCertusQuartzTank.getCapacity(item);
|
||||
|
||||
if (storedFluid != null && storedFluid.getFluid() != null) {
|
||||
IIcon fluidIcon = storedFluid.getFluid().getIcon();
|
||||
@@ -71,9 +73,12 @@ public class ItemCertusQuartzTankRender implements IItemRenderer {
|
||||
if (ModAndClassUtil.HODGEPODGE && fluidIcon instanceof IPatchedTextureAtlasSprite) {
|
||||
((IPatchedTextureAtlasSprite) fluidIcon).markNeedsAnimationUpdate();
|
||||
}
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
RenderBlocks renderer = new RenderBlocks();
|
||||
GL11.glScalef(1, 1, -1);
|
||||
Block waterBlock = FluidRegistry.WATER.getBlock();
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
renderer.setRenderBounds(
|
||||
0.08F,
|
||||
0.001F,
|
||||
@@ -81,9 +86,12 @@ public class ItemCertusQuartzTankRender implements IItemRenderer {
|
||||
0.92F,
|
||||
(float) storedFluid.amount / (float) tankCapacity * 0.999F,
|
||||
0.92F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Block waterBlock = FluidRegistry.WATER.getBlock();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA_F(
|
||||
(storedFluid.getFluid().getColor() >> 16 & 0xFF) / 255.0F,
|
||||
|
||||
@@ -25,8 +25,7 @@ public class ModelCertusTank extends ModelBase {
|
||||
this.textureHeight = 64;
|
||||
|
||||
this.Shape1 = new ModelRenderer(this, 0, 0);
|
||||
this.Shape1.addBox(0F, 0F, 0F, 14, 16, 14);
|
||||
this.Shape1.setRotationPoint(-7F, -8F, -7F);
|
||||
this.Shape1.addBox(-7F, -8F, -7F, 14, 16, 14);
|
||||
this.Shape1.setTextureSize(this.textureWidth, this.textureHeight);
|
||||
this.Shape1.mirror = true;
|
||||
setRotation(this.Shape1, 0F, 0F, 0F);
|
||||
|
||||
Reference in new issue
Block a user