@SubscribeEvent public void playerLogin(final PlayerLoggedInEvent event) { if (event.player instanceof EntityPlayer) { if (status == UpdateStatus.OUTDATED) { final String msg = StatCollector.translateToLocalFormatted( "msg.NewVersionAvailable.dsurround", Module.MOD_NAME, currentVersion, CURSE_PROJECT_NAME); final IChatComponent component = IChatComponent.Serializer.jsonToComponent(msg); event.player.addChatMessage(component); } } }
public void readFromNBT(NBTTagCompound compound) { this.isEditable = false; super.readFromNBT(compound); ICommandSender var2 = new ICommandSender() { public String getName() { return "Sign"; } public IChatComponent getDisplayName() { return new ChatComponentText(this.getName()); } public void addChatMessage(IChatComponent message) {} public boolean canCommandSenderUseCommand(int permissionLevel, String command) { return true; } public BlockPos getPosition() { return TileEntitySign.this.pos; } public Vec3 getPositionVector() { return new Vec3( (double) TileEntitySign.this.pos.getX() + 0.5D, (double) TileEntitySign.this.pos.getY() + 0.5D, (double) TileEntitySign.this.pos.getZ() + 0.5D); } public World getEntityWorld() { return TileEntitySign.this.worldObj; } public Entity getCommandSenderEntity() { return null; } public boolean sendCommandFeedback() { return false; } public void func_174794_a(CommandResultStats.Type p_174794_1_, int p_174794_2_) {} }; for (int var3 = 0; var3 < 4; ++var3) { String var4 = compound.getString("Text" + (var3 + 1)); try { IChatComponent var5 = IChatComponent.Serializer.jsonToComponent(var4); try { this.signText[var3] = ChatComponentProcessor.func_179985_a(var2, var5, (Entity) null); } catch (CommandException var7) { this.signText[var3] = var5; } } catch (JsonParseException var8) { this.signText[var3] = new ChatComponentText(var4); } } this.field_174883_i.func_179668_a(compound); }
public void readFromNBT(NBTTagCompound compound) { this.isEditable = false; super.readFromNBT(compound); ICommandSender icommandsender = new ICommandSender() { public String getName() { return "Sign"; } public IChatComponent getDisplayName() { return new ChatComponentText(this.getName()); } public void addChatMessage(IChatComponent component) {} public boolean canCommandSenderUseCommand(int permLevel, String commandName) { return true; } public BlockPos getPosition() { return TileEntitySign.this.pos; } public Vec3 getPositionVector() { return new Vec3( (double) TileEntitySign.this.pos.getX() + 0.5D, (double) TileEntitySign.this.pos.getY() + 0.5D, (double) TileEntitySign.this.pos.getZ() + 0.5D); } public World getEntityWorld() { return TileEntitySign.this.worldObj; } public Entity getCommandSenderEntity() { return null; } public boolean sendCommandFeedback() { return false; } public void setCommandStat(CommandResultStats.Type type, int amount) {} }; for (int i = 0; i < 4; ++i) { String s = compound.getString("Text" + (i + 1)); try { IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s); try { this.signText[i] = ChatComponentProcessor.processComponent( icommandsender, ichatcomponent, (Entity) null); } catch (CommandException var7) { this.signText[i] = ichatcomponent; } } catch (JsonParseException var8) { this.signText[i] = new ChatComponentText(s); } } this.stats.readStatsFromNBT(compound); }
@Override public void onBuild(int i, EntityPlayerSP player) { // 0 : opened GC inventory tab // 1,2,3 : Compressor, CF, Standard Wrench // 4,5,6 : Fuel loader, Launchpad, NASA Workbench // 7: oil found 8: placed rocket GCPlayerStatsClient stats = GCPlayerStatsClient.get(player); int flag = stats.buildFlags; if (flag == -1) flag = 0; int repeatCount = flag >> 9; if (repeatCount <= 3) { repeatCount++; } if ((flag & 1 << i) > 0) return; flag |= 1 << i; stats.buildFlags = (flag & 511) + (repeatCount << 9); GalacticraftCore.packetPipeline.sendToServer( new PacketSimple( EnumSimplePacket.S_BUILDFLAGS_UPDATE, player.worldObj.provider.getDimensionId(), new Object[] {stats.buildFlags})); switch (i) { case 0: case 1: case 2: case 3: player.addChatMessage( IChatComponent.Serializer.jsonToComponent( "[{\"text\":\"" + GCCoreUtil.translate("gui.message.help1") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + GalacticraftCore.PREFIX + "com/wiki/1" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + GalacticraftCore.PREFIX + "com/wiki/1" + "\"}}]")); player.addChatMessage( new ChatComponentText( GCCoreUtil.translate("gui.message.help1a") + EnumColor.AQUA + " /gchelp")); break; case 4: case 5: case 6: player.addChatMessage( IChatComponent.Serializer.jsonToComponent( "[{\"text\":\"" + GCCoreUtil.translate("gui.message.help2") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + GalacticraftCore.PREFIX + "com/wiki/2" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + GalacticraftCore.PREFIX + "com/wiki/2" + "\"}}]")); break; case 7: player.addChatMessage( IChatComponent.Serializer.jsonToComponent( "[{\"text\":\"" + GCCoreUtil.translate("gui.message.help3") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + GalacticraftCore.PREFIX + "com/wiki/oil" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + GalacticraftCore.PREFIX + "com/wiki/oil" + "\"}}]")); break; case 8: player.addChatMessage( IChatComponent.Serializer.jsonToComponent( "[{\"text\":\"" + GCCoreUtil.translate("gui.message.prelaunch") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + GalacticraftCore.PREFIX + "com/wiki/pre" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + GalacticraftCore.PREFIX + "com/wiki/pre" + "\"}}]")); break; } }