@SuppressWarnings("rawtypes") @SideOnly(Side.CLIENT) @Override public void onRenderLiving(RenderLivingEvent.Pre event, RenderLivingBase renderer, int amplifier) { GlStateManager.pushMatrix(); EnumDyeColor dye = EnumDyeColor.byDyeDamage(Math.min(amplifier, EnumDyeColor.values().length - 1)); int rgb = dye.getColorValue(); float r = (rgb >>> 16 & 0xFF) / 256.0F; float g = (rgb >>> 8 & 0xFF) / 256.0F; float b = (rgb & 0xFF) / 256.0F; GlStateManager.color(r, g, b); GlStateManager.popMatrix(); }
@SubscribeEvent(priority = EventPriority.HIGHEST) public void entityColorRender(final RenderLivingEvent.Pre event) { final String s = EnumChatFormatting.getTextWithoutFormattingCodes(event.entity.getCommandSenderName()); if (s.startsWith("Aureylian") && !(event.entity instanceof EntityPlayer)) { GL11.glColor4f(0.9686f, 0.7059f, 0.8392f, 1.0f); this.resetRender = true; } if (EventHandlerClient.holograms.contains(s) && (!(event.entity instanceof EntityPlayer) || !((EntityPlayer)event.entity).getHideCape())) { GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.45f); GL11.glEnable(3042); GL11.glBlendFunc(770, 771); this.resetRender = true; } if (s.equals("RWTema") && !(event.entity instanceof EntityPlayer)) { GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.65f); GL11.glEnable(3042); GL11.glBlendFunc(770, 771); this.resetRender = true; } if (s.equals("jadedcat") && (!(event.entity instanceof EntityPlayer) || !((EntityPlayer)event.entity).getHideCape())) { GL11.glColor4f(0.69f, 0.392f, 0.847f, 1.0f); this.resetRender = true; } }
@SubscribeEvent public void renderPlayer (RenderLivingEvent.Pre event) { if (event.getEntity() instanceof AbstractClientPlayer) { AbstractClientPlayer player = (AbstractClientPlayer) event.getEntity(); UserManager manager = UserManager.getInstance(); User user = manager.getUser(player.getUniqueID().toString()); if (user == null) return; ICape cape = user.capes.get(0); if (cape == null) return; boolean flag = cape.isTextureLoaded(player); if (!flag) cape.loadTexture(player); } }
@SideOnly(Side.CLIENT) @SubscribeEvent public void entityPreRender(RenderLivingEvent.Pre event) { if (GelsPlus.proxy.getRegistry().coloredList().containsKey(event.entity.getEntityId())) { GelAbility gel = null; try { gel = GelsPlus.proxy.getRegistry().getGel(GelsPlus.proxy.getRegistry().coloredList().get(event.entity.getEntityId())).newInstance(); } catch (Exception e) { e.printStackTrace(); GelsPlus.pktHandler.sendEverywhere(new PacketUpdateRegistry(event.entity)); return; } if (gel != null) RenderUtils.applyColor(gel.gelColor()); } }
@SuppressWarnings("unused") @SubscribeEvent public void onRenderPlayerEventPost(RenderLivingEvent.Post event) { if (event.entity != Minecraft.getMinecraft().thePlayer) { glPushMatrix(); glEnable(GL_BLEND); glTranslated(event.x, event.y, event.z); if (EntityPlayer.class.isAssignableFrom(event.entity.getClass())) { /*IInventory baubles = BaublesApi.getBaubles((EntityPlayer) event.entity); if (baubles.getStackInSlot(2) != null) { TextureHelper.bindTexture(textureRingOfHealth); model.renderAll(); } TODO: Baubles replacement*/ } glDisable(GL_BLEND); glPopMatrix(); } }
@SubscribeEvent public void onEntityLiving(RenderLivingEvent.Pre<EntityPlayer> event){ if(event.getEntity() instanceof EntityPlayer){ EntityPlayer player = (EntityPlayer)event.getEntity(); ItemStack stackMainHand = player.getHeldItemMainhand(); if(stackMainHand != null && stackMainHand.getItem() == CommonProxy.itemCombustibleLemonLauncher){ ModelBiped modelBiped = (ModelBiped)event.getRenderer().getMainModel(); switch(Minecraft.getMinecraft().gameSettings.mainHand){ case LEFT: modelBiped.leftArmPose = ArmPose.BOW_AND_ARROW; break; case RIGHT: modelBiped.rightArmPose = ArmPose.BOW_AND_ARROW; break; default: break; } } } }
@SuppressWarnings("rawtypes") @SubscribeEvent public void onRender(RenderLivingEvent.Pre event) { Collection<BrewEffect> effects = BrewStorageHandler.getBrewEffects(event.getEntity()); effects.stream().filter(effect -> effect.getBrew() instanceof IBrewRenderLiving).forEach(effect -> { if (event.isCanceled()) return; ((IBrewRenderLiving) effect.getBrew()).onRenderLiving(event, event.getRenderer(), effect.getAmplifier()); }); }
@Override public void invoke(Event e) { RenderLivingEvent.Specials.Pre format = (RenderLivingEvent.Specials.Pre) e; NametagRenderEvent event = new NametagRenderEvent(format.entity); event.call(); format.setCanceled(event.isCancelled()); }
@SubscribeEvent public void renderLivingPostEntity(RenderLivingEvent.Post<EntityLivingBase> event) { if (!(event.getEntity() instanceof EntityPlayer || event.getEntity() instanceof EntityTF2Character)) return; ClientProxy.renderCritGlow=0; if (event.getEntity().getActivePotionEffect(TF2weapons.uber)!=null) { GL11.glColor4f(1.0F, 1F, 1.0F, 1F); } // GlStateManager.enableLighting(); if (event.getEntity().getCapability(TF2weapons.WEAPONS_CAP, null).invisTicks > 0) { GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1.0F, 1F, 1.0F, 1F); } }
@SubscribeEvent public void entityColorRender(final RenderLivingEvent.Post event) { if (!this.avoidRecursion && this.resetRender) { GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); GL11.glDisable(3042); } }
/** * On name render, simply render the name of the user, instead of the name of * the entity. */ @SubscribeEvent public void onNameRender(RenderLivingEvent.Specials.Pre<EntityLivingBase> event) { EntityLivingBase render = EntityMorph.renderEntity; if (render == null) { return; } event.setCanceled(true); EntityLivingBase entity = event.getEntity(); if (!this.canRenderName(render, entity)) { return; } double dist = entity.getDistanceSqToEntity(this.manager.renderViewEntity); float factor = entity.isSneaking() ? 32.0F : 64.0F; if (dist < (double) (factor * factor)) { GlStateManager.alphaFunc(516, 0.1F); this.renderEntityName(entity, render.getDisplayName().getFormattedText(), event.getX(), event.getY(), event.getZ()); } }
@SubscribeEvent @SuppressWarnings("unused") public void onRenderLivingEvent(RenderLivingEvent.Pre event) { EntityLivingBase entity = event.getEntity(); if((entity instanceof EntityPlayer) && isInvisible((EntityPlayer) entity)) { event.setCanceled(true); event.setResult(Event.Result.DENY); } }
@SubscribeEvent @SuppressWarnings("unused") public void onRenderLivingSpecialsEvent(RenderLivingEvent.Specials.Pre event) { EntityLivingBase entity = event.getEntity(); if ((entity instanceof EntityPlayer) && isInvisible((EntityPlayer) entity)) { event.setCanceled(true); event.setResult(Event.Result.DENY); } }
@SideOnly(Side.CLIENT) @SubscribeEvent(priority = EventPriority.TOP) public void onRenderLiving_Pre(RenderLivingEvent.Pre<EntityLivingBase> event) { if (last == event.getEntity()) return; Minecraft minecraft = Minecraft.getMinecraft(); EntityPlayer player = minecraft.player; EntityLivingBase living = event.getEntity(); int id = living.getEntityData().getInteger(NBT_KEY_RENDER); if (id != 0) { AlchemyEventSystem.markEventCanceled(event); last = AlchemyEntityManager.getEntityById(AlchemyEntityManager.FRIENDLY_LIVING_LIST, id, minecraft.world); float partialTick = minecraft.getRenderPartialTicks(); double lx = living.lastTickPosX + (living.posX - living.lastTickPosX) * partialTick; double ly = living.lastTickPosY + (living.posY - living.lastTickPosY) * partialTick; double lz = living.lastTickPosZ + (living.posZ - living.lastTickPosZ) * partialTick; double px = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTick; double py = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTick; double pz = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTick; float f = living.prevRotationYaw + (living.rotationYaw - living.prevRotationYaw) * partialTick; glPushMatrix(); glTranslated(lx - px, ly - py, lz - pz); glRotatef(-f % 360, 0, 1, 0); RenderHelper.renderEntity(last, partialTick); glPopMatrix(); } }
@SubscribeEvent public void holding(RenderLivingEvent.Pre event) { Minecraft mc = Minecraft.getMinecraft(); EntityPlayer thePlayer = mc.player; ItemStack stack = thePlayer.getActiveItemStack(); if (!event.isCanceled() && event.getEntity().equals(thePlayer) && stack != null) { if (stack.getItem() instanceof ItemRangedWeapon) { ModelPlayer model = (ModelPlayer) event.getRenderer().getMainModel(); // TODO adapt for left/right handed model.rightArmPose = ArmPose.BOW_AND_ARROW; } } }
static void renderEntity(RenderLivingEvent.Post e) { if (!OptionCore.UI_ONLY.getValue()) { if (e.entity != mc.thePlayer) { StaticRenderer.render(e.renderer.getRenderManager(), e.entity, e.x, e.y, e.z); } } }
@SubscribeEvent public void onRenderLiving(RenderLivingEvent.Specials.Post event) { if (!(event.entity instanceof EntityPlayer)) return; ItemStack iS = TalismanStacks.talismanFlame; Minecraft mc = Minecraft.getMinecraft(); // IIcon icon = ModItems.FlameTalisman.getIconFromDamage(0); // This can // changed to // whatever you // want // mc.getTextureManager().bindTexture(TextureMap.locationItemsTexture); // mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); // Uncomment this if using a block texture final float yOffset = 0.65F; // Adjusts how far above the player to // render final float spinModifier = 30F; // Controls how fast the texture spins. // Lower number equals faster spin float spin = (((float) clientTickCount) / spinModifier) * (180F / (float) Math.PI); GL11.glPushMatrix(); GL11.glTranslatef((float) event.x + 0.0F, (float) event.y + event.entity.height + yOffset, (float) event.z); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(spin, 0, 1, 0); GL11.glScaled(0.5, 0.5, 0.5); // RendererUtil.renderItemIn3d(iS); GL11.glPopMatrix(); }
@SubscribeEvent public void holding(RenderLivingEvent.Pre event) { Minecraft mc = Minecraft.getMinecraft(); EntityPlayer thePlayer = mc.thePlayer; ItemStack stack = thePlayer.getCurrentEquippedItem(); if (!event.isCanceled() && event.entity.equals(thePlayer) && stack != null) { if (stack.getItem() instanceof ItemRangedWeapon) { ModelPlayer model = (ModelPlayer) event.renderer.getMainModel(); model.aimedBow = true; } } }
@SubscribeEvent public void onEntityRendering(RenderLivingEvent.Specials.Pre event) { EntityLivingBase entity = (EntityLiving) event.entity; if (!holders.containsKey(event.entity.getClass())) return; synchronized (used) { EntityViewInformation info = used.get(entity.getEntityId()); if (info == null) { info = new EntityViewInformation(); Class<? extends EntityLabelHolder> holderClass = holders.get(entity.getClass()); if (reusable.containsKey(holderClass) && reusable.get(holderClass).size() > 0) { synchronized (reusable) { info.view = reusable.get(holderClass).remove(0); } } else { try { EntityLabelHolder holder = holderClass.newInstance(); info.view = holder.getView(); info.view.setHolder(holder); } catch (Exception e) { throw new RuntimeException(e); } } info.view.getHolder().setObject(entity); used.put(entity.getEntityId(), info); } info.used++; draw(entity, info.view); } }
@SubscribeEvent public void onRenderLivingPre(RenderLivingEvent.Pre<EntityPlayer> event) { if (this.viewEntityOriginal != null) { this.mc.getRenderManager().renderViewEntity = this.viewEntityOriginal; this.viewEntityOriginal = null; } }
@SubscribeEvent @SideOnly(Side.CLIENT) public void onRenderLiving(RenderLivingEvent.Specials.Pre e) { if (e.entity instanceof EntityPlayer) { if (Corruption.isDebugMode) { boolean drawPlate = Minecraft.isGuiEnabled() && e.entity != RenderManager.instance.livingPlayer && !e.entity.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer) && e.entity.riddenByEntity == null; if (drawPlate) { String drawString = "Corruption: " + CorruptionDataHelper.getCorruptionForPlayer((EntityPlayer) e.entity); RenderHelper.drawMultiLineMessageFacingPlayer(e.x, e.y + ((EntityPlayer) e.entity).height + 0.75, e.z, 0.02F, new String[]{drawString}, 0xFFFFFF, true, true); } } } }
@SubscribeEvent(priority = EventPriority.HIGHEST) public void onPlayerRenderPre(RenderLivingEvent.Pre event) { if(nameIsGood(event.entity)){ GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); } }
@SubscribeEvent public void onPlayerRenderPost(RenderLivingEvent.Post event) { if(nameIsGood(event.entity)){ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); } }
@SubscribeEvent @SideOnly(Side.CLIENT) public void onRenderLiving(RenderLivingEvent.Specials.Pre event) { if (event.entity instanceof EntityPlayer) { if (event.isCancelable()) { Object hidden = HideNames.instance.hiddenPlayers.get(event.entity.getCommandSenderName().toLowerCase()); if (hidden != null && (Boolean)hidden) { event.setCanceled(true); } } } }
@SubscribeEvent(priority = EventPriority.HIGHEST) public void render(RenderLivingEvent.Pre event) { String s = EnumChatFormatting.getTextWithoutFormattingCodes(event.entity.getCommandSenderName()); if (s.equals("jaredlll08") && event.entity instanceof EntityPlayer) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.50F); GL11.glEnable(3042); GL11.glBlendFunc(770, 771); resetRender = true; } }
@SubscribeEvent public void entityColorRender(RenderLivingEvent.Post event) { if (this.resetRender) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(3042); } }
@SubscribeEvent public void onLivingRender(RenderLivingEvent.Specials.Pre event) { if (event.entity instanceof EntityXanafiedMob) { EntityXanafiedMob xana = (EntityXanafiedMob) event.entity; if (xana.infectedMob != null) { // event.setCanceled(true); } } }
@SubscribeEvent public static void onEntityRender(RenderLivingEvent.Pre<EntityLivingBase> event) { if (TelePadConfig.telepadShrinkEffect.get()) { final NBTTagCompound entityData = event.getEntity().getEntityData(); boolean isTarget = false; if (entityData.getBoolean(TileTelePad.TELEPORTING_KEY)) { isTarget = true; // shrink the entity for longer than the teleport lasts so it doesn't pop big again at the source location entityData.setInteger("eio_delay", 7); } else if (entityData.hasKey("eio_delay")) { int delay = entityData.getInteger("eio_delay") - 1; if (delay > 0) { entityData.setInteger("eio_delay", delay); } else { entityData.removeTag("eio_delay"); entityData.removeTag("eio_teleportrotation"); } isTarget = true; } if (isTarget) { final float progress = entityData.hasKey(TileTelePad.PROGRESS_KEY) ? entityData.getFloat(TileTelePad.PROGRESS_KEY) : 1; GlStateManager.pushMatrix(); GlStateManager.translate(event.getX(), event.getY(), event.getZ()); final float scale = 1 - progress * 0.75f; GlStateManager.scale(scale, scale, scale); GlStateManager.translate(-event.getX(), -event.getY(), -event.getZ()); entityData.setBoolean("eio_needs_pop", true); } } }
@ForgeSubscribe public void RenderLivingEvent(RenderLivingEvent.Pre event) { if (event.entity instanceof EntityPlayer) { if (event.entity.ridingEntity != null && event.entity.ridingEntity instanceof EntityMech) { event.setCanceled(true); } } }
@SuppressWarnings("rawtypes") @SideOnly(Side.CLIENT) void onRenderLiving(RenderLivingEvent.Pre event, RenderLivingBase renderer, int amplifier);
@SubscribeEvent public void onPreRenderLiving(RenderLivingEvent.Pre event) { GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL); GlStateManager.enablePolygonOffset(); GlStateManager.doPolygonOffset(1.0F, -1000000); }
@SubscribeEvent public void onPostRenderLiving(RenderLivingEvent.Post event) { GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL); GlStateManager.doPolygonOffset(1.0F, 1000000); GlStateManager.disablePolygonOffset(); }
@SubscribeEvent public void onRenderPlayerNameTag(RenderLivingEvent.Specials.Pre event) { if(EntityUtils.isPlayer(event.getEntity())) event.setCanceled(true); }
@SubscribeEvent public void onRenderLiving(RenderLivingEvent.Pre<?> event) { if(event.getEntity() instanceof EntityBat) event.setCanceled(true); }
@Override public void nullify() { unregister(this, MinecraftForge.EVENT_BUS, RenderLivingEvent.Specials.Pre.class); }
public NametagRenderEventDispatcher() { register(this, MinecraftForge.EVENT_BUS, RenderLivingEvent.Specials.Pre.class); }
@SideOnly(Side.CLIENT) @SubscribeEvent public void renderLivingEntity(RenderLivingEvent.Pre<EntityPlayer> event) { if(event.getEntity() instanceof EntityPlayer && event.getEntity().getDataManager().get(SPIN_TIME)) ((ModelPlayer)event.getRenderer().getMainModel()).rightArmPose=ArmPose.BOW_AND_ARROW; }
/** * Passes the specialRender and renders it */ protected void passSpecialRender(EntityLivingBase p_77033_1_, double p_77033_2_, double p_77033_4_, double p_77033_6_) { if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Pre(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_))) return; GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); if (this.func_110813_b(p_77033_1_)) { float f = 1.6F; float f1 = 0.016666668F * f; double d3 = p_77033_1_.getDistanceSqToEntity(this.renderManager.livingPlayer); float f2 = p_77033_1_.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; if (d3 < (double)(f2 * f2)) { String s = p_77033_1_.func_145748_c_().getFormattedText(); if (p_77033_1_.isSneaking()) { FontRenderer fontrenderer = this.getFontRendererFromRenderManager(); GL11.glPushMatrix(); GL11.glTranslatef((float)p_77033_2_ + 0.0F, (float)p_77033_4_ + p_77033_1_.height + 0.5F, (float)p_77033_6_); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GL11.glScalef(-f1, -f1, f1); GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslatef(0.0F, 0.25F / f1, 0.0F); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); Tessellator tessellator = Tessellator.instance; GL11.glDisable(GL11.GL_TEXTURE_2D); tessellator.startDrawingQuads(); int i = fontrenderer.getStringWidth(s) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex((double)(-i - 1), -1.0D, 0.0D); tessellator.addVertex((double)(-i - 1), 8.0D, 0.0D); tessellator.addVertex((double)(i + 1), 8.0D, 0.0D); tessellator.addVertex((double)(i + 1), -1.0D, 0.0D); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, 0, 553648127); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } else { this.func_96449_a(p_77033_1_, p_77033_2_, p_77033_4_, p_77033_6_, s, f1, d3); } } } MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Post(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_)); }
@SubscribeEvent public static void onRenderLiving_Specials_Pre(RenderLivingEvent.Specials.Pre event) { if (event.getEntity() == player) AlchemyEventSystem.markEventCanceled(event); }