Java Code Examples for net.minecraft.entity.Entity#hasCustomName()
The following examples show how to use
net.minecraft.entity.Entity#hasCustomName() .
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 |
@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: MinecraftTypeHelper.java From malmo with MIT License | 6 votes |
/** Does essentially the same as entity.getName(), but without pushing the result * through the translation layer. This ensures the result matches what we use in Types.XSD, * and prevents things like "entity.ShulkerBullet.name" being returned, where there is no * translation provided in the .lang file. * @param e The entity * @return The entity's name. */ public static String getUnlocalisedEntityName(Entity e) { String name; if (e.hasCustomName()) { name = e.getCustomNameTag(); } else if (e instanceof EntityPlayer) { name = e.getName(); // Just returns the user name } else { name = EntityList.getEntityString(e); if (name == null) name = "unknown"; } return name; }
Example 3
Source File: RenderManagerHook.java From SkyblockAddons with MIT License | 5 votes |
public static void shouldRender(Entity entityIn, ReturnValue<Boolean> returnValue) { SkyblockAddons main = SkyblockAddons.getInstance(); if (main.getUtils().isOnSkyblock()) { Location currentLocation = main.getUtils().getLocation(); if (entityIn instanceof EntityItem && entityIn.ridingEntity instanceof EntityArmorStand && entityIn.ridingEntity.isInvisible()) { // Conditions for skeleton helmet flying bones if (main.getConfigValues().isEnabled(Feature.HIDE_BONES)) { returnValue.cancel(); } } if (main.getConfigValues().isEnabled(Feature.HIDE_PLAYERS_NEAR_NPCS)) { if (entityIn instanceof EntityOtherPlayerMP && NPCUtils.isNearAnyNPCWithTag(entityIn, Tag.IMPORTANT) && !NPCUtils.isNPC(entityIn)) { returnValue.cancel(); } } if (main.getConfigValues().isEnabled(Feature.HIDE_PLAYERS_IN_LOBBY)) { if (currentLocation == Location.VILLAGE || currentLocation == Location.AUCTION_HOUSE || currentLocation == Location.BANK) { if ((entityIn instanceof EntityOtherPlayerMP || entityIn instanceof EntityFX || entityIn instanceof EntityItemFrame) && entityIn.getDistanceToEntity(Minecraft.getMinecraft().thePlayer) > 7) { returnValue.cancel(); } } } if(main.getConfigValues().isEnabled(Feature.HIDE_SVEN_PUP_NAMETAGS)) { if (entityIn instanceof EntityArmorStand && entityIn.hasCustomName()) { String customNameTag = entityIn.getCustomNameTag(); if (customNameTag.contains("Sven Pup")) { returnValue.cancel(); } } } } }