private void setRenderHead(EntityLivingBase entity, boolean setRender) { if (entity.getItemStackFromSlot(EntityEquipmentSlot.HEAD).getItem() == Itemss.PNEUMATIC_HELMET && (ConfigHandler.client.useHelmetModel || DateEventHandler.isIronManEvent())) { Render renderer = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(entity); if (renderer instanceof RenderBiped) { ModelBiped modelBiped = (ModelBiped) ((RenderBiped) renderer).getMainModel(); modelBiped.bipedHead.showModel = setRender; } } }
@Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { if(stack.toString().contains("leggings") || stack.toString().contains("Leggings")) { return ModInfo.MODID + ":textures/models/armor/" + RenderBiped.bipedArmorFilenamePrefix[index] + "_layer_2.png"; } else { return ModInfo.MODID + ":textures/models/armor/" + RenderBiped.bipedArmorFilenamePrefix[index] + "_layer_1.png"; } }
/** * Adds a render name for armour. Uses reflection because Mojang choices. * @param renderId */ public static final void addArmourRenderString(String renderId) { String[] bipedArmorFilenamePrefixes = ReflectionManipulateValues.getValue(RenderBiped.class, null, "bipedArmorFilenamePrefix"); String[] newPrefixes = new String[bipedArmorFilenamePrefixes.length + 1]; for (int i = 0; i == bipedArmorFilenamePrefixes.length; i++) { newPrefixes[i] = bipedArmorFilenamePrefixes[i]; } newPrefixes[newPrefixes.length] = renderId; ReflectionManipulateValues.setValue(RenderBiped.class, null, "bipedArmorFilenamePrefix", newPrefixes); }
protected void func_130220_b(AbstractClientPlayer p_130220_1_, int p_130220_2_, float p_130220_3_) { ItemStack var4 = p_130220_1_.field_71071_by.func_70440_f(3 - p_130220_2_); if(var4 != null) { Item var5 = var4.func_77973_b(); if(var5 instanceof ItemArmor) { this.func_110776_a(RenderBiped.func_110858_a((ItemArmor)var5, p_130220_2_, "overlay")); float var6 = 1.0F; GL11.glColor3f(var6, var6, var6); } } }
protected void func_130220_b(EntityStatuePlayer par1EntityFakePlayer, int par2, float par3) { ItemStack itemstack = par1EntityFakePlayer.inventory.armorItemInSlot(3 - par2); if (itemstack != null) { Item item = itemstack.getItem(); if (item instanceof ItemArmor) { bindTexture(RenderBiped.getArmorResource(par1EntityFakePlayer, itemstack, par2, "overlay")); float f1 = 1.0F; GL11.glColor3f(f1, f1, f1); } } }
private void setRenderHead(EntityLivingBase entity, boolean setRender){ if(entity.getEquipmentInSlot(4) != null && entity.getEquipmentInSlot(4).getItem() == Itemss.pneumaticHelmet && (Config.useHelmetModel || DateEventHandler.isIronManEvent())) { Render renderer = RenderManager.instance.getEntityRenderObject(entity); if(renderer instanceof RenderBiped) { ((RenderBiped)renderer).modelBipedMain.bipedHead.showModel = setRender; } } }
/** * Add a new armour prefix to the RenderPlayer * * @param armor */ public static int addNewArmourRendererPrefix(String armor) { RenderBiped.field_82424_k = ObjectArrays.concat(RenderBiped.field_82424_k, armor); return RenderBiped.field_82424_k.length - 1; }
@SubscribeEvent @SideOnly(Side.CLIENT) public void onRenderPlayerSetArmorModel(RenderPlayerEvent.SetArmorModel event) { if (!ProxyClient.isVRPlayer(event.entityPlayer)) return; if (event.stack != null) { Item item = event.stack.getItem(); if (item instanceof ItemArmor) { VRPlayerData data = ProxyClient.vrPlayerIds.get(event.entityPlayer.getEntityId()); ItemArmor itemarmor = (ItemArmor)item; ((RenderPlayer)event.renderer).bindTexture(RenderBiped.getArmorResource(event.entityPlayer, event.stack, 3 - event.slot, null)); ModelBiped modelbiped = event.slot == 1 ? ((RenderPlayer)event.renderer).modelArmor : ((RenderPlayer)event.renderer).modelArmorChestplate; modelbiped.bipedHead.showModel = event.slot == 3; modelbiped.bipedHeadwear.showModel = event.slot == 3; modelbiped.bipedBody.showModel = event.slot == 2 || event.slot == 1; modelbiped.bipedRightArm.showModel = event.slot == 2; modelbiped.bipedLeftArm.showModel = event.slot == 2; modelbiped.bipedRightLeg.showModel = event.slot == 1 || event.slot == 0; modelbiped.bipedLeftLeg.showModel = event.slot == 1 || event.slot == 0; modelbiped = net.minecraftforge.client.ForgeHooksClient.getArmorModel(event.entityPlayer, event.stack, 3 - event.slot, modelbiped); modelbiped.bipedHead.showModel = false; modelbiped.bipedHeadwear.showModel = false; modelbiped.bipedRightArm.showModel &= data.seated; modelbiped.bipedLeftArm.showModel &= data.seated; event.renderer.setRenderPassModel(modelbiped); modelbiped.onGround = ((RenderPlayer)event.renderer).mainModel.onGround; modelbiped.isRiding = ((RenderPlayer)event.renderer).mainModel.isRiding; modelbiped.isChild = ((RenderPlayer)event.renderer).mainModel.isChild; // Move outside if to allow for more then just CLOTH int j = itemarmor.getColor(event.stack); if (j != -1) { float f1 = (float) (j >> 16 & 255) / 255.0F; float f2 = (float) (j >> 8 & 255) / 255.0F; float f3 = (float) (j & 255) / 255.0F; GL11.glColor3f(f1, f2, f3); if (event.stack.isItemEnchanted()) { event.result = 31; return; } event.result = 16; return; } GL11.glColor3f(1.0F, 1.0F, 1.0F); if (event.stack.isItemEnchanted()) { event.result = 15; return; } event.result = 1; return; } } event.result = -2; }
@SubscribeEvent public void onRenderLivingPre(RenderLivingEvent.Pre event) { EntityGib[] gibs = amputationMap.get(event.getEntity()); if(gibs != null) { boolean gibbed = false; for(int i = 0; i <= 2; i++) { if(!gibs[i].attached) { gibbed = true; break; } } if(gibbed) { if(event.getRenderer() instanceof RenderBiped || event.getRenderer() instanceof RenderPlayer) { ModelBase model = event.getRenderer().mainModel; ModelBiped bipedPass1 = null; ModelBiped bipedPass2 = null; for(int i = 0; i < event.getRenderer().layerRenderers.size(); i++) { LayerRenderer layer = (LayerRenderer)event.getRenderer().layerRenderers.get(i); if(layer instanceof LayerBipedArmor) { LayerBipedArmor armor = (LayerBipedArmor)layer; bipedPass1 = armor.modelLeggings; bipedPass2 = armor.modelArmor; break; } } if(model instanceof ModelBiped && bipedPass1 != null && bipedPass2 != null) { ModelBiped biped = (ModelBiped)model; ModelGib.bipedHead1 = bipedPass1.bipedHead; ModelGib.bipedHeadwear1 = bipedPass1.bipedHeadwear; ModelGib.bipedLeftArm1 = bipedPass1.bipedLeftArm; ModelGib.bipedRightArm1 = bipedPass1.bipedRightArm; ModelGib.bipedHead2 = bipedPass2.bipedHead; ModelGib.bipedHeadwear2 = bipedPass2.bipedHeadwear; ModelGib.bipedLeftArm2 = bipedPass2.bipedLeftArm; ModelGib.bipedRightArm2 = bipedPass2.bipedRightArm; if(!gibs[0].attached) { biped.bipedHead.showModel = false; biped.bipedHeadwear.showModel = false; bipedPass1.bipedHead = bipedPass2.bipedHead = bipedPass1.bipedHeadwear = bipedPass2.bipedHeadwear = ModelGib.emptyModel; } if(!gibs[1].attached) { biped.bipedLeftArm.showModel = false; bipedPass1.bipedLeftArm = bipedPass2.bipedLeftArm = ModelGib.emptyModel; } if(!gibs[2].attached) { biped.bipedRightArm.showModel = false; bipedPass1.bipedRightArm = bipedPass2.bipedRightArm = ModelGib.emptyModel; } } } } } }
@SubscribeEvent public void onRenderLivingPost(RenderLivingEvent.Post event) { EntityGib[] gibs = amputationMap.get(event.getEntity()); if(gibs != null) { boolean gibbed = false; for(int i = 0; i <= 2; i++) { if(!gibs[i].attached) { gibbed = true; break; } } if(gibbed) { if(event.getRenderer() instanceof RenderBiped || event.getRenderer() instanceof RenderPlayer) { ModelBase model = event.getRenderer().mainModel; ModelBiped bipedPass1 = null; ModelBiped bipedPass2 = null; for(int i = 0; i < event.getRenderer().layerRenderers.size(); i++) { LayerRenderer layer = (LayerRenderer)event.getRenderer().layerRenderers.get(i); if(layer instanceof LayerBipedArmor) { LayerBipedArmor armor = (LayerBipedArmor)layer; bipedPass1 = armor.modelLeggings; bipedPass2 = armor.modelArmor; break; } } if(model instanceof ModelBiped && bipedPass1 != null && bipedPass2 != null) { ModelBiped biped = (ModelBiped)model; bipedPass1.bipedHead = ModelGib.bipedHead1; bipedPass1.bipedHeadwear = ModelGib.bipedHeadwear1; bipedPass1.bipedLeftArm = ModelGib.bipedLeftArm1; bipedPass1.bipedRightArm = ModelGib.bipedRightArm1; bipedPass2.bipedHead = ModelGib.bipedHead2; bipedPass2.bipedHeadwear = ModelGib.bipedHeadwear2; bipedPass2.bipedLeftArm = ModelGib.bipedLeftArm2; bipedPass2.bipedRightArm = ModelGib.bipedRightArm2; biped.bipedHead.showModel = true; biped.bipedHeadwear.showModel = true; biped.bipedLeftArm.showModel = true; biped.bipedRightArm.showModel = true; } } } } }
/** * Add a new armour prefix to the RenderPlayer * * @param armor */ public static int addNewArmourRendererPrefix(String armor) { RenderBiped.bipedArmorFilenamePrefix = ObjectArrays.concat(RenderBiped.bipedArmorFilenamePrefix, armor); return RenderBiped.bipedArmorFilenamePrefix.length - 1; }
@Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { return DefaultProps.blockKey + ":armor_sets/" + RenderBiped.bipedArmorFilenamePrefix[renderIndex] + "_" + (armorType == 2 ? 2 : 1) + ".png"; }
@Override public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) { if (this.isChild) { float var8 = 2.0F; GL11.glPushMatrix(); GL11.glScalef(1.5F / var8, 1.5F / var8, 1.5F / var8); GL11.glTranslatef(0.0F, 16.0F * par7, 0.0F); this.bipedHead.render(par7); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(1.0F / var8, 1.0F / var8, 1.0F / var8); GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F); this.bipedBody.render(par7); this.bipedRightArm.render(par7); this.bipedLeftArm.render(par7); this.bipedRightLeg.render(par7); this.bipedLeftLeg.render(par7); GL11.glPopMatrix(); } else { String textureLocation; ResourceLocation resource; ItemStack itemStack; float scale; /* Render Armor Legs */ textureLocation = "/armor/iron_2.png"; EntityHauntedArmor var5 = (EntityHauntedArmor) par1Entity; itemStack = var5.func_130225_q(2) != null ? var5.func_130225_q(2) : new ItemStack(Items.golden_chestplate); resource = RenderBiped.getArmorResource(par1Entity, itemStack, 2, null); Minecraft.getMinecraft().renderEngine.bindTexture(resource); scale = par7 * 0.85f; this.bipedRightLeg2.render(scale); this.bipedLeftLeg2.render(scale); /* Render Armor Upper Body */ textureLocation = "/armor/iron_1.png"; itemStack = var5.func_130225_q(1) != null ? var5.func_130225_q(2) : new ItemStack(Items.golden_leggings); resource = RenderBiped.getArmorResource(par1Entity, itemStack, 1, null); Minecraft.getMinecraft().renderEngine.bindTexture(resource); this.bipedHead.render(par7); this.bipedBody.render(par7); this.bipedRightArm.render(par7); this.bipedLeftArm.render(par7); this.bipedRightLeg.render(par7); this.bipedLeftLeg.render(par7); } }
protected int func_77107_a(AbstractClientPlayer p_77107_1_, int p_77107_2_, float p_77107_3_) { ItemStack var4 = p_77107_1_.field_71071_by.func_70440_f(3 - p_77107_2_); if(var4 != null) { Item var5 = var4.func_77973_b(); if(var5 instanceof ItemArmor) { ItemArmor var6 = (ItemArmor)var5; this.func_110776_a(RenderBiped.func_110857_a(var6, p_77107_2_)); ModelBiped var7 = p_77107_2_ == 2?this.field_77111_i:this.field_77108_b; var7.field_78116_c.field_78806_j = p_77107_2_ == 0; var7.field_78114_d.field_78806_j = p_77107_2_ == 0; var7.field_78115_e.field_78806_j = p_77107_2_ == 1 || p_77107_2_ == 2; var7.field_78112_f.field_78806_j = p_77107_2_ == 1; var7.field_78113_g.field_78806_j = p_77107_2_ == 1; var7.field_78123_h.field_78806_j = p_77107_2_ == 2 || p_77107_2_ == 3; var7.field_78124_i.field_78806_j = p_77107_2_ == 2 || p_77107_2_ == 3; this.func_77042_a(var7); var7.field_78095_p = this.field_77045_g.field_78095_p; var7.field_78093_q = this.field_77045_g.field_78093_q; var7.field_78091_s = this.field_77045_g.field_78091_s; float var8 = 1.0F; if(var6.func_82812_d() == EnumArmorMaterial.CLOTH) { int var9 = var6.func_82814_b(var4); float var10 = (float)(var9 >> 16 & 255) / 255.0F; float var11 = (float)(var9 >> 8 & 255) / 255.0F; float var12 = (float)(var9 & 255) / 255.0F; GL11.glColor3f(var8 * var10, var8 * var11, var8 * var12); if(var4.func_77948_v()) { return 31; } return 16; } GL11.glColor3f(var8, var8, var8); if(var4.func_77948_v()) { return 15; } return 1; } } return -1; }
/** * Set the specified armor model as the player model. Args: player, * armorSlot, partialTick */ protected int setArmorModel(EntityStatuePlayer par1EntityFakePlayer, int par2, float par3) { ItemStack itemstack = par1EntityFakePlayer.inventory.armorItemInSlot(3 - par2); if (itemstack != null) { Item item = itemstack.getItem(); if (item instanceof ItemArmor) { ItemArmor itemarmor = (ItemArmor) item; bindTexture(RenderBiped.getArmorResource(par1EntityFakePlayer, itemstack, par2, null)); ModelBiped modelbiped = par2 == 2 ? modelArmor : modelArmorChestplate; modelbiped.bipedHead.showModel = par2 == 0; modelbiped.bipedHeadwear.showModel = par2 == 0; modelbiped.bipedBody.showModel = par2 == 1 || par2 == 2; modelbiped.bipedRightArm.showModel = par2 == 1; modelbiped.bipedLeftArm.showModel = par2 == 1; modelbiped.bipedRightLeg.showModel = par2 == 2 || par2 == 3; modelbiped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3; modelbiped = ForgeHooksClient.getArmorModel(par1EntityFakePlayer, itemstack, par2, modelbiped); setRenderPassModel(modelbiped); modelbiped.onGround = mainModel.onGround; modelbiped.isRiding = mainModel.isRiding; modelbiped.isChild = mainModel.isChild; float f1 = 1.0F; // Move outside if to allow for more then just CLOTH int j = itemarmor.getColor(itemstack); if (j != -1) { float f2 = (j >> 16 & 255) / 255.0F; float f3 = (j >> 8 & 255) / 255.0F; float f4 = (j & 255) / 255.0F; GL11.glColor3f(f1 * f2, f1 * f3, f1 * f4); if (itemstack.isItemEnchanted()) { return 31; } return 16; } GL11.glColor3f(f1, f1, f1); if (itemstack.isItemEnchanted()) { return 15; } return 1; } } return -1; }
@Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { return DefaultProps.blockKey + ":textures/armor_sets/" + RenderBiped.bipedArmorFilenamePrefix[renderIndex] + "_" + (armorType == 2 ? 2 : 1) + ".png"; }