@SideOnly(Side.CLIENT) public static void addBrewTooltip(ItemStack stack, List<String> tooltip) { List<BrewEffect> brewsFromStack = BrewUtils.getBrewsFromStack(stack); for (BrewEffect effect : brewsFromStack) { IBrew brew = effect.getBrew(); String name = " - " + I18n.format("brew." + brew.getName() + ".tooltip") + " "; String amplifier = (effect.getAmplifier() <= 0) ? "" : (RomanNumber.getRoman(effect.getAmplifier())) + " "; String duration = effect.isInstant() ? I18n.format("brew.instant") : StringUtils.ticksToElapsedTime(effect.getDuration()); tooltip.add(TextFormatting.DARK_AQUA + "" + TextFormatting.ITALIC + name + amplifier + "(" + duration + ")"); } if (brewsFromStack.isEmpty()) { tooltip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + "---"); } }
private static void lookupNames(MinecraftServer server, Collection<String> names, ProfileLookupCallback callback) { String[] astring = (String[])Iterators.toArray(Iterators.filter(names.iterator(), new Predicate<String>() { public boolean apply(String p_apply_1_) { return !StringUtils.isNullOrEmpty(p_apply_1_); } }), String.class); if (server.isServerInOnlineMode()) { server.getGameProfileRepository().findProfilesByNames(astring, Agent.MINECRAFT, callback); } else { for (String s : astring) { UUID uuid = EntityPlayer.getUUID(new GameProfile((UUID)null, s)); GameProfile gameprofile = new GameProfile(uuid, s); callback.onProfileLookupSucceeded(gameprofile); } } }
public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); this.skullType = compound.getByte("SkullType"); this.skullRotation = compound.getByte("Rot"); if (this.skullType == 3) { if (compound.hasKey("Owner", 10)) { this.playerProfile = NBTUtil.readGameProfileFromNBT(compound.getCompoundTag("Owner")); } else if (compound.hasKey("ExtraType", 8)) { String s = compound.getString("ExtraType"); if (!StringUtils.isNullOrEmpty(s)) { this.playerProfile = new GameProfile((UUID)null, s); this.updatePlayerProfile(); } } } }
/** * allows items to add custom lines of information to the mouseover description */ public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) { if (stack.hasTagCompound()) { NBTTagCompound nbttagcompound = stack.getTagCompound(); String s = nbttagcompound.getString("author"); if (!StringUtils.isNullOrEmpty(s)) { tooltip.add(EnumChatFormatting.GRAY + StatCollector.translateToLocalFormatted("book.byAuthor", new Object[] {s})); } tooltip.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("book.generation." + nbttagcompound.getInteger("generation"))); } }
public void renderDemo(ScaledResolution p_175185_1_) { this.mc.mcProfiler.startSection("demo"); String s = ""; if (this.mc.theWorld.getTotalWorldTime() >= 120500L) { s = I18n.format("demo.demoExpired", new Object[0]); } else { s = I18n.format("demo.remainingTime", new Object[] {StringUtils.ticksToElapsedTime((int)(120500L - this.mc.theWorld.getTotalWorldTime()))}); } int i = this.getFontRenderer().getStringWidth(s); this.getFontRenderer().drawStringWithShadow(s, (float)(p_175185_1_.getScaledWidth() - i - 10), 5.0F, 16777215); this.mc.mcProfiler.endSection(); }
public void renderDemo(ScaledResolution scaledRes) { this.mc.mcProfiler.startSection("demo"); String s; if (this.mc.theWorld.getTotalWorldTime() >= 120500L) { s = I18n.format("demo.demoExpired", new Object[0]); } else { s = I18n.format("demo.remainingTime", new Object[] {StringUtils.ticksToElapsedTime((int)(120500L - this.mc.theWorld.getTotalWorldTime()))}); } int i = this.getFontRenderer().getStringWidth(s); this.getFontRenderer().drawStringWithShadow(s, (float)(scaledRes.getScaledWidth() - i - 10), 5.0F, 16777215); this.mc.mcProfiler.endSection(); }
public GameProfile updateGameprofile(GameProfile input) { if (input != null && !StringUtils.isNullOrEmpty(input.getName())) { if (input.isComplete() && input.getProperties().containsKey("textures")) { return input; } else if (profileCache != null && sessionService != null) { GameProfile gameprofile = profileCache.getGameProfileForUsername(input.getName()); if (gameprofile == null) { return input; } else { Property property = (Property) Iterables.getFirst(gameprofile.getProperties().get("textures"), (Object) null); if (property == null) { gameprofile = sessionService.fillProfileProperties(gameprofile, true); } return gameprofile; } } else { return input; } } else { return input; } }
public void resolve(ICommandSender sender) { MinecraftServer minecraftserver = sender.getServer(); if (minecraftserver != null && minecraftserver.isAnvilFileSet() && StringUtils.isNullOrEmpty(this.value)) { Scoreboard scoreboard = minecraftserver.worldServerForDimension(0).getScoreboard(); ScoreObjective scoreobjective = scoreboard.getObjective(this.objective); if (scoreboard.entityHasObjective(this.name, scoreobjective)) { Score score = scoreboard.getOrCreateScore(this.name, scoreobjective); this.setValue(String.format("%d", new Object[] {Integer.valueOf(score.getScorePoints())})); return; } } this.value = ""; }
/** * Either updates the score with a specified value or removes the score for an objective */ public void handleUpdateScore(S3CPacketUpdateScore packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Scoreboard scoreboard = this.clientWorldController.getScoreboard(); ScoreObjective scoreobjective = scoreboard.getObjective(packetIn.getObjectiveName()); if (packetIn.getScoreAction() == S3CPacketUpdateScore.Action.CHANGE) { Score score = scoreboard.getValueFromObjective(packetIn.getPlayerName(), scoreobjective); score.setScorePoints(packetIn.getScoreValue()); } else if (packetIn.getScoreAction() == S3CPacketUpdateScore.Action.REMOVE) { if (StringUtils.isNullOrEmpty(packetIn.getObjectiveName())) { scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), (ScoreObjective)null); } else if (scoreobjective != null) { scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), scoreobjective); } } }
/** * Either updates the score with a specified value or removes the score for an * objective */ public void handleUpdateScore(S3CPacketUpdateScore packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Scoreboard scoreboard = this.clientWorldController.getScoreboard(); ScoreObjective scoreobjective = scoreboard.getObjective(packetIn.getObjectiveName()); if (packetIn.getScoreAction() == S3CPacketUpdateScore.Action.CHANGE) { Score score = scoreboard.getValueFromObjective(packetIn.getPlayerName(), scoreobjective); score.setScorePoints(packetIn.getScoreValue()); } else if (packetIn.getScoreAction() == S3CPacketUpdateScore.Action.REMOVE) { if (StringUtils.isNullOrEmpty(packetIn.getObjectiveName())) { scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), (ScoreObjective) null); } else if (scoreobjective != null) { scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), scoreobjective); } } }
/** * Either updates the score with a specified value or removes the score for an objective */ public void handleUpdateScore(SPacketUpdateScore packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Scoreboard scoreboard = this.clientWorldController.getScoreboard(); ScoreObjective scoreobjective = scoreboard.getObjective(packetIn.getObjectiveName()); if (packetIn.getScoreAction() == SPacketUpdateScore.Action.CHANGE) { Score score = scoreboard.getOrCreateScore(packetIn.getPlayerName(), scoreobjective); score.setScorePoints(packetIn.getScoreValue()); } else if (packetIn.getScoreAction() == SPacketUpdateScore.Action.REMOVE) { if (StringUtils.isNullOrEmpty(packetIn.getObjectiveName())) { scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), (ScoreObjective)null); } else if (scoreobjective != null) { scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), scoreobjective); } } }
/** * allows items to add custom lines of information to the mouseover description */ public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) { if (stack.hasTagCompound()) { NBTTagCompound nbttagcompound = stack.getTagCompound(); String s = nbttagcompound.getString("author"); if (!StringUtils.isNullOrEmpty(s)) { tooltip.add(TextFormatting.GRAY + I18n.translateToLocalFormatted("book.byAuthor", new Object[] {s})); } tooltip.add(TextFormatting.GRAY + I18n.translateToLocal("book.generation." + nbttagcompound.getInteger("generation"))); } }
public void renderDemo(ScaledResolution scaledRes) { this.mc.mcProfiler.startSection("demo"); String s; if (this.mc.world.getTotalWorldTime() >= 120500L) { s = I18n.format("demo.demoExpired", new Object[0]); } else { s = I18n.format("demo.remainingTime", new Object[] {StringUtils.ticksToElapsedTime((int)(120500L - this.mc.world.getTotalWorldTime()))}); } int i = this.getFontRenderer().getStringWidth(s); this.getFontRenderer().drawStringWithShadow(s, (float)(scaledRes.getScaledWidth() - i - 10), 5.0F, 16777215); this.mc.mcProfiler.endSection(); }
public boolean save(boolean p_189712_1_) { if (this.mode == TileEntityStructure.Mode.SAVE && !this.worldObj.isRemote && !StringUtils.isNullOrEmpty(this.name)) { BlockPos blockpos = this.getPos().add(this.position); WorldServer worldserver = (WorldServer)this.worldObj; MinecraftServer minecraftserver = this.worldObj.getMinecraftServer(); TemplateManager templatemanager = worldserver.getStructureTemplateManager(); Template template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(this.name)); template.takeBlocksFromWorld(this.worldObj, blockpos, this.size, !this.ignoreEntities, Blocks.STRUCTURE_VOID); template.setAuthor(this.author); return !p_189712_1_ || templatemanager.writeTemplate(minecraftserver, new ResourceLocation(this.name)); } else { return false; } }
/** * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton */ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { super.mouseClicked(mouseX, mouseY, mouseButton); synchronized (this.threadLock) { if (!this.openGLWarning1.isEmpty() && !StringUtils.isNullOrEmpty(this.openGLWarningLink) && mouseX >= this.openGLWarningX1 && mouseX <= this.openGLWarningX2 && mouseY >= this.openGLWarningY1 && mouseY <= this.openGLWarningY2) { GuiConfirmOpenLink guiconfirmopenlink = new GuiConfirmOpenLink(this, this.openGLWarningLink, 13, true); guiconfirmopenlink.disableSecurityWarning(); this.mc.displayGuiScreen(guiconfirmopenlink); } } if (this.areRealmsNotificationsEnabled()) { this.realmsNotification.mouseClicked(mouseX, mouseY, mouseButton); } if (Reflector.ForgeHooksClient_mainMenuMouseClick.exists()) { Reflector.call(Reflector.ForgeHooksClient_mainMenuMouseClick, new Object[] { Integer.valueOf(mouseX), Integer.valueOf(mouseY), Integer.valueOf(mouseButton), this.fontRendererObj, Integer.valueOf(this.width) }); } }
private static void lookupNames(MinecraftServer server, Collection<String> names, ProfileLookupCallback callback) { String[] astring = (String[])Iterators.toArray(Iterators.filter(names.iterator(), new Predicate<String>() { public boolean apply(@Nullable String p_apply_1_) { return !StringUtils.isNullOrEmpty(p_apply_1_); } }), String.class); if (server.isServerInOnlineMode()) { server.getGameProfileRepository().findProfilesByNames(astring, Agent.MINECRAFT, callback); } else { for (String s : astring) { UUID uuid = EntityPlayer.getUUID(new GameProfile((UUID)null, s)); GameProfile gameprofile = new GameProfile(uuid, s); callback.onProfileLookupSucceeded(gameprofile); } } }
public void resolve(ICommandSender sender) { MinecraftServer minecraftserver = sender.getServer(); if (minecraftserver != null && minecraftserver.isAnvilFileSet() && StringUtils.isNullOrEmpty(this.value)) { Scoreboard scoreboard = minecraftserver.worldServerForDimension(0).getScoreboard(); ScoreObjective scoreobjective = scoreboard.getObjective(this.objective); if (scoreboard.entityHasObjective(this.name, scoreobjective)) { Score score = scoreboard.getOrCreateScore(this.name, scoreobjective); this.setValue(String.format("%d", new Object[] {Integer.valueOf(score.getScorePoints())})); } else { this.value = ""; } } }
public boolean save(boolean p_189712_1_) { if (this.mode == TileEntityStructure.Mode.SAVE && !this.world.isRemote && !StringUtils.isNullOrEmpty(this.name)) { BlockPos blockpos = this.getPos().add(this.position); WorldServer worldserver = (WorldServer)this.world; MinecraftServer minecraftserver = this.world.getMinecraftServer(); TemplateManager templatemanager = worldserver.getStructureTemplateManager(); Template template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(this.name)); template.takeBlocksFromWorld(this.world, blockpos, this.size, !this.ignoreEntities, Blocks.STRUCTURE_VOID); template.setAuthor(this.author); return !p_189712_1_ || templatemanager.writeTemplate(minecraftserver, new ResourceLocation(this.name)); } else { return false; } }
/** * allows items to add custom lines of information to the mouseover description */ @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) { if (stack.hasTagCompound()) { NBTTagCompound nbttagcompound = stack.getTagCompound(); String s = nbttagcompound.getString("author"); if (!StringUtils.isNullOrEmpty(s)) { tooltip.add(TextFormatting.GRAY + I18n.translateToLocalFormatted("book.byAuthor", new Object[] {s})); } tooltip.add(TextFormatting.GRAY + I18n.translateToLocal("book.generation." + nbttagcompound.getInteger("generation"))); } }
public String getItemStackDisplayName(ItemStack stack) { if (stack.hasTagCompound()) { NBTTagCompound nbttagcompound = stack.getTagCompound(); String s = nbttagcompound.getString("title"); if (!StringUtils.isNullOrEmpty(s)) { return s; } } return super.getItemStackDisplayName(stack); }
public static String getStringUUIDFromName(String p_152719_0_) { if (!StringUtils.isNullOrEmpty(p_152719_0_) && p_152719_0_.length() <= 16) { final MinecraftServer minecraftserver = MinecraftServer.getServer(); GameProfile gameprofile = minecraftserver.getPlayerProfileCache().getGameProfileForUsername(p_152719_0_); if (gameprofile != null && gameprofile.getId() != null) { return gameprofile.getId().toString(); } else if (!minecraftserver.isSinglePlayer() && minecraftserver.isServerInOnlineMode()) { final List<GameProfile> list = Lists.<GameProfile>newArrayList(); ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback() { public void onProfileLookupSucceeded(GameProfile p_onProfileLookupSucceeded_1_) { minecraftserver.getPlayerProfileCache().addEntry(p_onProfileLookupSucceeded_1_); list.add(p_onProfileLookupSucceeded_1_); } public void onProfileLookupFailed(GameProfile p_onProfileLookupFailed_1_, Exception p_onProfileLookupFailed_2_) { PreYggdrasilConverter.LOGGER.warn((String)("Could not lookup user whitelist entry for " + p_onProfileLookupFailed_1_.getName()), (Throwable)p_onProfileLookupFailed_2_); } }; lookupNames(minecraftserver, Lists.newArrayList(new String[] {p_152719_0_}), profilelookupcallback); return list.size() > 0 && ((GameProfile)list.get(0)).getId() != null ? ((GameProfile)list.get(0)).getId().toString() : ""; } else { return EntityPlayer.getUUID(new GameProfile((UUID)null, p_152719_0_)).toString(); } } else { return p_152719_0_; } }
public void writeToNBT(NBTTagCompound nbt) { String s = this.getEntityNameToSpawn(); if (!StringUtils.isNullOrEmpty(s)) { nbt.setString("EntityId", s); nbt.setShort("Delay", (short)this.spawnDelay); nbt.setShort("MinSpawnDelay", (short)this.minSpawnDelay); nbt.setShort("MaxSpawnDelay", (short)this.maxSpawnDelay); nbt.setShort("SpawnCount", (short)this.spawnCount); nbt.setShort("MaxNearbyEntities", (short)this.maxNearbyEntities); nbt.setShort("RequiredPlayerRange", (short)this.activatingRangeFromPlayer); nbt.setShort("SpawnRange", (short)this.spawnRange); if (this.getRandomEntity() != null) { nbt.setTag("SpawnData", this.getRandomEntity().nbtData.copy()); } if (this.getRandomEntity() != null || this.minecartToSpawn.size() > 0) { NBTTagList nbttaglist = new NBTTagList(); if (this.minecartToSpawn.size() > 0) { for (MobSpawnerBaseLogic.WeightedRandomMinecart mobspawnerbaselogic$weightedrandomminecart : this.minecartToSpawn) { nbttaglist.appendTag(mobspawnerbaselogic$weightedrandomminecart.toNBT()); } } else { nbttaglist.appendTag(this.getRandomEntity().toNBT()); } nbt.setTag("SpawnPotentials", nbttaglist); } } }
public static GameProfile updateGameprofile(GameProfile input) { if (input != null && !StringUtils.isNullOrEmpty(input.getName())) { if (input.isComplete() && input.getProperties().containsKey("textures")) { return input; } else if (MinecraftServer.getServer() == null) { return input; } else { GameProfile gameprofile = MinecraftServer.getServer().getPlayerProfileCache().getGameProfileForUsername(input.getName()); if (gameprofile == null) { return input; } else { Property property = (Property)Iterables.getFirst(gameprofile.getProperties().get("textures"), null); if (property == null) { gameprofile = MinecraftServer.getServer().getMinecraftSessionService().fillProfileProperties(gameprofile, true); } return gameprofile; } } } else { return input; } }
public static GameProfile updateGameprofile(GameProfile input) { if (input != null && !StringUtils.isNullOrEmpty(input.getName())) { if (input.isComplete() && input.getProperties().containsKey("textures")) { return input; } else if (profileCache != null && sessionService != null) { GameProfile gameprofile = profileCache.getGameProfileForUsername(input.getName()); if (gameprofile == null) { return input; } else { Property property = (Property)Iterables.getFirst(gameprofile.getProperties().get("textures"), null); if (property == null) { gameprofile = sessionService.fillProfileProperties(gameprofile, true); } return gameprofile; } } else { return input; } } else { return input; } }
public static String getDurationString(PotionEffect effect) { if (effect.getIsPotionDurationMax()) { return "**:**"; } else { int i = effect.getDuration(); return StringUtils.ticksToElapsedTime(i); } }