use of net.mcft.copy.betterstorage.client.model.ModelBackpackArmor in project BetterStorage by copygirl.
the class ClientProxy method onRenderPlayerSpecialsPre.
@SubscribeEvent
public void onRenderPlayerSpecialsPre(RenderPlayerEvent.Specials.Pre event) {
ItemStack backpack = ItemBackpack.getBackpackData(event.entityPlayer).backpack;
if (backpack != null) {
EntityPlayer player = event.entityPlayer;
float partial = event.partialRenderTick;
ItemBackpack backpackType = (ItemBackpack) backpack.getItem();
int color = backpackType.getColor(backpack);
ModelBackpackArmor model = (ModelBackpackArmor) backpackType.getArmorModel(player, backpack, 0);
model.onGround = ReflectionUtils.invoke(RendererLivingEntity.class, event.renderer, "func_77040_d", "renderSwingProgress", EntityLivingBase.class, float.class, player, partial);
model.setLivingAnimations(player, 0, 0, partial);
RenderUtils.bindTexture(new ResourceLocation(backpackType.getArmorTexture(backpack, player, 0, null)));
RenderUtils.setColorFromInt((color >= 0) ? color : 0xFFFFFF);
model.render(player, 0, 0, 0, 0, 0, 0);
if (color >= 0) {
RenderUtils.bindTexture(new ResourceLocation(backpackType.getArmorTexture(backpack, player, 0, "overlay")));
GL11.glColor3f(1.0F, 1.0F, 1.0F);
model.render(player, 0, 0, 0, 0, 0, 0);
}
if (backpack.isItemEnchanted()) {
float f9 = player.ticksExisted + partial;
RenderUtils.bindTexture(Resources.enchantedEffect);
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(0.5F, 0.5F, 0.5F, 1.0F);
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDepthMask(false);
for (int k = 0; k < 2; ++k) {
GL11.glDisable(GL11.GL_LIGHTING);
float f11 = 0.76F;
GL11.glColor4f(0.5F * f11, 0.25F * f11, 0.8F * f11, 1.0F);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glLoadIdentity();
float f12 = f9 * (0.001F + k * 0.003F) * 20.0F;
float f13 = 0.33333334F;
GL11.glScalef(f13, f13, f13);
GL11.glRotatef(30.0F - k * 60.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, f12, 0.0F);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
model.render(player, 0, 0, 0, 0, 0, 0);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glDepthMask(true);
GL11.glLoadIdentity();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
} else
backpack = ItemBackpack.getBackpack(event.entityPlayer);
if (backpack != null)
event.renderCape = false;
}
use of net.mcft.copy.betterstorage.client.model.ModelBackpackArmor in project BetterStorage by copygirl.
the class ItemBackpack method getArmorModel.
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entity, ItemStack stack, int slot) {
if (modelArmor == null) {
try {
ModelBackpack model = getModelClass().getConstructor(boolean.class).newInstance(false);
modelArmor = new ModelBackpackArmor(model);
} catch (Exception e) {
e.printStackTrace();
}
}
return modelArmor;
}
Aggregations