From d433825d985c7301befa99006d184d8da8219c1c Mon Sep 17 00:00:00 2001 From: Bruno Marques Caroba Date: Fri, 29 Mar 2024 12:13:54 -0300 Subject: [PATCH] Testing auto release --- .../cruciblemc/necrotempus/NecroTempus.java | 16 +++--- .../necrotempus/NecroTempusPlugin.java | 1 + .../necrotempus/api/actionbar/ActionBar.java | 7 +-- .../api/actionbar/ActionBarManager.java | 12 ++--- .../necrotempus/api/bossbar/BossBar.java | 17 ++++--- .../necrotempus/api/bossbar/BossBarColor.java | 30 ++++++------ .../api/bossbar/BossBarComponent.java | 28 +++++------ .../api/bossbar/BossBarManager.java | 33 +++++++------ .../necrotempus/api/bossbar/BossBarType.java | 8 +-- .../necrotempus/api/playertab/PlayerTab.java | 23 ++++----- .../api/playertab/PlayerTabManager.java | 12 ++--- .../necrotempus/api/playertab/TabCell.java | 4 +- .../necrotempus/api/title/TitleComponent.java | 24 ++++----- .../necrotempus/api/title/TitleElement.java | 8 +-- .../necrotempus/api/title/TitleManager.java | 12 ++--- .../necrotempus/api/title/TitleType.java | 6 +-- .../actionbar/client/ActionBarRegistry.java | 2 +- .../client/ClientGuiIngameModifier.java | 12 ++--- .../actionbar/network/ActionBarPacket.java | 17 ++++--- .../network/ActionBarPacketHandler.java | 6 +-- .../bossbar/client/BossBarRegistry.java | 2 +- .../bossbar/client/ClientBossBarManager.java | 12 ++--- .../bossbar/client/render/BossBarGui.java | 49 ++++++++++--------- .../render/BossDisplayAdapterListener.java | 18 +++---- .../bossbar/compat/crafttweaker/BossBar.java | 8 +-- .../bossbar/component/BossDisplayAdapter.java | 6 +-- .../bossbar/network/BossBarPacket.java | 17 ++++--- .../bossbar/network/BossBarPacketHandler.java | 4 +- .../bossbar/server/BossBarManagerServer.java | 12 ++--- .../modules/features/glyphs/CustomGlyphs.java | 15 +++--- .../features/glyphs/GlyphsRegistry.java | 23 ++++----- .../modules/features/glyphs/GlyphsRender.java | 2 +- .../features/packet/NTClientPacket.java | 11 +++-- .../packet/NTClientPacketRegistry.java | 2 +- .../client/ClientPlayerTabManager.java | 3 +- .../playertab/client/DefaultPlayerTab.java | 10 ++-- .../playertab/client/PlayerTabRegistry.java | 2 +- .../playertab/client/render/PlayerTabGui.java | 7 +-- .../playertab/network/PlayerTabPacket.java | 17 ++++--- .../network/PlayerTabPacketHandler.java | 6 +-- .../title/client/ClientTitleManager.java | 7 +-- .../features/title/client/TitleRegistry.java | 2 +- .../client/render/TitleDisplayListener.java | 12 ++--- .../title/client/render/TitleGui.java | 29 +++++------ .../features/title/component/TimedTitle.java | 9 ++-- .../features/title/network/TitlePacket.java | 17 ++++--- .../title/network/TitlePacketHandler.java | 6 +-- .../mixin/mixins/botania/BossBarHandler.java | 4 +- .../mixins/bukkit/player/CraftPlayer.java | 33 +++++++------ .../playerspigot/CraftPlayerSpigot.java | 12 ++--- .../customnpcs/MixinRenderNPCInterface.java | 3 +- .../mixin/mixins/fml/FMLClientHandler.java | 15 +++--- .../mixins/minecraft/FontRendererMixin.java | 1 - .../mixins/minecraft/GuiIngameMixin.java | 6 +-- .../modules/mixin/plugin/Mixin.java | 4 +- .../modules/mixin/plugin/TargetedMod.java | 9 ++-- .../necrotempus/proxy/CommonProxy.java | 11 +++-- .../necrotempus/proxy/ServerProxy.java | 2 +- .../necrotempus/utils/ColorUtils.java | 12 ++--- .../necrotempus/utils/CrucibleAsk.java | 4 +- .../utils/NetHandlerPlayClientNT.java | 10 ++-- .../necrotempus/utils/ServerUtils.java | 26 +++++----- .../necrotempus/utils/SideUtils.java | 4 +- 63 files changed, 387 insertions(+), 355 deletions(-) diff --git a/src/main/java/io/github/cruciblemc/necrotempus/NecroTempus.java b/src/main/java/io/github/cruciblemc/necrotempus/NecroTempus.java index 752e5f0..35647c4 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/NecroTempus.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/NecroTempus.java @@ -33,8 +33,8 @@ public class NecroTempus { private static NecroTempus instance; @SidedProxy( - clientSide="io.github.cruciblemc.necrotempus.proxy.ClientProxy", - serverSide="io.github.cruciblemc.necrotempus.proxy.ServerProxy" + clientSide = "io.github.cruciblemc.necrotempus.proxy.ClientProxy", + serverSide = "io.github.cruciblemc.necrotempus.proxy.ServerProxy" ) public static CommonProxy proxy; @@ -44,15 +44,15 @@ public class NecroTempus { public Logger logger; static { - DISPATCHER.registerMessage(NTClientPacketHandler.class, NTClientPacket.class, 0, Side.SERVER); - DISPATCHER.registerMessage(BossBarPacketHandler.class, BossBarPacket.class, 1, Side.CLIENT); - DISPATCHER.registerMessage(PlayerTabPacketHandler.class, PlayerTabPacket.class, 2, Side.CLIENT); - DISPATCHER.registerMessage(TitlePacketHandler.class, TitlePacket.class, 3, Side.CLIENT); - DISPATCHER.registerMessage(ActionBarPacketHandler.class, ActionBarPacket.class, 4, Side.CLIENT); + DISPATCHER.registerMessage(NTClientPacketHandler.class, NTClientPacket.class, 0, Side.SERVER); + DISPATCHER.registerMessage(BossBarPacketHandler.class, BossBarPacket.class, 1, Side.CLIENT); + DISPATCHER.registerMessage(PlayerTabPacketHandler.class, PlayerTabPacket.class, 2, Side.CLIENT); + DISPATCHER.registerMessage(TitlePacketHandler.class, TitlePacket.class, 3, Side.CLIENT); + DISPATCHER.registerMessage(ActionBarPacketHandler.class, ActionBarPacket.class, 4, Side.CLIENT); } @Mod.EventHandler - public void preInit(FMLPreInitializationEvent event){ + public void preInit(FMLPreInitializationEvent event) { logger = event.getModLog(); OmniconfigAPI.registerAnnotationConfig(NecroTempusConfig.class); proxy.preInit(event); diff --git a/src/main/java/io/github/cruciblemc/necrotempus/NecroTempusPlugin.java b/src/main/java/io/github/cruciblemc/necrotempus/NecroTempusPlugin.java index 383e6d6..192af66 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/NecroTempusPlugin.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/NecroTempusPlugin.java @@ -121,6 +121,7 @@ public void disablePlugin(Plugin plugin) { public Server getServer() { return Bukkit.getServer(); } + @Override public boolean isEnabled() { return isPluginEnabled; diff --git a/src/main/java/io/github/cruciblemc/necrotempus/api/actionbar/ActionBar.java b/src/main/java/io/github/cruciblemc/necrotempus/api/actionbar/ActionBar.java index 72de260..d487f59 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/api/actionbar/ActionBar.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/api/actionbar/ActionBar.java @@ -12,20 +12,21 @@ @Setter public class ActionBar { - @Getter @Setter + @Getter + @Setter private static ActionBarManager actionBarManager = new ActionBarManager(); private int time; private IChatComponent text; - public NBTTagCompound toNbt(){ + public NBTTagCompound toNbt() { NBTTagCompound tagCompound = new NBTTagCompound(); tagCompound.setInteger("time", time); tagCompound.setString("text", text.getUnformattedText()); return tagCompound; } - public static ActionBar fromCompound(NBTTagCompound tagCompound){ + public static ActionBar fromCompound(NBTTagCompound tagCompound) { return new ActionBar( tagCompound.getInteger("time"), new ChatComponentText(tagCompound.getString("text")) diff --git a/src/main/java/io/github/cruciblemc/necrotempus/api/actionbar/ActionBarManager.java b/src/main/java/io/github/cruciblemc/necrotempus/api/actionbar/ActionBarManager.java index 3ac7c84..4c540e5 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/api/actionbar/ActionBarManager.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/api/actionbar/ActionBarManager.java @@ -12,26 +12,26 @@ public class ActionBarManager { - public void set(HashSet players, ActionBar tab){ + public void set(HashSet players, ActionBar tab) { deliver(players, new ActionBarPacket(tab, ActionBarPacket.PacketType.SET)); } - public void remove(HashSet players){ + public void remove(HashSet players) { deliver(players, new ActionBarPacket( new ActionBar(0, new ChatComponentText("")), ActionBarPacket.PacketType.REMOVE) ); } - private void deliver(HashSet players, ActionBarPacket packet){ - for(UUID uuid : players){ + private void deliver(HashSet players, ActionBarPacket packet) { + for (UUID uuid : players) { EntityPlayerMP entityPlayerMP = ServerUtils.getPlayer(uuid); - if(entityPlayerMP != null) + if (entityPlayerMP != null) NecroTempus.DISPATCHER.sendTo(packet, entityPlayerMP); } } - public static PlayerTabManager commonInstance(){ + public static PlayerTabManager commonInstance() { return new PlayerTabManager(); } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBar.java b/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBar.java index 1d1c5b8..3624310 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBar.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBar.java @@ -9,9 +9,10 @@ import static io.github.cruciblemc.necrotempus.api.bossbar.BossBarManager.commonInstance; -public class BossBar extends BossBarComponent{ +public class BossBar extends BossBarComponent { - @Getter @Setter + @Getter + @Setter private static BossBarManager BossBarManager = commonInstance(); private BossBar() { @@ -22,27 +23,27 @@ private BossBar(UUID uuid) { super(uuid); } - private BossBar(NBTTagCompound tagCompound){ + private BossBar(NBTTagCompound tagCompound) { super(tagCompound); } - private BossBar(UUID uuid, ChatComponentText text, BossBarColor color, BossBarType type, Float percent, boolean isVisible){ + private BossBar(UUID uuid, ChatComponentText text, BossBarColor color, BossBarType type, Float percent, boolean isVisible) { super(uuid, text, color, type, percent, isVisible); } - public static BossBar createBossBar(){ + public static BossBar createBossBar() { return new BossBar(); } - public static BossBar createBossBar(UUID uuid){ + public static BossBar createBossBar(UUID uuid) { return new BossBar(uuid); } - public static BossBar createBossBar(NBTTagCompound nbtTagCompound){ + public static BossBar createBossBar(NBTTagCompound nbtTagCompound) { return new BossBar(nbtTagCompound); } - public static BossBar createBossBar(UUID uuid, ChatComponentText text, BossBarColor color, BossBarType type, Float percent, boolean isVisible){ + public static BossBar createBossBar(UUID uuid, ChatComponentText text, BossBarColor color, BossBarType type, Float percent, boolean isVisible) { return new BossBar(uuid, text, color, type, percent, isVisible); } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBarColor.java b/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBarColor.java index 10a40a7..fa13395 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBarColor.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBarColor.java @@ -5,30 +5,30 @@ public enum BossBarColor { - PINK( "pink", 15466679 ), - BLUE( "blue", 47084 ), - RED( "red", 15480064 ), - GREEN( "green", 1960960 ), - YELLOW( "yellow", 15264768 ), - PURPLE( "purple", 8061164 ), - WHITE( "white", 16777215 ), - LAZY( "lazy", 47084 ); + PINK("pink", 15466679), + BLUE("blue", 47084), + RED("red", 15480064), + GREEN("green", 1960960), + YELLOW("yellow", 15264768), + PURPLE("purple", 8061164), + WHITE("white", 16777215), + LAZY("lazy", 47084); private final String identifier; private int color; - BossBarColor(String colorIdentifier, int color){ + BossBarColor(String colorIdentifier, int color) { this.identifier = colorIdentifier; this.color = color; } - public static BossBarColor lazyOf(int color){ + public static BossBarColor lazyOf(int color) { BossBarColor barColor = LAZY; barColor.color = color; return barColor; } - public static BossBarColor lazyOf(String color){ + public static BossBarColor lazyOf(String color) { BossBarColor barColor = LAZY; barColor.color = ColorUtils.decodeColor(color).getRGB(); return barColor; @@ -42,14 +42,14 @@ public String getIdentifier() { return identifier; } - public static BossBarColor valueOfString(String name){ + public static BossBarColor valueOfString(String name) { - if(name.startsWith("$")){ + if (name.startsWith("$")) { return lazyOf(Integer.parseInt(name.substring(1))); } - for(BossBarColor type : values()){ - if(type.identifier.equalsIgnoreCase(name)){ + for (BossBarColor type : values()) { + if (type.identifier.equalsIgnoreCase(name)) { return type; } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBarComponent.java b/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBarComponent.java index 32ccacb..71769cd 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBarComponent.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBarComponent.java @@ -23,7 +23,7 @@ public abstract class BossBarComponent extends TimedElement { private int lazyColor = -1; - protected BossBarComponent(NBTTagCompound nbtTagCompound){ + protected BossBarComponent(NBTTagCompound nbtTagCompound) { this.uuid = UUID.fromString(nbtTagCompound.getString("uuid")); this.text = new ChatComponentText(nbtTagCompound.getString("text")); this.type = BossBarType.valueOfString(nbtTagCompound.getString("type")); @@ -32,15 +32,15 @@ protected BossBarComponent(NBTTagCompound nbtTagCompound){ this.percentage = nbtTagCompound.getFloat("percentage"); } - protected BossBarComponent(UUID uuid){ + protected BossBarComponent(UUID uuid) { this(uuid, new ChatComponentText(""), BossBarColor.PINK, BossBarType.FLAT, 1F, true); } - protected BossBarComponent(){ + protected BossBarComponent() { this(UUID.randomUUID()); } - protected BossBarComponent(UUID uuid, ChatComponentText text, BossBarColor color, BossBarType type, Float percent,boolean isVisible){ + protected BossBarComponent(UUID uuid, ChatComponentText text, BossBarColor color, BossBarType type, Float percent, boolean isVisible) { this.uuid = uuid; this.text = text; this.type = type; @@ -49,20 +49,20 @@ protected BossBarComponent(UUID uuid, ChatComponentText text, BossBarColor color this.isVisible = isVisible; } - public NBTTagCompound toNbt(){ + public NBTTagCompound toNbt() { NBTTagCompound nbtTagCompound = new NBTTagCompound(); - nbtTagCompound.setString( "text", text.getChatComponentText_TextValue()); - nbtTagCompound.setString( "type", type.getType()); - nbtTagCompound.setFloat( "percentage", percentage); - nbtTagCompound.setBoolean( "isVisible", isVisible); - nbtTagCompound.setString( "uuid", uuid.toString()); + nbtTagCompound.setString("text", text.getChatComponentText_TextValue()); + nbtTagCompound.setString("type", type.getType()); + nbtTagCompound.setFloat("percentage", percentage); + nbtTagCompound.setBoolean("isVisible", isVisible); + nbtTagCompound.setString("uuid", uuid.toString()); - if(color == BossBarColor.LAZY){ - nbtTagCompound.setString( "color", "$" + color.intValue()); - }else{ - nbtTagCompound.setString( "color", color.getIdentifier()); + if (color == BossBarColor.LAZY) { + nbtTagCompound.setString("color", "$" + color.intValue()); + } else { + nbtTagCompound.setString("color", color.getIdentifier()); } return nbtTagCompound; diff --git a/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBarManager.java b/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBarManager.java index 7f8cb89..f640629 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBarManager.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBarManager.java @@ -7,53 +7,56 @@ public abstract class BossBarManager { - public static BossBarManager commonInstance(){ + public static BossBarManager commonInstance() { return new BossBarManager() { @Override - public void add(UUID target, BossBar bossBar) {} + public void add(UUID target, BossBar bossBar) { + } @Override - public void remove(BossBar bossBar) {} + public void remove(BossBar bossBar) { + } @Override - public void remove(UUID target, BossBar bossBar) {} + public void remove(UUID target, BossBar bossBar) { + } }; } - private static final LinkedHashMap> players = new LinkedHashMap<>(); + private static final LinkedHashMap> players = new LinkedHashMap<>(); public Set getPlayers(BossBar bossBar) { return getOrCreatePlayers(bossBar); } - public boolean hasPlayer(BossBar bossBar, UUID player){ + public boolean hasPlayer(BossBar bossBar, UUID player) { return getPlayers(bossBar).contains(player); } - public boolean hasPlayers(BossBar bossBar){ + public boolean hasPlayers(BossBar bossBar) { return !getPlayers(bossBar).isEmpty(); } - public void removePlayer(UUID player, BossBar bossBar){ + public void removePlayer(UUID player, BossBar bossBar) { getPlayers(bossBar).remove(player); remove(player, bossBar); } - public void addPlayer(UUID player, BossBar bossBar){ + public void addPlayer(UUID player, BossBar bossBar) { getPlayers(bossBar).add(player); add(player, bossBar); } - public void removeAllPlayers(BossBar bossBar){ + public void removeAllPlayers(BossBar bossBar) { getPlayers(bossBar).clear(); remove(bossBar); } - private Set getOrCreatePlayers(BossBar bossBar){ + private Set getOrCreatePlayers(BossBar bossBar) { - if(!players.containsKey(bossBar.getUuid())){ + if (!players.containsKey(bossBar.getUuid())) { players.put(bossBar.getUuid(), new HashSet<>()); } @@ -66,12 +69,12 @@ private Set getOrCreatePlayers(BossBar bossBar){ public abstract void remove(UUID target, BossBar bossBar); - public void deliver(Set players, Object packet){ + public void deliver(Set players, Object packet) { } - public final void sync(BossBar bossBar){ - for(UUID uuid : getPlayers(bossBar)) + public final void sync(BossBar bossBar) { + for (UUID uuid : getPlayers(bossBar)) add(uuid, bossBar); } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBarType.java b/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBarType.java index 4c9921d..9121219 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBarType.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/api/bossbar/BossBarType.java @@ -15,17 +15,17 @@ public String getType() { return type; } - BossBarType(String type){ + BossBarType(String type) { this.type = type; } - public static BossBarType valueOfString(String name){ + public static BossBarType valueOfString(String name) { String fName = name.toLowerCase().replaceAll("segmented", "notched"); // if segmented -> notched fName = fName.replaceAll("solid", "flat"); // if solid -> flat - for(BossBarType type : values()){ - if(type.getType().equalsIgnoreCase(fName)){ + for (BossBarType type : values()) { + if (type.getType().equalsIgnoreCase(fName)) { return type; } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/api/playertab/PlayerTab.java b/src/main/java/io/github/cruciblemc/necrotempus/api/playertab/PlayerTab.java index c17c60b..bdd8a96 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/api/playertab/PlayerTab.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/api/playertab/PlayerTab.java @@ -14,7 +14,8 @@ @NoArgsConstructor public class PlayerTab { - @Getter @Setter + @Getter + @Setter private static PlayerTabManager playerTabManager = PlayerTabManager.commonInstance(); private List cellList; @@ -23,40 +24,40 @@ public class PlayerTab { private IChatComponent header; private IChatComponent footer; - public NBTTagCompound toNbt(){ + public NBTTagCompound toNbt() { NBTTagCompound nbtTagCompound = new NBTTagCompound(); NBTTagList cellListTag = new NBTTagList(); - for(TabCell cell : cellList) + for (TabCell cell : cellList) cellListTag.appendTag(cell.toNbt()); nbtTagCompound.setTag("cellList", cellListTag); nbtTagCompound.setBoolean("drawPlayerHeads", drawPlayerHeads); - if(header != null) nbtTagCompound.setString("header", header.getUnformattedText()); - if(footer != null) nbtTagCompound.setString("footer", footer.getUnformattedText()); + if (header != null) nbtTagCompound.setString("header", header.getUnformattedText()); + if (footer != null) nbtTagCompound.setString("footer", footer.getUnformattedText()); return nbtTagCompound; } - public static PlayerTab fromCompound(NBTTagCompound compound){ + public static PlayerTab fromCompound(NBTTagCompound compound) { ArrayList cells = new ArrayList<>(); - if(compound.hasKey("cellList", 10)){ + if (compound.hasKey("cellList", 10)) { NBTTagList tagList = compound.getTagList("cellList", 10); - for(int i = 0; i < tagList.tagCount(); i++) + for (int i = 0; i < tagList.tagCount(); i++) cells.add(TabCell.fromNBT(tagList.getCompoundTagAt(i))); } IChatComponent header = null; - if(compound.hasKey("header")) + if (compound.hasKey("header")) header = new ChatComponentText(compound.getString("header")); IChatComponent footer = null; - if(compound.hasKey("footer")) + if (compound.hasKey("footer")) footer = new ChatComponentText(compound.getString("footer")); return new PlayerTab( @@ -64,7 +65,7 @@ public static PlayerTab fromCompound(NBTTagCompound compound){ compound.getBoolean("drawPlayerHeads"), header, footer - ); + ); } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/api/playertab/PlayerTabManager.java b/src/main/java/io/github/cruciblemc/necrotempus/api/playertab/PlayerTabManager.java index ee689a8..0bfc5f3 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/api/playertab/PlayerTabManager.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/api/playertab/PlayerTabManager.java @@ -11,26 +11,26 @@ public class PlayerTabManager { - public void set(HashSet players, PlayerTab tab){ + public void set(HashSet players, PlayerTab tab) { deliver(players, new PlayerTabPacket(tab, PlayerTabPacket.PacketType.SET)); } - public void remove(HashSet players){ + public void remove(HashSet players) { deliver(players, new PlayerTabPacket( new PlayerTab(new ArrayList<>(), false, null, null), PlayerTabPacket.PacketType.REMOVE) ); } - private void deliver(HashSet players, PlayerTabPacket packet){ - for(UUID uuid : players){ + private void deliver(HashSet players, PlayerTabPacket packet) { + for (UUID uuid : players) { EntityPlayerMP entityPlayerMP = ServerUtils.getPlayer(uuid); - if(entityPlayerMP != null) + if (entityPlayerMP != null) NecroTempus.DISPATCHER.sendTo(packet, entityPlayerMP); } } - public static PlayerTabManager commonInstance(){ + public static PlayerTabManager commonInstance() { return new PlayerTabManager(); } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/api/playertab/TabCell.java b/src/main/java/io/github/cruciblemc/necrotempus/api/playertab/TabCell.java index cf5af17..15e97ff 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/api/playertab/TabCell.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/api/playertab/TabCell.java @@ -24,7 +24,7 @@ public class TabCell { private int playerPing; - public static TabCell fromNBT(NBTTagCompound tagCompound){ + public static TabCell fromNBT(NBTTagCompound tagCompound) { return new TabCell( new ChatComponentText(tagCompound.getString("displayName")), tagCompound.getString("linkedUserName"), @@ -34,7 +34,7 @@ public static TabCell fromNBT(NBTTagCompound tagCompound){ ); } - public NBTTagCompound toNbt(){ + public NBTTagCompound toNbt() { NBTTagCompound tagCompound = new NBTTagCompound(); diff --git a/src/main/java/io/github/cruciblemc/necrotempus/api/title/TitleComponent.java b/src/main/java/io/github/cruciblemc/necrotempus/api/title/TitleComponent.java index 80ce0d0..56d347a 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/api/title/TitleComponent.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/api/title/TitleComponent.java @@ -4,10 +4,12 @@ import lombok.Setter; import net.minecraft.nbt.NBTTagCompound; -@Getter @Setter +@Getter +@Setter public class TitleComponent { - @Getter @Setter + @Getter + @Setter private static TitleManager titleManager = new TitleManager(); private int fadeIn = 500; @@ -16,19 +18,19 @@ public class TitleComponent { private final TitleElement[] elements = new TitleElement[2]; - public void addElement(TitleElement element){ + public void addElement(TitleElement element) { elements[element.getType().ordinal()] = element; } - public boolean hasElement(TitleType type){ + public boolean hasElement(TitleType type) { return elements[type.ordinal()] != null; } - public TitleElement getElement(TitleType type){ + public TitleElement getElement(TitleType type) { return elements[type.ordinal()]; } - public NBTTagCompound toNbt(){ + public NBTTagCompound toNbt() { NBTTagCompound nbtTagCompound = new NBTTagCompound(); @@ -36,16 +38,16 @@ public NBTTagCompound toNbt(){ nbtTagCompound.setInteger("stay", stay); nbtTagCompound.setInteger("fadeOut", fadeOut); - for(TitleType type : TitleType.values()){ + for (TitleType type : TitleType.values()) { TitleElement titleElement = elements[type.ordinal()]; - if(titleElement != null) + if (titleElement != null) nbtTagCompound.setTag(type.name().toLowerCase(), titleElement.toNbt()); } return nbtTagCompound; } - public static TitleComponent fromCompound(NBTTagCompound tagCompound){ + public static TitleComponent fromCompound(NBTTagCompound tagCompound) { TitleComponent component = new TitleComponent(); @@ -53,9 +55,9 @@ public static TitleComponent fromCompound(NBTTagCompound tagCompound){ component.stay = tagCompound.getInteger("stay"); component.fadeOut = tagCompound.getInteger("fadeOut"); - for(TitleType type : TitleType.values()){ + for (TitleType type : TitleType.values()) { String key = type.name().toLowerCase(); - if(tagCompound.hasKey(key)){ + if (tagCompound.hasKey(key)) { component.addElement(TitleElement.fromCompound(tagCompound.getCompoundTag(key))); } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/api/title/TitleElement.java b/src/main/java/io/github/cruciblemc/necrotempus/api/title/TitleElement.java index e624f2e..93a7648 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/api/title/TitleElement.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/api/title/TitleElement.java @@ -16,22 +16,22 @@ private TitleElement(IChatComponent text, TitleType type) { this.type = type; } - public static TitleElement titleOf(IChatComponent text){ + public static TitleElement titleOf(IChatComponent text) { return new TitleElement(text, TitleType.TITLE); } - public static TitleElement subtitleOf(IChatComponent text){ + public static TitleElement subtitleOf(IChatComponent text) { return new TitleElement(text, TitleType.SUBTITLE); } - public NBTTagCompound toNbt(){ + public NBTTagCompound toNbt() { NBTTagCompound nbtTagCompound = new NBTTagCompound(); nbtTagCompound.setString("text", text.getUnformattedText()); nbtTagCompound.setString("type", type.name()); return nbtTagCompound; } - public static TitleElement fromCompound(NBTTagCompound tagCompound){ + public static TitleElement fromCompound(NBTTagCompound tagCompound) { return new TitleElement( new ChatComponentText(tagCompound.getString("text")), TitleType.of(tagCompound.getString("type")) diff --git a/src/main/java/io/github/cruciblemc/necrotempus/api/title/TitleManager.java b/src/main/java/io/github/cruciblemc/necrotempus/api/title/TitleManager.java index b0a190c..8d33a5b 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/api/title/TitleManager.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/api/title/TitleManager.java @@ -12,26 +12,26 @@ public class TitleManager { - public void set(HashSet players, TitleComponent tab){ + public void set(HashSet players, TitleComponent tab) { deliver(players, new TitlePacket(tab, TitlePacket.PacketType.SET)); } - public void remove(HashSet players){ + public void remove(HashSet players) { deliver(players, new TitlePacket( new TitleComponent(), TitlePacket.PacketType.REMOVE) ); } - private void deliver(HashSet players, TitlePacket packet){ - for(UUID uuid : players){ + private void deliver(HashSet players, TitlePacket packet) { + for (UUID uuid : players) { EntityPlayerMP entityPlayerMP = ServerUtils.getPlayer(uuid); - if(entityPlayerMP != null) + if (entityPlayerMP != null) NecroTempus.DISPATCHER.sendTo(packet, entityPlayerMP); } } - public static PlayerTabManager commonInstance(){ + public static PlayerTabManager commonInstance() { return new PlayerTabManager(); } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/api/title/TitleType.java b/src/main/java/io/github/cruciblemc/necrotempus/api/title/TitleType.java index f594ae1..219687a 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/api/title/TitleType.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/api/title/TitleType.java @@ -4,10 +4,10 @@ public enum TitleType { TITLE, SUBTITLE; - public static TitleType of(String name){ + public static TitleType of(String name) { - for(TitleType titleType : values()){ - if(titleType.name().equalsIgnoreCase(name)) + for (TitleType titleType : values()) { + if (titleType.name().equalsIgnoreCase(name)) return titleType; } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/actionbar/client/ActionBarRegistry.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/actionbar/client/ActionBarRegistry.java index c87da31..edc28cd 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/actionbar/client/ActionBarRegistry.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/actionbar/client/ActionBarRegistry.java @@ -4,7 +4,7 @@ public interface ActionBarRegistry { - static void init(){ + static void init() { MinecraftForge.EVENT_BUS.register(ClientGuiIngameModifier.getInstance()); } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/actionbar/client/ClientGuiIngameModifier.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/actionbar/client/ClientGuiIngameModifier.java index 6330c4a..478133b 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/actionbar/client/ClientGuiIngameModifier.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/actionbar/client/ClientGuiIngameModifier.java @@ -22,21 +22,21 @@ private ClientGuiIngameModifier() { @SubscribeEvent - public void onRender(RenderGameOverlayEvent.Pre evt){ - if(guiIngameForge == null){ + public void onRender(RenderGameOverlayEvent.Pre evt) { + if (guiIngameForge == null) { guiIngameForge = (GuiIngameForge) Minecraft.getMinecraft().ingameGUI; } } - public static void renderActionBar(ActionBar actionBar){ - if(guiIngameForge != null){ + public static void renderActionBar(ActionBar actionBar) { + if (guiIngameForge != null) { guiIngameForge.func_110326_a(actionBar.getText().getUnformattedText(), false); guiIngameForge.recordPlayingUpFor = actionBar.getTime(); } } - public static void clearActionbar(){ - if(guiIngameForge != null){ + public static void clearActionbar() { + if (guiIngameForge != null) { guiIngameForge.recordPlayingUpFor = 0; } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/actionbar/network/ActionBarPacket.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/actionbar/network/ActionBarPacket.java index b5ac5f7..bc41cfa 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/actionbar/network/ActionBarPacket.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/actionbar/network/ActionBarPacket.java @@ -11,14 +11,15 @@ public class ActionBarPacket implements IMessage { private ActionBar component; private PacketType packetType = PacketType.SET; - public ActionBarPacket(){} + public ActionBarPacket() { + } - public ActionBarPacket(NBTTagCompound tagCompound, PacketType type){ + public ActionBarPacket(NBTTagCompound tagCompound, PacketType type) { component = ActionBar.fromCompound(tagCompound); packetType = type; } - public ActionBarPacket(ActionBar actionBar, PacketType type){ + public ActionBarPacket(ActionBar actionBar, PacketType type) { component = actionBar; packetType = type; } @@ -38,14 +39,14 @@ public void toBytes(ByteBuf buf) { } - public enum PacketType{ + public enum PacketType { SET("set"), REMOVE("remove"); private final String name; - PacketType(String name){ + PacketType(String name) { this.name = name; } @@ -53,9 +54,9 @@ public String getName() { return name; } - public static PacketType valueOfString(String name){ - for(PacketType type : values()){ - if(type.getName().equalsIgnoreCase(name)){ + public static PacketType valueOfString(String name) { + for (PacketType type : values()) { + if (type.getName().equalsIgnoreCase(name)) { return type; } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/actionbar/network/ActionBarPacketHandler.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/actionbar/network/ActionBarPacketHandler.java index ebf2237..0eb5d46 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/actionbar/network/ActionBarPacketHandler.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/actionbar/network/ActionBarPacketHandler.java @@ -16,10 +16,10 @@ public IMessage onMessage(ActionBarPacket message, MessageContext ctx) { } @SideOnly(Side.CLIENT) - public static void handleActionBar(ActionBarPacket actionBarPacket){ - if(actionBarPacket.getPacketType() == ActionBarPacket.PacketType.REMOVE){ + public static void handleActionBar(ActionBarPacket actionBarPacket) { + if (actionBarPacket.getPacketType() == ActionBarPacket.PacketType.REMOVE) { ClientGuiIngameModifier.clearActionbar(); - }else { + } else { ClientGuiIngameModifier.renderActionBar(actionBarPacket.getComponent()); } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/client/BossBarRegistry.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/client/BossBarRegistry.java index 2bf2a01..e1855c3 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/client/BossBarRegistry.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/client/BossBarRegistry.java @@ -7,7 +7,7 @@ public interface BossBarRegistry { - static void init(){ + static void init() { MinecraftForge.EVENT_BUS.register(BossBarGui.getInstance()); MinecraftForge.EVENT_BUS.register(BossDisplayAdapterListener.getInstance()); FMLCommonHandler.instance().bus().register(ClientBossBarManager.getInstance()); diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/client/ClientBossBarManager.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/client/ClientBossBarManager.java index d5bcd87..78a472c 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/client/ClientBossBarManager.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/client/ClientBossBarManager.java @@ -15,7 +15,7 @@ public class ClientBossBarManager { private static ClientBossBarManager instance; - private ClientBossBarManager(){ + private ClientBossBarManager() { instance = this; } @@ -25,11 +25,11 @@ public static ClientBossBarManager getInstance() { private static final LinkedHashMap BOSS_BARS_ENTRIES = new LinkedHashMap<>(); - public static void add(BossBar bossBar){ + public static void add(BossBar bossBar) { BOSS_BARS_ENTRIES.put(bossBar.getUuid(), bossBar); } - public static void remove(BossBar bossBar){ + public static void remove(BossBar bossBar) { BOSS_BARS_ENTRIES.remove(bossBar.getUuid()); } @@ -37,16 +37,16 @@ public static Iterator iterator() { return BOSS_BARS_ENTRIES.values().iterator(); } - public static boolean isEmpty(){ + public static boolean isEmpty() { return BOSS_BARS_ENTRIES.isEmpty(); } - public static int size(){ + public static int size() { return BOSS_BARS_ENTRIES.size(); } @SubscribeEvent - public void onPlayerQuit(FMLNetworkEvent.ClientDisconnectionFromServerEvent event){ + public void onPlayerQuit(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) { BOSS_BARS_ENTRIES.clear(); } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/client/render/BossBarGui.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/client/render/BossBarGui.java index ac88bea..03103b3 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/client/render/BossBarGui.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/client/render/BossBarGui.java @@ -19,7 +19,7 @@ @SuppressWarnings("FieldCanBeLocal") public class BossBarGui extends Gui { - private static final ResourceLocation BARS_TEXTURES = new ResourceLocation(Tags.MODID,"textures/gui/bars.png"); + private static final ResourceLocation BARS_TEXTURES = new ResourceLocation(Tags.MODID, "textures/gui/bars.png"); private final int BAR_SIZE = 182; private final int BAR_SEGMENT_HEIGHT = 5; @@ -34,33 +34,34 @@ public static BossBarGui getInstance() { return (instance != null) ? instance : new BossBarGui(); } - private BossBarGui(){ + private BossBarGui() { instance = this; this.minecraft = Minecraft.getMinecraft(); } - private void render(ScaledResolution scaledResolution){ + private void render(ScaledResolution scaledResolution) { TextureManager textureManager = minecraft.getTextureManager(); - if(!ClientBossBarManager.isEmpty()){ + if (!ClientBossBarManager.isEmpty()) { int width = scaledResolution.getScaledWidth(); int y = 12; Iterator iterator = ClientBossBarManager.iterator(); - render: { - while(iterator.hasNext()){ + render: + { + while (iterator.hasNext()) { BossBar bar = iterator.next(); - if(bar.getCreationTime() != 0 && (bar.getCreationTime() + 2000) < System.currentTimeMillis()){ + if (bar.getCreationTime() != 0 && (bar.getCreationTime() + 2000) < System.currentTimeMillis()) { iterator.remove(); continue; } - if(bar.isVisible()){ + if (bar.isVisible()) { int x = (width / 2) - BAR_SIZE / 2; @@ -75,13 +76,13 @@ private void render(ScaledResolution scaledResolution){ int textX = (width / 2) - (textWidth / 2); int textY = y - 9; - minecraft.fontRenderer.drawStringWithShadow(t, textX, textY,16777215); + minecraft.fontRenderer.drawStringWithShadow(t, textX, textY, 16777215); GL11.glPopMatrix(); y += BAR_MARGIN; - if(y >= scaledResolution.getScaledHeight() / 3){ + if (y >= scaledResolution.getScaledHeight() / 3) { break render; } } @@ -90,43 +91,43 @@ private void render(ScaledResolution scaledResolution){ } } - private void drawBossBar(TextureManager textureManager, int x, int y, BossBarComponent bar){ + private void drawBossBar(TextureManager textureManager, int x, int y, BossBarComponent bar) { minecraft.mcProfiler.startSection("necroTimeBossBar"); GL11.glPushMatrix(); int color = bar.getColor().intValue(); - if(bar.getLazyColor() != -1){ + if (bar.getLazyColor() != -1) { color = bar.getLazyColor(); } - float RED = ((color >> 16) & 0xFF) / 255F; - float GREEN = ((color >> 8) & 0xFF) / 255F; - float BLUE = ((color) & 0xFF) / 255F; + float RED = ((color >> 16) & 0xFF) / 255F; + float GREEN = ((color >> 8) & 0xFF) / 255F; + float BLUE = ((color) & 0xFF) / 255F; - GL11.glColor4f(RED, GREEN, BLUE,1F); + GL11.glColor4f(RED, GREEN, BLUE, 1F); textureManager.bindTexture(BARS_TEXTURES); - drawTexturedModalRect(x, y,0,0, BAR_SIZE, BAR_SEGMENT_HEIGHT); + drawTexturedModalRect(x, y, 0, 0, BAR_SIZE, BAR_SEGMENT_HEIGHT); - if(bar.getType() != BossBarType.FLAT){ - drawTexturedModalRect(x,y,0,DECORATION_GAP + (bar.getType().ordinal() - 1) * BAR_SEGMENT_HEIGHT * 2, BAR_SIZE, BAR_SEGMENT_HEIGHT); + if (bar.getType() != BossBarType.FLAT) { + drawTexturedModalRect(x, y, 0, DECORATION_GAP + (bar.getType().ordinal() - 1) * BAR_SEGMENT_HEIGHT * 2, BAR_SIZE, BAR_SEGMENT_HEIGHT); } int percentage = (int) (bar.getPercentage() * BAR_SIZE); - if(percentage > 0){ + if (percentage > 0) { - drawTexturedModalRect(x,y,0,BAR_SEGMENT_HEIGHT, percentage, BAR_SEGMENT_HEIGHT); + drawTexturedModalRect(x, y, 0, BAR_SEGMENT_HEIGHT, percentage, BAR_SEGMENT_HEIGHT); - if(bar.getType() != BossBarType.FLAT){ - drawTexturedModalRect(x,y,0,(DECORATION_GAP + (bar.getType().ordinal() - 1) * BAR_SEGMENT_HEIGHT * 2 + BAR_SEGMENT_HEIGHT), percentage, BAR_SEGMENT_HEIGHT); + if (bar.getType() != BossBarType.FLAT) { + drawTexturedModalRect(x, y, 0, (DECORATION_GAP + (bar.getType().ordinal() - 1) * BAR_SEGMENT_HEIGHT * 2 + BAR_SEGMENT_HEIGHT), percentage, BAR_SEGMENT_HEIGHT); } } - GL11.glColor4f(1F,1F,1F,1F); + GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glPopMatrix(); minecraft.mcProfiler.endSection(); } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/client/render/BossDisplayAdapterListener.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/client/render/BossDisplayAdapterListener.java index 35e90c9..1bf8038 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/client/render/BossDisplayAdapterListener.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/client/render/BossDisplayAdapterListener.java @@ -21,31 +21,31 @@ public static BossDisplayAdapterListener getInstance() { return (instance != null) ? instance : new BossDisplayAdapterListener(); } - private BossDisplayAdapterListener(){ + private BossDisplayAdapterListener() { instance = this; } private static final LinkedHashSet CUSTOM_ADAPTERS = new LinkedHashSet<>(BossDisplayAdapter.defaultList()); - public static void add(BossDisplayAdapter bossDisplayAdapter){ + public static void add(BossDisplayAdapter bossDisplayAdapter) { CUSTOM_ADAPTERS.add(bossDisplayAdapter); } - public static void remove(BossDisplayAdapter bossDisplayAdapter){ + public static void remove(BossDisplayAdapter bossDisplayAdapter) { CUSTOM_ADAPTERS.remove(bossDisplayAdapter); } @SubscribeEvent - public void onRenderGameOverlayEvent(RenderGameOverlayEvent.Pre event){ - if(event.type == RenderGameOverlayEvent.ElementType.BOSSHEALTH) + public void onRenderGameOverlayEvent(RenderGameOverlayEvent.Pre event) { + if (event.type == RenderGameOverlayEvent.ElementType.BOSSHEALTH) event.setCanceled(true); } @SubscribeEvent public void onRenderLiving(RenderLivingEvent.Pre event) { - if(event.entity instanceof IBossDisplayData bossDisplayData){ + if (event.entity instanceof IBossDisplayData bossDisplayData) { BossBar bossBar = BossBar.createBossBar(event.entity.getUniqueID()); @@ -60,7 +60,7 @@ public void onRenderLiving(RenderLivingEvent.Pre event) { bossBar.setColor(adapter.getColor()); - if(adapter.getLazyColor() != -1){ + if (adapter.getLazyColor() != -1) { bossBar.setLazyColor(adapter.getLazyColor()); } @@ -70,12 +70,12 @@ public void onRenderLiving(RenderLivingEvent.Pre event) { } } - if(!customized){ + if (!customized) { bossBar.setColor(BossBarColor.PINK); bossBar.setType(BossBarType.FLAT); } - if(bossBar.getType() != BossBarType.NONE) + if (bossBar.getType() != BossBarType.NONE) ClientBossBarManager.add(bossBar); } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/compat/crafttweaker/BossBar.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/compat/crafttweaker/BossBar.java index 7022870..8316745 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/compat/crafttweaker/BossBar.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/compat/crafttweaker/BossBar.java @@ -17,11 +17,11 @@ public class BossBar { @ZenMethod - public static void customize(String entity, String type, int color){ + public static void customize(String entity, String type, int color) { MineTweakerAPI.apply(new BossBarCustomizeAction(entity, color, type)); } - public static class BossBarCustomizeAction implements IUndoableAction{ + public static class BossBarCustomizeAction implements IUndoableAction { private final String entity; private final BossBarColor color; @@ -42,14 +42,14 @@ public boolean canUndo() { @Override public void apply() { - if(FMLCommonHandler.instance().getSide().isClient()){ + if (FMLCommonHandler.instance().getSide().isClient()) { BossDisplayAdapterListener.add(bossDisplayAdapter); } } @Override public void undo() { - if(FMLCommonHandler.instance().getSide().isClient()){ + if (FMLCommonHandler.instance().getSide().isClient()) { BossDisplayAdapterListener.remove(bossDisplayAdapter); } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/component/BossDisplayAdapter.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/component/BossDisplayAdapter.java index 2cdc98d..2d909b2 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/component/BossDisplayAdapter.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/component/BossDisplayAdapter.java @@ -18,18 +18,18 @@ public class BossDisplayAdapter { private int lazyColor = -1; - public BossDisplayAdapter(String targetClass, BossBarColor color, BossBarType type){ + public BossDisplayAdapter(String targetClass, BossBarColor color, BossBarType type) { this.targetClass = targetClass; this.color = color; this.type = type; - if(color == BossBarColor.LAZY){ + if (color == BossBarColor.LAZY) { lazyColor = color.intValue(); } } - public static List defaultList(){ + public static List defaultList() { return Arrays.asList( new BossDisplayAdapter( "net.minecraft.entity.boss.EntityDragon", diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/network/BossBarPacket.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/network/BossBarPacket.java index d87ac83..b4c7742 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/network/BossBarPacket.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/network/BossBarPacket.java @@ -11,14 +11,15 @@ public class BossBarPacket implements IMessage { private BossBar component; private PacketType packetType = PacketType.ADD; - public BossBarPacket(){} + public BossBarPacket() { + } - public BossBarPacket(NBTTagCompound tagCompound, PacketType type){ + public BossBarPacket(NBTTagCompound tagCompound, PacketType type) { component = BossBar.createBossBar(tagCompound); packetType = type; } - public BossBarPacket(BossBar bossBarComponent, PacketType type){ + public BossBarPacket(BossBar bossBarComponent, PacketType type) { component = bossBarComponent; packetType = type; } @@ -37,7 +38,7 @@ public void toBytes(ByteBuf buf) { ByteBufUtils.writeTag(buf, tagCompound); } - public enum PacketType{ + public enum PacketType { ADD("add"), REMOVE("remove"), @@ -45,7 +46,7 @@ public enum PacketType{ private final String name; - PacketType(String name){ + PacketType(String name) { this.name = name; } @@ -53,9 +54,9 @@ public String getName() { return name; } - public static PacketType valueOfString(String name){ - for(PacketType type : values()){ - if(type.getName().equalsIgnoreCase(name)){ + public static PacketType valueOfString(String name) { + for (PacketType type : values()) { + if (type.getName().equalsIgnoreCase(name)) { return type; } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/network/BossBarPacketHandler.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/network/BossBarPacketHandler.java index 84ccb20..1bfccca 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/network/BossBarPacketHandler.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/network/BossBarPacketHandler.java @@ -16,9 +16,9 @@ public IMessage onMessage(BossBarPacket message, MessageContext ctx) { } @SideOnly(Side.CLIENT) - public static void handleBossBar(BossBarPacket bossBarPacket){ + public static void handleBossBar(BossBarPacket bossBarPacket) { - if(bossBarPacket.getPacketType() == BossBarPacket.PacketType.REMOVE) + if (bossBarPacket.getPacketType() == BossBarPacket.PacketType.REMOVE) ClientBossBarManager.remove(bossBarPacket.getComponent()); else ClientBossBarManager.add(bossBarPacket.getComponent()); diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/server/BossBarManagerServer.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/server/BossBarManagerServer.java index b83c1dd..1a18825 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/server/BossBarManagerServer.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/bossbar/server/BossBarManagerServer.java @@ -13,12 +13,12 @@ public class BossBarManagerServer extends BossBarManager { - public void add(UUID target, BossBar bossBar){ + public void add(UUID target, BossBar bossBar) { deliver(Collections.singleton(target), new BossBarPacket(bossBar, BossBarPacket.PacketType.ADD)); } public void remove(BossBar bossBar) { - if(!bossBar.isVisible() || hasPlayers(bossBar)) + if (!bossBar.isVisible() || hasPlayers(bossBar)) deliver(getPlayers(bossBar), new BossBarPacket(bossBar, BossBarPacket.PacketType.REMOVE)); } @@ -26,12 +26,12 @@ public void remove(UUID target, BossBar bossBar) { deliver(Collections.singleton(target), new BossBarPacket(bossBar, BossBarPacket.PacketType.REMOVE)); } - public void deliver(Set players, Object packet){ - if(packet instanceof BossBarPacket bossBarPacket){ - for(UUID uuid : players){ + public void deliver(Set players, Object packet) { + if (packet instanceof BossBarPacket bossBarPacket) { + for (UUID uuid : players) { EntityPlayerMP entityPlayerMP = ServerUtils.getPlayer(uuid); - if(entityPlayerMP != null) + if (entityPlayerMP != null) NecroTempus.DISPATCHER.sendTo(bossBarPacket, entityPlayerMP); } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/glyphs/CustomGlyphs.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/glyphs/CustomGlyphs.java index 55e6635..21432f7 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/glyphs/CustomGlyphs.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/glyphs/CustomGlyphs.java @@ -23,11 +23,12 @@ public class CustomGlyphs { private FitMode fitMode = NONE; - public int getFinalCharacterWidth(){ + public int getFinalCharacterWidth() { - if(charWidth >= 0){ + if (charWidth >= 0) { return charWidth; - }if(fitMode == CONTAINS) + } + if (fitMode == CONTAINS) return 10; else if (fitMode == VERTICALLY) { return (int) Math.ceil(MathUtils.calculateWidth(width, height, 9)) + 1; @@ -35,16 +36,16 @@ else if (fitMode == VERTICALLY) { return width; } - public enum FitMode{ + public enum FitMode { NONE, VERTICALLY, CONTAINS; - public static FitMode parse(String string){ + public static FitMode parse(String string) { - if(string == null) + if (string == null) return NONE; - for(FitMode el : values()) { + for (FitMode el : values()) { if (el.name().equalsIgnoreCase(string)) return el; } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/glyphs/GlyphsRegistry.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/glyphs/GlyphsRegistry.java index 59f9f38..a182c0e 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/glyphs/GlyphsRegistry.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/glyphs/GlyphsRegistry.java @@ -18,13 +18,13 @@ public class GlyphsRegistry implements IResourceManagerReloadListener { - public static void init(){ + public static void init() { ((SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new GlyphsRegistry()); } private static final ConcurrentHashMap GLYPHS_REGISTRY = new ConcurrentHashMap<>(); - public static CustomGlyphs getCandidate(char key){ + public static CustomGlyphs getCandidate(char key) { return GLYPHS_REGISTRY.get(key); } @@ -36,25 +36,25 @@ public void onResourceManagerReload(IResourceManager resourceManager) { GLYPHS_REGISTRY.clear(); - for(Object domain : resourceManager.getResourceDomains()){ + for (Object domain : resourceManager.getResourceDomains()) { - if(domain instanceof String dom){ + if (domain instanceof String dom) { - try{ + try { IResource resourceFile = resourceManager.getResource(new ResourceLocation(dom, "glyphs/glyphs.json")); JsonElement jsonElement = jsonParser.parse(new InputStreamReader(resourceFile.getInputStream())); JsonArray jsonArray = jsonElement.getAsJsonObject().getAsJsonArray("glyphs"); - if(jsonArray.size() == 0){ + if (jsonArray.size() == 0) { logger.info(String.format("Resource domain (%s) has glyphs.json file, but this file is empty.", domain)); continue; } int loaded = 0; - for(JsonElement entry : jsonArray){ + for (JsonElement entry : jsonArray) { - try{ + try { JsonObject jsonObject = entry.getAsJsonObject(); @@ -70,7 +70,7 @@ public void onResourceManagerReload(IResourceManager resourceManager) { int charWidth = -1; - if(jsonObject.has("charWidth")){ + if (jsonObject.has("charWidth")) { charWidth = jsonObject.get("charWidth").getAsInt(); } @@ -89,7 +89,7 @@ public void onResourceManagerReload(IResourceManager resourceManager) { GLYPHS_REGISTRY.put(target, customGlyphs); loaded++; - }catch (Exception ignored){ + } catch (Exception ignored) { logger.error(String.format("Fail to parse a glyph {%s}", entry.toString())); } @@ -97,7 +97,8 @@ public void onResourceManagerReload(IResourceManager resourceManager) { logger.info(String.format("Resource domain (%s) has glyphs.json file, registered %d elements", domain, loaded)); - }catch (Exception ignored){} + } catch (Exception ignored) { + } } } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/glyphs/GlyphsRender.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/glyphs/GlyphsRender.java index 307ec2c..51541e8 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/glyphs/GlyphsRender.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/glyphs/GlyphsRender.java @@ -13,7 +13,7 @@ public static float renderGlyph(TextureManager textureManager, CustomGlyphs cust try { GL11.glPushMatrix(); - GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS); + GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glColor4f(1, 1, 1, alpha); textureManager.bindTexture(customGlyphs.getResource()); diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/packet/NTClientPacket.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/packet/NTClientPacket.java index d1321ac..9f84ccc 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/packet/NTClientPacket.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/packet/NTClientPacket.java @@ -12,7 +12,8 @@ public class NTClientPacket implements IMessage { - public NTClientPacket(){} + public NTClientPacket() { + } @Override public void fromBytes(ByteBuf buf) { @@ -31,7 +32,7 @@ public static class NecroTempusClient { static int times = 0; @SubscribeEvent - public void playerServerConnect(FMLNetworkEvent.ClientConnectedToServerEvent event){ + public void playerServerConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) { packet = new NTClientPacket(); delay = 10; NecroTempus.getInstance().getLogger().info("Saying HELLO to the server."); @@ -45,7 +46,7 @@ public void onClientTick(TickEvent.ClientTickEvent event) { NecroTempus.DISPATCHER.sendToServer(packet); times++; - if(times > 8){ + if (times > 8) { packet = null; delay = 10; } @@ -56,11 +57,11 @@ public void onClientTick(TickEvent.ClientTickEvent event) { private static NecroTempusClient instance; - public static NecroTempusClient getInstance(){ + public static NecroTempusClient getInstance() { return instance != null ? instance : (instance = new NecroTempusClient()); } - public NBTTagCompound toNBT(){ + public NBTTagCompound toNBT() { NBTTagCompound nbtTagCompound = new NBTTagCompound(); diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/packet/NTClientPacketRegistry.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/packet/NTClientPacketRegistry.java index f0b5fc7..74f820a 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/packet/NTClientPacketRegistry.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/packet/NTClientPacketRegistry.java @@ -4,7 +4,7 @@ public interface NTClientPacketRegistry { - static void init(){ + static void init() { FMLCommonHandler.instance().bus().register(NTClientPacket.NecroTempusClient.getInstance()); } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/client/ClientPlayerTabManager.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/client/ClientPlayerTabManager.java index 46cfce7..99c3297 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/client/ClientPlayerTabManager.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/client/ClientPlayerTabManager.java @@ -7,7 +7,8 @@ public class ClientPlayerTabManager { - @Getter @Setter + @Getter + @Setter private static PlayerTab playerTab; } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/client/DefaultPlayerTab.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/client/DefaultPlayerTab.java index 63f0235..543c475 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/client/DefaultPlayerTab.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/client/DefaultPlayerTab.java @@ -25,7 +25,7 @@ public static PlayerTab getInstance() { return instance != null ? instance : new DefaultPlayerTab(); } - private DefaultPlayerTab(){ + private DefaultPlayerTab() { super(); instance = this; } @@ -43,11 +43,11 @@ public IChatComponent getFooter() { @Override public List getCellList() { - if(lastCellsUpdate != null){ + if (lastCellsUpdate != null) { long time = System.currentTimeMillis() - lastCellsUpdate; - if(time <= 250 && cachedList != null) + if (time <= 250 && cachedList != null) return cachedList; } @@ -59,14 +59,14 @@ public List getCellList() { NetHandlerPlayClientNT handlerWrapper = NetHandlerPlayClientNT.of(minecraft.thePlayer.sendQueue); - for(GuiPlayerInfo guiPlayerInfo : handlerWrapper.getOrderedServerPlayers()){ + for (GuiPlayerInfo guiPlayerInfo : handlerWrapper.getOrderedServerPlayers()) { EntityPlayer entityPlayer = minecraft.theWorld.getPlayerEntityByName(guiPlayerInfo.name); String name = guiPlayerInfo.name; // Yes, sometimes can be blank. - if(StringUtils.isBlank(name)){ + if (StringUtils.isBlank(name)) { continue; } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/client/PlayerTabRegistry.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/client/PlayerTabRegistry.java index f35b7f2..3c958fd 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/client/PlayerTabRegistry.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/client/PlayerTabRegistry.java @@ -5,7 +5,7 @@ public interface PlayerTabRegistry { - static void init(){ + static void init() { MinecraftForge.EVENT_BUS.register(PlayerTabDisplayListener.getInstance()); } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/client/render/PlayerTabGui.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/client/render/PlayerTabGui.java index d867614..e568c43 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/client/render/PlayerTabGui.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/client/render/PlayerTabGui.java @@ -389,11 +389,11 @@ public ResourceLocation getPlayerSkin(GameProfile gameProfile) { if (gameProfile != null) { - if(NecroTempusConfig.enableSkinPortCompat && Loader.isModLoaded("skinport") && skinProvider == null){ + if (NecroTempusConfig.enableSkinPortCompat && Loader.isModLoaded("skinport") && skinProvider == null) { skinProvider = (profile -> Hooks.TileEntitySkullRenderer_bindTexture(profile, locationStevePng)); } - if(skinProvider != null) + if (skinProvider != null) return skinProvider.getSkin(gameProfile); if (NecroTempusConfig.enableHeadsFallback && NecroTempusConfig.headsFallbackURL != null && !NecroTempusConfig.headsFallbackURL.isEmpty()) { @@ -421,7 +421,8 @@ public ResourceLocation getPlayerSkin(GameProfile gameProfile) { resourcelocation = minecraft.func_152342_ad().func_152792_a(skin, MinecraftProfileTexture.Type.SKIN); - } catch (Exception ignored) {} + } catch (Exception ignored) { + } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/network/PlayerTabPacket.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/network/PlayerTabPacket.java index 0deb926..0a20b74 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/network/PlayerTabPacket.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/network/PlayerTabPacket.java @@ -11,14 +11,15 @@ public class PlayerTabPacket implements IMessage { private PlayerTab component; private PlayerTabPacket.PacketType packetType = PacketType.SET; - public PlayerTabPacket(){} + public PlayerTabPacket() { + } - public PlayerTabPacket(NBTTagCompound tagCompound, PacketType type){ + public PlayerTabPacket(NBTTagCompound tagCompound, PacketType type) { component = PlayerTab.fromCompound(tagCompound); packetType = type; } - public PlayerTabPacket(PlayerTab playerTab, PacketType type){ + public PlayerTabPacket(PlayerTab playerTab, PacketType type) { component = playerTab; packetType = type; } @@ -37,14 +38,14 @@ public void toBytes(ByteBuf buf) { ByteBufUtils.writeTag(buf, tagCompound); } - public enum PacketType{ + public enum PacketType { SET("set"), REMOVE("remove"); private final String name; - PacketType(String name){ + PacketType(String name) { this.name = name; } @@ -52,9 +53,9 @@ public String getName() { return name; } - public static PacketType valueOfString(String name){ - for(PacketType type : values()){ - if(type.getName().equalsIgnoreCase(name)){ + public static PacketType valueOfString(String name) { + for (PacketType type : values()) { + if (type.getName().equalsIgnoreCase(name)) { return type; } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/network/PlayerTabPacketHandler.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/network/PlayerTabPacketHandler.java index ec1bd05..ada8893 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/network/PlayerTabPacketHandler.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/playertab/network/PlayerTabPacketHandler.java @@ -16,10 +16,10 @@ public IMessage onMessage(PlayerTabPacket message, MessageContext ctx) { } @SideOnly(Side.CLIENT) - public static void handleBossBar(PlayerTabPacket playerTabPacket){ - if(playerTabPacket.getPacketType() == PlayerTabPacket.PacketType.REMOVE){ + public static void handleBossBar(PlayerTabPacket playerTabPacket) { + if (playerTabPacket.getPacketType() == PlayerTabPacket.PacketType.REMOVE) { ClientPlayerTabManager.setPlayerTab(null); - }else { + } else { ClientPlayerTabManager.setPlayerTab(playerTabPacket.getComponent()); } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/client/ClientTitleManager.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/client/ClientTitleManager.java index be09c34..0797d5b 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/client/ClientTitleManager.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/client/ClientTitleManager.java @@ -10,7 +10,7 @@ public class ClientTitleManager { private static ClientTitleManager instance; - private ClientTitleManager(){ + private ClientTitleManager() { instance = this; } @@ -18,11 +18,12 @@ public static ClientTitleManager getInstance() { return (instance != null) ? instance : new ClientTitleManager(); } - @Getter @Setter + @Getter + @Setter private static TimedTitle currentTitle; @SubscribeEvent - public void onPlayerQuit(FMLNetworkEvent.ClientDisconnectionFromServerEvent event){ + public void onPlayerQuit(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) { currentTitle = null; } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/client/TitleRegistry.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/client/TitleRegistry.java index 382cb81..48f37b8 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/client/TitleRegistry.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/client/TitleRegistry.java @@ -6,7 +6,7 @@ public interface TitleRegistry { - static void init(){ + static void init() { MinecraftForge.EVENT_BUS.register(TitleDisplayListener.getInstance()); FMLCommonHandler.instance().bus().register(ClientTitleManager.getInstance()); } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/client/render/TitleDisplayListener.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/client/render/TitleDisplayListener.java index 2a5c373..4366522 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/client/render/TitleDisplayListener.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/client/render/TitleDisplayListener.java @@ -12,17 +12,17 @@ public static TitleDisplayListener getInstance() { return (instance != null) ? instance : new TitleDisplayListener(); } - private TitleDisplayListener(){ + private TitleDisplayListener() { instance = this; } @SubscribeEvent - public void onRenderGameOverlayEvent(RenderGameOverlayEvent.Post event){ - if(event.type == RenderGameOverlayEvent.ElementType.EXPERIENCE){ - if (TitleGui.getInstance().shouldRender()){ + public void onRenderGameOverlayEvent(RenderGameOverlayEvent.Post event) { + if (event.type == RenderGameOverlayEvent.ElementType.EXPERIENCE) { + if (TitleGui.getInstance().shouldRender()) { TitleGui.getInstance().render(event.resolution); - }else { - if(ClientTitleManager.getCurrentTitle() != null) + } else { + if (ClientTitleManager.getCurrentTitle() != null) ClientTitleManager.setCurrentTitle(null); } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/client/render/TitleGui.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/client/render/TitleGui.java index 89ed588..c497e75 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/client/render/TitleGui.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/client/render/TitleGui.java @@ -21,24 +21,24 @@ public static TitleGui getInstance() { return (instance != null) ? instance : new TitleGui(); } - private TitleGui(){ + private TitleGui() { instance = this; this.minecraft = Minecraft.getMinecraft(); } - public boolean shouldRender(){ + public boolean shouldRender() { return ClientTitleManager.getCurrentTitle() != null && finalTime(ClientTitleManager.getCurrentTitle()) >= System.currentTimeMillis(); } - public static int maxTime(TimedTitle title){ + public static int maxTime(TimedTitle title) { return title.getFadeIn() + title.getStay() + title.getFadeOut(); } - public static long finalTime(TimedTitle title){ + public static long finalTime(TimedTitle title) { return title.getStartTime() + maxTime(title); } - public void render(ScaledResolution resolution){ + public void render(ScaledResolution resolution) { minecraft.mcProfiler.startSection("necroTempusTitle"); TimedTitle title = ClientTitleManager.getCurrentTitle(); @@ -49,7 +49,7 @@ public void render(ScaledResolution resolution){ float currentOpacity = getCurrentOpacity(title, elapsedTime, currentState); - if(currentOpacity < 8) + if (currentOpacity < 8) return; GL11.glPushMatrix(); @@ -58,13 +58,13 @@ public void render(ScaledResolution resolution){ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glTranslatef(resolution.getScaledWidth() / 2F, resolution.getScaledHeight() / 2F, 0F); - int color = new Color(255,255,255, (int) currentOpacity).getRGB(); + int color = new Color(255, 255, 255, (int) currentOpacity).getRGB(); - if(title.hasElement(TitleType.TITLE)){ + if (title.hasElement(TitleType.TITLE)) { renderTitle(title, color); } - if(title.hasElement(TitleType.SUBTITLE)){ + if (title.hasElement(TitleType.SUBTITLE)) { renderSubtitle(title, color); } @@ -81,7 +81,7 @@ private void renderSubtitle(TimedTitle title, int color) { GL11.glPushMatrix(); GL11.glScalef(2F, 2F, 2F); - int width = - (minecraft.fontRenderer.getStringWidth(subtitleElement.getText().getFormattedText()) / 2); + int width = -(minecraft.fontRenderer.getStringWidth(subtitleElement.getText().getFormattedText()) / 2); int height = 5; minecraft.fontRenderer.drawStringWithShadow(subtitleElement.getText().getFormattedText(), width, height, color); @@ -96,7 +96,7 @@ private void renderTitle(TimedTitle title, int color) { GL11.glPushMatrix(); GL11.glScalef(4F, 4F, 4F); - int width = - (minecraft.fontRenderer.getStringWidth(titleElement.getText().getFormattedText()) / 2); + int width = -(minecraft.fontRenderer.getStringWidth(titleElement.getText().getFormattedText()) / 2); int height = -10; minecraft.fontRenderer.drawStringWithShadow(titleElement.getText().getFormattedText(), width, height, color); @@ -106,9 +106,10 @@ private void renderTitle(TimedTitle title, int color) { private static float getCurrentOpacity(TimedTitle title, long elapsedTime, int currentState) { - return switch (currentState){ + return switch (currentState) { case 0 -> clamp(((float) elapsedTime / title.getFadeIn()) * 255); - case 2 -> 255 - clamp(((float) (elapsedTime - (title.getFadeIn() + title.getStay())) / title.getFadeOut() ) * 255); + case 2 -> + 255 - clamp(((float) (elapsedTime - (title.getFadeIn() + title.getStay())) / title.getFadeOut()) * 255); default -> 255; }; @@ -119,7 +120,7 @@ private static int getCurrentState(TimedTitle title, long elapsedTime) { (elapsedTime <= (title.getFadeIn() + title.getStay())) ? 1 : 2; } - private static float clamp(float value){ + private static float clamp(float value) { return Math.max((float) 0, Math.min((float) 255, value)); } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/component/TimedTitle.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/component/TimedTitle.java index 6207fb6..8a262a9 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/component/TimedTitle.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/component/TimedTitle.java @@ -9,10 +9,11 @@ public class TimedTitle extends TitleComponent { - @Getter @Setter + @Getter + @Setter private long startTime; - public static TimedTitle fromCompound(NBTTagCompound tagCompound){ + public static TimedTitle fromCompound(NBTTagCompound tagCompound) { TimedTitle component = new TimedTitle(); @@ -21,9 +22,9 @@ public static TimedTitle fromCompound(NBTTagCompound tagCompound){ component.setFadeOut(tagCompound.getInteger("fadeOut")); component.setStartTime(System.currentTimeMillis()); - for(TitleType type : TitleType.values()){ + for (TitleType type : TitleType.values()) { String key = type.name().toLowerCase(); - if(tagCompound.hasKey(key)){ + if (tagCompound.hasKey(key)) { component.addElement(TitleElement.fromCompound(tagCompound.getCompoundTag(key))); } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/network/TitlePacket.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/network/TitlePacket.java index 2bc4726..90c37d1 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/network/TitlePacket.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/network/TitlePacket.java @@ -11,14 +11,15 @@ public class TitlePacket implements IMessage { private TitleComponent component; private PacketType packetType = PacketType.SET; - public TitlePacket(){} + public TitlePacket() { + } - public TitlePacket(NBTTagCompound tagCompound, PacketType type){ + public TitlePacket(NBTTagCompound tagCompound, PacketType type) { component = TitleComponent.fromCompound(tagCompound); packetType = type; } - public TitlePacket(TitleComponent title, PacketType type){ + public TitlePacket(TitleComponent title, PacketType type) { component = title; packetType = type; } @@ -37,14 +38,14 @@ public void toBytes(ByteBuf buf) { ByteBufUtils.writeTag(buf, tagCompound); } - public enum PacketType{ + public enum PacketType { SET("set"), REMOVE("remove"); private final String name; - PacketType(String name){ + PacketType(String name) { this.name = name; } @@ -52,9 +53,9 @@ public String getName() { return name; } - public static PacketType valueOfString(String name){ - for(PacketType type : values()){ - if(type.getName().equalsIgnoreCase(name)){ + public static PacketType valueOfString(String name) { + for (PacketType type : values()) { + if (type.getName().equalsIgnoreCase(name)) { return type; } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/network/TitlePacketHandler.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/network/TitlePacketHandler.java index ce372f7..9069f95 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/network/TitlePacketHandler.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/features/title/network/TitlePacketHandler.java @@ -17,10 +17,10 @@ public IMessage onMessage(TitlePacket message, MessageContext ctx) { } @SideOnly(Side.CLIENT) - public static void handleTitle(TitlePacket titlePacket){ - if(titlePacket.getPacketType() == TitlePacket.PacketType.REMOVE){ + public static void handleTitle(TitlePacket titlePacket) { + if (titlePacket.getPacketType() == TitlePacket.PacketType.REMOVE) { ClientTitleManager.setCurrentTitle(null); - }else { + } else { ClientTitleManager.setCurrentTitle( TimedTitle.fromCompound( titlePacket.getComponent().toNbt()) diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/botania/BossBarHandler.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/botania/BossBarHandler.java index 133bf4e..74b183f 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/botania/BossBarHandler.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/botania/BossBarHandler.java @@ -6,11 +6,11 @@ import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.ModifyConstant; -@Mixin(value=vazkii.botania.client.core.handler.BossBarHandler.class, remap = false) +@Mixin(value = vazkii.botania.client.core.handler.BossBarHandler.class, remap = false) public class BossBarHandler { @ModifyConstant(method = "render(Lnet/minecraft/client/gui/ScaledResolution;)V", constant = @Constant(intValue = 20)) - private static int render(int constant, ScaledResolution scaledResolution){ + private static int render(int constant, ScaledResolution scaledResolution) { return 20 + Math.min(ClientBossBarManager.size() * 20, scaledResolution.getScaledHeight() / 3); } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/bukkit/player/CraftPlayer.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/bukkit/player/CraftPlayer.java index 3b5e1a2..07807af 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/bukkit/player/CraftPlayer.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/bukkit/player/CraftPlayer.java @@ -20,15 +20,20 @@ @Mixin(targets = "org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer", remap = false) public abstract class CraftPlayer { - @Shadow public abstract EntityPlayerMP getHandle(); + @Shadow + public abstract EntityPlayerMP getHandle(); - @Shadow public abstract Player getPlayer(); + @Shadow + public abstract Player getPlayer(); - @Shadow public abstract boolean equals(Object o); + @Shadow + public abstract boolean equals(Object o); - @Shadow public String playerListHeaderString; + @Shadow + public String playerListHeaderString; - @Shadow public String playerListFooterString; + @Shadow + public String playerListFooterString; /** * @author brunoxkk0 @@ -36,7 +41,7 @@ public abstract class CraftPlayer { */ @Deprecated @Overwrite - public void sendTitle(String title, String subtitle){ + public void sendTitle(String title, String subtitle) { sendTitle(title, subtitle, 10, 70, 20); } @@ -45,16 +50,16 @@ public void sendTitle(String title, String subtitle){ * @reason Necro Tempus Crucible API overwrite. */ @Overwrite - public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut){ + public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) { - if(title == null && subtitle == null) return; + if (title == null && subtitle == null) return; TitleComponent titleComponent = new TitleComponent(); - if(title != null) + if (title != null) titleComponent.addElement(TitleElement.titleOf(new ChatComponentText(title))); - if(subtitle != null) + if (subtitle != null) titleComponent.addElement(TitleElement.subtitleOf(new ChatComponentText(subtitle))); titleComponent.setFadeIn(fadeIn * 50); @@ -70,7 +75,7 @@ public void sendTitle(String title, String subtitle, int fadeIn, int stay, int f * @reason Necro Tempus Crucible API overwrite. */ @Overwrite - public void resetTitle(){ + public void resetTitle() { TitleComponent.getTitleManager().set(new HashSet<>(Collections.singleton(getHandle().getUniqueID())), new TitleComponent()); } @@ -79,14 +84,14 @@ public void resetTitle(){ * @reason Necro Tempus Crucible API overwrite. */ @Overwrite - public void setPlayerListHeaderFooter(@Nullable String header, @Nullable String footer){ + public void setPlayerListHeaderFooter(@Nullable String header, @Nullable String footer) { PlayerTab playerTab = new PlayerTab(); - if((playerListHeaderString = header) != null) + if ((playerListHeaderString = header) != null) playerTab.setHeader(new ChatComponentText(playerListHeaderString)); - if((playerListFooterString = footer) != null) + if ((playerListFooterString = footer) != null) playerTab.setFooter(new ChatComponentText(playerListFooterString)); playerTab.setDrawPlayerHeads(true); diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/bukkit/playerspigot/CraftPlayerSpigot.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/bukkit/playerspigot/CraftPlayerSpigot.java index 76eea12..ddda3b1 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/bukkit/playerspigot/CraftPlayerSpigot.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/bukkit/playerspigot/CraftPlayerSpigot.java @@ -22,7 +22,7 @@ public abstract class CraftPlayerSpigot { CraftPlayer this$0; @Shadow - public abstract void sendMessage(BaseComponent ... component); + public abstract void sendMessage(BaseComponent... component); /** * @author brunoxkk0 @@ -31,10 +31,10 @@ public abstract class CraftPlayerSpigot { @Overwrite public void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent component) { - if(position == ChatMessageType.CHAT) + if (position == ChatMessageType.CHAT) sendMessage(component); - if(position == ChatMessageType.ACTION_BAR){ + if (position == ChatMessageType.ACTION_BAR) { ActionBar actionBar = new ActionBar(70, new ChatComponentText(component.toLegacyText())); UUID target = this$0.getUniqueId(); ActionBar.getActionBarManager().set(new HashSet<>(Collections.singleton(target)), actionBar); @@ -49,14 +49,14 @@ public void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.b @Overwrite public void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) { - if(position == ChatMessageType.CHAT) + if (position == ChatMessageType.CHAT) sendMessage(components); - if(position == ChatMessageType.ACTION_BAR){ + if (position == ChatMessageType.ACTION_BAR) { StringBuilder string = new StringBuilder(); - for(BaseComponent component : components){ + for (BaseComponent component : components) { string.append(component.toLegacyText()); } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/customnpcs/MixinRenderNPCInterface.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/customnpcs/MixinRenderNPCInterface.java index 0aa9f65..5a6d19f 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/customnpcs/MixinRenderNPCInterface.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/customnpcs/MixinRenderNPCInterface.java @@ -51,6 +51,7 @@ void doRenderInject(EntityLiving entityliving, double d, double d1, double d2, f method = "doRender(Lnet/minecraft/entity/EntityLiving;DDDFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/boss/BossStatus;setBossStatus(Lnet/minecraft/entity/boss/IBossDisplayData;Z)V", remap = false) ) - void doRender(IBossDisplayData iBossDisplayData, boolean b) { } // do nothing + void doRender(IBossDisplayData iBossDisplayData, boolean b) { + } // do nothing } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/fml/FMLClientHandler.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/fml/FMLClientHandler.java index fe6f4d7..a20b51c 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/fml/FMLClientHandler.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/fml/FMLClientHandler.java @@ -46,14 +46,14 @@ public String enhanceServerListEntry(ServerListEntryNormal serverListEntry, Serv if ("FML".equals(extendedData.type) && extendedData.isCompatible) { idx = 0; - crucibleMode = extendedData.modData.containsKey("Crucible") ? (extendedData.modData.containsKey(Tags.MODID) ? 2 : 1 ) : 0; + crucibleMode = extendedData.modData.containsKey("Crucible") ? (extendedData.modData.containsKey(Tags.MODID) ? 2 : 1) : 0; - if(crucibleMode > 0){ + if (crucibleMode > 0) { tooltip = String.format( (ChatFormatting.DARK_GRAY + "Compatible %s " + ChatFormatting.DARK_GRAY + "modded server\n" + ChatFormatting.DARK_GRAY + ChatFormatting.BOLD + "%d" + ChatFormatting.DARK_GRAY + " Mods are present"), (String.valueOf(crucibleMode == 1 ? ChatFormatting.GREEN : ChatFormatting.RED)) + ChatFormatting.BOLD + "Crucible" + ChatFormatting.RESET, extendedData.modData.size()); - }else{ + } else { tooltip = String.format("Compatible FML modded server\n%d mods present", extendedData.modData.size()); } @@ -76,13 +76,13 @@ public String enhanceServerListEntry(ServerListEntryNormal serverListEntry, Serv return null; } - if(crucibleMode > 0){ + if (crucibleMode > 0) { this.client.getTextureManager().bindTexture(CrucibleServerListEntry.CRUCIBLE_ICONS); - Gui.func_152125_a(x + width - 16, y + 10, 0, (float)(crucibleMode - 1) * 16, 16, 16, 12,12,256.0f, 256.0f); - }else{ + Gui.func_152125_a(x + width - 16, y + 10, 0, (float) (crucibleMode - 1) * 16, 16, 16, 12, 12, 256.0f, 256.0f); + } else { this.client.getTextureManager().bindTexture(iconSheet); - Gui.func_146110_a(x + width - 18, y + 10, 0, (float)idx, 16, 16, 256.0f, 256.0f); + Gui.func_146110_a(x + width - 18, y + 10, 0, (float) idx, 16, 16, 256.0f, 256.0f); if (blocked) { Gui.func_146110_a(x + width - 18, y + 10, 0, 80, 16, 16, 256.0f, 256.0f); @@ -93,5 +93,4 @@ public String enhanceServerListEntry(ServerListEntryNormal serverListEntry, Serv } - } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/minecraft/FontRendererMixin.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/minecraft/FontRendererMixin.java index d7f5998..af94552 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/minecraft/FontRendererMixin.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/minecraft/FontRendererMixin.java @@ -77,7 +77,6 @@ private void getHexStringWidth(String text, CallbackInfoReturnable cir) } - // These methods are used to inject the Hex Codes on Render // Reset hex state too @Inject(method = "resetStyles()V", at = @At(value = "HEAD")) diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/minecraft/GuiIngameMixin.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/minecraft/GuiIngameMixin.java index ba11bc5..096ac7a 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/minecraft/GuiIngameMixin.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/mixins/minecraft/GuiIngameMixin.java @@ -41,7 +41,7 @@ protected void func_96136_a(ScoreObjective scoreObjective, int y, int x, FontRen s = ScorePlayerTeam.formatPlayerName(scoreplayerteam, score.getPlayerName()) + ": " + (NecroTempusConfig.hideScores ? "" : EnumChatFormatting.RED + String.valueOf(score.getScorePoints())); } - if(NecroTempusConfig.hideScores) + if (NecroTempusConfig.hideScores) maxWidth -= 2; int height = scores.size() * fontRenderer.FONT_HEIGHT; @@ -76,10 +76,10 @@ protected void func_96136_a(ScoreObjective scoreObjective, int y, int x, FontRen fontRenderer.drawString(playerName, drawX, startY, -1); - if(!NecroTempusConfig.hideScores) + if (!NecroTempusConfig.hideScores) fontRenderer.drawString(scoreValue, endX - fontRenderer.getStringWidth(scoreValue), startY, -1); - if(!scoreIterator.hasNext()){ + if (!scoreIterator.hasNext()) { String title = scoreObjective.getDisplayName(); diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/plugin/Mixin.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/plugin/Mixin.java index 4837b94..7a3b944 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/plugin/Mixin.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/plugin/Mixin.java @@ -38,10 +38,10 @@ public enum Mixin { public boolean shouldLoad(List loadedMods) { - if(this == FontRenderMixin && !NecroTempusConfig.HexColorsEnabled) + if (this == FontRenderMixin && !NecroTempusConfig.HexColorsEnabled) return false; - if(this == GuiIngame && !NecroTempusConfig.ScoreBoardEnabled){ + if (this == GuiIngame && !NecroTempusConfig.ScoreBoardEnabled) { return false; } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/plugin/TargetedMod.java b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/plugin/TargetedMod.java index c86a990..adec6a5 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/plugin/TargetedMod.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/modules/mixin/plugin/TargetedMod.java @@ -27,7 +27,7 @@ public enum TargetedMod { public final boolean loadInDevelopment; public final String[] modId; - TargetedMod(String modName, String jarNamePrefix, boolean loadInDevelopment, String ... modId) { + TargetedMod(String modName, String jarNamePrefix, boolean loadInDevelopment, String... modId) { this.modName = modName; this.jarNamePrefixLowercase = jarNamePrefix.toLowerCase(); this.loadInDevelopment = loadInDevelopment; @@ -42,10 +42,11 @@ public boolean isMatchingJar(Path path) { String modIdString = null; - if(modId != null){ - try{ + if (modId != null) { + try { modIdString = getModID(path.toFile()); - }catch (Exception ignored){} + } catch (Exception ignored) { + } } return (nameLowerCase.startsWith(jarNamePrefixLowercase) || (modIdString != null && Arrays.asList(modId).contains(modIdString))) && "jar".equals(fileExtension); diff --git a/src/main/java/io/github/cruciblemc/necrotempus/proxy/CommonProxy.java b/src/main/java/io/github/cruciblemc/necrotempus/proxy/CommonProxy.java index 7668068..407305a 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/proxy/CommonProxy.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/proxy/CommonProxy.java @@ -9,9 +9,10 @@ public abstract class CommonProxy { - public void preInit(FMLPreInitializationEvent event){} + public void preInit(FMLPreInitializationEvent event) { + } - public void init(FMLInitializationEvent event){ + public void init(FMLInitializationEvent event) { try { ZenRegister.register(); } catch (NoClassDefFoundError e) { @@ -19,8 +20,10 @@ public void init(FMLInitializationEvent event){ } } - public void postInit(FMLPostInitializationEvent event){} + public void postInit(FMLPostInitializationEvent event) { + } - public void serverStarting(FMLServerStartingEvent event){} + public void serverStarting(FMLServerStartingEvent event) { + } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/proxy/ServerProxy.java b/src/main/java/io/github/cruciblemc/necrotempus/proxy/ServerProxy.java index d06cac4..2529627 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/proxy/ServerProxy.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/proxy/ServerProxy.java @@ -31,7 +31,7 @@ public void postInit(FMLPostInitializationEvent event) { public void serverStarting(FMLServerStartingEvent event) { BossBar.setBossBarManager(new BossBarManagerServer()); - if(CrucibleAsk.isAvailable()){ + if (CrucibleAsk.isAvailable()) { CrucibleAPI.registerModPlugin(new NecroTempusPlugin()); } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/utils/ColorUtils.java b/src/main/java/io/github/cruciblemc/necrotempus/utils/ColorUtils.java index a5bc09f..b696f6c 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/utils/ColorUtils.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/utils/ColorUtils.java @@ -4,11 +4,11 @@ public class ColorUtils { - public static Color decodeColor(String hex){ + public static Color decodeColor(String hex) { hex = hex.toLowerCase(); - if(hex.startsWith("#") || hex.startsWith("x")) + if (hex.startsWith("#") || hex.startsWith("x")) hex = hex.substring(1); int r = Integer.valueOf(hex.substring(0, 2), 16); @@ -16,14 +16,14 @@ public static Color decodeColor(String hex){ int b = Integer.valueOf(hex.substring(4, 6), 16); int a = -1; - if(hex.length() >= 8){ + if (hex.length() >= 8) { a = Integer.valueOf(hex.substring(6, 8), 16); } - if(a != -1) - return new Color(r,g,b,a); + if (a != -1) + return new Color(r, g, b, a); else - return new Color(r,g,b); + return new Color(r, g, b); } } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/utils/CrucibleAsk.java b/src/main/java/io/github/cruciblemc/necrotempus/utils/CrucibleAsk.java index 6f00286..757573c 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/utils/CrucibleAsk.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/utils/CrucibleAsk.java @@ -2,8 +2,8 @@ public class CrucibleAsk { - public static boolean isAvailable(){ - try{ + public static boolean isAvailable() { + try { CrucibleAsk.class.getClassLoader().loadClass("io.github.crucible.api.CrucibleAPI"); return true; } catch (ClassNotFoundException ignored) { diff --git a/src/main/java/io/github/cruciblemc/necrotempus/utils/NetHandlerPlayClientNT.java b/src/main/java/io/github/cruciblemc/necrotempus/utils/NetHandlerPlayClientNT.java index 4ec4250..cffec25 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/utils/NetHandlerPlayClientNT.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/utils/NetHandlerPlayClientNT.java @@ -14,25 +14,25 @@ public class NetHandlerPlayClientNT { private final NetHandlerPlayClient internal; - private NetHandlerPlayClientNT(NetHandlerPlayClient netHandlerPlayClient){ + private NetHandlerPlayClientNT(NetHandlerPlayClient netHandlerPlayClient) { internal = netHandlerPlayClient; } - public static NetHandlerPlayClientNT of(NetHandlerPlayClient netHandlerPlayClient){ + public static NetHandlerPlayClientNT of(NetHandlerPlayClient netHandlerPlayClient) { return new NetHandlerPlayClientNT(netHandlerPlayClient); } - public List getServerPlayers(){ + public List getServerPlayers() { return (List) internal.playerInfoList; } - public List getOrderedServerPlayers(){ + public List getOrderedServerPlayers() { List newList = new ArrayList<>(getServerPlayers()); newList.sort(PLAYER_INFO_COMPARATOR); return newList; } - public int getServerMaxPlayers(){ + public int getServerMaxPlayers() { return internal.currentServerMaxPlayers; } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/utils/ServerUtils.java b/src/main/java/io/github/cruciblemc/necrotempus/utils/ServerUtils.java index d3050ec..1ad7cce 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/utils/ServerUtils.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/utils/ServerUtils.java @@ -12,11 +12,11 @@ public class ServerUtils { @SuppressWarnings("unchecked") - public static List getAllPlayers(){ + public static List getAllPlayers() { return MinecraftServer.getServer().getConfigurationManager().playerEntityList; } - public static EntityPlayerMP getPlayer(UUID uuid){ + public static EntityPlayerMP getPlayer(UUID uuid) { return getAllPlayers() .stream() .filter(entityPlayerMP -> entityPlayerMP.getUniqueID().equals(uuid)) @@ -25,32 +25,34 @@ public static EntityPlayerMP getPlayer(UUID uuid){ } @SuppressWarnings("unchecked") - public static T lazyAccess(boolean accessible, String method, Object target, Object ... params){ - try{ + public static T lazyAccess(boolean accessible, String method, Object target, Object... params) { + try { Method mt = target.getClass().getDeclaredMethod(method, params.getClass()); - if(!accessible) + if (!accessible) mt.setAccessible(true); T element = (T) mt.invoke(target, params); - if(!accessible) + if (!accessible) mt.setAccessible(false); return element; - } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ignored) {} + } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ignored) { + } return null; } @SuppressWarnings("unchecked") - public static T lazyAccess(boolean accessible, String method, Object target){ - try{ + public static T lazyAccess(boolean accessible, String method, Object target) { + try { System.out.println(Arrays.toString(target.getClass().getMethods())); Method mt = target.getClass().getDeclaredMethod(method); - if(!accessible) + if (!accessible) mt.setAccessible(true); T element = (T) mt.invoke(target); - if(!accessible) + if (!accessible) mt.setAccessible(false); return element; - } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ignored) {} + } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ignored) { + } return null; } diff --git a/src/main/java/io/github/cruciblemc/necrotempus/utils/SideUtils.java b/src/main/java/io/github/cruciblemc/necrotempus/utils/SideUtils.java index eb31115..ba93704 100644 --- a/src/main/java/io/github/cruciblemc/necrotempus/utils/SideUtils.java +++ b/src/main/java/io/github/cruciblemc/necrotempus/utils/SideUtils.java @@ -5,8 +5,8 @@ public class SideUtils { - public static void enforceSide(Side expectedSide, String reason){ - if(FMLCommonHandler.instance().getEffectiveSide() != expectedSide){ + public static void enforceSide(Side expectedSide, String reason) { + if (FMLCommonHandler.instance().getEffectiveSide() != expectedSide) { throw new IllegalStateException(reason); } }