mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-13 00:37:57 +00:00
Proper player head rendering thanks to Kihira :D
This commit is contained in:
1 parent
d07440d27a
commit
db402007e3
4 files changed
+135
-2
No files matched your search
@@ -17,6 +17,7 @@ import net.minecraft.client.network.NetHandlerPlayClient;
|
||||
import net.minecraft.client.renderer.entity.RenderSnowball;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntitySkull;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSettings.GameType;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
@@ -54,6 +55,7 @@ import vazkii.botania.client.render.tile.RenderTileMiniIsland;
|
||||
import vazkii.botania.client.render.tile.RenderTilePool;
|
||||
import vazkii.botania.client.render.tile.RenderTilePylon;
|
||||
import vazkii.botania.client.render.tile.RenderTileRuneAltar;
|
||||
import vazkii.botania.client.render.tile.RenderTileSkullOverride;
|
||||
import vazkii.botania.client.render.tile.RenderTileSpawnerClaw;
|
||||
import vazkii.botania.client.render.tile.RenderTileSpreader;
|
||||
import vazkii.botania.client.render.tile.RenderTileTinyPotato;
|
||||
@@ -134,7 +136,9 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileMiniIsland.class, new RenderTileMiniIsland());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTinyPotato.class, new RenderTileTinyPotato());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileSpawnerClaw.class, new RenderTileSpawnerClaw());
|
||||
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySkull.class, new RenderTileSkullOverride());
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityPixie.class, new RenderPixie());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityVineBall.class, new RenderSnowball(ModItems.vineBall));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityDoppleganger.class, new RenderDoppleganger());
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* This class was created by <Kihira>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [? (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelSkullOverride extends ModelBase {
|
||||
|
||||
private final ModelRenderer bipedHead;
|
||||
private final ModelRenderer bipedHeadwear;
|
||||
|
||||
public ModelSkullOverride() {
|
||||
this.textureWidth = 64;
|
||||
this.textureHeight = 32;
|
||||
this.bipedHead = new ModelRenderer(this, 0, 0);
|
||||
this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0F);
|
||||
this.bipedHead.setRotationPoint(0.0F, 0.0F, 0.0F);
|
||||
this.bipedHeadwear = new ModelRenderer(this, 32, 0);
|
||||
this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.5F);
|
||||
this.bipedHeadwear.setRotationPoint(0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
public void renderWithoutRotation(float par1) {
|
||||
this.bipedHead.render(par1);
|
||||
this.bipedHeadwear.render(par1);
|
||||
}
|
||||
|
||||
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) {
|
||||
this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
|
||||
this.bipedHead.render(par7);
|
||||
this.bipedHeadwear.render(par7);
|
||||
}
|
||||
|
||||
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) {
|
||||
this.bipedHead.rotateAngleY = this.bipedHeadwear.rotateAngleY = par4 / (180F / (float)Math.PI);
|
||||
this.bipedHead.rotateAngleX = this.bipedHeadwear.rotateAngleX = par5 / (180F / (float)Math.PI);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* This class was created by <Kihira>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [? (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.render.tile;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
|
||||
import net.minecraft.tileentity.TileEntitySkull;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import vazkii.botania.client.model.ModelSkullOverride;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
|
||||
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_) {
|
||||
this.render(p_147500_1_, (float) p_147500_2_, (float) p_147500_4_, (float) p_147500_6_, p_147500_1_.getBlockMetadata() & 7, (float) (p_147500_1_.func_145906_b() * 360) / 16.0F, p_147500_1_.func_145904_a(), p_147500_1_.func_152108_a());
|
||||
}
|
||||
|
||||
public void render(TileEntitySkull skull, float par1, float par2, float par3, int par4, float par5, int par6, GameProfile gameProfile) {
|
||||
if (par6 == 3) {
|
||||
ResourceLocation resourcelocation = AbstractClientPlayer.locationStevePng;
|
||||
if (gameProfile != null) {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
Map map = minecraft.func_152342_ad().func_152788_a(gameProfile);
|
||||
|
||||
if (map.containsKey(MinecraftProfileTexture.Type.SKIN)) {
|
||||
resourcelocation = minecraft.func_152342_ad().func_152792_a((MinecraftProfileTexture)map.get(MinecraftProfileTexture.Type.SKIN), MinecraftProfileTexture.Type.SKIN);
|
||||
}
|
||||
}
|
||||
this.bindTexture(resourcelocation);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
if (par4 != 1) {
|
||||
switch (par4) {
|
||||
case 2:
|
||||
GL11.glTranslatef(par1 + 0.5F, par2 + 0.25F, par3 + 0.74F);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glTranslatef(par1 + 0.5F, par2 + 0.25F, par3 + 0.26F);
|
||||
par5 = 180.0F;
|
||||
break;
|
||||
case 4:
|
||||
GL11.glTranslatef(par1 + 0.74F, par2 + 0.25F, par3 + 0.5F);
|
||||
par5 = 270.0F;
|
||||
break;
|
||||
case 5:
|
||||
default:
|
||||
GL11.glTranslatef(par1 + 0.26F, par2 + 0.25F, par3 + 0.5F);
|
||||
par5 = 90.0F;
|
||||
}
|
||||
} else GL11.glTranslatef(par1 + 0.5F, par2, par3 + 0.5F);
|
||||
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glScalef(-1.0F, -1.0F, 1.0F);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
modelSkull.render(null, 0F, 0F, 0F, par5, 0F, 0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
} else super.func_152674_a(par1, par2, par3, par4, par5, par6, gameProfile);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
"url": "http://www.vazkii.us",
|
||||
"updateUrl": "",
|
||||
"authorList": ["Vazkii"],
|
||||
"credits": "Azanor, dylan4ever, Flaxbeard, Futureazoo, wiiv, Rorax, Adubbz, Auric245524, MegaManki, mDiyo, Mikeemoo, ChickenBones, PowerCrystals, cpw",
|
||||
"credits": "Azanor, dylan4ever, Flaxbeard, Futureazoo, wiiv, Rorax, Adubbz, Auric245524, MegaManki, Kihira, mDiyo, Mikeemoo, ChickenBones, PowerCrystals, cpw",
|
||||
"parent": "",
|
||||
"screenshots": [],
|
||||
"dependencies": []
|
||||
|
||||
Reference in new issue
Block a user