@Override public @Nonnull String apply(@Nullable ItemStack itemStack) { if (itemStack == null) { throw new NullPointerException("You want me to return something Nonnull for a null ItemStack? F.U."); } CapturedMob capturedMob = CapturedMob.create(itemStack); if (capturedMob != null) { return capturedMob.getDisplayName(); } return ""; }
@Override @SideOnly(Side.CLIENT) public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List<String> tooltip, @Nonnull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); CapturedMob capturedMob = CapturedMob.create(stack); if (capturedMob != null) { tooltip.add(Lang.PRESSURE_PLATE_TUNED.get(capturedMob.getDisplayName())); } }
@Override public void addCommonEntries(@Nonnull ItemStack itemstack, @Nullable EntityPlayer entityplayer, @Nonnull List<String> list, boolean flag) { CapturedMob mob = CapturedMob.create(itemstack); if (mob != null) { list.add(mob.getDisplayName()); list.add(Lang.TOOLTIP_SPAWNER_COST.get(LangPower.FLOAT_NF.format(PoweredSpawnerRecipeRegistry.getInstance().getCostMultiplierFor(mob.getEntityName())))); } else { list.add(Lang.SPAWNER_EMPTY.get()); } }
@Override @SideOnly(Side.CLIENT) public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List<String> tooltip, @Nonnull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); CapturedMob mob = CapturedMob.create(stack); if (mob != null) { tooltip.add(mob.getDisplayName()); } if (!SpecialTooltipHandler.showAdvancedTooltips()) { SpecialTooltipHandler.addShowDetailsTooltip(tooltip); } else { SpecialTooltipHandler.addDetailedTooltipFromResources(tooltip, stack); } }
CapturedMob capturedMob = CapturedMob.create(stack); if (capturedMob != null) { tooltip.add(capturedMob.getDisplayName());
@Override public String toString() { return "CapturedMob [" + "entityId=" + entityId + ", " + (customName != null ? "customName=" + customName + ", " : "") + (entityNbt != null ? "entityNbt=" + entityNbt + ", " : "") + "getDisplayName()=" + getDisplayName() + ", getHealth()=" + getHealth() + ", getMaxHealth()=" + getMaxHealth() + ", " + (getColor() != null ? "getColor()=" + getColor() + ", " : "") + (getFluidName() != null ? "getFluidName()=" + getFluidName() : "") + "]"; }
@Override public void enforceValidity() throws InvalidRecipeConfigException { if (!isValid()) { Log.warn("Could not find an entity for '" + name + "'"); Log.warn("Available entities are:"); for (CapturedMob possible : CapturedMob.getAllSouls()) { Log.warn(" -> " + possible.getEntityName() + " (" + possible.getDisplayName() + ")"); // Log.warn(" <entity name=\"" + possible.getEntityName() + "\" costMultiplier=\"1\" disabled=\"false\"/> <!-- " + possible.getDisplayName() + " -->"); } throw new InvalidRecipeConfigException("Could not find an entity for '" + name + "'"); } }
@Override public void enforceValidity() throws InvalidRecipeConfigException { if (!isValid()) { Log.warn("Could not find an entity for '" + name + "'"); Log.warn("Available entities are:"); for (CapturedMob possible : CapturedMob.getAllSouls()) { Log.warn(" -> " + possible.getEntityName() + " (" + possible.getDisplayName() + ")"); } throw new InvalidRecipeConfigException("Could not find an entity for '" + name + "'"); } }
@SideOnly(Side.CLIENT) public static void doItemOverlayIntoGUI(@Nonnull ItemStack stack, int xPosition, int yPosition) { if (EnderIO.proxy.getClientPlayer().isSneaking() || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) { CapturedMob capturedMob = CapturedMob.create(stack); if (capturedMob != null) { String name = capturedMob.getDisplayName(); int idx = (int) ((EnderIO.proxy.getTickCount() / 4) % name.length()); name = (name + " " + name).substring(idx, idx + 3); FontRenderer fr = Minecraft.getMinecraft().getRenderManager().getFontRenderer(); GlStateManager.disableLighting(); GlStateManager.disableDepth(); GlStateManager.disableBlend(); GlStateManager.enableBlend(); fr.drawStringWithShadow(name, xPosition + 8 - fr.getStringWidth(name) / 2, yPosition + 5, 0xFF0030B0); GlStateManager.enableLighting(); GlStateManager.enableDepth(); GlStateManager.enableBlend(); } } }
@Override public void renderCustomOptions(int top, float par1, int par2, int par3) { FontRenderer fr = Minecraft.getMinecraft().fontRenderer; int limit = (isBig() ? 63 : 144) - 2; NNList<CapturedMob> souls = filter.getSouls(); for (GhostSlot slot : getGhostSlotHandler().getGhostSlots()) { if (slot instanceof SoulFilterGhostSlot) { int slotno = slot.getSlot(); if (slotno < souls.size()) { String displayName = souls.get(slotno).getDisplayName(); if (fr.getStringWidth(displayName) > limit) { while (fr.getStringWidth(displayName + "...") > limit) { displayName = displayName.substring(0, displayName.length() - 2); } displayName = displayName + "..."; } fr.drawString(displayName, getGuiLeft() + slot.getX() + 18 + 1, getGuiTop() + slot.getY() + 4, ColorUtil.getRGB(Color.WHITE)); } } } }
fr.drawStringWithShadow(header, x, y, ColorUtil.getRGB(Color.WHITE)); String name = TextFormatting.ITALIC + (getTileEntity().getEntity() != null ? getTileEntity().getEntity().getDisplayName() : ""); x = sx + xSize / 2 - fr.getStringWidth(name) / 2; y = sy + 43 + 16 + 2;