public RenderGuard(RenderManager renderManagerIn) { super(renderManagerIn, new ModelGuard(), 0.5F); LayerRenderer<?> layerrenderer = (LayerRenderer) this.layerRenderers.get(0); defaultModel = (ModelGuard) mainModel; addLayer(new LayerHeldItem(this)); LayerBipedArmor layerbipedarmor = new LayerBipedArmor(this) { protected void initArmor() { modelLeggings = new ModelZombie(0.5F, true); modelArmor = new ModelZombie(1.0F, true); } }; addLayer(layerbipedarmor); // addLayer(new LayerCape(this)); this.defaultLayers = Lists.newArrayList(this.layerRenderers); }
private static void replaceCapeLayer(@Nonnull RenderPlayer renderLivingBase) { try { List<LayerRenderer<AbstractClientPlayer>> value = ReflectionHelper.getPrivateValue(RenderLivingBase.class, renderLivingBase, "layerRenderers", "field_177097_h"); if (value != null) { LayerRenderer<AbstractClientPlayer> capeLayer = null; for (LayerRenderer<AbstractClientPlayer> layerRenderer : value) { if (layerRenderer instanceof LayerCape && !(layerRenderer instanceof CapeFilterLayer)) { capeLayer = layerRenderer; break; } } if (capeLayer != null) { renderLivingBase.addLayer(new CapeFilterLayer(capeLayer)); value.remove(capeLayer); } } } catch (UnableToAccessFieldException e) { Log.warn("Unable to access RenderLivingBase.layerRenderers, reason: " + e); } }
@Redirect(method = "renderLayers", at = @At(value = "INVOKE", target = "net/minecraft/client/renderer/entity/layers/LayerRenderer.doRenderLayer(Lnet/minecraft/entity/EntityLivingBase;FFFFFFF)V")) @SuppressWarnings("unchecked") private void doRenderLayer(LayerRenderer renderer, EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scaleIn) { LayerRenderEvent event = new LayerRenderEvent(entitylivingbaseIn, renderer); ClientAPI.EVENT_BUS.post(event); if (!event.isCancelled()) renderer.doRenderLayer(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scaleIn); }
public RenderZombie(RenderManager renderManagerIn) { super(renderManagerIn, new ModelZombie(), 0.5F, 1.0F); LayerRenderer layerrenderer = (LayerRenderer)this.layerRenderers.get(0); this.field_82434_o = this.modelBipedMain; this.zombieVillagerModel = new ModelZombieVillager(); this.addLayer(new LayerHeldItem(this)); LayerBipedArmor layerbipedarmor = new LayerBipedArmor(this) { protected void initArmor() { this.field_177189_c = new ModelZombie(0.5F, true); this.field_177186_d = new ModelZombie(1.0F, true); } }; this.addLayer(layerbipedarmor); this.field_177122_o = Lists.newArrayList(this.layerRenderers); if (layerrenderer instanceof LayerCustomHead) { this.removeLayer(layerrenderer); this.addLayer(new LayerCustomHead(this.zombieVillagerModel.bipedHead)); } this.removeLayer(layerbipedarmor); this.addLayer(new LayerVillagerArmor(this)); this.field_177121_n = Lists.newArrayList(this.layerRenderers); }
protected void renderLayers(T entitylivingbaseIn, float p_177093_2_, float p_177093_3_, float partialTicks, float p_177093_5_, float p_177093_6_, float p_177093_7_, float p_177093_8_) { for (LayerRenderer<T> layerrenderer : this.layerRenderers) { boolean flag = this.setBrightness(entitylivingbaseIn, partialTicks, layerrenderer.shouldCombineTextures()); layerrenderer.doRenderLayer(entitylivingbaseIn, p_177093_2_, p_177093_3_, partialTicks, p_177093_5_, p_177093_6_, p_177093_7_, p_177093_8_); if (flag) { this.unsetBrightness(); } } }
private RenderTreater(RenderManager renderManager, ModelBase model) { super(renderManager, model, 0.25F); this.defaultTreaterModel = this.mainModel; this.spiderTreaterModel = new ModelTreaterSpider(); this.defaultLayers = Lists.newArrayList(this.layerRenderers); this.creeperLayers = Collections.singletonList((LayerRenderer<EntityTreater>)new LayerTreaterCreeper(this)); this.witchLayers = Collections.singletonList((LayerRenderer<EntityTreater>)new LayerWitchClothes(this)); }
public IEntityRenderer makeEntityRender(ModelBase modelBase, float shadowSize) { RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); Render render = (Render)rendermanager.getEntityRenderMap().get(EntitySheep.class); if (!(render instanceof RenderSheep)) { Config.warn("Not a RenderSheep: " + render); return null; } else { if (render.getEntityClass() == null) { RenderSheep rendersheep = new RenderSheep(rendermanager); rendersheep.mainModel = new ModelSheep2(); rendersheep.shadowSize = 0.7F; render = rendersheep; } RenderSheep rendersheep1 = (RenderSheep)render; List<LayerRenderer<EntitySheep>> list = rendersheep1.getLayerRenderers(); Iterator iterator = list.iterator(); while (iterator.hasNext()) { LayerRenderer layerrenderer = (LayerRenderer)iterator.next(); if (layerrenderer instanceof LayerSheepWool) { iterator.remove(); } } LayerSheepWool layersheepwool = new LayerSheepWool(rendersheep1); layersheepwool.sheepModel = (ModelSheep1)modelBase; rendersheep1.addLayer(layersheepwool); return rendersheep1; } }
protected void renderLayers(T entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scaleIn) { for (LayerRenderer<T> layerrenderer : this.layerRenderers) { boolean flag = this.setBrightness(entitylivingbaseIn, partialTicks, layerrenderer.shouldCombineTextures()); layerrenderer.doRenderLayer(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scaleIn); if (flag) { this.unsetBrightness(); } } }
public RenderZombie(RenderManager renderManagerIn) { super(renderManagerIn, new ModelZombie(), 0.5F, 1.0F); LayerRenderer<?> layerrenderer = (LayerRenderer)this.layerRenderers.get(0); this.defaultModel = this.modelBipedMain; this.zombieVillagerModel = new ModelZombieVillager(); this.addLayer(new LayerHeldItem(this)); LayerBipedArmor layerbipedarmor = new LayerBipedArmor(this) { protected void initArmor() { this.modelLeggings = new ModelZombie(0.5F, true); this.modelArmor = new ModelZombie(1.0F, true); } }; this.addLayer(layerbipedarmor); this.defaultLayers = Lists.newArrayList(this.layerRenderers); if (layerrenderer instanceof LayerCustomHead) { this.removeLayer(layerrenderer); this.addLayer(new LayerCustomHead(this.zombieVillagerModel.bipedHead)); } this.removeLayer(layerbipedarmor); this.addLayer(new LayerVillagerArmor(this)); this.villagerLayers = Lists.newArrayList(this.layerRenderers); }
@Override protected LayerRenderer<EntityLivingBase> getElytraLayer() { final LayerRenderer<EntityLivingBase> elytra = super.getElytraLayer(); final ModelPonyElytra modelElytra = new ModelPonyElytra(); return new AbstractPonyLayer<EntityLivingBase>(this, elytra) { @Override public void doPonyRender(EntityLivingBase entityBase, float swing, float swingAmount, float ticks, float age, float yaw, float head, float scale) { EntityPonyModel entity = (EntityPonyModel) entityBase; ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST); if (itemstack.getItem() == Items.ELYTRA) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); bindTexture(entity.getElytraTexture()); GlStateManager.pushMatrix(); GlStateManager.translate(0.0F, 0.25F, 0.125F); ((AbstractPonyModel) mainModel).transform(BodyPart.BODY); modelElytra.setRotationAngles(swing, swingAmount, age, yaw, head, scale, entity); modelElytra.render(entity, swing, swingAmount, age, yaw, head, scale); GlStateManager.popMatrix(); } } }; }
protected LayerRenderer<EntityLivingBase> getElytraLayer() { final ModelElytra modelElytra = new ModelElytra(); return new LayerRenderer<EntityLivingBase>() { @Override public void doRenderLayer(EntityLivingBase entityBase, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { EntityPlayerModel entity = (EntityPlayerModel) entityBase; ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST); if (itemstack.getItem() == Items.ELYTRA) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); bindTexture(entity.getElytraTexture()); GlStateManager.pushMatrix(); GlStateManager.translate(0.0F, 0.0F, 0.125F); modelElytra.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entity); modelElytra.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); GlStateManager.disableBlend(); GlStateManager.popMatrix(); } } @Override public boolean shouldCombineTextures() { return false; } }; }
public static <V extends EntityLivingBase, U extends LayerRenderer<V>> void init_RenderBendsPlayer(RenderBendsPlayer render) { render.addLayer(new BaublesRenderLayer()); try { U layer = $("Lvazkii.botania.client.core.handler.ContributorFancinessHandler", "new"); if (layer != null) render.addLayer(layer); layer = $("Lvazkii.botania.client.core.handler.BaubleRenderHandler", "new"); if (layer != null) render.addLayer(layer); layer = $("Lvazkii.botania.client.render.entity.LayerGaiaHead", "new", render.getMainModel().bipedHead); if (layer != null) render.addLayer(layer); } catch (Exception e) { } }
@Override protected void renderLayers(EntityTameableDragon dragon, float moveTime, float moveSpeed, float partialTicks, float ticksExisted, float lookYaw, float lookPitch, float scale) { List<LayerRenderer<EntityTameableDragon>> layers = getBreedRenderer(dragon).getLayers(); layers.forEach(layer -> { boolean brighnessSet = setBrightness(dragon, partialTicks, layer.shouldCombineTextures()); layer.doRenderLayer(dragon, moveTime, moveSpeed, partialTicks, ticksExisted, lookYaw, lookPitch, scale); if (brighnessSet) { unsetBrightness(); } }); }
@SuppressWarnings("unchecked") public RenderZombieVillager(RenderManager p_i46127_1_) { super(p_i46127_1_, new ModelZombie(), 0.5F, 1.0F); final LayerRenderer layerrenderer = (LayerRenderer) this.layerRenderers.get(0); this.field_82434_o = this.modelBipedMain; this.zombieVillagerProfessionModel = new ModelZombieVillagerProfession(); this.addLayer(new LayerHeldItem(this)); final LayerBipedArmor layerbipedarmor = new LayerBipedArmor(this) { @Override protected void func_177177_a() { this.field_177189_c = new ModelZombie(0.5F, true); this.field_177186_d = new ModelZombie(1.0F, true); } }; this.addLayer(layerbipedarmor); this.field_177122_o = Lists.newArrayList(this.layerRenderers); if (layerrenderer instanceof LayerCustomHead) { this.removeLayer(layerrenderer); this.addLayer(new LayerCustomHead(this.zombieVillagerProfessionModel.bipedHead)); } this.removeLayer(layerbipedarmor); this.addLayer(new LayerVillagerArmor(this)); this.field_177121_n = Lists.newArrayList(this.layerRenderers); }
public LayerRenderEvent(EntityLivingBase entity, LayerRenderer layerRenderer) { this.entity = entity; this.layerRenderer = layerRenderer; }
public final LayerRenderer getLayerRenderer() { return this.layerRenderer; }
protected <V extends EntityLivingBase, U extends LayerRenderer<V>> boolean addLayer(U layer) { return this.layerRenderers.add((LayerRenderer<T>)layer); }
protected <V extends EntityLivingBase, U extends LayerRenderer<V>> boolean removeLayer(U layer) { return this.layerRenderers.remove(layer); }
public <V extends EntityLivingBase, U extends LayerRenderer<V>> boolean addLayer(U layer) { return this.layerRenderers.add((LayerRenderer<T>)layer); }
public <V extends EntityLivingBase, U extends LayerRenderer<V>> boolean addLayer(U layer) { return this.layerRenderers.add((LayerRenderer<T>) layer); }
public List<LayerRenderer<T>> getLayerRenderers() { return this.layerRenderers; }
public <V extends EntityLivingBase, U extends LayerRenderer<V>> boolean removeLayer(U layer) { return this.layerRenderers.remove(layer); }
@SubscribeEvent public void onRender(final RenderPlayerEvent.Pre event){ if(event.getEntityPlayer() ==null)return; try{ @SuppressWarnings("unchecked") List<LayerRenderer<EntityLivingBase>> layers = (List<LayerRenderer<EntityLivingBase>>) ReflectionUtils.getPrivateValue(event.getRenderer(), RenderLivingBase.class, ObfuscatedNames.RenderLivingBase_layerRenderers); for(LayerRenderer<EntityLivingBase> layer : layers){ if(layer instanceof LayerBipedArmor){ LayerBipedArmor armor = (LayerBipedArmor)layer; ItemStack helmet = event.getEntityPlayer().getItemStackFromSlot(EntityEquipmentSlot.HEAD); ModelBiped modelHelmet = armor.getModelFromSlot(EntityEquipmentSlot.HEAD); ItemStack chest = event.getEntityPlayer().getItemStackFromSlot(EntityEquipmentSlot.CHEST); ModelBiped modelChest = armor.getModelFromSlot(EntityEquipmentSlot.CHEST); ItemStack legs = event.getEntityPlayer().getItemStackFromSlot(EntityEquipmentSlot.LEGS); ModelBiped modelLegs = armor.getModelFromSlot(EntityEquipmentSlot.LEGS); ItemStack boots = event.getEntityPlayer().getItemStackFromSlot(EntityEquipmentSlot.FEET); ModelBiped modelBoots = armor.getModelFromSlot(EntityEquipmentSlot.FEET); if(modelHelmet !=null){ if(ItemStackTools.isValid(helmet) && ModEnhancements.INVIS_ARMOR.isApplied(helmet)){ modelHelmet.bipedHead.isHidden = true; modelHelmet.bipedHeadwear.isHidden = true; } } if(modelChest !=null){ if(ItemStackTools.isValid(chest) && ModEnhancements.INVIS_ARMOR.isApplied(chest)){ modelChest.bipedBody.isHidden = true; modelChest.bipedRightArm.isHidden = true; modelChest.bipedLeftArm.isHidden = true; } } if(modelLegs !=null){ if(ItemStackTools.isValid(legs) && ModEnhancements.INVIS_ARMOR.isApplied(legs)){ modelLegs.bipedBody.isHidden = true; modelLegs.bipedLeftLeg.isHidden = true; modelLegs.bipedRightLeg.isHidden = true; } } if(modelBoots !=null){ if(ItemStackTools.isValid(boots) && ModEnhancements.INVIS_ARMOR.isApplied(boots)){ modelBoots.bipedLeftLeg.isHidden = true; modelBoots.bipedRightLeg.isHidden = true; } } } } }catch(Exception e){ e.printStackTrace(); } }
@SubscribeEvent public void renderSpecials(RenderPlayerEvent.Post event){ try{ @SuppressWarnings("unchecked") List<LayerRenderer<EntityLivingBase>> layers = (List<LayerRenderer<EntityLivingBase>>) ReflectionUtils.getPrivateValue(event.getRenderer(), RenderLivingBase.class, ObfuscatedNames.RenderLivingBase_layerRenderers); for(LayerRenderer<EntityLivingBase> layer : layers){ if(layer instanceof LayerBipedArmor){ LayerBipedArmor armor = (LayerBipedArmor)layer; ItemStack helmet = event.getEntityPlayer().getItemStackFromSlot(EntityEquipmentSlot.HEAD); ModelBiped modelHelmet = armor.getModelFromSlot(EntityEquipmentSlot.HEAD); ItemStack chest = event.getEntityPlayer().getItemStackFromSlot(EntityEquipmentSlot.CHEST); ModelBiped modelChest = armor.getModelFromSlot(EntityEquipmentSlot.CHEST); ItemStack legs = event.getEntityPlayer().getItemStackFromSlot(EntityEquipmentSlot.LEGS); ModelBiped modelLegs = armor.getModelFromSlot(EntityEquipmentSlot.LEGS); ItemStack boots = event.getEntityPlayer().getItemStackFromSlot(EntityEquipmentSlot.FEET); ModelBiped modelBoots = armor.getModelFromSlot(EntityEquipmentSlot.FEET); if(modelHelmet !=null){ if(ItemStackTools.isValid(helmet) && ModEnhancements.INVIS_ARMOR.isApplied(helmet)){ modelHelmet.bipedHead.isHidden = false; modelHelmet.bipedHeadwear.isHidden = false; } } if(modelChest !=null){ if(ItemStackTools.isValid(chest) && ModEnhancements.INVIS_ARMOR.isApplied(chest)){ modelChest.bipedBody.isHidden = false; modelChest.bipedRightArm.isHidden = false; modelChest.bipedLeftArm.isHidden = false; } } if(modelLegs !=null){ if(ItemStackTools.isValid(legs) && ModEnhancements.INVIS_ARMOR.isApplied(legs)){ modelLegs.bipedBody.isHidden = false; modelLegs.bipedLeftLeg.isHidden = false; modelLegs.bipedRightLeg.isHidden = false; } } if(modelBoots !=null){ if(ItemStackTools.isValid(boots) && ModEnhancements.INVIS_ARMOR.isApplied(boots)){ modelBoots.bipedLeftLeg.isHidden = false; modelBoots.bipedRightLeg.isHidden = false; } } } } }catch(Exception e){ e.printStackTrace(); } }
public static Optional<Function<RenderManager,LayerRenderer<EntityPlayer>>> createShoulderLayer() { if (forgeLoaded) { // TODO } return Optional.empty(); }
public AbstractPonyLayer(RenderLivingBase<? extends T> renderer, LayerRenderer<T> humanLayer) { this.renderer = renderer; this.layer = humanLayer; }
private static LayerRenderer<EntityPlayer> getForgeLayer(RenderManager rm) { return ForgeProxy.createShoulderLayer() .orElse(LayerEntityOnShoulder::new) .apply(rm); }
@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; } } } } }