错误:
java.lang.ClassCastException: net.minecraft.client.model.ModelZombie cannot be cast to net.minecraft.client.model.ModelPlayer
at net.minecraft.client.renderer.entity.RenderPlayer.getMainModel(RenderPlayer.java:42)
at net.minecraft.client.renderer.entity.RenderPlayer.renderRightArm(RenderPlayer.java:122)
at net.minecraft.client.renderer.ItemRenderer.func_178095_a(ItemRenderer.java:207)
at net.minecraft.client.renderer.ItemRenderer.renderItemInFirstPerson(ItemRenderer.java:322)
at net.minecraft.client.renderer.EntityRenderer.renderHand(EntityRenderer.java:1018)
at net.minecraft.client.renderer.EntityRenderer.renderHand(EntityRenderer.java:963)
at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1898)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1528)
at net.minecraft.client.renderer.EntityRenderer.func_181560_a(EntityRenderer.java:1326)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1129)
at net.minecraft.client.Minecraft.run(Minecraft.java:421)
at net.minecraft.client.main.Main.main(Main.java:113)
at Start.main(Start.java:11)
错误、代码路径和所有已知详细信息的详细演练如下:
-- Head --
Stacktrace:
at net.minecraft.client.renderer.entity.RenderPlayer.getMainModel(RenderPlayer.java:42)
at net.minecraft.client.renderer.entity.RenderPlayer.renderRightArm(RenderPlayer.java:122)
at net.minecraft.client.renderer.ItemRenderer.func_178095_a(ItemRenderer.java:207)
at net.minecraft.client.renderer.ItemRenderer.renderItemInFirstPerson(ItemRenderer.java:322)
at net.minecraft.client.renderer.EntityRenderer.renderHand(EntityRenderer.java:1018)
at net.minecraft.client.renderer.EntityRenderer.renderHand(EntityRenderer.java:963)
at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1898)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1528)
调用错误的类:
package net.minecraft.client.renderer.entity;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.layers.LayerArrow;
import net.minecraft.client.renderer.entity.layers.LayerBipedArmor;
import net.minecraft.client.renderer.entity.layers.LayerCape;
import net.minecraft.client.renderer.entity.layers.LayerCustomHead;
import net.minecraft.client.renderer.entity.layers.LayerDeadmau5Head;
import net.minecraft.client.renderer.entity.layers.LayerHeldItem;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EnumPlayerModelParts;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.scoreboard.Score;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.util.ResourceLocation;
public class RenderPlayer extends RendererLivingEntity<AbstractClientPlayer> {
private boolean smallArms;
public RenderPlayer(RenderManager renderManager) {
this(renderManager, false);
}
public RenderPlayer(RenderManager renderManager, boolean useSmallArms) {
super(renderManager, (ModelBase)new ModelPlayer(0.0F, useSmallArms), 0.5F);
this.smallArms = useSmallArms;
addLayer(new LayerBipedArmor(this));
addLayer(new LayerHeldItem(this));
addLayer(new LayerArrow(this));
addLayer(new LayerDeadmau5Head(this));
addLayer(new LayerCape(this));
addLayer(new LayerCustomHead((getMainModel()).bipedHead));
}
public ModelPlayer getMainModel() {
return (ModelPlayer)super.getMainModel();
}
public void setMainModel(float scale) {
this.mainModel = (ModelBase)new ModelPlayer(scale, this.smallArms);
}
public void doRender(AbstractClientPlayer entity, double x, double y, double z, float entityYaw, float partialTicks) {
if (!entity.isUser() || this.renderManager.livingPlayer == entity) {
double d0 = y;
if (entity.isSneaking() && !(entity instanceof net.minecraft.client.entity.EntityPlayerSP))
d0 = y - 0.125D;
setModelVisibilities(entity);
super.doRender(entity, x, d0, z, entityYaw, partialTicks);
}
}
private void setModelVisibilities(AbstractClientPlayer clientPlayer) {
ModelPlayer modelplayer = getMainModel();
if (clientPlayer.isSpectator()) {
modelplayer.setInvisible(false);
modelplayer.bipedHead.showModel = true;
modelplayer.bipedHeadwear.showModel = true;
} else {
ItemStack itemstack = clientPlayer.inventory.getCurrentItem();
modelplayer.setInvisible(true);
modelplayer.bipedHeadwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.HAT);
modelplayer.bipedBodyWear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.JACKET);
modelplayer.bipedLeftLegwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.LEFT_PANTS_LEG);
modelplayer.bipedRightLegwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_PANTS_LEG);
modelplayer.bipedLeftArmwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.LEFT_SLEEVE);
modelplayer.bipedRightArmwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_SLEEVE);
modelplayer.heldItemLeft = 0;
modelplayer.aimedBow = false;
modelplayer.isSneak = clientPlayer.isSneaking();
if (itemstack == null) {
modelplayer.heldItemRight = 0;
} else {
modelplayer.heldItemRight = 1;
if (clientPlayer.getItemInUseCount() > 0) {
EnumAction enumaction = itemstack.getItemUseAction();
if (enumaction == EnumAction.BLOCK) {
modelplayer.heldItemRight = 3;
} else if (enumaction == EnumAction.BOW) {
modelplayer.aimedBow = true;
}
}
}
}
}
protected ResourceLocation getEntityTexture(AbstractClientPlayer entity) {
return entity.getLocationSkin();
}
public void transformHeldFull3DItemLayer() {
GlStateManager.translate(0.0F, 0.1875F, 0.0F);
}
protected void preRenderCallback(AbstractClientPlayer entitylivingbaseIn, float partialTickTime) {
float f = 0.9375F;
GlStateManager.scale(f, f, f);
}
protected void renderOffsetLivingLabel(AbstractClientPlayer entityIn, double x, double y, double z, String str, float p_177069_9_, double p_177069_10_) {
if (p_177069_10_ < 100.0D) {
Scoreboard scoreboard = entityIn.getWorldScoreboard();
ScoreObjective scoreobjective = scoreboard.getObjectiveInDisplaySlot(2);
if (scoreobjective != null) {
Score score = scoreboard.getValueFromObjective(entityIn.getName(), scoreobjective);
renderLivingLabel(entityIn, score.getScorePoints() + " " + scoreobjective.getDisplayName(), x, y, z, 64);
y += ((getFontRendererFromRenderManager()).FONT_HEIGHT * 1.15F * p_177069_9_);
}
}
super.renderOffsetLivingLabel(entityIn, x, y, z, str, p_177069_9_, p_177069_10_);
}
public void renderRightArm(AbstractClientPlayer clientPlayer) {
float f = 1.0F;
GlStateManager.color(f, f, f);
ModelPlayer modelplayer = getMainModel();
setModelVisibilities(clientPlayer);
modelplayer.swingProgress = 0.0F;
modelplayer.isSneak = false;
modelplayer.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, (Entity)clientPlayer);
modelplayer.renderRightArm();
}
public void renderLeftArm(AbstractClientPlayer clientPlayer) {
float f = 1.0F;
GlStateManager.color(f, f, f);
ModelPlayer modelplayer = getMainModel();
setModelVisibilities(clientPlayer);
modelplayer.isSneak = false;
modelplayer.swingProgress = 0.0F;
modelplayer.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, (Entity)clientPlayer);
modelplayer.renderLeftArm();
}
protected void renderLivingAt(AbstractClientPlayer entityLivingBaseIn, double x, double y, double z) {
if (entityLivingBaseIn.isEntityAlive() && entityLivingBaseIn.isPlayerSleeping()) {
super.renderLivingAt(entityLivingBaseIn, x + entityLivingBaseIn.renderOffsetX, y + entityLivingBaseIn.renderOffsetY, z + entityLivingBaseIn.renderOffsetZ);
} else {
super.renderLivingAt(entityLivingBaseIn, x, y, z);
}
}
protected void rotateCorpse(AbstractClientPlayer bat, float p_77043_2_, float p_77043_3_, float partialTicks) {
if (bat.isEntityAlive() && bat.isPlayerSleeping()) {
GlStateManager.rotate(bat.getBedOrientationInDegrees(), 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(getDeathMaxRotation(bat), 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(270.0F, 0.0F, 1.0F, 0.0F);
} else {
super.rotateCorpse(bat, p_77043_2_, p_77043_3_, partialTicks);
}
}
}
具体称为错误的行:
public ModelPlayer getMainModel() {
return (ModelPlayer)super.getMainModel();
}
您可能需要的其他课程:
package net.minecraft.client.renderer;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraft.world.storage.MapData;
import optifine.Config;
import optifine.DynamicLights;
import optifine.Reflector;
import org.lwjgl.opengl.GL11;
import shadersmod.client.Shaders;
public class ItemRenderer {
private static final ResourceLocation RES_MAP_BACKGROUND = new ResourceLocation("textures/map/map_background.png");
private static final ResourceLocation RES_UNDERWATER_OVERLAY = new ResourceLocation("textures/misc/underwater.png");
private final Minecraft mc;
private ItemStack itemToRender;
private float equippedProgress;
private float prevEquippedProgress;
private final RenderManager renderManager;
private final RenderItem itemRenderer;
private int equippedItemSlot = -1;
private static final String __OBFID = "CL_00000953";
public ItemRenderer(Minecraft mcIn) {
this.mc = mcIn;
this.renderManager = mcIn.getRenderManager();
this.itemRenderer = mcIn.getRenderItem();
}
public void renderItem(EntityLivingBase entityIn, ItemStack heldStack, ItemCameraTransforms.TransformType transform) {
if (heldStack != null) {
Item item = heldStack.getItem();
Block block = Block.getBlockFromItem(item);
GlStateManager.pushMatrix();
if (this.itemRenderer.shouldRenderItemIn3D(heldStack)) {
GlStateManager.scale(2.0F, 2.0F, 2.0F);
if (isBlockTranslucent(block) && (!Config.isShaders() || !Shaders.renderItemKeepDepthMask))
GlStateManager.depthMask(false);
}
this.itemRenderer.renderItemModelForEntity(heldStack, entityIn, transform);
if (isBlockTranslucent(block))
GlStateManager.depthMask(true);
GlStateManager.popMatrix();
}
}
private boolean isBlockTranslucent(Block blockIn) {
return (blockIn != null && blockIn.getBlockLayer() == EnumWorldBlockLayer.TRANSLUCENT);
}
private void func_178101_a(float angle, float p_178101_2_) {
GlStateManager.pushMatrix();
GlStateManager.rotate(angle, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(p_178101_2_, 0.0F, 1.0F, 0.0F);
RenderHelper.enableStandardItemLighting();
GlStateManager.popMatrix();
}
private void func_178109_a(AbstractClientPlayer clientPlayer) {
int i = this.mc.theWorld.getCombinedLight(new BlockPos(clientPlayer.posX, clientPlayer.posY + clientPlayer.getEyeHeight(), clientPlayer.posZ), 0);
if (Config.isDynamicLights())
i = DynamicLights.getCombinedLight(this.mc.getRenderViewEntity(), i);
float f = (i & 0xFFFF);
float f1 = (i >> 16);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f, f1);
}
private void func_178110_a(EntityPlayerSP entityplayerspIn, float partialTicks) {
float f = entityplayerspIn.prevRenderArmPitch + (entityplayerspIn.renderArmPitch - entityplayerspIn.prevRenderArmPitch) * partialTicks;
float f1 = entityplayerspIn.prevRenderArmYaw + (entityplayerspIn.renderArmYaw - entityplayerspIn.prevRenderArmYaw) * partialTicks;
GlStateManager.rotate((entityplayerspIn.rotationPitch - f) * 0.1F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate((entityplayerspIn.rotationYaw - f1) * 0.1F, 0.0F, 1.0F, 0.0F);
}
private float func_178100_c(float p_178100_1_) {
float f = 1.0F - p_178100_1_ / 45.0F + 0.1F;
f = MathHelper.clamp_float(f, 0.0F, 1.0F);
f = -MathHelper.cos(f * 3.1415927F) * 0.5F + 0.5F;
return f;
}
private void renderRightArm(RenderPlayer renderPlayerIn) {
GlStateManager.pushMatrix();
GlStateManager.rotate(54.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(64.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(-62.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.translate(0.25F, -0.85F, 0.75F);
renderPlayerIn.renderRightArm((AbstractClientPlayer)this.mc.thePlayer);
GlStateManager.popMatrix();
}
private void renderLeftArm(RenderPlayer renderPlayerIn) {
GlStateManager.pushMatrix();
GlStateManager.rotate(92.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(41.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.translate(-0.3F, -1.1F, 0.45F);
renderPlayerIn.renderLeftArm((AbstractClientPlayer)this.mc.thePlayer);
GlStateManager.popMatrix();
}
private void renderPlayerArms(AbstractClientPlayer clientPlayer) {
this.mc.getTextureManager().bindTexture(clientPlayer.getLocationSkin());
Render render = this.renderManager.getEntityRenderObject((Entity)this.mc.thePlayer);
RenderPlayer renderplayer = (RenderPlayer)render;
if (!clientPlayer.isInvisible()) {
GlStateManager.disableCull();
renderRightArm(renderplayer);
renderLeftArm(renderplayer);
GlStateManager.enableCull();
}
}
private void renderItemMap(AbstractClientPlayer clientPlayer, float p_178097_2_, float p_178097_3_, float p_178097_4_) {
float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(p_178097_4_) * 3.1415927F);
float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(p_178097_4_) * 3.1415927F * 2.0F);
float f2 = -0.2F * MathHelper.sin(p_178097_4_ * 3.1415927F);
GlStateManager.translate(f, f1, f2);
float f3 = func_178100_c(p_178097_2_);
GlStateManager.translate(0.0F, 0.04F, -0.72F);
GlStateManager.translate(0.0F, p_178097_3_ * -1.2F, 0.0F);
GlStateManager.translate(0.0F, f3 * -0.5F, 0.0F);
GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(f3 * -85.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(0.0F, 1.0F, 0.0F, 0.0F);
renderPlayerArms(clientPlayer);
float f4 = MathHelper.sin(p_178097_4_ * p_178097_4_ * 3.1415927F);
float f5 = MathHelper.sin(MathHelper.sqrt_float(p_178097_4_) * 3.1415927F);
GlStateManager.rotate(f4 * -20.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(f5 * -20.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(f5 * -80.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.scale(0.38F, 0.38F, 0.38F);
GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(0.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.translate(-1.0F, -1.0F, 0.0F);
GlStateManager.scale(0.015625F, 0.015625F, 0.015625F);
this.mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
GL11.glNormal3f(0.0F, 0.0F, -1.0F);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(-7.0D, 135.0D, 0.0D).tex(0.0D, 1.0D).endVertex();
worldrenderer.pos(135.0D, 135.0D, 0.0D).tex(1.0D, 1.0D).endVertex();
worldrenderer.pos(135.0D, -7.0D, 0.0D).tex(1.0D, 0.0D).endVertex();
worldrenderer.pos(-7.0D, -7.0D, 0.0D).tex(0.0D, 0.0D).endVertex();
tessellator.draw();
MapData mapdata = Items.filled_map.getMapData(this.itemToRender, (World)this.mc.theWorld);
if (mapdata != null)
this.mc.entityRenderer.getMapItemRenderer().renderMap(mapdata, false);
}
private void func_178095_a(AbstractClientPlayer clientPlayer, float p_178095_2_, float p_178095_3_) {
float f = -0.3F * MathHelper.sin(MathHelper.sqrt_float(p_178095_3_) * 3.1415927F);
float f1 = 0.4F * MathHelper.sin(MathHelper.sqrt_float(p_178095_3_) * 3.1415927F * 2.0F);
float f2 = -0.4F * MathHelper.sin(p_178095_3_ * 3.1415927F);
GlStateManager.translate(f, f1, f2);
GlStateManager.translate(0.64000005F, -0.6F, -0.71999997F);
GlStateManager.translate(0.0F, p_178095_2_ * -0.6F, 0.0F);
GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F);
float f3 = MathHelper.sin(p_178095_3_ * p_178095_3_ * 3.1415927F);
float f4 = MathHelper.sin(MathHelper.sqrt_float(p_178095_3_) * 3.1415927F);
GlStateManager.rotate(f4 * 70.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(f3 * -20.0F, 0.0F, 0.0F, 1.0F);
this.mc.getTextureManager().bindTexture(clientPlayer.getLocationSkin());
GlStateManager.translate(-1.0F, 3.6F, 3.5F);
GlStateManager.rotate(120.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(200.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.scale(1.0F, 1.0F, 1.0F);
GlStateManager.translate(5.6F, 0.0F, 0.0F);
Render render = this.renderManager.getEntityRenderObject((Entity)this.mc.thePlayer);
GlStateManager.disableCull();
RenderPlayer renderplayer = (RenderPlayer)render;
renderplayer.renderRightArm((AbstractClientPlayer)this.mc.thePlayer);
GlStateManager.enableCull();
}
private void func_178105_d(float p_178105_1_) {
float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(p_178105_1_) * 3.1415927F);
float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(p_178105_1_) * 3.1415927F * 2.0F);
float f2 = -0.2F * MathHelper.sin(p_178105_1_ * 3.1415927F);
GlStateManager.translate(f, f1, f2);
}
private void func_178104_a(AbstractClientPlayer clientPlayer, float p_178104_2_) {
float f = clientPlayer.getItemInUseCount() - p_178104_2_ + 1.0F;
float f1 = f / this.itemToRender.getMaxItemUseDuration();
float f2 = MathHelper.abs(MathHelper.cos(f / 4.0F * 3.1415927F) * 0.1F);
if (f1 >= 0.8F)
f2 = 0.0F;
GlStateManager.translate(0.0F, f2, 0.0F);
float f3 = 1.0F - (float)Math.pow(f1, 27.0D);
GlStateManager.translate(f3 * 0.6F, f3 * -0.5F, f3 * 0.0F);
GlStateManager.rotate(f3 * 90.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(f3 * 10.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(f3 * 30.0F, 0.0F, 0.0F, 1.0F);
}
private void transformFirstPersonItem(float equipProgress, float swingProgress) {
boolean displayLegacyAnimations = true;
if (displayLegacyAnimations && this.mc != null && this.mc.thePlayer != null && this.mc.thePlayer.getItemInUse() != null && this.mc.thePlayer.getItemInUse().getItem() != null && Item.getIdFromItem(this.mc.thePlayer.getItemInUse().getItem()) == 261)
GlStateManager.translate(-0.01F, 0.05F, -0.06F);
if (displayLegacyAnimations && this.mc != null && this.mc.thePlayer != null && this.mc.thePlayer.getCurrentEquippedItem() != null && this.mc.thePlayer.getCurrentEquippedItem().getItem() != null && Item.getIdFromItem(this.mc.thePlayer.getCurrentEquippedItem().getItem()) == 346) {
GlStateManager.translate(0.08F, -0.027F, -0.33F);
GlStateManager.scale(0.93F, 1.0F, 1.0F);
}
if (displayLegacyAnimations && this.mc != null && this.mc.thePlayer != null && this.mc.thePlayer.isSwingInProgress && this.mc.thePlayer.getCurrentEquippedItem() != null && !this.mc.thePlayer.isEating() && !this.mc.thePlayer.isBlocking()) {
GlStateManager.scale(0.85F, 0.85F, 0.85F);
GlStateManager.translate(-0.078F, 0.003F, 0.05F);
}
GlStateManager.translate(0.56F, -0.52F, -0.71999997F);
GlStateManager.translate(0.0F, equipProgress * -0.6F, 0.0F);
GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F);
float f = MathHelper.sin(swingProgress * swingProgress * 3.1415927F);
float f1 = MathHelper.sin(MathHelper.sqrt_float(swingProgress) * 3.1415927F);
GlStateManager.rotate(f * -20.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(f1 * -20.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(f1 * -80.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.scale(0.4F, 0.4F, 0.4F);
}
private void func_178098_a(float p_178098_1_, AbstractClientPlayer clientPlayer) {
GlStateManager.rotate(-18.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(-12.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-8.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.translate(-0.9F, 0.2F, 0.0F);
float f = this.itemToRender.getMaxItemUseDuration() - clientPlayer.getItemInUseCount() - p_178098_1_ + 1.0F;
float f1 = f / 20.0F;
f1 = (f1 * f1 + f1 * 2.0F) / 3.0F;
if (f1 > 1.0F)
f1 = 1.0F;
if (f1 > 0.1F) {
float f2 = MathHelper.sin((f - 0.1F) * 1.3F);
float f3 = f1 - 0.1F;
float f4 = f2 * f3;
GlStateManager.translate(f4 * 0.0F, f4 * 0.01F, f4 * 0.0F);
}
GlStateManager.translate(f1 * 0.0F, f1 * 0.0F, f1 * 0.1F);
GlStateManager.scale(1.0F, 1.0F, 1.0F + f1 * 0.2F);
}
private void func_178103_d() {
GlStateManager.translate(-0.5F, 0.2F, 0.0F);
GlStateManager.rotate(30.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-80.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(60.0F, 0.0F, 1.0F, 0.0F);
}
public void renderItemInFirstPerson(float partialTicks) {
float f = 1.0F - this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * partialTicks;
EntityPlayerSP entityplayersp = this.mc.thePlayer;
float f1 = entityplayersp.getSwingProgress(partialTicks);
float f2 = entityplayersp.prevRotationPitch + (entityplayersp.rotationPitch - entityplayersp.prevRotationPitch) * partialTicks;
float f3 = entityplayersp.prevRotationYaw + (entityplayersp.rotationYaw - entityplayersp.prevRotationYaw) * partialTicks;
func_178101_a(f2, f3);
func_178109_a((AbstractClientPlayer)entityplayersp);
func_178110_a(entityplayersp, partialTicks);
GlStateManager.enableRescaleNormal();
GlStateManager.pushMatrix();
if (this.itemToRender != null) {
if (this.itemToRender.getItem() instanceof net.minecraft.item.ItemMap) {
renderItemMap((AbstractClientPlayer)entityplayersp, f2, f, f1);
} else if (entityplayersp.getItemInUseCount() > 0) {
EnumAction enumaction = this.itemToRender.getItemUseAction();
switch (ItemRenderer$1.field_178094_a[enumaction.ordinal()]) {
case 1:
transformFirstPersonItem(f, entityplayersp.getSwingProgress(partialTicks));
break;
case 2:
case 3:
func_178104_a((AbstractClientPlayer)entityplayersp, partialTicks);
transformFirstPersonItem(f, entityplayersp.getSwingProgress(partialTicks));
break;
case 4:
transformFirstPersonItem(f, entityplayersp.getSwingProgress(partialTicks));
func_178103_d();
break;
case 5:
transformFirstPersonItem(f, entityplayersp.getSwingProgress(partialTicks));
func_178098_a(partialTicks, (AbstractClientPlayer)entityplayersp);
break;
}
} else {
func_178105_d(f1);
transformFirstPersonItem(f, f1);
}
renderItem((EntityLivingBase)entityplayersp, this.itemToRender, ItemCameraTransforms.TransformType.FIRST_PERSON);
} else if (!entityplayersp.isInvisible()) {
func_178095_a((AbstractClientPlayer)entityplayersp, f, f1);
}
GlStateManager.popMatrix();
GlStateManager.disableRescaleNormal();
RenderHelper.disableStandardItemLighting();
}
public void renderOverlays(float partialTicks) {
GlStateManager.disableAlpha();
if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) {
IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos((Entity)this.mc.thePlayer));
BlockPos blockpos = new BlockPos((Entity)this.mc.thePlayer);
EntityPlayerSP entityplayersp = this.mc.thePlayer;
for (int i = 0; i < 8; i++) {
double d0 = entityplayersp.posX + ((((i >> 0) % 2) - 0.5F) * entityplayersp.width * 0.8F);
double d1 = entityplayersp.posY + ((((i >> 1) % 2) - 0.5F) * 0.1F);
double d2 = entityplayersp.posZ + ((((i >> 2) % 2) - 0.5F) * entityplayersp.width * 0.8F);
BlockPos blockpos1 = new BlockPos(d0, d1 + entityplayersp.getEyeHeight(), d2);
IBlockState iblockstate1 = this.mc.theWorld.getBlockState(blockpos1);
if (iblockstate1.getBlock().isVisuallyOpaque()) {
iblockstate = iblockstate1;
blockpos = blockpos1;
}
}
Object object = Reflector.getFieldValue(Reflector.RenderBlockOverlayEvent_OverlayType_BLOCK);
if (iblockstate.getBlock().getRenderType() != -1 && !Reflector.callBoolean(Reflector.ForgeEventFactory_renderBlockOverlay, new Object[] { this.mc.thePlayer, Float.valueOf(partialTicks), object, iblockstate, blockpos }))
func_178108_a(partialTicks, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate));
}
if (!this.mc.thePlayer.isSpectator()) {
if (this.mc.thePlayer.isInsideOfMaterial(Material.water) && !Reflector.callBoolean(Reflector.ForgeEventFactory_renderWaterOverlay, new Object[] { this.mc.thePlayer, Float.valueOf(partialTicks) }))
renderWaterOverlayTexture(partialTicks);
if (this.mc.thePlayer.isBurning() && !Reflector.callBoolean(Reflector.ForgeEventFactory_renderFireOverlay, new Object[] { this.mc.thePlayer, Float.valueOf(partialTicks) }))
renderFireInFirstPerson(partialTicks);
}
GlStateManager.enableAlpha();
}
private void func_178108_a(float p_178108_1_, TextureAtlasSprite p_178108_2_) {
this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
float f = 0.1F;
GlStateManager.color(0.1F, 0.1F, 0.1F, 0.5F);
GlStateManager.pushMatrix();
float f1 = -1.0F;
float f2 = 1.0F;
float f3 = -1.0F;
float f4 = 1.0F;
float f5 = -0.5F;
float f6 = p_178108_2_.getMinU();
float f7 = p_178108_2_.getMaxU();
float f8 = p_178108_2_.getMinV();
float f9 = p_178108_2_.getMaxV();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(-1.0D, -1.0D, -0.5D).tex(f7, f9).endVertex();
worldrenderer.pos(1.0D, -1.0D, -0.5D).tex(f6, f9).endVertex();
worldrenderer.pos(1.0D, 1.0D, -0.5D).tex(f6, f8).endVertex();
worldrenderer.pos(-1.0D, 1.0D, -0.5D).tex(f7, f8).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
'''
PS: If you need more pls tell me
暂无答案!
目前还没有任何答案,快来回答吧!