net.minecraftforge.client.event.RenderLivingEvent Java Examples

The following examples show how to use net.minecraftforge.client.event.RenderLivingEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RenderListener.java    From SkyblockAddons with MIT License 6 votes vote down vote up
@SubscribeEvent()
public void onRenderLiving(RenderLivingEvent.Specials.Pre<EntityLivingBase> e) {
    Entity entity = e.entity;
    if (main.getConfigValues().isEnabled(Feature.MINION_DISABLE_LOCATION_WARNING) && entity.hasCustomName()) {
        if (entity.getCustomNameTag().startsWith("§cThis location isn\'t perfect! :(")) {
            e.setCanceled(true);
        }
        if (entity.getCustomNameTag().startsWith("§c/!\\")) {
            for (Entity listEntity : Minecraft.getMinecraft().theWorld.loadedEntityList) {
                if (listEntity.hasCustomName() && listEntity.getCustomNameTag().startsWith("§cThis location isn\'t perfect! :(") &&
                        listEntity.posX == entity.posX && listEntity.posZ == entity.posZ &&
                        listEntity.posY + 0.375 == entity.posY) {
                    e.setCanceled(true);
                    break;
                }
            }
        }
    }
}
 
Example #2
Source File: SquashableMod.java    From CommunityMod with GNU Lesser General Public License v2.1 6 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void onRenderLivingPre(RenderLivingEvent.Pre<?> event) {
    EntityLivingBase entity = event.getEntity();
    Squashable squashable = entity.getCapability(squashableCap(), null);
    if (squashable == null) {
        return;
    }

    EnumFacing.Axis squashedAxis = squashable.getSquashedAxis();
    if (squashedAxis != null) {
        RenderLivingBase<?> renderer = event.getRenderer();
        originalModel = renderer.getMainModel();
        ModelHooks.setMainModel(renderer, new FlattenedModel(originalModel, squashedAxis));
    }
}
 
Example #3
Source File: SquashableMod.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void onRenderLivingPost(RenderLivingEvent.Post<?> event) {
    if (originalModel != null) {
        ModelHooks.setMainModel(event.getRenderer(), originalModel);
        originalModel = null;
    }
}
 
Example #4
Source File: FreecamMod.java    From ForgeHax with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onEntityRender(RenderLivingEvent.Pre<?> event) {
  if (originalPlayer != null
      && getLocalPlayer() != null
      && getLocalPlayer().equals(event.getEntity())) {
    event.setCanceled(true);
  }
}
 
Example #5
Source File: FreecamMod.java    From ForgeHax with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onRenderTag(RenderLivingEvent.Specials.Pre event) {
  if (originalPlayer != null
      && getLocalPlayer() != null
      && getLocalPlayer().equals(event.getEntity())) {
    event.setCanceled(true);
  }
}
 
Example #6
Source File: VanishTracker.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void doRenderOverride(RenderLivingEvent.Pre event) {
	EntityLivingBase entity = event.getEntity();

	if (isVanished(entity)) {
		event.setCanceled(true);
	}
}
 
Example #7
Source File: PlayerSpecials.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
@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);
       }
}
 
Example #8
Source File: PlayerSpecials.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
@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);
       }
}
 
Example #9
Source File: ClientEventListener.java    From BetterChests with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void render(RenderLivingEvent.Pre<EntityLivingBase> event) throws NoSuchFieldException {
	EntityLivingBase entity = event.getEntity();

	if (entitiesWithBag.contains(entity.getEntityId())) {
		render = new LayerBag();
		if (renderLayers == null) {
			renderLayers = RenderLivingBase.class.getDeclaredField(MCPNames.field("field_177097_h"));
			renderLayers.setAccessible(true);
		}
		event.getRenderer().addLayer(render);
	}
}
 
Example #10
Source File: ChamsMod.java    From ForgeHax with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onPreRenderLiving(RenderLivingEvent.Pre event) {
  GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
  GlStateManager.enablePolygonOffset();
  GlStateManager.doPolygonOffset(1.0F, -1000000);
}
 
Example #11
Source File: ChamsMod.java    From ForgeHax with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onPostRenderLiving(RenderLivingEvent.Post event) {
  GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
  GlStateManager.doPolygonOffset(1.0F, 1000000);
  GlStateManager.disablePolygonOffset();
}
 
Example #12
Source File: ESP.java    From ForgeHax with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onRenderPlayerNameTag(RenderLivingEvent.Specials.Pre event) {
  if (EntityUtils.isPlayer(event.getEntity())) {
    event.setCanceled(true);
  }
}
 
Example #13
Source File: AntiBatsMod.java    From ForgeHax with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onRenderLiving(RenderLivingEvent.Pre<?> event) {
  if (event.getEntity() instanceof EntityBat) {
    event.setCanceled(true);
  }
}
 
Example #14
Source File: ClientEventHandler.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void onLivingRender(RenderLivingEvent.Pre event){
    setRenderHead(event.entity, false);
}
 
Example #15
Source File: ClientEventHandler.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void onLivingRender(RenderLivingEvent.Post event){
    setRenderHead(event.entity, true);
}