mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-16 18:44:44 +00:00
Clean up gaia head renderer. Closes #303
This commit is contained in:
3 files changed
+20
-45
No files matched your search
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.client.render.tile;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.sun.istack.internal.Nullable;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
|
||||
@@ -22,56 +23,28 @@ import vazkii.botania.client.model.ModelSkullOverride;
|
||||
import vazkii.botania.client.render.entity.RenderDoppleganger;
|
||||
import vazkii.botania.common.block.tile.TileGaiaHead;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class RenderTileSkullOverride extends TileEntitySkullRenderer {
|
||||
|
||||
public static final ModelSkullOverride modelSkull = new ModelSkullOverride();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntitySkull p_147500_1_, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_, int digProgress) {
|
||||
if (p_147500_1_ != null) {
|
||||
render(p_147500_1_, (float) p_147500_2_, (float) p_147500_4_, (float) p_147500_6_, EnumFacing.getFront(p_147500_1_.getBlockMetadata() & 7), p_147500_1_.getSkullRotation() * 360 / 16.0F, p_147500_1_.getSkullType(), p_147500_1_.getPlayerProfile(), digProgress);
|
||||
} else {
|
||||
render(null, ((float) p_147500_2_), ((float) p_147500_4_), ((float) p_147500_6_), EnumFacing.NORTH, 0, 3, null, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void render(TileEntitySkull skull, float par1, float par2, float par3, EnumFacing par4, float par5, int par6, GameProfile gameProfile, int digProgress) {
|
||||
public void renderTileEntityAt(TileEntitySkull skull, double x, double y, double z, float partialTicks, int digProgress) {
|
||||
boolean gaia = skull == null || skull instanceof TileGaiaHead;
|
||||
if(gaia) {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
ResourceLocation resourcelocation = minecraft.thePlayer.getLocationSkin();
|
||||
bindTexture(resourcelocation);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableCull();
|
||||
if (par4 != EnumFacing.UP) {
|
||||
switch (par4) {
|
||||
case NORTH:
|
||||
GlStateManager.translate(par1 + 0.5F, par2 + 0.25F, par3 + 0.74F);
|
||||
break;
|
||||
case SOUTH:
|
||||
GlStateManager.translate(par1 + 0.5F, par2 + 0.25F, par3 + 0.26F);
|
||||
par5 = 180.0F;
|
||||
break;
|
||||
case WEST:
|
||||
GlStateManager.translate(par1 + 0.74F, par2 + 0.25F, par3 + 0.5F);
|
||||
par5 = 270.0F;
|
||||
break;
|
||||
case EAST:
|
||||
default:
|
||||
GlStateManager.translate(par1 + 0.26F, par2 + 0.25F, par3 + 0.5F);
|
||||
par5 = 90.0F;
|
||||
}
|
||||
} else GlStateManager.translate(par1 + 0.5F, par2, par3 + 0.5F);
|
||||
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.scale(-1.0F, -1.0F, 1.0F);
|
||||
GlStateManager.enableAlpha();
|
||||
if(gaia)
|
||||
ShaderHelper.useShader(ShaderHelper.doppleganger, RenderDoppleganger.defaultCallback);
|
||||
|
||||
modelSkull.render(null, 0F, 0F, 0F, par5, 0F, 0.0625F);
|
||||
if(skull == null)
|
||||
// Copy of super that is null safe
|
||||
renderSkull((float) x, (float) y, (float) z, EnumFacing.NORTH, 0, 3, null, digProgress, partialTicks);
|
||||
else super.renderTileEntityAt(skull, x, y, z, partialTicks, digProgress);
|
||||
|
||||
if(gaia)
|
||||
ShaderHelper.releaseShader();
|
||||
GlStateManager.popMatrix();
|
||||
} else super.renderSkull(par1, par2, par3, par4, par5, par6, gameProfile, digProgress, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSkull(float x, float y, float z, @Nonnull EnumFacing facing, float rotation, int skullType, @Nullable GameProfile profile, int destroyStage, float animateTicks) {
|
||||
// Null out profile so Steve skin renders at all times
|
||||
super.renderSkull(x, y, z, facing, rotation, skullType, null, destroyStage, animateTicks);
|
||||
}
|
||||
}
|
||||
@@ -13,5 +13,7 @@ package vazkii.botania.common.block.tile;
|
||||
import net.minecraft.tileentity.TileEntitySkull;
|
||||
|
||||
public class TileGaiaHead extends TileEntitySkull {
|
||||
|
||||
public TileGaiaHead() {
|
||||
setType(3);
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ public class ItemGaiaHead extends ItemMod {
|
||||
|
||||
tileentityskull.setPlayerProfile(gameprofile);*/
|
||||
} else {
|
||||
tileentityskull.setType(stack.getMetadata());
|
||||
tileentityskull.setType(3); // Botania - Force type to 3 (humanoid)
|
||||
}
|
||||
|
||||
tileentityskull.setSkullRotation(i);
|
||||
|
||||
Reference in new issue
Block a user