diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index ed91e479..5483ee7e 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -168,7 +168,7 @@ import common.util.HitPosition; import common.util.IntHashMap; import common.util.LongHashMap; import common.util.ParticleType; -import common.util.TextColor; +import common.util.Color; import common.util.Util; import common.util.Var; import common.util.HitPosition.ObjectType; @@ -1036,7 +1036,7 @@ public class Client implements IThreadListener { private int drawStat(int x, int y, String name, int value, int max, int color) { int w = (int)(246.0f * (float)value / (float)max); Drawing.drawTextboxRight(name, x + 250, y, 0x3f000000); - Drawing.drawTextbox(String.format(TextColor.GREEN + "%d " + TextColor.GRAY + "/ " + TextColor.NEON + "%d", value, max), x, y, 0x3f000000); + Drawing.drawTextbox(String.format(Color.GREEN + "%d " + Color.GRAY + "/ " + Color.NEON + "%d", value, max), x, y, 0x3f000000); Drawing.drawRectBorder(x, y + 20, 250, 10, 0xff000000, 0xff202020, 0xffcfcfcf, 0xff6f6f6f); Drawing.drawGradient(x + 2 + 246 - w, y + 20 + 2, w, 6, color | 0xff000000, Util.mixColor(color | 0xff000000, 0xff000000)); return y + 40; @@ -1085,10 +1085,10 @@ public class Client implements IThreadListener { Entity ent; if(this.player != null && now - status.getValue() < 10000L && (ent = this.player.worldObj.getEntityByID(status.getKey())) instanceof EntityLiving) { EntityLiving entity = (EntityLiving)ent; - String s = entity.getName() + TextColor.GRAY + " [" + + String s = entity.getName() + Color.GRAY + " [" + EntityLiving.getHealthColor(entity.getHealth(), entity.getMaxHealth()) + - entity.getHealth() + TextColor.GRAY + " / " + EntityLiving.getMaxHpColor(entity.getMaxHealth()) + - entity.getMaxHealth() + TextColor.GRAY + "]"; + entity.getHealth() + Color.GRAY + " / " + EntityLiving.getMaxHpColor(entity.getMaxHealth()) + + entity.getMaxHealth() + Color.GRAY + "]"; Drawing.drawTextboxCentered(s, x, y, 0x3f000000); Drawing.drawRectBorder(x - 200, y + 20, 400, 10, 0xff000000, 0xff202020, 0xffcfcfcf, 0xff6f6f6f); Drawing.drawGradient(x - 200 + 2, y + 20 + 2, (int)(396.0f * ((float)entity.getHealth() / (float)entity.getMaxHealth())), 6, entity.getColor() | 0xff000000, Util.mixColor(entity.getColor() | 0xff000000, 0xff000000)); @@ -1105,8 +1105,8 @@ public class Client implements IThreadListener { for(StatusEffect effect : this.player.getEffects()) { Effect potion = effect.getPotion(); int color = potion.getColor(); - String name = (potion.isBadEffect() ? TextColor.ORANGE : TextColor.ACID) + effect.getEffectName(); - String desc = TextColor.NEON + effect.getDurationString(); + String name = (potion.isBadEffect() ? Color.ORANGE : Color.ACID) + effect.getEffectName(); + String desc = Color.NEON + effect.getDurationString(); Drawing.drawRectBorder(x, y, 250, Font.YGLYPH + 6, 0xff000000, 0xff202020, 0xffcfcfcf, 0xff6f6f6f); Drawing.drawGradient(x + 2, y + 2, effect.isInfinite() ? 246 : ((int)(246.0f * ((float)effect.getRemaining() / (float)effect.getDuration()))), Font.YGLYPH + 2, color | 0xff000000, Util.mixColor(color | 0xff000000, 0xff000000)); Drawing.drawText(name, x + 4, y + 3, 0xffffffff); @@ -1128,16 +1128,16 @@ public class Client implements IThreadListener { y = this.fbY - 40 - stats * 40; int hp = entity.getHealth(); int max = entity.getMaxHealth(); - y = this.drawStat(x, y, TextColor.RED + "Schaden", hp, max, 0xff0000); + y = this.drawStat(x, y, Color.RED + "Schaden", hp, max, 0xff0000); if(absorb > 0) - y = this.drawStat(x, y, TextColor.YELLOW + "Schadenspuffer", absorb, 1024, 0xffff00); + y = this.drawStat(x, y, Color.YELLOW + "Schadenspuffer", absorb, 1024, 0xffff00); if(entity instanceof EntityWaterNPC npc) { int moist = npc.getMoisture(); int maxm = npc.getMaxMoisture(); - y = this.drawStat(x, y, TextColor.BLUE + "Feuchtigkeit", moist, maxm, 0x4f4fff); + y = this.drawStat(x, y, Color.BLUE + "Feuchtigkeit", moist, maxm, 0x4f4fff); } if(armor > 0) - y = this.drawStat(x, y, TextColor.GRAY + "Rüstung", armor, 1024, 0x707070); + y = this.drawStat(x, y, Color.GRAY + "Rüstung", armor, 1024, 0x707070); if(entity.vehicle instanceof EntityLiving living) { int vh = living.getHealth(); int vhMax = living.getMaxHealth(); @@ -1146,23 +1146,23 @@ public class Client implements IThreadListener { if(entity.getManaPoints() > 0) { int mana = entity.getManaPoints(); int maxm = entity.getMaxMana(); - y = this.drawStat(x, y, TextColor.CYAN + "Mana", mana, maxm, 0x0000ff); + y = this.drawStat(x, y, Color.CYAN + "Mana", mana, maxm, 0x0000ff); } for(int z = 0; z < Energy.values().length; z++) { Energy type = Energy.values()[z]; int energy = entity.getEnergy(type); if(energy > 0) { int emax = entity.getEnergyCap(type); - y = this.drawStat(x, y, TextColor.LIGHT_GRAY + type.display, energy, emax, entity.hasEnergyEffect(type) ? type.effect : type.color); + y = this.drawStat(x, y, Color.LIGHT_GRAY + type.display, energy, emax, entity.hasEnergyEffect(type) ? type.effect : type.color); } } x = 40; y = this.fbY - 40 - (this.player.isRidingHorse() && this.player.getHorseJumpPower() != 0.0f ? 2 : 1) * 40; if(this.player.isRidingHorse() && this.player.getHorseJumpPower() != 0.0f) // { - y = this.drawBar(x, y, String.format(TextColor.NEON + "Sprungkraft: " + TextColor.CYAN + "%d %%", (int)(this.player.getHorseJumpPower() * 100.0f)), + y = this.drawBar(x, y, String.format(Color.NEON + "Sprungkraft: " + Color.CYAN + "%d %%", (int)(this.player.getHorseJumpPower() * 100.0f)), this.player.getHorseJumpPower(), 0x4040ff); - y = this.drawBar(x, y, String.format(TextColor.ACID + "EXP: " + TextColor.GREEN + "Level %d, %d/%d", this.player.experienceLevel, (int)((float)this.player.xpBarCap() * this.player.experience), this.player.xpBarCap()), this.player.experience, 0x40ff40); + y = this.drawBar(x, y, String.format(Color.ACID + "EXP: " + Color.GREEN + "Level %d, %d/%d", this.player.experienceLevel, (int)((float)this.player.xpBarCap() * this.player.experience), this.player.xpBarCap()), this.player.experience, 0x40ff40); } GlState.bindTexture(0); @@ -1239,9 +1239,9 @@ public class Client implements IThreadListener { this.renderLagometer(); } else { - Drawing.drawText(String.format("%s%.2f" + TextColor.RESET + " %s [%s" + TextColor.RESET + "], %.3f ms, W %d x %d%s", + Drawing.drawText(String.format("%s%.2f" + Color.RESET + " %s [%s" + Color.RESET + "], %.3f ms, W %d x %d%s", this.framecode(), this.framerate < 1.0f ? 1.0f / this.framerate : this.framerate, this.framerate < 1.0f ? "SPF" : "FPS", - this.vsync ? TextColor.DARK_GRAY + "VSYNC" : (this.syncLimited ? TextColor.GREEN + "" + this.syncLimit : TextColor.RED + "UNL"), + this.vsync ? Color.DARK_GRAY + "VSYNC" : (this.syncLimited ? Color.GREEN + "" + this.syncLimit : Color.RED + "UNL"), (float)PerfSection.getTotal(false) / 1000.0f, this.fbRawX, this.fbRawY, this.fullscreen ? " @ " + (this.vidMode == null ? "?" : this.vidMode.refresh()) + " Hz" : ""), 0, 0, 0xffffffff); @@ -1264,14 +1264,14 @@ public class Client implements IThreadListener { String draw = String.format( "OpenGL: %s\n" + "Renderer: %s (%s)\n" + - "Bildrate: %s%.2f" + TextColor.RESET + " %s [%s" + TextColor.RESET + "], %.3f ms, W %d x %d%s\n" + - "Tickrate: %s%.2f" + TextColor.RESET + " %s [" + TextColor.GREEN + "%.1f" + TextColor.RESET + "], %.3f ms, E %d ms" + + "Bildrate: %s%.2f" + Color.RESET + " %s [%s" + Color.RESET + "], %.3f ms, W %d x %d%s\n" + + "Tickrate: %s%.2f" + Color.RESET + " %s [" + Color.GREEN + "%.1f" + Color.RESET + "], %.3f ms, E %d ms" + "%s%s" , GL11.glGetString(GL11.GL_VERSION), GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VENDOR), this.framecode(), this.framerate < 1.0f ? 1.0f / this.framerate : this.framerate, this.framerate < 1.0f ? "SPF" : "FPS", - this.vsync ? TextColor.DARK_GRAY + "VSYNC" : (this.syncLimited ? TextColor.GREEN + "" + this.syncLimit : TextColor.RED + "UNL"), + this.vsync ? Color.DARK_GRAY + "VSYNC" : (this.syncLimited ? Color.GREEN + "" + this.syncLimit : Color.RED + "UNL"), (float)PerfSection.getTotal(false) / 1000.0f, this.fbRawX, this.fbRawY, this.fullscreen ? " @ " + (this.vidMode == null ? "?" : this.vidMode.refresh()) + " Hz" : "", this.tpscode(), this.tickrate < 1.0f ? 1.0f / this.tickrate : this.tickrate, @@ -1856,7 +1856,7 @@ public class Client implements IThreadListener { String.format("Richtung: %s (%.1f / %.1f)", dirStr, ExtMath.wrapf(this.viewEntity.rotYaw), ExtMath.wrapf(this.viewEntity.rotPitch)) + "\n" + String.format("Biom: %.2f K, N: %.2f K, D: %s (%s)", chunk.getTemperature(pos), chunk.getOffset(pos), - TextColor.stripCodes(this.world.dimension.getDisplay()), + Color.stripCodes(this.world.dimension.getDisplay()), this.dimensionName) + "\n" + "Licht: " + chunk.getLightSub(pos, 0) + " (" + chunk.getLight(LightType.SKY, pos) + " Himmel, " + chunk.getLight(LightType.BLOCK, pos) + " Blöcke, " + String.format( @@ -1905,7 +1905,7 @@ public class Client implements IThreadListener { String.format("Position: %d %d %d", pos.getX(), pos.getY(), pos.getZ()) ); for(Entry entry : block.getProperties().entrySet()) { - str.append("\n" + (block.getBlock().getSavedProperties().contains(entry.getKey()) ? TextColor.NEON : TextColor.LIGHT_GRAY) + entry.getKey().getName() + TextColor.RESET + ": " + (entry.getValue() instanceof Boolean bool ? (bool ? TextColor.GREEN : TextColor.RED) + "" + entry.getValue() + TextColor.RESET : entry.getValue())); + str.append("\n" + (block.getBlock().getSavedProperties().contains(entry.getKey()) ? Color.NEON : Color.LIGHT_GRAY) + entry.getKey().getName() + Color.RESET + ": " + (entry.getValue() instanceof Boolean bool ? (bool ? Color.GREEN : Color.RED) + "" + entry.getValue() + Color.RESET : entry.getValue())); } return str.toString(); @@ -1936,7 +1936,7 @@ public class Client implements IThreadListener { + (entity.isWet() ? "W" : "") + (entity.canAttackWithItem() ? "A" : "") + (entity.passenger != null ? "H" : "") + (entity.vehicle != null ? "R" : "") + (entity.doesEntityNotTriggerPressurePlate() ? "L" : "") + "\n" + - (entity.hasCustomName() ? "Name: '" + TextColor.stripCodes(entity.getCustomNameTag()) + "'" : "Name: n/a") + (entity.hasCustomName() ? "Name: '" + Color.stripCodes(entity.getCustomNameTag()) + "'" : "Name: n/a") ; } @@ -2286,7 +2286,7 @@ public class Client implements IThreadListener { public void disconnected(String msg) { Log.NETWORK.info("Getrennt: %s", msg); this.unload(true); - this.show(new GuiInfo("Von Server getrennt", TextColor.RED + "Verbindung zum Server wurde getrennt\n\n" + TextColor.RESET + msg)); + this.show(new GuiInfo("Von Server getrennt", Color.RED + "Verbindung zum Server wurde getrennt\n\n" + Color.RESET + msg)); } @@ -2397,13 +2397,13 @@ public class Client implements IThreadListener { }, "Screenshot writer").start(); } - public TextColor framecode() { - return (this.framerate >= 59.0f) ? TextColor.GREEN : ((this.framerate >= 29.0f) ? TextColor.YELLOW : ((this.framerate >= 14.0f) ? TextColor.ORANGE : TextColor.RED)); + public Color framecode() { + return (this.framerate >= 59.0f) ? Color.GREEN : ((this.framerate >= 29.0f) ? Color.YELLOW : ((this.framerate >= 14.0f) ? Color.ORANGE : Color.RED)); } - public TextColor tpscode() { - return (this.tickrate >= (((float)this.tickTarget / 1000.0f) - 1.0f)) ? TextColor.GREEN : ((this.tickrate >= (((float)this.tickTarget / 1000.0f) / 2.0f - 1.0f)) ? TextColor.YELLOW : - ((this.tickrate >= (((float)this.tickTarget / 1000.0f) / 4.0f - 1.0f)) ? TextColor.ORANGE : TextColor.RED)); + public Color tpscode() { + return (this.tickrate >= (((float)this.tickTarget / 1000.0f) - 1.0f)) ? Color.GREEN : ((this.tickrate >= (((float)this.tickTarget / 1000.0f) / 2.0f - 1.0f)) ? Color.YELLOW : + ((this.tickrate >= (((float)this.tickTarget / 1000.0f) / 4.0f - 1.0f)) ? Color.ORANGE : Color.RED)); } private void doTicks() { @@ -2490,10 +2490,10 @@ public class Client implements IThreadListener { this.registerDebug(Keysym.H, "Hilfe zu Tastenkombinationen anzeigen", new DebugRunner() { public void execute(Keysym key) { String bind = Bind.CHEAT.getInput() == null ? "n/a" : Bind.CHEAT.getInput().getDisplay(); - Client.this.show(new GuiInfo("Hilfe zu Tastenkombinationen", TextColor.DARK_GREEN + "" + Client.this.debug.size() + " Tastenkombinationen stehen zur Verfügung:\n" + + Client.this.show(new GuiInfo("Hilfe zu Tastenkombinationen", Color.DARK_GREEN + "" + Client.this.debug.size() + " Tastenkombinationen stehen zur Verfügung:\n" + Util.buildLines(new Function() { public String apply(DebugFunction func) { - return TextColor.CYAN + bind + TextColor.RED + "+" + TextColor.GREEN + func.key.getDisplay() + TextColor.GRAY + " - " + TextColor.YELLOW + func.help; + return Color.CYAN + bind + Color.RED + "+" + Color.GREEN + func.key.getDisplay() + Color.GRAY + " - " + Color.YELLOW + func.help; } }, Client.this.debug.values()))); } @@ -2623,7 +2623,7 @@ public class Client implements IThreadListener { } else { this.lastUsed = System.currentTimeMillis(); - Client.this.logFeed(TextColor.RED + "VORSICHT: Debug-Absturz nach mehrmaligem Drücken innerhalb einer Sekunde"); + Client.this.logFeed(Color.RED + "VORSICHT: Debug-Absturz nach mehrmaligem Drücken innerhalb einer Sekunde"); } } }); @@ -2862,9 +2862,9 @@ public class Client implements IThreadListener { private void printVar(CVar cv) { String values = cv.getValues(); - this.logConsole("%s " + TextColor.NEON + "%s " + TextColor.DARK_GRAY + "[%s" + TextColor.DARK_GRAY + "]" + TextColor.GRAY + " = " + TextColor.WHITE + "%s " + TextColor.DARK_GRAY + - "[" + TextColor.GRAY + "D " + TextColor.CRIMSON + "%s" + TextColor.DARK_GRAY + "]%s", cv.getType(), cv.getCVarName(), cv.getCategory(), cv.format(), cv.getDefault(), - values != null ? " [" + TextColor.LIGHT_GRAY + values + TextColor.DARK_GRAY + "]" : ""); + this.logConsole("%s " + Color.NEON + "%s " + Color.DARK_GRAY + "[%s" + Color.DARK_GRAY + "]" + Color.GRAY + " = " + Color.WHITE + "%s " + Color.DARK_GRAY + + "[" + Color.GRAY + "D " + Color.CRIMSON + "%s" + Color.DARK_GRAY + "]%s", cv.getType(), cv.getCVarName(), cv.getCategory(), cv.format(), cv.getDefault(), + values != null ? " [" + Color.LIGHT_GRAY + values + Color.DARK_GRAY + "]" : ""); } public void exec(String line) { @@ -2872,7 +2872,7 @@ public class Client implements IThreadListener { for(CVar cv : this.cvars.values()) { printVar(cv); } - this.logConsole(TextColor.GREEN + "CVARs insgesamt registriert: %d", this.cvars.size()); + this.logConsole(Color.GREEN + "CVARs insgesamt registriert: %d", this.cvars.size()); return; } else if(line.startsWith("#")) { @@ -2890,7 +2890,7 @@ public class Client implements IThreadListener { this.logConsole("%s -> %s", cv.getCVarName(), cv.format()); } else { - this.logConsole(TextColor.RED + "Kann CVAR '%s' nicht auf '%s' setzen", cv.getCVarName(), value); + this.logConsole(Color.RED + "Kann CVAR '%s' nicht auf '%s' setzen", cv.getCVarName(), value); } return; } @@ -2900,7 +2900,7 @@ public class Client implements IThreadListener { } public void reset() { - this.buffer = TextColor.NEON + "*** " + VERSION + " ***"; + this.buffer = Color.NEON + "*** " + VERSION + " ***"; this.console.clear(); this.chat.clear(); this.feed.clear(); @@ -3015,30 +3015,30 @@ public class Client implements IThreadListener { private void drawPing(int x, int y, int ping) { int bars; - TextColor color; + Color color; if(ping < 0 || ping >= 20000) { bars = 0; - color = ping < 0 ? TextColor.GRAY : TextColor.DARK_RED; + color = ping < 0 ? Color.GRAY : Color.DARK_RED; } else if(ping < 80) { bars = ping < 50 ? 8 : 7; - color = TextColor.GREEN; + color = Color.GREEN; } else if(ping < 160) { bars = ping < 120 ? 6 : 5; - color = TextColor.DARK_GREEN; + color = Color.DARK_GREEN; } else if(ping < 350) { bars = ping < 220 ? 4 : 3; - color = TextColor.YELLOW; + color = Color.YELLOW; } else if(ping < 700) { bars = ping < 500 ? 2 : 1; - color = TextColor.RED; + color = Color.RED; } else { bars = 1; - color = TextColor.DARK_RED; + color = Color.DARK_RED; } Drawing.drawTextRight(color + (ping < 10000 ? String.format("%d", ping) + "ms" : String.format("%.1f", ((float)ping) / 1000.0f) + "s"), x - 18, y, 0xffffffff); for(int z = 0; z < bars; z++) { diff --git a/client/src/main/java/client/audio/Volume.java b/client/src/main/java/client/audio/Volume.java index 7b14a9e5..1058079a 100644 --- a/client/src/main/java/client/audio/Volume.java +++ b/client/src/main/java/client/audio/Volume.java @@ -6,7 +6,7 @@ import client.gui.element.SliderCallback; import client.vars.CVar; import client.vars.CVarCategory; import common.sound.EventType; -import common.util.TextColor; +import common.util.Color; public enum Volume implements CVar { MASTER("master", "Gesamt"), @@ -52,7 +52,7 @@ public enum Volume implements CVar { } public String getType() { - return TextColor.DARK_GREEN + "volume"; + return Color.DARK_GREEN + "volume"; } public CVarCategory getCategory() { diff --git a/client/src/main/java/client/gui/GuiConnect.java b/client/src/main/java/client/gui/GuiConnect.java index 0053330f..3931aceb 100644 --- a/client/src/main/java/client/gui/GuiConnect.java +++ b/client/src/main/java/client/gui/GuiConnect.java @@ -20,7 +20,7 @@ import common.log.Log; import common.network.IPlayer; import common.util.EncryptUtil; import common.util.Pair; -import common.util.TextColor; +import common.util.Color; import common.util.Util; public class GuiConnect extends GuiList implements ButtonCallback { @@ -152,12 +152,12 @@ public class GuiConnect extends GuiList implements Button } public void draw(int x, int y, int width, int height, int mouseXIn, int mouseYIn, boolean hover) { - Drawing.drawText(this.name + TextColor.GRAY + " - " + TextColor.RESET + this.user, x + 2, y, 0xffffffff); + Drawing.drawText(this.name + Color.GRAY + " - " + Color.RESET + this.user, x + 2, y, 0xffffffff); if(this.keypair != null || !this.password.isEmpty()) Drawing.drawTextRight( (this.keypair != null ? "Pubkey " + this.keyDigest : "") + (this.keypair != null && !this.password.isEmpty() ? " + " : "") + (!this.password.isEmpty() ? "Passwort" : ""), x + width - 2, y, 0xffffffff); - Drawing.drawText(this.address + TextColor.GRAY + " Port " + TextColor.RESET + this.port + (this.enforceEncryption ? TextColor.GRAY + ", nur verschlüsselt" : ""), + Drawing.drawText(this.address + Color.GRAY + " Port " + Color.RESET + this.port + (this.enforceEncryption ? Color.GRAY + ", nur verschlüsselt" : ""), x + 2, y + height - Font.YGLYPH * 2, 0xffb0b0b0); if(!this.access.isEmpty()) Drawing.drawTextRight((this.keypair != null || !this.password.isEmpty() ? "+ " : "") + "Server-Passwort", x + width - 2, y + height - Font.YGLYPH * 2, 0xffb0b0b0); diff --git a/client/src/main/java/client/gui/GuiConsole.java b/client/src/main/java/client/gui/GuiConsole.java index 43748098..5d46f2e1 100644 --- a/client/src/main/java/client/gui/GuiConsole.java +++ b/client/src/main/java/client/gui/GuiConsole.java @@ -22,7 +22,7 @@ import common.packet.CPacketComplete; import common.util.BlockPos; import common.util.ExtMath; import common.util.HitPosition; -import common.util.TextColor; +import common.util.Color; public class GuiConsole extends Gui implements FieldCallback { private class ConsoleArea extends Area { @@ -42,7 +42,7 @@ public class GuiConsole extends Gui implements FieldCallback { if(this.sel_start >= 0 && this.sel_end == this.sel_start) { for(int z = this.sel_start; z >= 0; z--) { char c = this.text.charAt(z); - if(c == TextColor.COMMAND) { + if(c == Color.COMMAND) { for(int n = z + 1; n < this.text.length(); n++) { c = this.text.charAt(n); if(c < 0x20) { @@ -189,7 +189,7 @@ public class GuiConsole extends Gui implements FieldCallback { int nl = buffer.indexOf('\n', offset); buffer = nl >= 0 ? buffer.substring(nl + 1) : ""; } - this.setLog(buffer + "\n" + TextColor.RESET + msg); + this.setLog(buffer + "\n" + Color.RESET + msg); } public void autocompletePlayerNames() diff --git a/client/src/main/java/client/gui/GuiInfo.java b/client/src/main/java/client/gui/GuiInfo.java index 9c613d4b..b91fc15e 100644 --- a/client/src/main/java/client/gui/GuiInfo.java +++ b/client/src/main/java/client/gui/GuiInfo.java @@ -4,13 +4,13 @@ import client.Client; import client.gui.element.MultiLabel; import client.gui.element.NavButton; import common.Version; -import common.util.TextColor; +import common.util.Color; import common.util.Util; public class GuiInfo extends Gui { private static final String VER = - TextColor.GREEN + "" + Util.repeatString("\u009a", Version.RELEASE.getId()) + TextColor.DARK_VIOLET + "|-| " + TextColor.VIOLET + Client.VERSION + TextColor.DARK_VIOLET + " |-|" + - TextColor.GREEN + Util.repeatString("\u009a", Version.RELEASE.getId()); + Color.GREEN + "" + Util.repeatString("\u009a", Version.RELEASE.getId()) + Color.DARK_VIOLET + "|-| " + Color.VIOLET + Client.VERSION + Color.DARK_VIOLET + " |-|" + + Color.GREEN + Util.repeatString("\u009a", Version.RELEASE.getId()); private static final String INFO = "Ein Spiel zur Simulation, zum Testen, für Rollenspiele, Mehrspieler und vieles mehr." + "\n" + "Optimiert für Geschwindigkeit, Stabilität und\u007f\u007f [Speicherzugriffsfehler]"; @@ -42,28 +42,28 @@ public class GuiInfo extends Gui { } private static String getHeader(boolean hax, String normal, String hacked) { - return (hax ? TextColor.RED : TextColor.YELLOW) + (hax ? hacked : normal) + "\n" + - (hax ? TextColor.CYAN : TextColor.WHITE) + "==========================+=========================="; + return (hax ? Color.RED : Color.YELLOW) + (hax ? hacked : normal) + "\n" + + (hax ? Color.CYAN : Color.WHITE) + "==========================+=========================="; } private static void addLines(StringBuilder sb, boolean hax, String alternate, String category, String... authors) { - sb.append("\n" + (hax ? TextColor.BLUE : TextColor.GRAY) + sb.append("\n" + (hax ? Color.BLUE : Color.GRAY) + (hax ? alternate : category) + "\n "); for(int z = 0; z < authors.length; z++) { if(z > 0) - sb.append((hax ? TextColor.VIOLET : TextColor.GRAY) + ", "); - sb.append((hax ? TextColor.DARK_VIOLET : TextColor.WHITE) + authors[z]); + sb.append((hax ? Color.VIOLET : Color.GRAY) + ", "); + sb.append((hax ? Color.DARK_VIOLET : Color.WHITE) + authors[z]); } } private static String getInfo(boolean hax) { - return getHeader(hax, VER, VER) + "\n" + (hax ? (TextColor.VIOLET + HACKED) : (TextColor.LIGHT_GRAY + INFO)); + return getHeader(hax, VER, VER) + "\n" + (hax ? (Color.VIOLET + HACKED) : (Color.LIGHT_GRAY + INFO)); } private static String getLibraries(boolean hax) { StringBuilder sb = new StringBuilder(getHeader(hax, "Verwendete Programmbibliotheken", "U$3d 3xpl0its")); for(String lib : LIBRARIES) { - sb.append("\n" + TextColor.NEON + lib); + sb.append("\n" + Color.NEON + lib); } return sb.toString(); } @@ -71,17 +71,17 @@ public class GuiInfo extends Gui { private static String getCode(boolean hax) { StringBuilder sb = new StringBuilder(getHeader(hax, "Zusätzlicher Quellcode", "M0ar 3xpl01ts")); for(String lib : CODE) { - sb.append("\n" + TextColor.NEON + lib); + sb.append("\n" + Color.NEON + lib); } return sb.toString(); } private static String getColors() { - StringBuilder sb = new StringBuilder(TextColor.RESET + "#D "); + StringBuilder sb = new StringBuilder(Color.RESET + "#D "); int num = 0; - for(TextColor color : TextColor.values()) { - if(num == TextColor.values().length / 2) - sb.append("\n" + TextColor.COMMAND + "#d "); + for(Color color : Color.values()) { + if(num == Color.values().length / 2) + sb.append("\n" + Color.COMMAND + "#d "); sb.append(color + "#" + color.colorId + ' '); num++; } @@ -92,8 +92,8 @@ public class GuiInfo extends Gui { StringBuilder sb = new StringBuilder(getHeader(hax, "Mitwirkende dieses Programms", "Das Team -- TCQ")); addLines(sb, hax, "Die dunklen Herrscher", "Quellcode, Design, Grafiken, Refactoring und Code-Cleanup", - TextColor.CYAN + "Sen der \"kleine\" Dämon", - TextColor.RED + "Shen, Herrscher des Schattenlandes"); + Color.CYAN + "Sen der \"kleine\" Dämon", + Color.RED + "Shen, Herrscher des Schattenlandes"); return sb.toString(); } diff --git a/client/src/main/java/client/gui/GuiMenu.java b/client/src/main/java/client/gui/GuiMenu.java index 2b0e3e6c..ea829bc6 100644 --- a/client/src/main/java/client/gui/GuiMenu.java +++ b/client/src/main/java/client/gui/GuiMenu.java @@ -13,7 +13,7 @@ import client.renderer.Drawing; import client.window.Keysym; import common.rng.Random; import common.util.ExtMath; -import common.util.TextColor; +import common.util.Color; public class GuiMenu extends Gui { public static final GuiMenu INSTANCE = new GuiMenu(); @@ -59,7 +59,7 @@ public class GuiMenu extends Gui { } if(GuiMenu.this.hacked == 9) { GuiMenu.this.hacked++; - GuiMenu.this.splashLabel.setText(TextColor.VIOLET + "Hax!"); + GuiMenu.this.splashLabel.setText(Color.VIOLET + "Hax!"); } else { GuiMenu.this.gm.show(GuiConnect.INSTANCE); @@ -104,7 +104,7 @@ public class GuiMenu extends Gui { } }, "Client schließen")); this.shift(); - this.add(new Label(4, 4, 200, 0, TextColor.VIOLET + Client.VERSION, true)); + this.add(new Label(4, 4, 200, 0, Color.VIOLET + Client.VERSION, true)); this.splashLabel = this.add(new Label(0, 100, width, 0, "")); this.pickSplash(); } @@ -128,7 +128,7 @@ public class GuiMenu extends Gui { } private void pickSplash() { - this.splashLabel.setText(TextColor.VIOLET + this.rand.pick(Splashes.SPLASHES)); + this.splashLabel.setText(Color.VIOLET + this.rand.pick(Splashes.SPLASHES)); } private void resetAnimation() { @@ -162,9 +162,9 @@ public class GuiMenu extends Gui { } this.animStep = !this.animStep; StringBuilder sb = new StringBuilder(11); - sb.append(TextColor.GRAY); + sb.append(Color.GRAY); sb.append("["); - sb.append(TextColor.YELLOW); + sb.append(Color.YELLOW); switch(this.animDir) { case -1: sb.append((this.animStep ? '>' : '-') + "' "); @@ -176,7 +176,7 @@ public class GuiMenu extends Gui { sb.append(" `" + (this.animStep ? '<' : '-')); break; } - sb.append(TextColor.GRAY); + sb.append(Color.GRAY); sb.append("]"); this.animStr = sb.toString(); for(int z = this.animPos; z < this.animPos + 4; z++) { @@ -186,39 +186,39 @@ public class GuiMenu extends Gui { this.animGrow[this.rand.zrange(this.animWidth)] += 1; } sb = new StringBuilder(this.animWidth + 2); - sb.append(TextColor.DARK_GREEN); + sb.append(Color.DARK_GREEN); for(int z = 0; z < this.animWidth; z++) { switch(this.animGrow[z] / 5) { case 0: - sb.append(TextColor.BLACK); + sb.append(Color.BLACK); break; case 1: - sb.append(TextColor.GRAY); + sb.append(Color.GRAY); break; case 2: case 3: - sb.append(TextColor.LIGHT_GRAY); + sb.append(Color.LIGHT_GRAY); break; case 4: case 5: case 6: - sb.append(TextColor.WHITE); + sb.append(Color.WHITE); break; case 7: case 8: case 9: case 10: - sb.append(TextColor.MAGENTA); + sb.append(Color.MAGENTA); break; case 11: case 12: case 13: case 14: case 15: - sb.append(TextColor.DARK_VIOLET); + sb.append(Color.DARK_VIOLET); break; default: - sb.append(TextColor.VIOLET); + sb.append(Color.VIOLET); break; } sb.append(",."); diff --git a/client/src/main/java/client/gui/GuiServer.java b/client/src/main/java/client/gui/GuiServer.java index c90e037c..a23fb423 100644 --- a/client/src/main/java/client/gui/GuiServer.java +++ b/client/src/main/java/client/gui/GuiServer.java @@ -19,7 +19,7 @@ import client.vars.Variable; import client.window.Window; import common.network.IPlayer; import common.util.EncryptUtil; -import common.util.TextColor; +import common.util.Color; public class GuiServer extends Gui implements FieldCallback { public static final GuiServer INSTANCE = new GuiServer(null); @@ -193,22 +193,22 @@ public class GuiServer extends Gui implements FieldCallback { if(this.server != null) { name = this.nameBox.getText(); if(name.isEmpty()) { - this.nameLabel.setText(TextColor.RED + "Name in der Liste"); + this.nameLabel.setText(Color.RED + "Name in der Liste"); return; } if(GuiConnect.INSTANCE.isNameTaken(name)) { - this.nameLabel.setText("Name in der Liste - " + TextColor.RED + "Bereits vorhanden"); + this.nameLabel.setText("Name in der Liste - " + Color.RED + "Bereits vorhanden"); return; } } String addr = this.addrBox.getText(); if(addr.isEmpty()) { - this.addrLabel.setText(TextColor.RED + "Adresse / Hostname"); + this.addrLabel.setText(Color.RED + "Adresse / Hostname"); return; } int port = -1; if(this.portBox.getText().isEmpty()) { - this.portLabel.setText(TextColor.RED + "Port"); + this.portLabel.setText(Color.RED + "Port"); return; } else { @@ -216,27 +216,27 @@ public class GuiServer extends Gui implements FieldCallback { port = Integer.parseInt(this.portBox.getText()); } catch(NumberFormatException e) { - this.rangeLabel.setText("[" + TextColor.RED + "1024..32767" + TextColor.RESET + "]"); + this.rangeLabel.setText("[" + Color.RED + "1024..32767" + Color.RESET + "]"); return; } if(port < 1024 || port > 32767) { - this.rangeLabel.setText("[" + (port < 1024 ? TextColor.RED + "1024" + TextColor.RESET + "..32767" : "1024.." + TextColor.RED + "32767" + TextColor.RESET) + "]"); + this.rangeLabel.setText("[" + (port < 1024 ? Color.RED + "1024" + Color.RESET + "..32767" : "1024.." + Color.RED + "32767" + Color.RESET) + "]"); return; } } String user = this.userBox.getText(); if(user.isEmpty()) { - this.userLabel.setText(TextColor.RED + "Benutzername"); + this.userLabel.setText(Color.RED + "Benutzername"); return; } String pass = this.passBox.getText(); if(!pass.isEmpty() && pass.length() < 8) { - this.passLabel.setText((this.keypair == null ? "Anmelde" : "Ersatz") + "-Passwort (" + TextColor.RED + "mind. 8 Zeichen" + TextColor.RESET + ")"); + this.passLabel.setText((this.keypair == null ? "Anmelde" : "Ersatz") + "-Passwort (" + Color.RED + "mind. 8 Zeichen" + Color.RESET + ")"); return; } String acc = this.accBox.getText(); if(!acc.isEmpty() && acc.length() < 8) { - this.accLabel.setText("Zugang (" + TextColor.RED + "mind. 8 Zeichen" + TextColor.RESET + ")"); + this.accLabel.setText("Zugang (" + Color.RED + "mind. 8 Zeichen" + Color.RESET + ")"); return; } if(this.server == null) { diff --git a/client/src/main/java/client/gui/character/GuiCharacters.java b/client/src/main/java/client/gui/character/GuiCharacters.java index 551b49b6..118e35e0 100644 --- a/client/src/main/java/client/gui/character/GuiCharacters.java +++ b/client/src/main/java/client/gui/character/GuiCharacters.java @@ -15,7 +15,7 @@ import common.entity.npc.PlayerCharacter; import common.packet.CPacketAction; import common.packet.CPacketAction.Action; import common.util.ExtMath; -import common.util.TextColor; +import common.util.Color; public class GuiCharacters extends GuiList implements ButtonCallback { @@ -34,11 +34,11 @@ public class GuiCharacters extends GuiList impleme { if(this.initial) Drawing.drawRect(x, y, 1, 36, 0xffaf0000); - String str = this.character == null ? TextColor.BLUE + "[" + TextColor.CYAN + "+" + TextColor.BLUE + "]" : - String.format(TextColor.GREEN + "Level " + TextColor.DARK_GREEN + "%d " + TextColor.YELLOW + "%s " + TextColor.VIOLET + "%s", + String str = this.character == null ? Color.BLUE + "[" + Color.CYAN + "+" + Color.BLUE + "]" : + String.format(Color.GREEN + "Level " + Color.DARK_GREEN + "%d " + Color.YELLOW + "%s " + Color.VIOLET + "%s", character.level(), character.type(), character.name()); - String pos = this.character == null ? TextColor.BROWN + "Neuen Charakter erstellen" : - String.format(TextColor.NEON + "%s " + TextColor.GRAY + "bei " + TextColor.ACID + "%d" + TextColor.GRAY + ", " + TextColor.ACID + "%d" + TextColor.GRAY + ", " + TextColor.ACID + "%d", + String pos = this.character == null ? Color.BROWN + "Neuen Charakter erstellen" : + String.format(Color.NEON + "%s " + Color.GRAY + "bei " + Color.ACID + "%d" + Color.GRAY + ", " + Color.ACID + "%d" + Color.GRAY + ", " + Color.ACID + "%d", character.dim(), character.pos().getX(), character.pos().getY(), character.pos().getZ()); Drawing.drawText(str, x + 3, y, 0xffffffff); Drawing.drawText(pos, x + 3, y + height - Font.YGLYPH, 0xffffffff); @@ -63,7 +63,7 @@ public class GuiCharacters extends GuiList impleme private void updateButtons() { CharacterEntry entry = this.getSelected(); - this.descField.setText(entry == null ? "" : (entry.character == null ? "*neuer Charakter*" : String.format(TextColor.GRAY + "[%s%s" + TextColor.GRAY + "]\n" + TextColor.LIGHT_YELLOW + "Herkunft" + TextColor.LIGHT_GRAY + ": " + TextColor.LIGHT_BROWN + "%s\n" + TextColor.RESET + "%s", entry.character.align().color, entry.character.align().display, entry.character.origin() == null ? TextColor.DARK_GRAY + "*unbekannt*" : entry.character.origin(), entry.character.info() == null ? "*keine Beschreibung vorhanden*" : this.getSelected().character.info()))); + this.descField.setText(entry == null ? "" : (entry.character == null ? "*neuer Charakter*" : String.format(Color.GRAY + "[%s%s" + Color.GRAY + "]\n" + Color.LIGHT_YELLOW + "Herkunft" + Color.LIGHT_GRAY + ": " + Color.LIGHT_BROWN + "%s\n" + Color.RESET + "%s", entry.character.align().color, entry.character.align().display, entry.character.origin() == null ? Color.DARK_GRAY + "*unbekannt*" : entry.character.origin(), entry.character.info() == null ? "*keine Beschreibung vorhanden*" : this.getSelected().character.info()))); this.actionButtom.setText(entry != null && entry.character == null ? "Charakter erstellen" : "Charakter spielen"); this.actionButtom.enabled = entry != null && !entry.initial; this.deleteButtom.enabled = !this.gm.charEditor && entry != null && entry.character != null && !entry.initial; diff --git a/client/src/main/java/client/gui/container/GuiContainer.java b/client/src/main/java/client/gui/container/GuiContainer.java index 17813c9a..6d513277 100755 --- a/client/src/main/java/client/gui/container/GuiContainer.java +++ b/client/src/main/java/client/gui/container/GuiContainer.java @@ -40,7 +40,7 @@ import common.item.ItemStack; import common.packet.CPacketAction; import common.packet.CPacketCheat; import common.util.ExtMath; -import common.util.TextColor; +import common.util.Color; public abstract class GuiContainer extends Gui { @@ -125,14 +125,14 @@ public abstract class GuiContainer extends Gui List list = Lists.newArrayList(); String s = stack.getColoredName(); if(stack.getSize() != 1) - s = TextColor.YELLOW + "" + stack.getSize() + " " + TextColor.RESET + s; - s = s + TextColor.RESET; + s = Color.YELLOW + "" + stack.getSize() + " " + Color.RESET + s; + s = s + Color.RESET; list.add(s); stack.getItem().addInformation(stack, this.gm.player, list); if(stack.getItem().isAdminItem()) - list.add(TextColor.RED + "Admin-Gegenstand"); + list.add(Color.RED + "Admin-Gegenstand"); if(stack.getItem().isMagnetic()) - list.add(TextColor.LIGHT_GRAY + "Magnetisch"); + list.add(Color.LIGHT_GRAY + "Magnetisch"); if(stack.getItem().canBeDyed()) list.add("Farbe: #" + Integer.toHexString(stack.getDyeColor()).toUpperCase()); @@ -146,9 +146,9 @@ public abstract class GuiContainer extends Gui damage += EnchantmentHelper.getDamageModifier(stack); if(damage != 0) { if(damage > 0) - list.add(TextColor.BLUE + String.format("+%d Angriffsschaden", damage)); + list.add(Color.BLUE + String.format("+%d Angriffsschaden", damage)); else - list.add(TextColor.RED + String.format("-%d Angriffsschaden", damage)); + list.add(Color.RED + String.format("-%d Angriffsschaden", damage)); } Map mods = stack.getAttributeModifiers(null); @@ -160,17 +160,17 @@ public abstract class GuiContainer extends Gui if(stack.getSize() != 1) { double total = amt * (double)stack.getSize(); if(amt > 0.0D) - list.add(TextColor.BLUE + String.format("+%s %s [%dx +%s]", DECIMALFORMAT.format(total), entry.getKey(), stack.getSize(), + list.add(Color.BLUE + String.format("+%s %s [%dx +%s]", DECIMALFORMAT.format(total), entry.getKey(), stack.getSize(), DECIMALFORMAT.format(amt))); else if(amt < 0.0D) - list.add(TextColor.RED + String.format("-%s %s [%dx -%s]", DECIMALFORMAT.format(total * -1.0), entry.getKey(), stack.getSize(), + list.add(Color.RED + String.format("-%s %s [%dx -%s]", DECIMALFORMAT.format(total * -1.0), entry.getKey(), stack.getSize(), DECIMALFORMAT.format(amt * -1.0))); } else { if(amt > 0.0D) - list.add(TextColor.BLUE + String.format("+%s %s", DECIMALFORMAT.format(amt), entry.getKey())); + list.add(Color.BLUE + String.format("+%s %s", DECIMALFORMAT.format(amt), entry.getKey())); else if(amt < 0.0D) - list.add(TextColor.RED + String.format("-%s %s", DECIMALFORMAT.format(amt * -1.0), entry.getKey())); + list.add(Color.RED + String.format("-%s %s", DECIMALFORMAT.format(amt * -1.0), entry.getKey())); } } } @@ -188,7 +188,7 @@ public abstract class GuiContainer extends Gui else list.add("Stapelbar bis " + stack.getItem().getMaxAmount()); - list.add(TextColor.GRAY + ItemRegistry.getName(stack.getItem())); + list.add(Color.GRAY + ItemRegistry.getName(stack.getItem())); return list; } @@ -420,11 +420,11 @@ public abstract class GuiContainer extends Gui if (stack.isEmpty()) { - s = "" + TextColor.YELLOW + "0"; + s = "" + Color.YELLOW + "0"; } } else if(stack == this.cheatStack) { - s = TextColor.DARK_GREEN + "+" + TextColor.GREEN + formatAmount(stack.getSize()); + s = Color.DARK_GREEN + "+" + Color.GREEN + formatAmount(stack.getSize()); } this.drawItemStack(stack, mouseX - j2, mouseY - k2, s); @@ -472,7 +472,7 @@ public abstract class GuiContainer extends Gui StringBuilder sb = new StringBuilder(); for(int i = 0; i < list.size(); ++i) { if(i != 0) - sb.append("\n" + TextColor.LIGHT_GRAY + (String)list.get(i)); + sb.append("\n" + Color.LIGHT_GRAY + (String)list.get(i)); else sb.append((String)list.get(i)); } @@ -532,13 +532,13 @@ public abstract class GuiContainer extends Gui if (itemstack.getSize() > itemstack.getMaxStackSize()) { - s = TextColor.YELLOW + formatAmount(itemstack.getMaxStackSize()); + s = Color.YELLOW + formatAmount(itemstack.getMaxStackSize()); itemstack.setSize(itemstack.getMaxStackSize()); } if (itemstack.getSize() > slotIn.getItemStackLimit(itemstack)) { - s = TextColor.YELLOW + formatAmount(slotIn.getItemStackLimit(itemstack)); + s = Color.YELLOW + formatAmount(slotIn.getItemStackLimit(itemstack)); itemstack.setSize(slotIn.getItemStackLimit(itemstack)); } } @@ -880,7 +880,7 @@ public abstract class GuiContainer extends Gui if (text == null && stack.isEmpty()) { - s = TextColor.RED + formatAmount(stack.getSize()); + s = Color.RED + formatAmount(stack.getSize()); } Drawing.drawTextRight(s, xPosition + scale * 16, yPosition + scale * 16 + 1 - Font.YGLYPH, 0xffffffff); } diff --git a/client/src/main/java/client/gui/container/GuiEnchant.java b/client/src/main/java/client/gui/container/GuiEnchant.java index 4c14f694..13447c45 100755 --- a/client/src/main/java/client/gui/container/GuiEnchant.java +++ b/client/src/main/java/client/gui/container/GuiEnchant.java @@ -10,7 +10,7 @@ import common.inventory.ContainerEnchantment; import common.inventory.InventoryPlayer; import common.rng.Random; import common.util.Pair; -import common.util.TextColor; +import common.util.Color; import common.world.World; public class GuiEnchant extends GuiContainer implements ButtonCallback { @@ -46,13 +46,13 @@ public class GuiEnchant extends GuiContainer implements ButtonCallback { else { if(this.gm.player.getManaPoints() < mana) { this.buttons[l].enabled = false; - this.labels[l].setText(TextColor.DARK_GRAY + name); - this.mana[l].setText(TextColor.DARK_RED + "Mana-Level " + mana); + this.labels[l].setText(Color.DARK_GRAY + name); + this.mana[l].setText(Color.DARK_RED + "Mana-Level " + mana); } else { this.buttons[l].enabled = true; - this.labels[l].setText(TextColor.GREEN + name); - this.mana[l].setText(TextColor.DARK_GREEN + "Mana-Level " + mana + TextColor.GRAY + ", " + TextColor.YELLOW + "-" + (l + 1) + " Mana"); + this.labels[l].setText(Color.GREEN + name); + this.mana[l].setText(Color.DARK_GREEN + "Mana-Level " + mana + Color.GRAY + ", " + Color.YELLOW + "-" + (l + 1) + " Mana"); } } } @@ -95,10 +95,10 @@ public class GuiEnchant extends GuiContainer implements ButtonCallback { StringBuilder sb = new StringBuilder(); String s = l.first().getFormattedName(l.second()); - sb.append(TextColor.WHITE + s + " . . . ?"); + sb.append(Color.WHITE + s + " . . . ?"); if(this.gm.player.getManaPoints() < k) { - sb.append((sb.length() != 0 ? "\n" : "") + TextColor.RED + String.format("%d Mana erforderlich", this.enchantment.mana[j])); + sb.append((sb.length() != 0 ? "\n" : "") + Color.RED + String.format("%d Mana erforderlich", this.enchantment.mana[j])); } else { String s1 = ""; @@ -110,7 +110,7 @@ public class GuiEnchant extends GuiContainer implements ButtonCallback { s1 = String.format("%d Manapunkte", i1); } - sb.append((sb.length() != 0 ? "\n" : "") + TextColor.LIGHT_GRAY.toString() + "" + s1); + sb.append((sb.length() != 0 ? "\n" : "") + Color.LIGHT_GRAY.toString() + "" + s1); } this.hover(sb.toString(), mouseX, mouseY); diff --git a/client/src/main/java/client/gui/container/GuiRepair.java b/client/src/main/java/client/gui/container/GuiRepair.java index 91fe9e67..09f396d1 100755 --- a/client/src/main/java/client/gui/container/GuiRepair.java +++ b/client/src/main/java/client/gui/container/GuiRepair.java @@ -3,7 +3,7 @@ package client.gui.container; import client.gui.element.Label; import common.inventory.ContainerRepair; import common.inventory.InventoryPlayer; -import common.util.TextColor; +import common.util.Color; import common.world.World; public class GuiRepair extends GuiContainer { @@ -20,13 +20,13 @@ public class GuiRepair extends GuiContainer { public void updateScreen() { super.updateScreen(); if(this.anvil.maximumCost >= 40) - this.info.setText(TextColor.DARK_RED + "Zu teuer!"); + this.info.setText(Color.DARK_RED + "Zu teuer!"); else if(this.anvil.maximumCost <= 0 || !this.anvil.getSlot(2).getHasStack()) this.info.setText(""); else if(!this.anvil.getSlot(2).canTakeStack(this.playerInv.player)) - this.info.setText(TextColor.RED + "Manakosten: " + this.anvil.maximumCost); + this.info.setText(Color.RED + "Manakosten: " + this.anvil.maximumCost); else - this.info.setText(TextColor.GREEN + "Manakosten: " + this.anvil.maximumCost); + this.info.setText(Color.GREEN + "Manakosten: " + this.anvil.maximumCost); } public void addElements() { diff --git a/client/src/main/java/client/gui/ingame/GuiForm.java b/client/src/main/java/client/gui/ingame/GuiForm.java index b84831dc..ef5c53b2 100644 --- a/client/src/main/java/client/gui/ingame/GuiForm.java +++ b/client/src/main/java/client/gui/ingame/GuiForm.java @@ -18,7 +18,7 @@ import client.gui.element.ToggleCallback; import client.network.ClientPlayer; import common.packet.CPacketForm; import common.util.ExtMath; -import common.util.TextColor; +import common.util.Color; import common.util.Triplet; public class GuiForm extends Gui implements ButtonCallback { @@ -107,8 +107,8 @@ public class GuiForm extends Gui implements ButtonCallback { int min = (this.inputData[z].third() & 0x7fffffff) >> 16; String text = this.inputs[z].getText(); if(text.length() < min) { - if(!GuiForm.this.labels[z].getText().startsWith("" + TextColor.RED)) - GuiForm.this.labels[z].setText(TextColor.RED + GuiForm.this.labels[z].getText()); + if(!GuiForm.this.labels[z].getText().startsWith("" + Color.RED)) + GuiForm.this.labels[z].setText(Color.RED + GuiForm.this.labels[z].getText()); return; } this.outputData[z] = text; diff --git a/client/src/main/java/client/gui/ingame/GuiGameOver.java b/client/src/main/java/client/gui/ingame/GuiGameOver.java index 1b255df5..608cb5de 100755 --- a/client/src/main/java/client/gui/ingame/GuiGameOver.java +++ b/client/src/main/java/client/gui/ingame/GuiGameOver.java @@ -4,7 +4,7 @@ import client.gui.Gui; import client.gui.element.ActButton; import client.gui.element.ButtonCallback; import common.util.ExtMath; -import common.util.TextColor; +import common.util.Color; import client.gui.element.Label; import client.gui.element.MultiLabel; import client.gui.element.PressType; @@ -20,8 +20,8 @@ public class GuiGameOver extends Gui { public void init(int width, int height) { this.timer = 0; - this.add(new Label(0, 0, 400, 0, TextColor.DARK_RED + "Du bist gestorben!")); - this.add(new MultiLabel(0, 32, 400, 42, String.format(TextColor.GREEN + "Letzte Position" + TextColor.GRAY + ":\n" + TextColor.YELLOW + "%d, %d, %d\n" + TextColor.YELLOW + "%s", ExtMath.floord(this.gm.player.posX), ExtMath.floord(this.gm.player.posY), ExtMath.floord(this.gm.player.posZ), this.gm.player.worldObj.dimension.getDisplay()))); + this.add(new Label(0, 0, 400, 0, Color.DARK_RED + "Du bist gestorben!")); + this.add(new MultiLabel(0, 32, 400, 42, String.format(Color.GREEN + "Letzte Position" + Color.GRAY + ":\n" + Color.YELLOW + "%d, %d, %d\n" + Color.YELLOW + "%s", ExtMath.floord(this.gm.player.posX), ExtMath.floord(this.gm.player.posY), ExtMath.floord(this.gm.player.posZ), this.gm.player.worldObj.dimension.getDisplay()))); this.button = this.add(new ActButton(100, 100, 200, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiGameOver.this.gm.player.respawnPlayer(); diff --git a/client/src/main/java/client/gui/ingame/GuiRename.java b/client/src/main/java/client/gui/ingame/GuiRename.java index 8c35a6dc..ae783d51 100644 --- a/client/src/main/java/client/gui/ingame/GuiRename.java +++ b/client/src/main/java/client/gui/ingame/GuiRename.java @@ -12,7 +12,7 @@ import client.gui.element.FieldCallback; import client.network.ClientPlayer; import common.item.ItemStack; import common.packet.CPacketMessage; -import common.util.TextColor; +import common.util.Color; public class GuiRename extends Gui implements FieldCallback, ButtonCallback { private final String itemName; @@ -37,7 +37,7 @@ public class GuiRename extends Gui implements FieldCallback, ButtonCallback { public GuiRename(int slot, ItemStack stack, Gui prev) { this.itemName = stack.getItem().getDisplay(); - this.origName = stack.hasDisplayName() ? TextColor.stripCodes(stack.getDisplayName()) : ""; + this.origName = stack.hasDisplayName() ? Color.stripCodes(stack.getDisplayName()) : ""; this.slot = slot; this.previous = prev; } diff --git a/client/src/main/java/client/gui/options/GuiBinds.java b/client/src/main/java/client/gui/options/GuiBinds.java index cd7741d7..9714153a 100644 --- a/client/src/main/java/client/gui/options/GuiBinds.java +++ b/client/src/main/java/client/gui/options/GuiBinds.java @@ -6,7 +6,7 @@ import client.gui.element.ButtonCallback; import client.gui.element.Label; import client.gui.element.PressType; import client.window.Bind; -import common.util.TextColor; +import common.util.Color; public class GuiBinds extends GuiOptions { protected GuiBinds() { @@ -41,9 +41,9 @@ public class GuiBinds extends GuiOptions { }, new Formatter() { public String use(ActButton elem) { if(bind == Bind.getWaiting()) - return TextColor.BLUE + "***"; + return Color.BLUE + "***"; else - return (bind.isDupe() ? TextColor.RED : TextColor.YELLOW) + (bind.getInput() == null ? "---" : bind.getInput().getDisplay()); + return (bind.isDupe() ? Color.RED : Color.YELLOW) + (bind.getInput() == null ? "---" : bind.getInput().getDisplay()); } })); if(++x == cols) { diff --git a/client/src/main/java/client/gui/options/GuiDisplay.java b/client/src/main/java/client/gui/options/GuiDisplay.java index 0ddd0c28..5941c684 100644 --- a/client/src/main/java/client/gui/options/GuiDisplay.java +++ b/client/src/main/java/client/gui/options/GuiDisplay.java @@ -18,7 +18,7 @@ import client.window.DisplayMode; import client.window.Window; import common.collect.Lists; import common.util.ExtMath; -import common.util.TextColor; +import common.util.Color; public class GuiDisplay extends GuiOptions { private static final String[] DISTANCES = new String[] {"Gruselig", "Winzig", "Gering", "Normal", "Weit"}; @@ -61,7 +61,7 @@ public class GuiDisplay extends GuiOptions { } } if(dmodes == null) - this.add(new Fill(242, 0, 240, 0, TextColor.RED + "")); + this.add(new Fill(242, 0, 240, 0, Color.RED + "")); this.add(new Slider(0, 20, 240, 0, 0, 0, 360 - 8, 0, (this.gm.sync < 0) ? (360 - 8) : (this.gm.sync != 0 ? ((this.gm.sync < 10) ? 1 : (this.gm.sync - 9)) : 0), new SliderCallback() { public void use(Slider elem, int value) { diff --git a/client/src/main/java/client/network/ClientPlayer.java b/client/src/main/java/client/network/ClientPlayer.java index 56d48d0d..4e45e548 100755 --- a/client/src/main/java/client/network/ClientPlayer.java +++ b/client/src/main/java/client/network/ClientPlayer.java @@ -56,6 +56,7 @@ import common.inventory.InventoryPlayer; import common.inventory.InventoryWarpChest; import common.item.ItemStack; import common.item.material.ItemDye; +import common.item.material.ItemGrindedBones; import common.log.Log; import common.network.IClientPlayer; import common.network.NetConnection; @@ -1595,7 +1596,7 @@ public class ClientPlayer implements IClientPlayer break; case 2005: - ItemDye.spawnBonemealParticles(this.gm.world, blockPosIn, data); + ItemGrindedBones.spawnParticles(this.gm.world, blockPosIn, data); break; case 2016: diff --git a/client/src/main/java/client/renderer/Drawing.java b/client/src/main/java/client/renderer/Drawing.java index db09ed72..88eaf3c8 100644 --- a/client/src/main/java/client/renderer/Drawing.java +++ b/client/src/main/java/client/renderer/Drawing.java @@ -6,7 +6,7 @@ import client.Client; import client.gui.Font; import client.gui.FontChar; import common.log.Log; -import common.util.TextColor; +import common.util.Color; import common.util.Util; public abstract class Drawing { @@ -52,7 +52,7 @@ public abstract class Drawing { continue; } else if((ch >= Log.CHR_COLORS1 && ch <= Log.CHR_COLORE1) || (ch >= Log.CHR_COLORS2 && ch <= Log.CHR_COLORE2)) { - ncolor = TextColor.getColor(ch) | (color & 0xff000000); + ncolor = Color.getColor(ch) | (color & 0xff000000); continue; } else if(ch == Log.CHR_CRESET) { @@ -315,7 +315,7 @@ public abstract class Drawing { continue; } else if((ch >= Log.CHR_COLORS1 && ch <= Log.CHR_COLORE1) || (ch >= Log.CHR_COLORS2 && ch <= Log.CHR_COLORE2)) { - bcolor = TextColor.getShadow(ch) | (scolor & 0xff000000); + bcolor = Color.getShadow(ch) | (scolor & 0xff000000); continue; } else if(ch == Log.CHR_CRESET) { @@ -343,7 +343,7 @@ public abstract class Drawing { continue; } else if((ch >= Log.CHR_COLORS1 && ch <= Log.CHR_COLORE1) || (ch >= Log.CHR_COLORS2 && ch <= Log.CHR_COLORE2)) { - ncolor = TextColor.getColor(ch) | (color & 0xff000000); + ncolor = Color.getColor(ch) | (color & 0xff000000); continue; } else if(ch == Log.CHR_CRESET) { diff --git a/client/src/main/java/client/renderer/entity/RenderRabbit.java b/client/src/main/java/client/renderer/entity/RenderRabbit.java index a7cc098b..e42b7619 100755 --- a/client/src/main/java/client/renderer/entity/RenderRabbit.java +++ b/client/src/main/java/client/renderer/entity/RenderRabbit.java @@ -2,7 +2,7 @@ package client.renderer.entity; import client.renderer.model.ModelBase; import common.entity.animal.EntityRabbit; -import common.util.TextColor; +import common.util.Color; public class RenderRabbit extends RenderLiving { @@ -26,7 +26,7 @@ public class RenderRabbit extends RenderLiving { } protected String getEntityTexture(EntityRabbit entity) { - String name = TextColor.stripCodes(entity.getCustomNameTag()); + String name = Color.stripCodes(entity.getCustomNameTag()); if("Lola".equalsIgnoreCase(name) || "Lolo".equalsIgnoreCase(name)) return HALF; int type = entity.getRabbitType(); diff --git a/client/src/main/java/client/renderer/entity/RendererLivingEntity.java b/client/src/main/java/client/renderer/entity/RendererLivingEntity.java index 6f72865f..d37bba83 100755 --- a/client/src/main/java/client/renderer/entity/RendererLivingEntity.java +++ b/client/src/main/java/client/renderer/entity/RendererLivingEntity.java @@ -23,7 +23,7 @@ import common.entity.types.EntityAnimal; import common.entity.types.EntityLiving; import common.log.Log; import common.util.ExtMath; -import common.util.TextColor; +import common.util.Color; public abstract class RendererLivingEntity extends Render { @@ -436,7 +436,7 @@ public abstract class RendererLivingEntity extends Rende } else { - String s = TextColor.stripCodes(bat.getCustomNameTag()); + String s = Color.stripCodes(bat.getCustomNameTag()); if (s != null && (s.startsWith("Australia") || s.startsWith("Australien"))) // && (!(bat.isPlayer()) || ((EntityNPC)bat).isWearing(ModelPart.CAPE))) { diff --git a/client/src/main/java/client/vars/BoolVar.java b/client/src/main/java/client/vars/BoolVar.java index 36865613..25922e27 100644 --- a/client/src/main/java/client/vars/BoolVar.java +++ b/client/src/main/java/client/vars/BoolVar.java @@ -4,7 +4,7 @@ import java.lang.reflect.Field; import client.gui.element.Toggle; import client.gui.element.ToggleCallback; -import common.util.TextColor; +import common.util.Color; import common.util.Util; public class BoolVar extends BaseVar { @@ -27,7 +27,7 @@ public class BoolVar extends BaseVar { } public String getType() { - return TextColor.MAGENTA + "bool"; + return Color.MAGENTA + "bool"; } public boolean parse(String str) { diff --git a/client/src/main/java/client/vars/CVarCategory.java b/client/src/main/java/client/vars/CVarCategory.java index 4a8bfde5..250d4b75 100644 --- a/client/src/main/java/client/vars/CVarCategory.java +++ b/client/src/main/java/client/vars/CVarCategory.java @@ -1,15 +1,15 @@ package client.vars; -import common.util.TextColor; +import common.util.Color; public enum CVarCategory { - SYSTEM(TextColor.RED + "system"), - WINDOW(TextColor.BLUE + "window"), - GUI(TextColor.GREEN + "gui"), - RENDER(TextColor.NEON + "render"), - INPUT(TextColor.ORANGE + "input"), - CONSOLE(TextColor.YELLOW + "console"), - SOUND(TextColor.CRIMSON + "sound"); + SYSTEM(Color.RED + "system"), + WINDOW(Color.BLUE + "window"), + GUI(Color.GREEN + "gui"), + RENDER(Color.NEON + "render"), + INPUT(Color.ORANGE + "input"), + CONSOLE(Color.YELLOW + "console"), + SOUND(Color.CRIMSON + "sound"); private final String name; diff --git a/client/src/main/java/client/vars/ColorVar.java b/client/src/main/java/client/vars/ColorVar.java index e65aad68..307bf754 100644 --- a/client/src/main/java/client/vars/ColorVar.java +++ b/client/src/main/java/client/vars/ColorVar.java @@ -7,7 +7,7 @@ import client.gui.element.FieldCallback; import client.gui.element.Label; import client.gui.element.Slider; import client.gui.element.FieldAction; -import common.util.TextColor; +import common.util.Color; import common.util.Util; public class ColorVar extends IntVar { @@ -19,7 +19,7 @@ public class ColorVar extends IntVar { } public String getType() { - return this.alpha ? (TextColor.GRAY + "color32") : (TextColor.LIGHT_GRAY + "color"); + return this.alpha ? (Color.GRAY + "color32") : (Color.LIGHT_GRAY + "color"); } protected Integer parseValue(String str) { diff --git a/client/src/main/java/client/vars/EnumVar.java b/client/src/main/java/client/vars/EnumVar.java index d5897615..e46eee7f 100644 --- a/client/src/main/java/client/vars/EnumVar.java +++ b/client/src/main/java/client/vars/EnumVar.java @@ -8,7 +8,7 @@ import client.gui.element.Element; import client.gui.element.Switch; import client.gui.element.SwitchCallback; import common.util.Identifyable; -import common.util.TextColor; +import common.util.Color; import common.util.Util; public class EnumVar extends BaseVar { @@ -41,7 +41,7 @@ public class EnumVar extends BaseVar { } public String getType() { - return TextColor.CYAN + "enum"; + return Color.CYAN + "enum"; } public boolean parse(String str) { diff --git a/client/src/main/java/client/vars/FloatVar.java b/client/src/main/java/client/vars/FloatVar.java index 45fdad03..2fd87fc9 100644 --- a/client/src/main/java/client/vars/FloatVar.java +++ b/client/src/main/java/client/vars/FloatVar.java @@ -5,7 +5,7 @@ import java.lang.reflect.Field; import client.gui.element.Slider; import client.gui.element.SliderFloatCallback; import common.util.ExtMath; -import common.util.TextColor; +import common.util.Color; public class FloatVar extends BaseVar { public static interface FloatFunction extends VarFunction { @@ -47,7 +47,7 @@ public class FloatVar extends BaseVar { } public String getType() { - return TextColor.YELLOW + "float"; + return Color.YELLOW + "float"; } public boolean parse(String str) { diff --git a/client/src/main/java/client/vars/IntVar.java b/client/src/main/java/client/vars/IntVar.java index 5b99a738..614dac69 100644 --- a/client/src/main/java/client/vars/IntVar.java +++ b/client/src/main/java/client/vars/IntVar.java @@ -5,7 +5,7 @@ import java.lang.reflect.Field; import client.gui.element.Slider; import client.gui.element.SliderCallback; import common.util.ExtMath; -import common.util.TextColor; +import common.util.Color; import common.util.Util; public class IntVar extends BaseVar { @@ -36,7 +36,7 @@ public class IntVar extends BaseVar { } public String getType() { - return TextColor.GREEN + "int"; + return Color.GREEN + "int"; } protected Integer parseValue(String str) { diff --git a/client/src/main/java/client/vars/StringVar.java b/client/src/main/java/client/vars/StringVar.java index b0b03265..84bd4cd6 100644 --- a/client/src/main/java/client/vars/StringVar.java +++ b/client/src/main/java/client/vars/StringVar.java @@ -5,7 +5,7 @@ import java.lang.reflect.Field; import client.gui.element.FieldCallback; import client.gui.element.FieldAction; import common.util.CharValidator; -import common.util.TextColor; +import common.util.Color; public class StringVar extends BaseVar { public static interface StringFunction extends VarFunction { @@ -33,7 +33,7 @@ public class StringVar extends BaseVar { } public String getType() { - return TextColor.YELLOW + "float"; + return Color.YELLOW + "float"; } public boolean parse(String str) { diff --git a/client/src/main/java/client/window/Bind.java b/client/src/main/java/client/window/Bind.java index 0884a050..cb7d4085 100644 --- a/client/src/main/java/client/window/Bind.java +++ b/client/src/main/java/client/window/Bind.java @@ -5,7 +5,7 @@ import client.gui.element.Element; import client.vars.CVar; import client.vars.CVarCategory; import common.util.Identifyable; -import common.util.TextColor; +import common.util.Color; import common.util.Util; public enum Bind implements Identifyable, CVar { @@ -180,7 +180,7 @@ public enum Bind implements Identifyable, CVar { } public String getType() { - return TextColor.VIOLET + "key"; + return Color.VIOLET + "key"; } public CVarCategory getCategory() { diff --git a/client/src/main/resources/textures/items/acid_green_dye.png b/client/src/main/resources/textures/items/acid_green_dye.png new file mode 100644 index 00000000..b499b6c7 Binary files /dev/null and b/client/src/main/resources/textures/items/acid_green_dye.png differ diff --git a/client/src/main/resources/textures/items/beige_dye.png b/client/src/main/resources/textures/items/beige_dye.png new file mode 100644 index 00000000..db0d6731 Binary files /dev/null and b/client/src/main/resources/textures/items/beige_dye.png differ diff --git a/client/src/main/resources/textures/items/black_dye.png b/client/src/main/resources/textures/items/black_dye.png new file mode 100644 index 00000000..69e67d09 Binary files /dev/null and b/client/src/main/resources/textures/items/black_dye.png differ diff --git a/client/src/main/resources/textures/items/blue_dye.png b/client/src/main/resources/textures/items/blue_dye.png new file mode 100644 index 00000000..bbc4bdd4 Binary files /dev/null and b/client/src/main/resources/textures/items/blue_dye.png differ diff --git a/client/src/main/resources/textures/items/brown_dye.png b/client/src/main/resources/textures/items/brown_dye.png new file mode 100644 index 00000000..501769dd Binary files /dev/null and b/client/src/main/resources/textures/items/brown_dye.png differ diff --git a/client/src/main/resources/textures/items/camera.png b/client/src/main/resources/textures/items/camera.png index 3ab9d103..89d0c6a6 100755 Binary files a/client/src/main/resources/textures/items/camera.png and b/client/src/main/resources/textures/items/camera.png differ diff --git a/client/src/main/resources/textures/items/chick_magnet.png b/client/src/main/resources/textures/items/chick_magnet.png index aa06fee1..48403ca6 100755 Binary files a/client/src/main/resources/textures/items/chick_magnet.png and b/client/src/main/resources/textures/items/chick_magnet.png differ diff --git a/client/src/main/resources/textures/items/crimson_dye.png b/client/src/main/resources/textures/items/crimson_dye.png new file mode 100644 index 00000000..cbe0b072 Binary files /dev/null and b/client/src/main/resources/textures/items/crimson_dye.png differ diff --git a/client/src/main/resources/textures/items/cyan_dye.png b/client/src/main/resources/textures/items/cyan_dye.png index 924d399d..0e129a0c 100755 Binary files a/client/src/main/resources/textures/items/cyan_dye.png and b/client/src/main/resources/textures/items/cyan_dye.png differ diff --git a/client/src/main/resources/textures/items/dark_brown_dye.png b/client/src/main/resources/textures/items/dark_brown_dye.png new file mode 100644 index 00000000..b91aecf0 Binary files /dev/null and b/client/src/main/resources/textures/items/dark_brown_dye.png differ diff --git a/client/src/main/resources/textures/items/dark_gray_dye.png b/client/src/main/resources/textures/items/dark_gray_dye.png new file mode 100644 index 00000000..32fb35ca Binary files /dev/null and b/client/src/main/resources/textures/items/dark_gray_dye.png differ diff --git a/client/src/main/resources/textures/items/dark_green_dye.png b/client/src/main/resources/textures/items/dark_green_dye.png index eecd002c..319aace4 100755 Binary files a/client/src/main/resources/textures/items/dark_green_dye.png and b/client/src/main/resources/textures/items/dark_green_dye.png differ diff --git a/client/src/main/resources/textures/items/dark_magenta_dye.png b/client/src/main/resources/textures/items/dark_magenta_dye.png new file mode 100644 index 00000000..88863ba5 Binary files /dev/null and b/client/src/main/resources/textures/items/dark_magenta_dye.png differ diff --git a/client/src/main/resources/textures/items/dark_red_dye.png b/client/src/main/resources/textures/items/dark_red_dye.png new file mode 100644 index 00000000..3aaa1891 Binary files /dev/null and b/client/src/main/resources/textures/items/dark_red_dye.png differ diff --git a/client/src/main/resources/textures/items/dark_violet_dye.png b/client/src/main/resources/textures/items/dark_violet_dye.png new file mode 100644 index 00000000..3b3642ef Binary files /dev/null and b/client/src/main/resources/textures/items/dark_violet_dye.png differ diff --git a/client/src/main/resources/textures/items/demon_rod.png b/client/src/main/resources/textures/items/demon_rod.png index 1b3aa447..9c81e884 100755 Binary files a/client/src/main/resources/textures/items/demon_rod.png and b/client/src/main/resources/textures/items/demon_rod.png differ diff --git a/client/src/main/resources/textures/items/gray_dye.png b/client/src/main/resources/textures/items/gray_dye.png index 24921c82..8bebf8eb 100755 Binary files a/client/src/main/resources/textures/items/gray_dye.png and b/client/src/main/resources/textures/items/gray_dye.png differ diff --git a/client/src/main/resources/textures/items/green_dye.png b/client/src/main/resources/textures/items/green_dye.png index 1bc92269..d16de720 100755 Binary files a/client/src/main/resources/textures/items/green_dye.png and b/client/src/main/resources/textures/items/green_dye.png differ diff --git a/client/src/main/resources/textures/items/bonemeal.png b/client/src/main/resources/textures/items/grinded_bones.png similarity index 100% rename from client/src/main/resources/textures/items/bonemeal.png rename to client/src/main/resources/textures/items/grinded_bones.png diff --git a/client/src/main/resources/textures/items/light_blue_dye.png b/client/src/main/resources/textures/items/light_blue_dye.png index acf8b4b3..f4206fbe 100755 Binary files a/client/src/main/resources/textures/items/light_blue_dye.png and b/client/src/main/resources/textures/items/light_blue_dye.png differ diff --git a/client/src/main/resources/textures/items/light_brown_dye.png b/client/src/main/resources/textures/items/light_brown_dye.png new file mode 100644 index 00000000..93e5f81d Binary files /dev/null and b/client/src/main/resources/textures/items/light_brown_dye.png differ diff --git a/client/src/main/resources/textures/items/light_gray_dye.png b/client/src/main/resources/textures/items/light_gray_dye.png index a001151f..aab555f5 100755 Binary files a/client/src/main/resources/textures/items/light_gray_dye.png and b/client/src/main/resources/textures/items/light_gray_dye.png differ diff --git a/client/src/main/resources/textures/items/light_yellow_dye.png b/client/src/main/resources/textures/items/light_yellow_dye.png new file mode 100644 index 00000000..a5ace70c Binary files /dev/null and b/client/src/main/resources/textures/items/light_yellow_dye.png differ diff --git a/client/src/main/resources/textures/items/magenta_dye.png b/client/src/main/resources/textures/items/magenta_dye.png index 1a358245..00b604cf 100755 Binary files a/client/src/main/resources/textures/items/magenta_dye.png and b/client/src/main/resources/textures/items/magenta_dye.png differ diff --git a/client/src/main/resources/textures/items/magnet.png b/client/src/main/resources/textures/items/magnet.png index 77d99028..c5dee98e 100755 Binary files a/client/src/main/resources/textures/items/magnet.png and b/client/src/main/resources/textures/items/magnet.png differ diff --git a/client/src/main/resources/textures/items/midnight_dye.png b/client/src/main/resources/textures/items/midnight_dye.png new file mode 100644 index 00000000..10bf255b Binary files /dev/null and b/client/src/main/resources/textures/items/midnight_dye.png differ diff --git a/client/src/main/resources/textures/items/neon_dye.png b/client/src/main/resources/textures/items/neon_dye.png new file mode 100644 index 00000000..3e8c3f7b Binary files /dev/null and b/client/src/main/resources/textures/items/neon_dye.png differ diff --git a/client/src/main/resources/textures/items/orange_dye.png b/client/src/main/resources/textures/items/orange_dye.png index 82c6c1be..5b854c57 100755 Binary files a/client/src/main/resources/textures/items/orange_dye.png and b/client/src/main/resources/textures/items/orange_dye.png differ diff --git a/client/src/main/resources/textures/items/ork_green_dye.png b/client/src/main/resources/textures/items/ork_green_dye.png new file mode 100644 index 00000000..6b12458f Binary files /dev/null and b/client/src/main/resources/textures/items/ork_green_dye.png differ diff --git a/client/src/main/resources/textures/items/red_dye.png b/client/src/main/resources/textures/items/red_dye.png index 34a3b598..895148b4 100755 Binary files a/client/src/main/resources/textures/items/red_dye.png and b/client/src/main/resources/textures/items/red_dye.png differ diff --git a/client/src/main/resources/textures/items/violet_dye.png b/client/src/main/resources/textures/items/violet_dye.png index d8119ca3..006efe53 100755 Binary files a/client/src/main/resources/textures/items/violet_dye.png and b/client/src/main/resources/textures/items/violet_dye.png differ diff --git a/client/src/main/resources/textures/items/white_dye.png b/client/src/main/resources/textures/items/white_dye.png new file mode 100644 index 00000000..781ab339 Binary files /dev/null and b/client/src/main/resources/textures/items/white_dye.png differ diff --git a/client/src/main/resources/textures/items/yellow_dye.png b/client/src/main/resources/textures/items/yellow_dye.png index caf2c9f9..818e1c44 100755 Binary files a/client/src/main/resources/textures/items/yellow_dye.png and b/client/src/main/resources/textures/items/yellow_dye.png differ diff --git a/common/src/main/java/common/block/Block.java b/common/src/main/java/common/block/Block.java index dd472da4..634cb023 100755 --- a/common/src/main/java/common/block/Block.java +++ b/common/src/main/java/common/block/Block.java @@ -51,7 +51,7 @@ import common.util.Vec3; import common.util.HitPosition.ObjectType; import common.util.Pair; import common.util.Serverside; -import common.util.TextColor; +import common.util.Color; import common.vars.Vars; import common.world.Explosion; import common.world.IBlockAccess; @@ -1102,8 +1102,8 @@ public class Block { return this.getState(); } - public TextColor getItemColor() { - return this.radiation > 0.0f ? TextColor.GREEN : null; + public Color getItemColor() { + return this.radiation > 0.0f ? Color.GREEN : null; } @Clientside diff --git a/common/src/main/java/common/block/artificial/BlockBed.java b/common/src/main/java/common/block/artificial/BlockBed.java index 0e0f2b31..6b7563ce 100755 --- a/common/src/main/java/common/block/artificial/BlockBed.java +++ b/common/src/main/java/common/block/artificial/BlockBed.java @@ -19,7 +19,7 @@ import common.util.Clientside; import common.util.ExtMath; import common.util.Facing; import common.util.Identifyable; -import common.util.TextColor; +import common.util.Color; import common.util.WorldPos; import common.world.AWorldServer; import common.world.IWorldAccess; @@ -47,11 +47,11 @@ public class BlockBed extends Block implements Rotatable { public static final PropertyEnum PART = PropertyEnum.create("part", BlockBed.EnumPartType.class); - public static final TextColor[] COLORS = new TextColor[] {TextColor.RED, TextColor.WHITE, TextColor.BLACK, TextColor.VIOLET}; + public static final Color[] COLORS = new Color[] {Color.RED, Color.WHITE, Color.BLACK, Color.VIOLET}; - private final TextColor color; + private final Color color; - public BlockBed(TextColor color) { + public BlockBed(Color color) { super(Material.BURNABLE); this.color = color; this.setDefaultState(this.getBaseState().withProperty(PART, BlockBed.EnumPartType.FOOT)); @@ -73,7 +73,7 @@ public class BlockBed extends Block implements Rotatable { if(player.isEntityAlive() && Math.abs(player.posX - (double)pos.getX()) <= 3.0D && Math.abs(player.posY - (double)pos.getY()) <= 2.0D && Math.abs(player.posZ - (double)pos.getZ()) <= 3.0D) { player.setSpawnPoint(new WorldPos(pos, player.worldObj)); - player.connection.addHotbar(TextColor.DARK_GREEN + "Dein Einstiegspunkt wurde auf %s bei [%s, %s, %s] gesetzt", + player.connection.addHotbar(Color.DARK_GREEN + "Dein Einstiegspunkt wurde auf %s bei [%s, %s, %s] gesetzt", player.worldObj.dimension.getDisplay(), player.getSpawnPoint().getX(), player.getSpawnPoint().getY(), player.getSpawnPoint().getZ()); } diff --git a/common/src/main/java/common/block/artificial/BlockCarpet.java b/common/src/main/java/common/block/artificial/BlockCarpet.java index 219b78de..3235be33 100755 --- a/common/src/main/java/common/block/artificial/BlockCarpet.java +++ b/common/src/main/java/common/block/artificial/BlockCarpet.java @@ -7,7 +7,7 @@ import common.model.Model; import common.model.Model.ModelProvider; import common.util.BlockPos; import common.util.Facing; -import common.util.TextColor; +import common.util.Color; import common.world.AWorldServer; import common.world.IWorldAccess; import common.world.State; @@ -15,15 +15,15 @@ import common.world.World; public class BlockCarpet extends Block { - public static final BlockCarpet[] CARPETS = new BlockCarpet[TextColor.values().length]; + public static final BlockCarpet[] CARPETS = new BlockCarpet[Color.values().length]; - private final TextColor color; + private final Color color; - public static BlockCarpet getByColor(TextColor color) { + public static BlockCarpet getByColor(Color color) { return CARPETS[color.ordinal()]; } - public BlockCarpet(TextColor color) + public BlockCarpet(Color color) { super(Material.FLEECE); this.color = color; @@ -34,7 +34,7 @@ public class BlockCarpet extends Block CARPETS[color.ordinal()] = this; } - public TextColor getColor() { + public Color getColor() { return this.color; } diff --git a/common/src/main/java/common/block/artificial/BlockStainedGlass.java b/common/src/main/java/common/block/artificial/BlockStainedGlass.java index 6629abdb..534efbf2 100755 --- a/common/src/main/java/common/block/artificial/BlockStainedGlass.java +++ b/common/src/main/java/common/block/artificial/BlockStainedGlass.java @@ -1,22 +1,22 @@ package common.block.artificial; -import common.util.TextColor; +import common.util.Color; public class BlockStainedGlass extends BlockGlass { - public static final BlockStainedGlass[] GLASS = new BlockStainedGlass[TextColor.values().length]; + public static final BlockStainedGlass[] GLASS = new BlockStainedGlass[Color.values().length]; - private final TextColor color; + private final Color color; - public static BlockStainedGlass getByColor(TextColor color) { + public static BlockStainedGlass getByColor(Color color) { return GLASS[color.ordinal()]; } - public BlockStainedGlass(TextColor color) { + public BlockStainedGlass(Color color) { this.color = color; GLASS[color.ordinal()] = this; } - public TextColor getColor() { + public Color getColor() { return this.color; } } diff --git a/common/src/main/java/common/block/artificial/BlockStainedGlassPane.java b/common/src/main/java/common/block/artificial/BlockStainedGlassPane.java index e956a11f..79af4e33 100755 --- a/common/src/main/java/common/block/artificial/BlockStainedGlassPane.java +++ b/common/src/main/java/common/block/artificial/BlockStainedGlassPane.java @@ -3,19 +3,19 @@ package common.block.artificial; import common.block.Material; import common.item.CheatTab; import common.properties.Property; -import common.util.TextColor; +import common.util.Color; public class BlockStainedGlassPane extends BlockPane { - public static final BlockStainedGlassPane[] PANES = new BlockStainedGlassPane[TextColor.values().length]; + public static final BlockStainedGlassPane[] PANES = new BlockStainedGlassPane[Color.values().length]; - private final TextColor color; + private final Color color; - public static BlockStainedGlassPane getByColor(TextColor color) { + public static BlockStainedGlassPane getByColor(Color color) { return PANES[color.ordinal()]; } - public BlockStainedGlassPane(TextColor color) + public BlockStainedGlassPane(Color color) { super(Material.TRANSLUCENT); this.color = color; @@ -24,7 +24,7 @@ public class BlockStainedGlassPane extends BlockPane PANES[color.ordinal()] = this; } - public TextColor getColor() { + public Color getColor() { return this.color; } diff --git a/common/src/main/java/common/block/artificial/BlockWool.java b/common/src/main/java/common/block/artificial/BlockWool.java index 7ded23cb..14a04f59 100755 --- a/common/src/main/java/common/block/artificial/BlockWool.java +++ b/common/src/main/java/common/block/artificial/BlockWool.java @@ -5,19 +5,19 @@ import common.block.Material; import common.item.CheatTab; import common.model.Model; import common.model.Model.ModelProvider; -import common.util.TextColor; +import common.util.Color; import common.world.State; public class BlockWool extends Block { - public static final BlockWool[] WOOLS = new BlockWool[TextColor.values().length]; + public static final BlockWool[] WOOLS = new BlockWool[Color.values().length]; - private final TextColor color; + private final Color color; - public static BlockWool getByColor(TextColor color) { + public static BlockWool getByColor(Color color) { return WOOLS[color.ordinal()]; } - public BlockWool(TextColor color) { + public BlockWool(Color color) { super(Material.BURNABLE); this.color = color; this.setTab(CheatTab.BLOCKS); @@ -25,7 +25,7 @@ public class BlockWool extends Block { WOOLS[color.ordinal()] = this; } - public TextColor getColor() { + public Color getColor() { return this.color; } diff --git a/common/src/main/java/common/block/natural/BlockColoredClay.java b/common/src/main/java/common/block/natural/BlockColoredClay.java index fd9abd46..31e02ebb 100644 --- a/common/src/main/java/common/block/natural/BlockColoredClay.java +++ b/common/src/main/java/common/block/natural/BlockColoredClay.java @@ -5,26 +5,26 @@ import common.block.Material; import common.item.CheatTab; import common.model.Model; import common.model.Model.ModelProvider; -import common.util.TextColor; +import common.util.Color; import common.world.State; public class BlockColoredClay extends Block { - public static final BlockColoredClay[] CLAY = new BlockColoredClay[TextColor.values().length]; + public static final BlockColoredClay[] CLAY = new BlockColoredClay[Color.values().length]; - private final TextColor color; + private final Color color; - public static BlockColoredClay getByColor(TextColor color) { + public static BlockColoredClay getByColor(Color color) { return CLAY[color.ordinal()]; } - public BlockColoredClay(TextColor color) { + public BlockColoredClay(Color color) { super(Material.SOLID); this.color = color; this.setTab(CheatTab.ROCK); CLAY[color.ordinal()] = this; } - public TextColor getColor() { + public Color getColor() { return this.color; } diff --git a/common/src/main/java/common/block/tech/BlockChest.java b/common/src/main/java/common/block/tech/BlockChest.java index ac3df983..a1376c69 100755 --- a/common/src/main/java/common/block/tech/BlockChest.java +++ b/common/src/main/java/common/block/tech/BlockChest.java @@ -29,7 +29,7 @@ import common.tileentity.TileEntityChest; import common.util.BlockPos; import common.util.BoundingBox; import common.util.Facing; -import common.util.TextColor; +import common.util.Color; import common.vars.Vars; import common.world.State; import common.world.World; @@ -165,14 +165,14 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable if(chest.getLockCode() != null) { if(stack.hasDisplayName() && stack.getDisplayName().equals(chest.getLockCode())) { chest.setLockCode(null); - playerIn.connection.addHotbar(TextColor.BLUE + "%s wurde entriegelt", chest.getName()); + playerIn.connection.addHotbar(Color.BLUE + "%s wurde entriegelt", chest.getName()); playerIn.connection.sendPacket(new SPacketSoundEffect(SoundEvent.DOOR, playerIn.posX, playerIn.posY, playerIn.posZ, 1.0F)); return true; } } else if(stack.hasDisplayName() && !stack.getDisplayName().isEmpty()) { chest.setLockCode(stack.getDisplayName()); - playerIn.connection.addHotbar(TextColor.ORANGE + "%s wurde verriegelt", chest.getName()); + playerIn.connection.addHotbar(Color.ORANGE + "%s wurde verriegelt", chest.getName()); playerIn.connection.sendPacket(new SPacketSoundEffect(SoundEvent.DOOR, playerIn.posX, playerIn.posY, playerIn.posZ, 1.0F)); return true; } diff --git a/common/src/main/java/common/block/tech/BlockNuke.java b/common/src/main/java/common/block/tech/BlockNuke.java index 55b6aab5..d04abd41 100755 --- a/common/src/main/java/common/block/tech/BlockNuke.java +++ b/common/src/main/java/common/block/tech/BlockNuke.java @@ -9,7 +9,7 @@ import common.item.CheatTab; import common.model.Model; import common.model.Model.ModelProvider; import common.util.BlockPos; -import common.util.TextColor; +import common.util.Color; import common.world.Explosion; import common.world.State; import common.world.World; @@ -54,7 +54,7 @@ public class BlockNuke extends Block return provider.getModel("nuke_side").add().nswe().d("nuke_bottom").u("nuke_top"); } - public TextColor getItemColor() { - return TextColor.RED; + public Color getItemColor() { + return Color.RED; } } diff --git a/common/src/main/java/common/block/tech/BlockTNT.java b/common/src/main/java/common/block/tech/BlockTNT.java index 8cfd5029..96658e18 100755 --- a/common/src/main/java/common/block/tech/BlockTNT.java +++ b/common/src/main/java/common/block/tech/BlockTNT.java @@ -20,7 +20,7 @@ import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.ExtMath; import common.util.Facing; -import common.util.TextColor; +import common.util.Color; import common.util.Vec3; import common.world.AWorldServer; import common.world.Explosion; @@ -161,8 +161,8 @@ public class BlockTNT extends Block this.onBroken(world, pos, state.withProperty(BlockTNT.EXPLODE, Boolean.valueOf(true))); } - public TextColor getItemColor() { - return TextColor.RED; + public Color getItemColor() { + return Color.RED; } public boolean dispense(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { diff --git a/common/src/main/java/common/effect/Effect.java b/common/src/main/java/common/effect/Effect.java index 74da2616..52587e46 100755 --- a/common/src/main/java/common/effect/Effect.java +++ b/common/src/main/java/common/effect/Effect.java @@ -7,18 +7,18 @@ import common.entity.npc.EntityNPC; import common.entity.projectile.EntityPotion; import common.entity.types.EntityLiving; import common.item.ItemStack; -import common.util.TextColor; +import common.util.Color; import common.vars.Vars; public enum Effect { SPEED("speed", 2, 180, "Schnelligkeit", "Trank der Schnelligkeit", false, 8171462) { public String getTooltip(int amp) { - return String.format(TextColor.BLUE + "+%d%% Geschwindigkeit", 20 * (amp + 1)); + return String.format(Color.BLUE + "+%d%% Geschwindigkeit", 20 * (amp + 1)); } }, SLOWNESS("slowness", 1, 90, "Langsamkeit", "Trank der Langsamkeit", true, 5926017) { public String getTooltip(int amp) { - return String.format(TextColor.RED + "-%d%% Geschwindigkeit", 15 * (amp + 1)); + return String.format(Color.RED + "-%d%% Geschwindigkeit", 15 * (amp + 1)); } }, HASTE("haste", "Eile", "Trank der Eile", false, 14270531) { @@ -29,7 +29,7 @@ public enum Effect { FATIGUE("mining_fatigue", "Abbaulähmung", "Trank der Trägheit", true, 4866583), STRENGTH("strength", 2, 180, "Stärke", "Trank der Stärke", false, 9643043) { public String getTooltip(int amp) { - return String.format(TextColor.BLUE + "+%d%% Angriffsschaden", 50 * (amp + 1)); + return String.format(Color.BLUE + "+%d%% Angriffsschaden", 50 * (amp + 1)); } }, HEAL("health", 2, "Direktheilung", "Trank der Heilung", false, 16262179) { @@ -110,7 +110,7 @@ public enum Effect { STABILITY("stability", 1, 180, "Stabilität", "Trank der Standfestigkeit", false, 5797459), WEAKNESS("weakness", 1, 90, "Schwäche", "Trank der Schwäche", true, 4738376) { public String getTooltip(int amp) { - return String.format(TextColor.RED + "-%d%% Angriffsschaden", 20 * (amp + 1)); + return String.format(Color.RED + "-%d%% Angriffsschaden", 20 * (amp + 1)); } }, POISON("poison", 2, 45, "Vergiftung", "Trank der Vergiftung", true, 5149489) { diff --git a/common/src/main/java/common/entity/DamageSource.java b/common/src/main/java/common/entity/DamageSource.java index 3fb2052a..4b1769e3 100755 --- a/common/src/main/java/common/entity/DamageSource.java +++ b/common/src/main/java/common/entity/DamageSource.java @@ -2,44 +2,44 @@ package common.entity; import common.entity.projectile.EntityProjectile; import common.entity.types.EntityLiving; -import common.util.TextColor; +import common.util.Color; import common.world.Explosion; public class DamageSource { public static final DamageSource inFire = - (new DamageSource(TextColor.ORANGE, "%s ging in Flammen auf", "%s lief ins Feuer, während er mit %s kämpfte", "%s ins Feuer gelaufen")).setFireDamage(); + (new DamageSource(Color.ORANGE, "%s ging in Flammen auf", "%s lief ins Feuer, während er mit %s kämpfte", "%s ins Feuer gelaufen")).setFireDamage(); public static final DamageSource onFire = - (new DamageSource(TextColor.ORANGE, "%s wurde zu heiß und verbrannte", "%s wurde während des Kampfes mit %s geröstet", "%s geröstet")).setDamageBypassesArmor().setFireDamage(); + (new DamageSource(Color.ORANGE, "%s wurde zu heiß und verbrannte", "%s wurde während des Kampfes mit %s geröstet", "%s geröstet")).setDamageBypassesArmor().setFireDamage(); public static final DamageSource hotLiquid = - (new DamageSource(TextColor.ORANGE, "%s versuchte in einer unangenehm brennenden Flüssigkeit zu schwimmen", "%s fiel beim Versuch %s zu entkommen in eine unangenehm brennende Flüssigkeit", "%s in unangenehm brennender Flüssigkeit gelandet")).setFireDamage(); + (new DamageSource(Color.ORANGE, "%s versuchte in einer unangenehm brennenden Flüssigkeit zu schwimmen", "%s fiel beim Versuch %s zu entkommen in eine unangenehm brennende Flüssigkeit", "%s in unangenehm brennender Flüssigkeit gelandet")).setFireDamage(); public static final DamageSource molten = - (new DamageSource(TextColor.ORANGE, "%s versuchte dem Magmaregen zu trotzen", "%s geriet beim Versuch %s zu entkommen in Magmaregen", "%s in Magmaregen geraten")).setFireDamage(); + (new DamageSource(Color.ORANGE, "%s versuchte dem Magmaregen zu trotzen", "%s geriet beim Versuch %s zu entkommen in Magmaregen", "%s in Magmaregen geraten")).setFireDamage(); public static final DamageSource inWall = - (new DamageSource(TextColor.GRAY, "%s wurde lebendig begraben")).setDamageBypassesArmor(); + (new DamageSource(Color.GRAY, "%s wurde lebendig begraben")).setDamageBypassesArmor(); public static final DamageSource dry = - (new DamageSource(TextColor.GRAY, "%s ist vertrocknet", "%s ist beim Versuch %s zu entkommen vertrocknet", "%s vertrocknet")).setDamageBypassesArmor(); + (new DamageSource(Color.GRAY, "%s ist vertrocknet", "%s ist beim Versuch %s zu entkommen vertrocknet", "%s vertrocknet")).setDamageBypassesArmor(); public static final DamageSource cactus = - new DamageSource(TextColor.ORK, "%s wurde zu Tode gestochen", "%s rannte beim Versuch %s zu entkommen in einen Kaktus", "%s in Kaktus gerannt"); + new DamageSource(Color.ORK, "%s wurde zu Tode gestochen", "%s rannte beim Versuch %s zu entkommen in einen Kaktus", "%s in Kaktus gerannt"); public static final DamageSource fall = - (new DamageSource(TextColor.NEON, "%s fiel der Schwerkraft zum Opfer")).setDamageBypassesArmor(); + (new DamageSource(Color.NEON, "%s fiel der Schwerkraft zum Opfer")).setDamageBypassesArmor(); public static final DamageSource outOfWorld = - (new DamageSource(TextColor.DARK_GRAY, "%s fiel aus der Welt")).setDamageBypassesArmor(); + (new DamageSource(Color.DARK_GRAY, "%s fiel aus der Welt")).setDamageBypassesArmor(); public static final DamageSource generic = - (new DamageSource(TextColor.LIGHT_GRAY, "%s starb")).setDamageBypassesArmor(); + (new DamageSource(Color.LIGHT_GRAY, "%s starb")).setDamageBypassesArmor(); public static final DamageSource magic = - (new DamageSource(TextColor.DARK_MAGENTA, "%s wurde durch Magie getötet")).setDamageBypassesArmor().setMagicDamage(); + (new DamageSource(Color.DARK_MAGENTA, "%s wurde durch Magie getötet")).setDamageBypassesArmor().setMagicDamage(); public static final DamageSource anvil = - new DamageSource(TextColor.DARK_RED, "%s wurde von einem fallenden Amboss zerquetscht"); + new DamageSource(Color.DARK_RED, "%s wurde von einem fallenden Amboss zerquetscht"); public static final DamageSource fallingBlock = - new DamageSource(TextColor.GRAY, "%s wurde von einem fallenden Block zerquetscht"); + new DamageSource(Color.GRAY, "%s wurde von einem fallenden Block zerquetscht"); public static final DamageSource radiation = - (new DamageSource(TextColor.GREEN, "%s hat seine Halbwertszeit nicht rechtzeitig erreicht")).setDamageBypassesArmor(); + (new DamageSource(Color.GREEN, "%s hat seine Halbwertszeit nicht rechtzeitig erreicht")).setDamageBypassesArmor(); protected final String display; protected final String displayExtra; protected final String displayKill; - protected final TextColor color; + protected final Color color; private boolean isUnblockable; private boolean fireDamage; @@ -49,57 +49,57 @@ public class DamageSource public static DamageSource causeMobDamage(EntityLiving mob) { - return new EntityDamageSource(TextColor.CRIMSON, "%s wurde von %s erschlagen", "%s wurde von %s mit %s erschlagen", + return new EntityDamageSource(Color.CRIMSON, "%s wurde von %s erschlagen", "%s wurde von %s mit %s erschlagen", "%s erschlagen", "%s mit %s erschlagen", mob); } public static DamageSource causeLightningDamage(EntityLiving mob) { - return mob == null ? new DamageSource(TextColor.YELLOW, "%s wurde vom Blitz getroffen und gegrillt") : - new EntityDamageSource(TextColor.YELLOW, "%s wurde von %s gegrillt", "%s wurde von %s mit %s gegrillt", + return mob == null ? new DamageSource(Color.YELLOW, "%s wurde vom Blitz getroffen und gegrillt") : + new EntityDamageSource(Color.YELLOW, "%s wurde von %s gegrillt", "%s wurde von %s mit %s gegrillt", "%s gegrillt", "%s mit %s gegrillt", mob); } public static DamageSource causeExterminatusDamage(EntityLiving mob) { - return mob == null ? new DamageSource(TextColor.DARK_RED, "%s wurde vernichtet") : - new EntityDamageSource(TextColor.DARK_RED, "%s wurde von %s vernichtet", "%s wurde von %s mit %s vernichtet", + return mob == null ? new DamageSource(Color.DARK_RED, "%s wurde vernichtet") : + new EntityDamageSource(Color.DARK_RED, "%s wurde von %s vernichtet", "%s wurde von %s mit %s vernichtet", "%s vernichtet", "%s mit %s vernichtet", mob); } public static DamageSource causeShotDamage(Entity projectile, Entity shooter) { - return (new EntityDamageSourceIndirect(TextColor.RED, "%s wurde von %s erschossen", "%s wurde von %s mit %s erschossen", "%s erschossen", "%s mit %s erschossen", projectile, shooter)).setProjectile(); + return (new EntityDamageSourceIndirect(Color.RED, "%s wurde von %s erschossen", "%s wurde von %s mit %s erschossen", "%s erschossen", "%s mit %s erschossen", projectile, shooter)).setProjectile(); } public static DamageSource causeFireballDamage(EntityProjectile fireball, Entity shooter) { - return shooter == null ? (new EntityDamageSourceIndirect(TextColor.YELLOW, "%s wurde von %s flambiert", fireball)).setFireDamage().setProjectile() : (new EntityDamageSourceIndirect(TextColor.YELLOW, "%s wurde von %s flambiert", "%s wurde von %s mit %s flambiert", "%s flambiert", "%s mit %s flambiert", fireball, shooter)).setFireDamage().setProjectile(); + return shooter == null ? (new EntityDamageSourceIndirect(Color.YELLOW, "%s wurde von %s flambiert", fireball)).setFireDamage().setProjectile() : (new EntityDamageSourceIndirect(Color.YELLOW, "%s wurde von %s flambiert", "%s wurde von %s mit %s flambiert", "%s flambiert", "%s mit %s flambiert", fireball, shooter)).setFireDamage().setProjectile(); } public static DamageSource causeThrownDamage(Entity source, Entity thrower) { - return (new EntityDamageSourceIndirect(TextColor.DARK_GREEN, "%s wurde von %s zu Tode geprügelt", "%s wurde von %s mit %s zu Tode geprügelt", "%s zu Tode geprügelt", "%s mit %s zu Tode geprügelt", source, thrower)).setProjectile(); + return (new EntityDamageSourceIndirect(Color.DARK_GREEN, "%s wurde von %s zu Tode geprügelt", "%s wurde von %s mit %s zu Tode geprügelt", "%s zu Tode geprügelt", "%s mit %s zu Tode geprügelt", source, thrower)).setProjectile(); } public static DamageSource causeTeleFragDamage(Entity source, Entity replacer) { - return (new EntityDamageSourceIndirect(TextColor.MAGENTA, "%s wurde von %s verdrängt", "%s wurde von %s mit %s verdrängt", "%s verdrängt", "%s mit %s verdrängt", source, replacer)).setDamageBypassesArmor(); + return (new EntityDamageSourceIndirect(Color.MAGENTA, "%s wurde von %s verdrängt", "%s wurde von %s mit %s verdrängt", "%s verdrängt", "%s mit %s verdrängt", source, replacer)).setDamageBypassesArmor(); } public static DamageSource causeIndirectMagicDamage(Entity source, Entity mage) { - return (new EntityDamageSourceIndirect(TextColor.DARK_MAGENTA, "%s wurde von %s mit Magie getötet", "%s wurde von %s mit %s getötet", "%s mit Magie getötet", "%s mit %s getötet", source, mage)).setDamageBypassesArmor().setMagicDamage(); + return (new EntityDamageSourceIndirect(Color.DARK_MAGENTA, "%s wurde von %s mit Magie getötet", "%s wurde von %s mit %s getötet", "%s mit Magie getötet", "%s mit %s getötet", source, mage)).setDamageBypassesArmor().setMagicDamage(); } public static DamageSource causeThornsDamage(Entity source) { - return (new EntityDamageSource(TextColor.ORK, "%s wurde beim Versuch %s zu verletzen getötet", "%s durch Dornen getötet", source)).setIsThornsDamage().setMagicDamage(); + return (new EntityDamageSource(Color.ORK, "%s wurde beim Versuch %s zu verletzen getötet", "%s durch Dornen getötet", source)).setIsThornsDamage().setMagicDamage(); } public static DamageSource causeExplosionDamage(Explosion explosion) { - return explosion != null && explosion.getExplosivePlacedBy() != null ? (new EntityDamageSource(TextColor.YELLOW, "%s wurde durch %s in die Luft gesprengt", "%s in die Luft gesprengt", explosion.getExplosivePlacedBy())).setExplosion() : (new DamageSource(TextColor.YELLOW, "%s wurde in die Luft gesprengt")).setExplosion(); + return explosion != null && explosion.getExplosivePlacedBy() != null ? (new EntityDamageSource(Color.YELLOW, "%s wurde durch %s in die Luft gesprengt", "%s in die Luft gesprengt", explosion.getExplosivePlacedBy())).setExplosion() : (new DamageSource(Color.YELLOW, "%s wurde in die Luft gesprengt")).setExplosion(); } /** @@ -135,7 +135,7 @@ public class DamageSource return this.isUnblockable; } - protected DamageSource(TextColor color, String display, String extra, String kill) + protected DamageSource(Color color, String display, String extra, String kill) { this.color = color; this.display = this.color + display; @@ -143,7 +143,7 @@ public class DamageSource this.displayKill = this.color + "* " + kill; } - protected DamageSource(TextColor color, String display) + protected DamageSource(Color color, String display) { this(color, display, display, ""); } diff --git a/common/src/main/java/common/entity/Entity.java b/common/src/main/java/common/entity/Entity.java index 7f316f67..8c069d92 100755 --- a/common/src/main/java/common/entity/Entity.java +++ b/common/src/main/java/common/entity/Entity.java @@ -37,7 +37,7 @@ import common.util.ParticleType; import common.util.PortalType; import common.util.Position; import common.util.Serverside; -import common.util.TextColor; +import common.util.Color; import common.util.Vec3; import common.vars.Vars; import common.world.Explosion; @@ -2410,12 +2410,12 @@ public abstract class Entity public final String getCommandName() { - return TextColor.stripCodes(this.getName()); + return Color.stripCodes(this.getName()); } - public final String getColoredName(TextColor reset) + public final String getColoredName(Color reset) { - return TextColor.DARK_GRAY + "[" + this.getName() + TextColor.DARK_GRAY + "]" + reset; + return Color.DARK_GRAY + "[" + this.getName() + Color.DARK_GRAY + "]" + reset; } // public Text formatComponent(Text comp) { diff --git a/common/src/main/java/common/entity/EntityDamageSource.java b/common/src/main/java/common/entity/EntityDamageSource.java index 77f85c89..8b5b7bfc 100755 --- a/common/src/main/java/common/entity/EntityDamageSource.java +++ b/common/src/main/java/common/entity/EntityDamageSource.java @@ -2,7 +2,7 @@ package common.entity; import common.entity.types.EntityLiving; import common.item.ItemStack; -import common.util.TextColor; +import common.util.Color; public class EntityDamageSource extends DamageSource { @@ -14,14 +14,14 @@ public class EntityDamageSource extends DamageSource */ private boolean isThornsDamage = false; - public EntityDamageSource(TextColor color, String display, String item, String kill, String killItem, Entity damageSourceEntityIn) + public EntityDamageSource(Color color, String display, String item, String kill, String killItem, Entity damageSourceEntityIn) { super(color, display, item, kill); this.damageSourceEntity = damageSourceEntityIn; this.displayKillItem = killItem; } - public EntityDamageSource(TextColor color, String display, String kill, Entity damageSourceEntityIn) + public EntityDamageSource(Color color, String display, String kill, Entity damageSourceEntityIn) { this(color, display, display, kill, kill, damageSourceEntityIn); } diff --git a/common/src/main/java/common/entity/EntityDamageSourceIndirect.java b/common/src/main/java/common/entity/EntityDamageSourceIndirect.java index eff37f09..bc718cc2 100755 --- a/common/src/main/java/common/entity/EntityDamageSourceIndirect.java +++ b/common/src/main/java/common/entity/EntityDamageSourceIndirect.java @@ -2,19 +2,19 @@ package common.entity; import common.entity.types.EntityLiving; import common.item.ItemStack; -import common.util.TextColor; +import common.util.Color; public class EntityDamageSourceIndirect extends EntityDamageSource { private Entity indirectEntity; - public EntityDamageSourceIndirect(TextColor color, String display, String item, String kill, String killItem, Entity source, Entity indirectEntityIn) + public EntityDamageSourceIndirect(Color color, String display, String item, String kill, String killItem, Entity source, Entity indirectEntityIn) { super(color, display, item, kill, killItem, source); this.indirectEntity = indirectEntityIn; } - public EntityDamageSourceIndirect(TextColor color, String display, Entity source) + public EntityDamageSourceIndirect(Color color, String display, Entity source) { this(color, display, display, "", "", source, source); } diff --git a/common/src/main/java/common/entity/animal/EntitySheep.java b/common/src/main/java/common/entity/animal/EntitySheep.java index f27580e5..127dffca 100755 --- a/common/src/main/java/common/entity/animal/EntitySheep.java +++ b/common/src/main/java/common/entity/animal/EntitySheep.java @@ -29,7 +29,7 @@ import common.rng.Random; import common.tags.TagObject; import common.util.Clientside; import common.util.ExtMath; -import common.util.TextColor; +import common.util.Color; import common.world.World; public class EntitySheep extends EntityAnimal @@ -100,7 +100,7 @@ public class EntitySheep extends EntityAnimal { super.entityInit(); this.dataWatcher.addObject(16, (byte)0); - this.dataWatcher.addObject(17, (byte)(TextColor.WHITE.ordinal() & 255)); + this.dataWatcher.addObject(17, (byte)(Color.WHITE.ordinal() & 255)); } /** @@ -209,7 +209,7 @@ public class EntitySheep extends EntityAnimal { super.readEntity(tagCompund); this.setSheared(tagCompund.getBool("Sheared")); - this.setFleeceColor(TextColor.byName(tagCompund.getString("Color"))); + this.setFleeceColor(Color.byName(tagCompund.getString("Color"))); } /** @@ -244,15 +244,15 @@ public class EntitySheep extends EntityAnimal /** * Gets the wool color of this sheep. */ - public TextColor getFleeceColor() + public Color getFleeceColor() { - return TextColor.values()[(this.dataWatcher.getWatchableObjectByte(17) & 255) % TextColor.values().length]; + return Color.values()[(this.dataWatcher.getWatchableObjectByte(17) & 255) % Color.values().length]; } /** * Sets the wool color of this sheep */ - public void setFleeceColor(TextColor color) + public void setFleeceColor(Color color) { this.dataWatcher.updateObject(17, (byte)(color.ordinal() & 255)); } @@ -273,23 +273,23 @@ public class EntitySheep extends EntityAnimal this.dataWatcher.updateObject(16, (byte)(sheared ? 1 : 0)); } - private static final TextColor[] RARE_COLORS = { - TextColor.BLUE, TextColor.CYAN, TextColor.DARK_GREEN, TextColor.LIGHT_BLUE, TextColor.GREEN, - TextColor.MAGENTA, TextColor.ORANGE, TextColor.DARK_VIOLET, TextColor.VIOLET, TextColor.RED + private static final Color[] RARE_COLORS = { + Color.BLUE, Color.CYAN, Color.DARK_GREEN, Color.LIGHT_BLUE, Color.GREEN, + Color.MAGENTA, Color.ORANGE, Color.DARK_VIOLET, Color.VIOLET, Color.RED }; - public static TextColor getRandomSheepColor(Random random, float temp) + public static Color getRandomSheepColor(Random random, float temp) { if(temp <= 0.0f) - return TextColor.WHITE; + return Color.WHITE; int i = random.zrange(140); - return i < 20 ? TextColor.BLACK : - (i < 30 ? TextColor.GRAY : - (i < 40 ? TextColor.LIGHT_GRAY : - (i < 70 ? TextColor.BROWN : - (i < 120 ? TextColor.WHITE : - (i < 130 ? (random.chance(10) ? RARE_COLORS[i - 120] : TextColor.WHITE) : - (random.chance(500) ? TextColor.YELLOW : TextColor.WHITE) + return i < 20 ? Color.BLACK : + (i < 30 ? Color.GRAY : + (i < 40 ? Color.LIGHT_GRAY : + (i < 70 ? Color.BROWN : + (i < 120 ? Color.WHITE : + (i < 130 ? (random.chance(10) ? RARE_COLORS[i - 120] : Color.WHITE) : + (random.chance(500) ? Color.YELLOW : Color.WHITE) ))))); } @@ -322,14 +322,14 @@ public class EntitySheep extends EntityAnimal return livingdata; } - private TextColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother) + private Color getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother) { - TextColor i = ((EntitySheep)father).getFleeceColor(); - TextColor j = ((EntitySheep)mother).getFleeceColor(); + Color i = ((EntitySheep)father).getFleeceColor(); + Color j = ((EntitySheep)mother).getFleeceColor(); this.inventoryCrafting.setInventorySlotContents(0, new ItemStack(ItemDye.getByColor(i))); this.inventoryCrafting.setInventorySlotContents(1, new ItemStack(ItemDye.getByColor(j))); ItemStack itemstack = CraftingRegistry.getMatching(this.inventoryCrafting); - TextColor k; + Color k; if (itemstack != null && itemstack.getItem() instanceof ItemDye dye) { diff --git a/common/src/main/java/common/entity/animal/EntityWolf.java b/common/src/main/java/common/entity/animal/EntityWolf.java index a2fdde7f..bfc20a18 100755 --- a/common/src/main/java/common/entity/animal/EntityWolf.java +++ b/common/src/main/java/common/entity/animal/EntityWolf.java @@ -33,7 +33,7 @@ import common.tags.TagObject; import common.util.Clientside; import common.util.ExtMath; import common.util.ParticleType; -import common.util.TextColor; +import common.util.Color; import common.vars.Vars; import common.world.World; @@ -118,7 +118,7 @@ public class EntityWolf extends EntityTameable super.entityInit(); this.dataWatcher.addObject(18, this.getHealth()); this.dataWatcher.addObject(19, (byte)0); - this.dataWatcher.addObject(20, (byte)(TextColor.RED.ordinal() & 255)); + this.dataWatcher.addObject(20, (byte)(Color.RED.ordinal() & 255)); } // protected void playStepSound(BlockPos pos, Block blockIn) @@ -137,7 +137,7 @@ public class EntityWolf extends EntityTameable { super.readEntity(tagCompund); this.setAngry(tagCompund.getBool("Angry")); - this.setCollarColor(TextColor.byName(tagCompund.getString("CollarColor"))); + this.setCollarColor(Color.byName(tagCompund.getString("CollarColor"))); } /** @@ -373,7 +373,7 @@ public class EntityWolf extends EntityTameable } else if (itemstack.getItem() instanceof ItemDye dye) { - TextColor enumdyecolor = dye.getColor(); + Color enumdyecolor = dye.getColor(); if (enumdyecolor != this.getCollarColor()) { @@ -492,12 +492,12 @@ public class EntityWolf extends EntityTameable } } - public TextColor getCollarColor() + public Color getCollarColor() { - return TextColor.values()[(this.dataWatcher.getWatchableObjectByte(20) & 255) % TextColor.values().length]; + return Color.values()[(this.dataWatcher.getWatchableObjectByte(20) & 255) % Color.values().length]; } - public void setCollarColor(TextColor collarcolor) + public void setCollarColor(Color collarcolor) { this.dataWatcher.updateObject(20, (byte)(collarcolor.ordinal() & 255)); } diff --git a/common/src/main/java/common/entity/item/EntityItem.java b/common/src/main/java/common/entity/item/EntityItem.java index 1180dc0e..5c54ace3 100755 --- a/common/src/main/java/common/entity/item/EntityItem.java +++ b/common/src/main/java/common/entity/item/EntityItem.java @@ -18,7 +18,7 @@ import common.util.BlockPos; import common.util.ExtMath; import common.util.ParticleType; import common.util.PortalType; -import common.util.TextColor; +import common.util.Color; import common.vars.Vars; import common.world.World; import common.world.AWorldServer; @@ -599,7 +599,7 @@ public class EntityItem extends Entity ItemStack stack = this.getEntityItem(); if(!stack.isStacked()) return null; - return TextColor.DARK_GREEN + "" + stack.getSize(); + return Color.DARK_GREEN + "" + stack.getSize(); } public EntityType getType() { diff --git a/common/src/main/java/common/entity/item/EntityXp.java b/common/src/main/java/common/entity/item/EntityXp.java index 781879e8..df2111c0 100755 --- a/common/src/main/java/common/entity/item/EntityXp.java +++ b/common/src/main/java/common/entity/item/EntityXp.java @@ -14,7 +14,7 @@ import common.util.Clientside; import common.util.ExtMath; import common.util.ParticleType; import common.util.PortalType; -import common.util.TextColor; +import common.util.Color; import common.vars.Vars; import common.world.World; @@ -396,7 +396,7 @@ public class EntityXp extends Entity implements IObjectData // if(!this.hasCustomName()) { // return super.getDisplayName(); // } - return this.hasCustomName() ? TextColor.GREEN + this.getCustomNameTag() : null; + return this.hasCustomName() ? Color.GREEN + this.getCustomNameTag() : null; } public EntityType getType() { diff --git a/common/src/main/java/common/entity/npc/Alignment.java b/common/src/main/java/common/entity/npc/Alignment.java index 5c2ca4fd..e3882f60 100755 --- a/common/src/main/java/common/entity/npc/Alignment.java +++ b/common/src/main/java/common/entity/npc/Alignment.java @@ -3,18 +3,18 @@ package common.entity.npc; import java.util.Map; import common.collect.Maps; -import common.util.TextColor; +import common.util.Color; public enum Alignment { - LAWFUL_GOOD("lgood", "Rechtsch. gut", 1, 1, TextColor.NEON), - GOOD("good", "Gut", 0, 1, TextColor.BLUE), - CHAOTIC_GOOD("cgood", "Chaotisch gut", -1, 1, TextColor.CYAN), - LAWFUL("lawful", "Rechtschaffen", 1, 0, TextColor.WHITE), - NEUTRAL("neutral", "Neutral", 0, 0, TextColor.LIGHT_GRAY), - CHAOTIC("chaotic", "Chaotisch", -1, 0, TextColor.GRAY), - LAWFUL_EVIL("levil", "Rechtsch. böse", 1, -1, TextColor.ORANGE), - EVIL("evil", "Böse", 0, -1, TextColor.RED), - CHAOTIC_EVIL("cevil", "Chaotisch böse", -1, -1, TextColor.DARK_RED); + LAWFUL_GOOD("lgood", "Rechtsch. gut", 1, 1, Color.NEON), + GOOD("good", "Gut", 0, 1, Color.BLUE), + CHAOTIC_GOOD("cgood", "Chaotisch gut", -1, 1, Color.CYAN), + LAWFUL("lawful", "Rechtschaffen", 1, 0, Color.WHITE), + NEUTRAL("neutral", "Neutral", 0, 0, Color.LIGHT_GRAY), + CHAOTIC("chaotic", "Chaotisch", -1, 0, Color.GRAY), + LAWFUL_EVIL("levil", "Rechtsch. böse", 1, -1, Color.ORANGE), + EVIL("evil", "Böse", 0, -1, Color.RED), + CHAOTIC_EVIL("cevil", "Chaotisch böse", -1, -1, Color.DARK_RED); private static final Map LOOKUP = Maps.newHashMap(); @@ -22,12 +22,12 @@ public enum Alignment { public final boolean chaotic; public final boolean good; public final boolean evil; - public final TextColor color; + public final Color color; public final String name; public final String prefix; public final String display; - private Alignment(String name, String display, int temper, int morale, TextColor color) { + private Alignment(String name, String display, int temper, int morale, Color color) { this.lawful = temper == 1; this.chaotic = temper == -1; this.good = morale == 1; @@ -35,10 +35,10 @@ public enum Alignment { this.color = color; this.name = name; this.display = display; - this.prefix = TextColor.GRAY + "[" + (temper == 0 && morale == 0 ? TextColor.LIGHT_GRAY + "~" : "") + - (this.good ? TextColor.BLUE + "*" : (this.evil ? TextColor.RED + "!" : "")) + - (this.lawful ? TextColor.GREEN + "+" : (this.chaotic ? TextColor.DARK_MAGENTA + "-" : "")) + - TextColor.GRAY + "]"; + this.prefix = Color.GRAY + "[" + (temper == 0 && morale == 0 ? Color.LIGHT_GRAY + "~" : "") + + (this.good ? Color.BLUE + "*" : (this.evil ? Color.RED + "!" : "")) + + (this.lawful ? Color.GREEN + "+" : (this.chaotic ? Color.DARK_MAGENTA + "-" : "")) + + Color.GRAY + "]"; } public static Alignment getByName(String name) { diff --git a/common/src/main/java/common/entity/npc/EntityNPC.java b/common/src/main/java/common/entity/npc/EntityNPC.java index 0e34d45a..37f8ffd7 100755 --- a/common/src/main/java/common/entity/npc/EntityNPC.java +++ b/common/src/main/java/common/entity/npc/EntityNPC.java @@ -92,7 +92,7 @@ import common.util.ExtMath; import common.util.Facing; import common.util.ParticleType; import common.util.PortalType; -import common.util.TextColor; +import common.util.Color; import common.util.Vec3; import common.util.WorldPos; import common.vars.Vars; @@ -1139,7 +1139,7 @@ public abstract class EntityNPC extends EntityLiving } public String formatStats() { - return super.formatStats() + (this.getManaPoints() == 0 ? "" : TextColor.GRAY + " [" + TextColor.MIDNIGHT + this.getManaPoints() + TextColor.GRAY + "]"); + return super.formatStats() + (this.getManaPoints() == 0 ? "" : Color.GRAY + " [" + Color.MIDNIGHT + this.getManaPoints() + Color.GRAY + "]"); } public MerchantRecipeList getTrades(EntityNPC player) { diff --git a/common/src/main/java/common/entity/types/EntityLiving.java b/common/src/main/java/common/entity/types/EntityLiving.java index 38746573..7035d3e6 100755 --- a/common/src/main/java/common/entity/types/EntityLiving.java +++ b/common/src/main/java/common/entity/types/EntityLiving.java @@ -57,7 +57,7 @@ import common.util.Clientside; import common.util.ExtMath; import common.util.ParticleType; import common.util.Serverside; -import common.util.TextColor; +import common.util.Color; import common.util.Vec3; import common.vars.Vars; import common.world.State; @@ -2243,15 +2243,15 @@ public abstract class EntityLiving extends Entity this.effectsDirty = true; } - public static TextColor getHealthColor(int health, int max) { + public static Color getHealthColor(int health, int max) { float perc = (float)health / (float)max; - return /* health <= 1.0f ? ChatFormat.DARK_RED : ( */ perc >= 1.0f ? TextColor.DARK_GREEN : (perc >= 0.75f ? TextColor.GREEN : - (perc >= 0.5f ? TextColor.YELLOW : (perc >= 0.25f ? TextColor.ORANGE : (perc >= 0.1f ? TextColor.RED : TextColor.DARK_RED)))); + return /* health <= 1.0f ? ChatFormat.DARK_RED : ( */ perc >= 1.0f ? Color.DARK_GREEN : (perc >= 0.75f ? Color.GREEN : + (perc >= 0.5f ? Color.YELLOW : (perc >= 0.25f ? Color.ORANGE : (perc >= 0.1f ? Color.RED : Color.DARK_RED)))); } - public static TextColor getMaxHpColor(int max) { - return max >= 2000 ? TextColor.BLACK : (max >= 500 ? TextColor.DARK_MAGENTA : (max >= 120 ? TextColor.MAGENTA : - (max >= 40 ? TextColor.CYAN : (max >= 15 ? TextColor.NEON : (max >= 5 ? TextColor.BLUE : TextColor.LIGHT_GRAY))))); + public static Color getMaxHpColor(int max) { + return max >= 2000 ? Color.BLACK : (max >= 500 ? Color.DARK_MAGENTA : (max >= 120 ? Color.MAGENTA : + (max >= 40 ? Color.CYAN : (max >= 15 ? Color.NEON : (max >= 5 ? Color.BLUE : Color.LIGHT_GRAY))))); } public int getEnergy(Energy type) { @@ -2272,7 +2272,7 @@ public abstract class EntityLiving extends Entity public String formatStats() { return String.format(this.getAlignment().prefix + " " + getHealthColor(this.getHealth(), this.getMaxHealth()) + "%d" + - TextColor.GRAY + "/" + getMaxHpColor(this.getMaxHealth()) + "%d", + Color.GRAY + "/" + getMaxHpColor(this.getMaxHealth()) + "%d", this.getHealth(), this.getMaxHealth()); } @@ -2327,7 +2327,7 @@ public abstract class EntityLiving extends Entity String kill; IPlayer receiver = null; if(this.combat.size() == 0) { - msg = kill = natural ? String.format("%s starb", this.getColoredName(TextColor.LIGHT_GRAY)) : null; + msg = kill = natural ? String.format("%s starb", this.getColoredName(Color.LIGHT_GRAY)) : null; } else { CombatEntry strong = null; @@ -2366,16 +2366,16 @@ public abstract class EntityLiving extends Entity ItemStack fallItem = fallEnt instanceof EntityLiving ? ((EntityLiving)fallEnt).getHeldItem() : null; receiver = fallEnt.isPlayer() ? ((EntityNPC)fallEnt).connection : null; if(fallItem != null) { // && fallItem.hasDisplayName()) { - msg = String.format("%s wurde von %s mit %s zum Fallen verdammt", this.getColoredName(TextColor.CYAN), - fallEnt.getColoredName(TextColor.CYAN), fallItem.getColoredName(TextColor.CYAN)); - kill = String.format(TextColor.CYAN + "* %s mit %s zum Fallen verdammt", - this.getColoredName(TextColor.CYAN), fallItem.getColoredName(TextColor.CYAN)); + msg = String.format("%s wurde von %s mit %s zum Fallen verdammt", this.getColoredName(Color.CYAN), + fallEnt.getColoredName(Color.CYAN), fallItem.getColoredName(Color.CYAN)); + kill = String.format(Color.CYAN + "* %s mit %s zum Fallen verdammt", + this.getColoredName(Color.CYAN), fallItem.getColoredName(Color.CYAN)); } else { - msg = String.format("%s wurde von %s zum Fallen verdammt", this.getColoredName(TextColor.CYAN), - fallEnt.getColoredName(TextColor.CYAN)); - kill = String.format(TextColor.CYAN + "* %s zum Fallen verdammt", - this.getColoredName(TextColor.CYAN)); + msg = String.format("%s wurde von %s zum Fallen verdammt", this.getColoredName(Color.CYAN), + fallEnt.getColoredName(Color.CYAN)); + kill = String.format(Color.CYAN + "* %s zum Fallen verdammt", + this.getColoredName(Color.CYAN)); } } else if(lastEnt != null) { @@ -2383,24 +2383,24 @@ public abstract class EntityLiving extends Entity receiver = lastEnt.isPlayer() ? ((EntityNPC)lastEnt).connection : null; if(lastItem != null) { // && lastItem.hasDisplayName()) { msg = String.format("%s fiel zu tief und wurde von %s mit %s erledigt", - this.getColoredName(TextColor.BLUE), - lastEnt.getColoredName(TextColor.BLUE), lastItem.getColoredName(TextColor.BLUE)); - kill = String.format(TextColor.BLUE + "* %s mit %s erledigt", - this.getColoredName(TextColor.BLUE), lastItem.getColoredName(TextColor.BLUE)); + this.getColoredName(Color.BLUE), + lastEnt.getColoredName(Color.BLUE), lastItem.getColoredName(Color.BLUE)); + kill = String.format(Color.BLUE + "* %s mit %s erledigt", + this.getColoredName(Color.BLUE), lastItem.getColoredName(Color.BLUE)); } else { - msg = String.format("%s fiel zu tief und wurde von %s erledigt", this.getColoredName(TextColor.BLUE), - lastEnt.getColoredName(TextColor.BLUE)); - kill = String.format(TextColor.BLUE + "%s erledigt", this.getColoredName(TextColor.BLUE)); + msg = String.format("%s fiel zu tief und wurde von %s erledigt", this.getColoredName(Color.BLUE), + lastEnt.getColoredName(Color.BLUE)); + kill = String.format(Color.BLUE + "%s erledigt", this.getColoredName(Color.BLUE)); } } else { - msg = kill = natural ? String.format("%s wurde zum Fallen verdammt", this.getColoredName(TextColor.CYAN)) : null; + msg = kill = natural ? String.format("%s wurde zum Fallen verdammt", this.getColoredName(Color.CYAN)) : null; } } else { msg = kill = natural ? String.format("%s fiel " + (fall.blockType() == null ? "aus zu großer Höhe" : fall.blockType()), - this.getColoredName(TextColor.NEON)) : null; + this.getColoredName(Color.NEON)) : null; } } else { diff --git a/common/src/main/java/common/init/BlockRegistry.java b/common/src/main/java/common/init/BlockRegistry.java index c3252211..266486b0 100755 --- a/common/src/main/java/common/init/BlockRegistry.java +++ b/common/src/main/java/common/init/BlockRegistry.java @@ -134,7 +134,7 @@ import common.log.Log; import common.model.TextureAnimation; import common.properties.Property; import common.util.PortalType; -import common.util.TextColor; +import common.util.Color; import common.util.Util; import common.world.State; @@ -265,7 +265,7 @@ public abstract class BlockRegistry { .setDisplay("Obsidian").setMiningLevel(3)); register("clay", (new BlockClay()).setHardness(0.6F).setSound(SoundType.GRAVEL).setDisplay("Ton").setShovelHarvestable()); register("hardened_clay", (new BlockHardenedClay()).setHardness(1.25F).setResistance(7.0F).setSound(SoundType.STONE).setDisplay("Gebrannter Ton")); - for(TextColor color : TextColor.values()) { + for(Color color : Color.values()) { register(color.getName() + "_clay", (new BlockColoredClay(color)).setHardness(1.25F).setResistance(7.0F) .setSound(SoundType.STONE).setDisplay(color.getDisplay() + " gefärbter Ton")); } @@ -414,23 +414,23 @@ public abstract class BlockRegistry { .setSound(SoundType.STONE).setDisplay("Geladener Block").setTab(CheatTab.GEMS)); register("glass", (new BlockGlass()).setHardness(0.3F).setSound(SoundType.GLASS).setDisplay("Glas")); - for(TextColor color : TextColor.values()) { + for(Color color : Color.values()) { register(color.getName() + "_glass", (new BlockStainedGlass(color)).setHardness(0.3F).setSound(SoundType.GLASS).setDisplay(color.getDisplay() + " gefärbtes Glas")); } register("glass_pane", (new BlockPane(Material.TRANSLUCENT)).setHardness(0.3F).setSound(SoundType.GLASS).setDisplay("Glasscheibe")); - for(TextColor color : TextColor.values()) { + for(Color color : Color.values()) { register(color.getName() + "_glass_pane", (new BlockStainedGlassPane(color)).setHardness(0.3F).setSound(SoundType.GLASS).setDisplay(color.getDisplay() + " gefärbte Glasscheibe")); } - for(TextColor color : TextColor.values()) { + for(Color color : Color.values()) { register(color.getName() + "_wool", (new BlockWool(color)).setHardness(0.8F).setSound(SoundType.CLOTH).setDisplay(color.getSubject(-1) + " Wolle") .setShearsEfficiency(1)); } - for(TextColor color : TextColor.values()) { + for(Color color : Color.values()) { register(color.getName() + "_carpet", (new BlockCarpet(color)).setHardness(0.1F).setSound(SoundType.CLOTH).setDisplay(color.getSubject(1) + " Teppich").setOpacity(0)); } - for(TextColor color : BlockBed.COLORS) { + for(Color color : BlockBed.COLORS) { register(color.getName() + "_bed", (new BlockBed(color)).setSound(SoundType.WOOD).setHardness(0.2F).setDisplay(color.getSubject(0) + " Bett")); } diff --git a/common/src/main/java/common/init/CraftingRegistry.java b/common/src/main/java/common/init/CraftingRegistry.java index 641a5c45..3e1d6cbc 100755 --- a/common/src/main/java/common/init/CraftingRegistry.java +++ b/common/src/main/java/common/init/CraftingRegistry.java @@ -18,7 +18,7 @@ import common.inventory.InventoryCrafting; import common.item.Item; import common.item.ItemStack; import common.item.material.ItemDye; -import common.util.TextColor; +import common.util.Color; public abstract class CraftingRegistry { @@ -156,47 +156,51 @@ public abstract class CraftingRegistry add(new ItemStack(Items.blood_brick, 1), "NN", "NN", 'N', Items.bloodbrick); add(new ItemStack(Items.coarse_dirt, 4), "DG", "GD", 'D', Items.dirt, 'G', Items.gravel); - for (TextColor color : TextColor.values()) + for (Color color : Color.values()) { ItemDye dye = ItemDye.getByColor(color); - if(color != TextColor.WHITE) + if(color != Color.WHITE) addShapeless(new ItemStack(BlockWool.getByColor(color).getItem()), dye, Items.white_wool); add(new ItemStack(BlockColoredClay.getByColor(color).getItem(), 8), "###", "#X#", "###", '#', Items.hardened_clay, 'X', dye); add(new ItemStack(BlockStainedGlass.getByColor(color).getItem(), 8), "###", "#X#", "###", '#', Items.glass, 'X', dye); add(new ItemStack(BlockStainedGlassPane.getByColor(color).getItem(), 16), "###", "###", '#', BlockStainedGlass.getByColor(color).getItem()); } - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.YELLOW)), Items.dandelion); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.RED)), Items.rose); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.RED)), Items.poppy); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.WHITE), 3), Items.bone); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.MAGENTA), 2), new ItemStack(ItemDye.getByColor(TextColor.RED)), new ItemStack(ItemDye.getByColor(TextColor.WHITE))); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.ORANGE), 2), new ItemStack(ItemDye.getByColor(TextColor.RED)), new ItemStack(ItemDye.getByColor(TextColor.YELLOW))); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.GREEN), 2), new ItemStack(ItemDye.getByColor(TextColor.DARK_GREEN)), new ItemStack(ItemDye.getByColor(TextColor.WHITE))); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.GRAY), 2), new ItemStack(ItemDye.getByColor(TextColor.BLACK)), new ItemStack(ItemDye.getByColor(TextColor.WHITE))); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.LIGHT_GRAY), 2), new ItemStack(ItemDye.getByColor(TextColor.GRAY)), new ItemStack(ItemDye.getByColor(TextColor.WHITE))); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.LIGHT_GRAY), 3), new ItemStack(ItemDye.getByColor(TextColor.BLACK)), new ItemStack(ItemDye.getByColor(TextColor.WHITE)), new ItemStack(ItemDye.getByColor(TextColor.WHITE))); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.LIGHT_BLUE), 2), new ItemStack(ItemDye.getByColor(TextColor.BLUE)), new ItemStack(ItemDye.getByColor(TextColor.WHITE))); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.CYAN), 2), new ItemStack(ItemDye.getByColor(TextColor.BLUE)), new ItemStack(ItemDye.getByColor(TextColor.DARK_GREEN))); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.VIOLET), 2), new ItemStack(ItemDye.getByColor(TextColor.BLUE)), new ItemStack(ItemDye.getByColor(TextColor.RED))); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.DARK_MAGENTA), 2), new ItemStack(ItemDye.getByColor(TextColor.VIOLET)), new ItemStack(ItemDye.getByColor(TextColor.MAGENTA))); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.DARK_MAGENTA), 3), new ItemStack(ItemDye.getByColor(TextColor.BLUE)), new ItemStack(ItemDye.getByColor(TextColor.RED)), new ItemStack(ItemDye.getByColor(TextColor.MAGENTA))); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.MAGENTA), 4), new ItemStack(ItemDye.getByColor(TextColor.BLUE)), new ItemStack(ItemDye.getByColor(TextColor.RED)), new ItemStack(ItemDye.getByColor(TextColor.RED)), new ItemStack(ItemDye.getByColor(TextColor.WHITE))); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.LIGHT_BLUE)), Items.blue_orchid); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.MAGENTA)), Items.allium); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.LIGHT_GRAY)), Items.houstonia); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.RED)), Items.red_tulip); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.ORANGE)), Items.orange_tulip); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.LIGHT_GRAY)), Items.white_tulip); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.MAGENTA)), Items.pink_tulip); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.LIGHT_GRAY)), Items.daisy); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.YELLOW), 2), Items.sunflower); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.MAGENTA), 2), Items.syringa); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.RED), 2), Items.rose_bush); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.MAGENTA), 2), Items.paeonia); - addShapeless(new ItemStack(ItemDye.getByColor(TextColor.DARK_GREEN)), Items.cactus); + addShapeless(new ItemStack(ItemDye.getByColor(Color.YELLOW)), Items.dandelion); + addShapeless(new ItemStack(ItemDye.getByColor(Color.RED)), Items.rose); + addShapeless(new ItemStack(ItemDye.getByColor(Color.RED)), Items.poppy); + addShapeless(new ItemStack(ItemDye.getByColor(Color.WHITE), 3), Items.bone); + addShapeless(new ItemStack(ItemDye.getByColor(Color.MAGENTA), 2), new ItemStack(ItemDye.getByColor(Color.RED)), new ItemStack(ItemDye.getByColor(Color.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(Color.ORANGE), 2), new ItemStack(ItemDye.getByColor(Color.RED)), new ItemStack(ItemDye.getByColor(Color.YELLOW))); + addShapeless(new ItemStack(ItemDye.getByColor(Color.GREEN), 2), new ItemStack(ItemDye.getByColor(Color.DARK_GREEN)), new ItemStack(ItemDye.getByColor(Color.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(Color.GRAY), 2), new ItemStack(ItemDye.getByColor(Color.BLACK)), new ItemStack(ItemDye.getByColor(Color.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(Color.LIGHT_GRAY), 2), new ItemStack(ItemDye.getByColor(Color.GRAY)), new ItemStack(ItemDye.getByColor(Color.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(Color.LIGHT_GRAY), 3), new ItemStack(ItemDye.getByColor(Color.BLACK)), new ItemStack(ItemDye.getByColor(Color.WHITE)), new ItemStack(ItemDye.getByColor(Color.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(Color.LIGHT_BLUE), 2), new ItemStack(ItemDye.getByColor(Color.BLUE)), new ItemStack(ItemDye.getByColor(Color.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(Color.CYAN), 2), new ItemStack(ItemDye.getByColor(Color.BLUE)), new ItemStack(ItemDye.getByColor(Color.DARK_GREEN))); + addShapeless(new ItemStack(ItemDye.getByColor(Color.VIOLET), 2), new ItemStack(ItemDye.getByColor(Color.BLUE)), new ItemStack(ItemDye.getByColor(Color.RED))); + addShapeless(new ItemStack(ItemDye.getByColor(Color.DARK_MAGENTA), 2), new ItemStack(ItemDye.getByColor(Color.VIOLET)), new ItemStack(ItemDye.getByColor(Color.MAGENTA))); + addShapeless(new ItemStack(ItemDye.getByColor(Color.DARK_MAGENTA), 3), new ItemStack(ItemDye.getByColor(Color.BLUE)), new ItemStack(ItemDye.getByColor(Color.RED)), new ItemStack(ItemDye.getByColor(Color.MAGENTA))); + addShapeless(new ItemStack(ItemDye.getByColor(Color.MAGENTA), 4), new ItemStack(ItemDye.getByColor(Color.BLUE)), new ItemStack(ItemDye.getByColor(Color.RED)), new ItemStack(ItemDye.getByColor(Color.RED)), new ItemStack(ItemDye.getByColor(Color.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(Color.LIGHT_BLUE)), Items.blue_orchid); + addShapeless(new ItemStack(ItemDye.getByColor(Color.MAGENTA)), Items.allium); + addShapeless(new ItemStack(ItemDye.getByColor(Color.LIGHT_GRAY)), Items.houstonia); + addShapeless(new ItemStack(ItemDye.getByColor(Color.RED)), Items.red_tulip); + addShapeless(new ItemStack(ItemDye.getByColor(Color.ORANGE)), Items.orange_tulip); + addShapeless(new ItemStack(ItemDye.getByColor(Color.LIGHT_GRAY)), Items.white_tulip); + addShapeless(new ItemStack(ItemDye.getByColor(Color.MAGENTA)), Items.pink_tulip); + addShapeless(new ItemStack(ItemDye.getByColor(Color.LIGHT_GRAY)), Items.daisy); + addShapeless(new ItemStack(ItemDye.getByColor(Color.YELLOW), 2), Items.sunflower); + addShapeless(new ItemStack(ItemDye.getByColor(Color.MAGENTA), 2), Items.syringa); + addShapeless(new ItemStack(ItemDye.getByColor(Color.RED), 2), Items.rose_bush); + addShapeless(new ItemStack(ItemDye.getByColor(Color.MAGENTA), 2), Items.paeonia); + addShapeless(new ItemStack(ItemDye.getByColor(Color.DARK_GREEN)), Items.cactus); + addShapeless(new ItemStack(ItemDye.getByColor(Color.WHITE)), Items.grinded_bones); + addShapeless(new ItemStack(ItemDye.getByColor(Color.BROWN)), Items.cocoa_powder); + addShapeless(new ItemStack(ItemDye.getByColor(Color.BLACK)), Items.ink_sack); + addShapeless(new ItemStack(ItemDye.getByColor(Color.BLUE)), Items.lapis_lazuli); - for (TextColor color : TextColor.values()) + for (Color color : Color.values()) { add(new ItemStack(BlockCarpet.getByColor(color).getItem(), 3), "##", '#', BlockWool.getByColor(color).getItem()); } @@ -230,7 +234,7 @@ public abstract class CraftingRegistry add(new ItemStack(Items.wooden_button, 1), "#", '#', planks); add(new ItemStack(Items.wooden_pressure_plate, 1), "##", '#', planks); add(new ItemStack(Items.piston, 1), "TTT", "#X#", "#R#", '#', Items.cobblestone, 'X', Items.iron_ingot, 'R', Items.charged_powder, 'T', planks); - for(TextColor color : BlockBed.COLORS) { + for(Color color : BlockBed.COLORS) { add(new ItemStack(ItemRegistry.byName(color.getName() + "_bed"), 1), "###", "XXX", '#', BlockWool.getByColor(color).getItem(), 'X', planks); } } diff --git a/common/src/main/java/common/init/ItemRegistry.java b/common/src/main/java/common/init/ItemRegistry.java index 2232d4ef..6d56de3e 100755 --- a/common/src/main/java/common/init/ItemRegistry.java +++ b/common/src/main/java/common/init/ItemRegistry.java @@ -36,6 +36,7 @@ import common.item.material.ItemBottle; import common.item.material.ItemBucket; import common.item.material.ItemDye; import common.item.material.ItemEnchantedBook; +import common.item.material.ItemGrindedBones; import common.item.material.ItemHorseArmor; import common.item.material.ItemMetal; import common.item.material.ItemRecord; @@ -79,7 +80,7 @@ import common.item.weapon.ItemSword; import common.item.weapon.ItemTrident; import common.log.Log; import common.util.Pair; -import common.util.TextColor; +import common.util.Color; import common.util.Util; import common.world.Weather; @@ -204,7 +205,7 @@ public abstract class ItemRegistry { register("green_keycard", (new ItemKey()).setDisplay("Grüne Schlüsselkarte").setTab(CheatTab.TOOLS).setMaxAmount(StackSize.L)); register("blue_keycard", (new ItemKey()).setDisplay("Blaue Schlüsselkarte").setTab(CheatTab.TOOLS).setMaxAmount(StackSize.L)); register("black_keycard", (new ItemKey()).setDisplay("Schwarze Schlüsselkarte").setTab(CheatTab.TOOLS).setMaxAmount(StackSize.L)); - for(Pair sides : ItemDie.DIE_SIDES) { + for(Pair sides : ItemDie.DIE_SIDES) { register("die_" + sides.first(), (new ItemDie(sides.first(), sides.second())).setMaxAmount(StackSize.L)); } register("chick_magnet", (new ItemMagnet(true)).setDisplay("Kükenmagnet")); @@ -258,12 +259,8 @@ public abstract class ItemRegistry { register(type.getName(), (new ItemFishFood(false, type))); register("cooked_" + type.getName(), (new ItemFishFood(true, type))); } - Item lapis = null; - for(TextColor color : TextColor.values()) { - Item dye = new ItemDye(color); - if(color == TextColor.BLUE) - lapis = dye; - register(color.getDye(), dye); + for(Color color : Color.values()) { + register(color.getName() + "_dye", new ItemDye(color)); } register("bone", (new Item()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L)); register("sugar", (new Item()).setDisplay("Zucker").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XXL)); @@ -295,6 +292,11 @@ public abstract class ItemRegistry { register("fireball", (new ItemFireball()).setDisplay("Feuerkugel")); Item emerald = (new Item()).setDisplay("Smaragd").setTab(CheatTab.METALS); register("emerald", emerald); + register("cocoa_powder", new Item().setTab(CheatTab.MATERIALS).setDisplay("Gemahlene Kakaobohnen").setMaxAmount(StackSize.L)); + Item lapis = new Item().setTab(CheatTab.METALS).setDisplay("Lapislazuli").setMaxAmount(StackSize.L); + register("lapis_lazuli", lapis); + register("grinded_bones", new ItemGrindedBones().setTab(CheatTab.MATERIALS).setDisplay("Gemahlene Knochen").setMaxAmount(StackSize.L)); + register("ink_sack", new Item().setTab(CheatTab.MATERIALS).setDisplay("Tintenbeutel").setMaxAmount(StackSize.L)); register("carrot", new ItemSeedFood(3, Blocks.carrots, Blocks.farmland).setDisplay("Karotte").setMaxAmount(StackSize.L)); @@ -305,7 +307,7 @@ public abstract class ItemRegistry { register("melon_seed", new ItemSeeds(Blocks.melon_stem, Blocks.farmland).setDisplay("Melonenkerne").setMaxAmount(StackSize.XL)); register("whip", (new ItemWhip()).setDisplay("Peitsche")); - register("charge_crystal", (new Item()).setDisplay("Energiekristall").setTab(CheatTab.MISC).setColor(TextColor.DARK_MAGENTA).setGleaming()); + register("charge_crystal", (new Item()).setDisplay("Energiekristall").setTab(CheatTab.MISC).setColor(Color.DARK_MAGENTA).setGleaming()); for(Enchantment ench : Enchantment.values()) { register("enchanted_book_" + ench.getName(), (new ItemEnchantedBook(ench, 1)).setUnstackable().setDisplay("Verzaubertes Buch mit " + ench.getFormattedName(1)).setTab(CheatTab.ENCHANTMENTS)); int max = ench.getMaxLevel(); @@ -323,7 +325,7 @@ public abstract class ItemRegistry { register("lead", (new ItemLead()).setDisplay("Leine").setMaxAmount(StackSize.L)); register("name_tag", (new ItemNameTag()).setDisplay("Namensschild")); for(int z = 0; z < ItemDynamite.DYNAMITE.length; z++) { - register("dynamite" + (z == 0 ? "" : ("_" + z)), (new ItemDynamite(z)).setDisplay("Dynamit" + Util.getTierSuffix(z)).setColor(TextColor.RED)); + register("dynamite" + (z == 0 ? "" : ("_" + z)), (new ItemDynamite(z)).setDisplay("Dynamit" + Util.getTierSuffix(z)).setColor(Color.RED)); } register("chain", (new Item()).setDisplay("Kette").setTab(CheatTab.MATERIALS).setMagnetic()); Item chargedPowder = (new Item()).setDisplay("Geladener Staub").setTab(CheatTab.METALS).setMagnetic(); diff --git a/common/src/main/java/common/init/Items.java b/common/src/main/java/common/init/Items.java index b7851e8c..46cd269b 100755 --- a/common/src/main/java/common/init/Items.java +++ b/common/src/main/java/common/init/Items.java @@ -23,6 +23,7 @@ import common.item.material.ItemBottle; import common.item.material.ItemBucket; import common.item.material.ItemDye; import common.item.material.ItemEnchantedBook; +import common.item.material.ItemGrindedBones; import common.item.material.ItemHorseArmor; import common.item.material.ItemMetal; import common.item.material.ItemRecord; @@ -187,7 +188,6 @@ public abstract class Items { public static final ItemAmmo bolt = get("bolt"); public static final ItemBoltgun boltgun = get("boltgun"); public static final Item bone = get("bone"); - public static final ItemDye bonemeal = get("bonemeal"); public static final ItemBook book = get("book"); public static final Item bookshelf = get("bookshelf"); public static final ItemBow bow = get("bow"); @@ -266,7 +266,6 @@ public abstract class Items { public static final Item cobblestone_slab = get("cobblestone_slab"); public static final Item cobblestone_stairs = get("cobblestone_stairs"); public static final Item cobblestone_wall = get("cobblestone_wall"); - public static final ItemDye cocoa_powder = get("cocoa_powder"); public static final Item construction_table = get("construction_table"); public static final ItemFood cooked_beef = get("cooked_beef"); public static final ItemFood cooked_chicken = get("cooked_chicken"); @@ -406,7 +405,6 @@ public abstract class Items { public static final ItemBucket hydrogen_bucket = get("hydrogen_bucket"); public static final Item ice = get("ice"); public static final ItemScanner scanner = get("scanner"); - public static final ItemDye ink_sack = get("ink_sack"); public static final Item iodine_block = get("iodine_block"); public static final Item iodine_ore = get("iodine_ore"); public static final ItemMetal iodine_powder = get("iodine_powder"); @@ -442,7 +440,6 @@ public abstract class Items { public static final Item jungle_stairs = get("jungle_stairs"); public static final Item ladder = get("ladder"); public static final Item lapis_block = get("lapis_block"); - public static final ItemDye lapis_lazuli = get("lapis_lazuli"); public static final Item lapis_ore = get("lapis_ore"); public static final Item large_fern = get("large_fern"); public static final Item large_tallgrass = get("large_tallgrass"); @@ -1066,6 +1063,14 @@ public abstract class Items { public static final Item violet_glass = get("violet_glass"); public static final Item violet_glass_pane = get("violet_glass_pane"); public static final Item violet_wool = get("violet_wool"); + public static final ItemDye white_dye = get("white_dye"); + public static final ItemDye brown_dye = get("brown_dye"); + public static final ItemDye black_dye = get("black_dye"); + public static final ItemDye blue_dye = get("blue_dye"); + public static final ItemGrindedBones grinded_bones = get("grinded_bones"); + public static final Item cocoa_powder = get("cocoa_powder"); + public static final Item ink_sack = get("ink_sack"); + public static final Item lapis_lazuli = get("lapis_lazuli"); private static T get(String id) { T item = (T)ItemRegistry.byName(id); diff --git a/common/src/main/java/common/init/MetalType.java b/common/src/main/java/common/init/MetalType.java index 492de484..4b146a38 100755 --- a/common/src/main/java/common/init/MetalType.java +++ b/common/src/main/java/common/init/MetalType.java @@ -1,6 +1,6 @@ package common.init; -import common.util.TextColor; +import common.util.Color; public enum MetalType { IRON("iron", 26, "Fe", "Eisen", 0, new ToolMaterial(2, 8.0f, 0.0f, 250, 6.0F, 2, 14, true, 15, 9, 2, 6, 5, 2).setMagnetic()), @@ -87,15 +87,15 @@ public enum MetalType { } public String formatSymbol() { - return TextColor.YELLOW + "Element-Symbol: " + TextColor.ORANGE + this.order + " " + this.sign; + return Color.YELLOW + "Element-Symbol: " + Color.ORANGE + this.order + " " + this.sign; } public String formatRarity() { - return TextColor.DARK_MAGENTA + "Seltenheit: " + TextColor.NEON + "" + (this.rarity + 1); + return Color.DARK_MAGENTA + "Seltenheit: " + Color.NEON + "" + (this.rarity + 1); } public String formatRadioactivity() { - return TextColor.RED + "Radioaktivität: " + TextColor.GREEN + String.format("%.1f RN", this.radioactivity * 100.0f); + return Color.RED + "Radioaktivität: " + Color.GREEN + String.format("%.1f RN", this.radioactivity * 100.0f); } public boolean isMagnetic() { diff --git a/common/src/main/java/common/item/Item.java b/common/src/main/java/common/item/Item.java index a46e1087..07eb2873 100755 --- a/common/src/main/java/common/item/Item.java +++ b/common/src/main/java/common/item/Item.java @@ -20,7 +20,7 @@ import common.util.ExtMath; import common.util.Facing; import common.util.HitPosition; import common.util.Serverside; -import common.util.TextColor; +import common.util.Color; import common.util.Vec3; import common.world.AWorldServer; import common.world.World; @@ -33,7 +33,7 @@ public class Item { private Item containerItem; private String display; private CheatTab tab; - private TextColor color = null; + private Color color = null; private int defColor = 0xffffffff; private boolean magnetic = false; private boolean gleaming = false; @@ -88,7 +88,7 @@ public class Item { return this; } - public final Item setColor(TextColor color) { + public final Item setColor(Color color) { this.color = color; return this; } @@ -136,8 +136,8 @@ public class Item { return this.containerItem != null; } - public final TextColor getColor(ItemStack stack) { - return this.color != null ? this.color : (stack.isItemEnchanted() ? TextColor.NEON : TextColor.WHITE); + public final Color getColor(ItemStack stack) { + return this.color != null ? this.color : (stack.isItemEnchanted() ? Color.NEON : Color.WHITE); } public final CheatTab getTab() { diff --git a/common/src/main/java/common/item/ItemStack.java b/common/src/main/java/common/item/ItemStack.java index 1d7968b9..a3d38930 100755 --- a/common/src/main/java/common/item/ItemStack.java +++ b/common/src/main/java/common/item/ItemStack.java @@ -17,7 +17,7 @@ import common.init.ItemRegistry; import common.item.weapon.ItemBow; import common.rng.Random; import common.tags.TagObject; -import common.util.TextColor; +import common.util.Color; public final class ItemStack { public static final int MAX_SIZE = 67108864; @@ -232,15 +232,15 @@ public final class ItemStack { return this.getColor() + this.getDisplayName(); } - public String getColoredName(TextColor reset) { - return TextColor.DARK_GRAY + "[" + this.getColor() + this.getDisplayName() + TextColor.DARK_GRAY + "]" + reset; + public String getColoredName(Color reset) { + return Color.DARK_GRAY + "[" + this.getColor() + this.getDisplayName() + Color.DARK_GRAY + "]" + reset; } public boolean hasDisplayName() { return this.name != null; } - public TextColor getColor() { + public Color getColor() { return this.item.getColor(this); } diff --git a/common/src/main/java/common/item/consumable/ItemAppleGold.java b/common/src/main/java/common/item/consumable/ItemAppleGold.java index ee30c7b2..d5475052 100755 --- a/common/src/main/java/common/item/consumable/ItemAppleGold.java +++ b/common/src/main/java/common/item/consumable/ItemAppleGold.java @@ -4,7 +4,7 @@ import common.effect.Effect; import common.effect.StatusEffect; import common.entity.npc.EntityNPC; import common.item.ItemStack; -import common.util.TextColor; +import common.util.Color; import common.world.World; public class ItemAppleGold extends ItemFood @@ -15,7 +15,7 @@ public class ItemAppleGold extends ItemFood { super(amount, false); this.powered = powered; - this.setColor(powered ? TextColor.MAGENTA : TextColor.NEON); + this.setColor(powered ? Color.MAGENTA : Color.NEON); if(this.powered) this.setGleaming(); } diff --git a/common/src/main/java/common/item/consumable/ItemPotion.java b/common/src/main/java/common/item/consumable/ItemPotion.java index db135718..f39cf24f 100755 --- a/common/src/main/java/common/item/consumable/ItemPotion.java +++ b/common/src/main/java/common/item/consumable/ItemPotion.java @@ -22,7 +22,7 @@ import common.util.Clientside; import common.util.Facing; import common.util.Pair; import common.util.Serverside; -import common.util.TextColor; +import common.util.Color; import common.util.Vec3; import common.world.AWorldServer; import common.world.World; @@ -74,7 +74,7 @@ public class ItemPotion extends Item this.effect = effect; this.setMaxAmount(StackSize.XS); this.setTab(CheatTab.POTIONS); - this.setColor(TextColor.ORK); + this.setColor(Color.ORK); this.setDisplay(getDisplay(this)); if(this.effect != null) this.setGleaming(); @@ -212,18 +212,18 @@ public class ItemPotion extends Item if (potion.isBadEffect()) { - tooltip.add(TextColor.RED + s1); + tooltip.add(Color.RED + s1); } else { - tooltip.add(TextColor.LIGHT_GRAY + s1); + tooltip.add(Color.LIGHT_GRAY + s1); } String effectTip = this.effect.getPotion().getTooltip(this.effect.getAmplifier()); if(effectTip != null) tooltip.add(effectTip); } else if(this.type != null) { - tooltip.add(TextColor.LIGHT_GRAY + "Wirkungslos"); + tooltip.add(Color.LIGHT_GRAY + "Wirkungslos"); } } diff --git a/common/src/main/java/common/item/material/ItemDye.java b/common/src/main/java/common/item/material/ItemDye.java index a165f991..82891f4e 100755 --- a/common/src/main/java/common/item/material/ItemDye.java +++ b/common/src/main/java/common/item/material/ItemDye.java @@ -2,7 +2,6 @@ package common.item.material; import common.block.Block; import common.block.artificial.BlockBed; -import common.block.foliage.IGrowable; import common.entity.animal.EntitySheep; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; @@ -12,43 +11,34 @@ import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; import common.item.StackSize; -import common.tileentity.TileEntity; import common.util.BlockPos; -import common.util.Clientside; import common.util.Facing; -import common.util.ParticleType; -import common.util.Serverside; -import common.util.TextColor; -import common.util.Vec3; +import common.util.Color; import common.world.State; import common.world.World; -import common.world.AWorldServer; public class ItemDye extends Item { - private static final ItemDye[] DIES = new ItemDye[TextColor.values().length]; + private static final ItemDye[] DIES = new ItemDye[Color.values().length]; - private final TextColor color; + private final Color color; - public static ItemDye getByColor(TextColor color) { + public static ItemDye getByColor(Color color) { return DIES[color.ordinal()]; } - public ItemDye(TextColor color) + public ItemDye(Color color) { this.color = color; - this.setTab(color == TextColor.BLUE ? CheatTab.METALS : CheatTab.MATERIALS); - this.setDisplay(color.getDyeName()); + this.setTab(CheatTab.MATERIALS); + this.setDisplay(color.getSubject(1) + " Farbstoff"); this.setMaxAmount(StackSize.XXL); DIES[this.color.ordinal()] = this; } - public TextColor getColor() { + public Color getColor() { return this.color; } - /** - * Called when a Block is right-clicked with this Item - */ public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) { if (!playerIn.canPlayerEdit(pos.offset(side), side, stack)) @@ -57,18 +47,6 @@ public class ItemDye extends Item { } else { - if (this.color == TextColor.WHITE) - { - if (applyBonemeal(stack, worldIn, pos)) - { - if (!worldIn.client) - { - worldIn.playEffect(2005, pos, 0); - } - - return true; - } - } State iblockstate = worldIn.getState(pos); if(iblockstate.getBlock() instanceof BlockBed) { Block bedBlock = BlockRegistry.byName(this.color.getName() + "_bed"); @@ -104,57 +82,6 @@ public class ItemDye extends Item { } } - public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target) - { - State iblockstate = worldIn.getState(target); - - if (iblockstate.getBlock() instanceof IGrowable) - { - IGrowable igrowable = (IGrowable)iblockstate.getBlock(); - - if (igrowable.canGrow(worldIn, target, iblockstate, worldIn.client)) - { - if (!worldIn.client) - { - if (igrowable.canUseBonemeal(worldIn, worldIn.rand, target, iblockstate)) - { - igrowable.grow((AWorldServer)worldIn, worldIn.rand, target, iblockstate); - } - - stack.decrSize(); - } - - return true; - } - } - - return false; - } - - @Clientside - public static void spawnBonemealParticles(World worldIn, BlockPos pos, int amount) - { - if (amount == 0) - { - amount = 15; - } - - Block block = worldIn.getState(pos).getBlock(); - - if (block != Blocks.air) - { - block.setBlockBounds(worldIn, pos); - - for (int i = 0; i < amount; ++i) - { - worldIn.clientParticle(ParticleType.GROW, (double)((float)pos.getX() + worldIn.rand.floatv()), (double)pos.getY() + (double)worldIn.rand.floatv() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + worldIn.rand.floatv())); - } - } - } - - /** - * Returns true if the item can be used on the given entity, e.g. shears on sheep. - */ public boolean itemInteractionForEntity(ItemStack stack, EntityNPC playerIn, EntityLiving target) { if (target instanceof EntitySheep) @@ -174,31 +101,4 @@ public class ItemDye extends Item { return false; } } - - @Serverside - public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { - if(this.color != TextColor.WHITE) - return super.dispenseStack(world, source, position, blockpos, facing, stack); - BlockPos pos = blockpos = blockpos.offset(facing); - - if (applyBonemeal(stack, world, pos)) - { - if (!world.client) - { - world.playEffect(2005, pos, 0); - } - world.playEffect(1000, blockpos, 0); - } - else - { - world.playEffect(1001, blockpos, 0); - } - - return stack; - } - - @Serverside - public int getDispenseSoundId() { - return this.color == TextColor.WHITE ? 0 : super.getDispenseSoundId(); - } } diff --git a/common/src/main/java/common/item/material/ItemEnchantedBook.java b/common/src/main/java/common/item/material/ItemEnchantedBook.java index bdd7d85d..20549629 100755 --- a/common/src/main/java/common/item/material/ItemEnchantedBook.java +++ b/common/src/main/java/common/item/material/ItemEnchantedBook.java @@ -14,7 +14,7 @@ import common.item.ItemStack; import common.item.RngLoot; import common.rng.Random; import common.util.Clientside; -import common.util.TextColor; +import common.util.Color; public class ItemEnchantedBook extends Item { @@ -25,7 +25,7 @@ public class ItemEnchantedBook extends Item private final int level; public ItemEnchantedBook(Enchantment enchantment, int level) { - this.setColor(TextColor.YELLOW); + this.setColor(Color.YELLOW); this.setGleaming(); this.enchantment = enchantment; this.level = level; diff --git a/common/src/main/java/common/item/material/ItemGrindedBones.java b/common/src/main/java/common/item/material/ItemGrindedBones.java new file mode 100644 index 00000000..e96d2be2 --- /dev/null +++ b/common/src/main/java/common/item/material/ItemGrindedBones.java @@ -0,0 +1,115 @@ +package common.item.material; + +import common.block.Block; +import common.block.foliage.IGrowable; +import common.entity.npc.EntityNPC; +import common.init.Blocks; +import common.item.Item; +import common.item.ItemStack; +import common.tileentity.TileEntity; +import common.util.BlockPos; +import common.util.Clientside; +import common.util.Facing; +import common.util.ParticleType; +import common.util.Serverside; +import common.util.Vec3; +import common.world.State; +import common.world.World; +import common.world.AWorldServer; + +public class ItemGrindedBones extends Item { + public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + { + if (!playerIn.canPlayerEdit(pos.offset(side), side, stack)) + { + return false; + } + else + { + if (applyBonemeal(stack, worldIn, pos)) + { + if (!worldIn.client) + { + worldIn.playEffect(2005, pos, 0); + } + + return true; + } + + return false; + } + } + + public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target) + { + State iblockstate = worldIn.getState(target); + + if (iblockstate.getBlock() instanceof IGrowable) + { + IGrowable igrowable = (IGrowable)iblockstate.getBlock(); + + if (igrowable.canGrow(worldIn, target, iblockstate, worldIn.client)) + { + if (!worldIn.client) + { + if (igrowable.canUseBonemeal(worldIn, worldIn.rand, target, iblockstate)) + { + igrowable.grow((AWorldServer)worldIn, worldIn.rand, target, iblockstate); + } + + stack.decrSize(); + } + + return true; + } + } + + return false; + } + + @Clientside + public static void spawnParticles(World worldIn, BlockPos pos, int amount) + { + if (amount == 0) + { + amount = 15; + } + + Block block = worldIn.getState(pos).getBlock(); + + if (block != Blocks.air) + { + block.setBlockBounds(worldIn, pos); + + for (int i = 0; i < amount; ++i) + { + worldIn.clientParticle(ParticleType.GROW, (double)((float)pos.getX() + worldIn.rand.floatv()), (double)pos.getY() + (double)worldIn.rand.floatv() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + worldIn.rand.floatv())); + } + } + } + + @Serverside + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + BlockPos pos = blockpos = blockpos.offset(facing); + + if (applyBonemeal(stack, world, pos)) + { + if (!world.client) + { + world.playEffect(2005, pos, 0); + } + world.playEffect(1000, blockpos, 0); + } + else + { + world.playEffect(1001, blockpos, 0); + } + + return stack; + } + + @Serverside + public int getDispenseSoundId() { + return 0; + } +} diff --git a/common/src/main/java/common/item/material/ItemMetal.java b/common/src/main/java/common/item/material/ItemMetal.java index fb101420..8000aa8c 100755 --- a/common/src/main/java/common/item/material/ItemMetal.java +++ b/common/src/main/java/common/item/material/ItemMetal.java @@ -9,7 +9,7 @@ import common.init.MetalType; import common.item.Item; import common.item.ItemStack; import common.util.Clientside; -import common.util.TextColor; +import common.util.Color; public class ItemMetal extends Item { private final MetalType metal; @@ -17,7 +17,7 @@ public class ItemMetal extends Item { public ItemMetal(MetalType metal) { this.metal = metal; if(this.metal.radioactivity > 0.0f) - this.setColor(TextColor.GREEN); + this.setColor(Color.GREEN); if(this.metal.isMagnetic()) this.setMagnetic(); } diff --git a/common/src/main/java/common/item/projectile/ItemChargedOrb.java b/common/src/main/java/common/item/projectile/ItemChargedOrb.java index 3651d683..38705053 100755 --- a/common/src/main/java/common/item/projectile/ItemChargedOrb.java +++ b/common/src/main/java/common/item/projectile/ItemChargedOrb.java @@ -12,7 +12,7 @@ import common.item.ItemStack; import common.util.BlockPos; import common.util.Facing; import common.util.ParticleType; -import common.util.TextColor; +import common.util.Color; import common.world.State; import common.world.World; @@ -22,7 +22,7 @@ public class ItemChargedOrb extends Item { this.setTab(CheatTab.MAGIC); this.setMaxDamage(16); - this.setColor(TextColor.DARK_MAGENTA); + this.setColor(Color.DARK_MAGENTA); this.setFragile(); } diff --git a/common/src/main/java/common/item/projectile/ItemDie.java b/common/src/main/java/common/item/projectile/ItemDie.java index 76690dda..73118aff 100755 --- a/common/src/main/java/common/item/projectile/ItemDie.java +++ b/common/src/main/java/common/item/projectile/ItemDie.java @@ -19,25 +19,25 @@ import common.util.Clientside; import common.util.Facing; import common.util.Pair; import common.util.Serverside; -import common.util.TextColor; +import common.util.Color; import common.util.Vec3; import common.world.AWorldServer; import common.world.World; public class ItemDie extends Item { - public static final Pair[] DIE_SIDES = new Pair[] { - new Pair(4, TextColor.DARK_GREEN), - new Pair(6, TextColor.NEON), - new Pair(8, TextColor.DARK_MAGENTA), - new Pair(10, TextColor.MAGENTA), - new Pair(12, TextColor.DARK_RED), - new Pair(20, TextColor.ORANGE) + public static final Pair[] DIE_SIDES = new Pair[] { + new Pair(4, Color.DARK_GREEN), + new Pair(6, Color.NEON), + new Pair(8, Color.DARK_MAGENTA), + new Pair(10, Color.MAGENTA), + new Pair(12, Color.DARK_RED), + new Pair(20, Color.ORANGE) }; public static final Map DICE = Maps.newTreeMap(); private final int sides; - private final TextColor color; + private final Color color; public static final ItemDie getBySides(int sides) { ItemDie die = DICE.get(sides); @@ -48,7 +48,7 @@ public class ItemDie extends Item return DICE.values(); } - public ItemDie(int sides, TextColor color) + public ItemDie(int sides, Color color) { this.sides = sides; this.color = color; @@ -61,7 +61,7 @@ public class ItemDie extends Item return this.sides; } - public TextColor getDieColor() { + public Color getDieColor() { return this.color; } diff --git a/common/src/main/java/common/item/spawner/ItemCharTemplate.java b/common/src/main/java/common/item/spawner/ItemCharTemplate.java index 568997b0..78635b61 100755 --- a/common/src/main/java/common/item/spawner/ItemCharTemplate.java +++ b/common/src/main/java/common/item/spawner/ItemCharTemplate.java @@ -23,7 +23,7 @@ import common.util.ExtMath; import common.util.Facing; import common.util.HitPosition; import common.util.Serverside; -import common.util.TextColor; +import common.util.Color; import common.world.State; import common.world.World; @@ -67,7 +67,7 @@ public class ItemCharTemplate extends Item @Clientside public void addInformation(ItemStack stack, EntityNPC player, List tooltip) { Dimension dim = this.spawned.species.origin == null ? null : DimensionRegistry.getDimension(this.spawned.species.origin); - tooltip.add(TextColor.ORANGE + "Herkunft: " + (dim == null ? "???" : dim.getDisplay())); + tooltip.add(Color.ORANGE + "Herkunft: " + (dim == null ? "???" : dim.getDisplay())); } public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) diff --git a/common/src/main/java/common/item/spawner/ItemMobTemplate.java b/common/src/main/java/common/item/spawner/ItemMobTemplate.java index 1aab7381..810b5f13 100755 --- a/common/src/main/java/common/item/spawner/ItemMobTemplate.java +++ b/common/src/main/java/common/item/spawner/ItemMobTemplate.java @@ -21,7 +21,7 @@ import common.util.ExtMath; import common.util.Facing; import common.util.HitPosition; import common.util.Serverside; -import common.util.TextColor; +import common.util.Color; import common.world.State; import common.world.World; @@ -59,7 +59,7 @@ public class ItemMobTemplate extends Item EntityInfo egg = EntityRegistry.DNA.get(this.entityId); if(egg != null) { Dimension dim = egg.origin() == null ? null : DimensionRegistry.getDimension(egg.origin()); - tooltip.add(TextColor.ORANGE + "Herkunft: " + (dim == null ? "???" : dim.getDisplay())); + tooltip.add(Color.ORANGE + "Herkunft: " + (dim == null ? "???" : dim.getDisplay())); } } diff --git a/common/src/main/java/common/item/tool/ItemScanner.java b/common/src/main/java/common/item/tool/ItemScanner.java index 2e32a9d7..6cd24b16 100755 --- a/common/src/main/java/common/item/tool/ItemScanner.java +++ b/common/src/main/java/common/item/tool/ItemScanner.java @@ -4,19 +4,19 @@ import common.entity.npc.EntityNPC; import common.item.ItemStack; import common.item.WieldType; import common.util.BlockPos; -import common.util.TextColor; +import common.util.Color; import common.util.Vec3; import common.world.AWorldServer; public class ItemScanner extends ItemWand { public ItemScanner() { - this.setColor(TextColor.BLUE); + this.setColor(Color.BLUE); } public void onUse(ItemStack stack, EntityNPC player, AWorldServer world, Vec3 vec) { BlockPos pos = new BlockPos(vec); - player.connection.addHotbar(TextColor.NEON + "* Position in %s: %.1f %.1f %.1f, %.1f K, %.1f °C, G: %.1f °C, %.1f %%", world.dimension.getDisplay(), + player.connection.addHotbar(Color.NEON + "* Position in %s: %.1f %.1f %.1f, %.1f K, %.1f °C, G: %.1f °C, %.1f %%", world.dimension.getDisplay(), vec.xCoord, vec.yCoord, vec.zCoord, world.getTemperatureK(pos), world.getTemperatureC(pos), world.getGenTemperature(pos.getX(), pos.getZ()), world.getGenHumidity(pos.getX(), pos.getZ())); } diff --git a/common/src/main/java/common/item/tool/ItemSpaceNavigator.java b/common/src/main/java/common/item/tool/ItemSpaceNavigator.java index 0d338fbc..0b543626 100755 --- a/common/src/main/java/common/item/tool/ItemSpaceNavigator.java +++ b/common/src/main/java/common/item/tool/ItemSpaceNavigator.java @@ -7,7 +7,7 @@ import common.item.Item; import common.item.ItemStack; import common.util.BlockPos; import common.util.Clientside; -import common.util.TextColor; +import common.util.Color; public class ItemSpaceNavigator extends Item { @Clientside @@ -15,7 +15,7 @@ public class ItemSpaceNavigator extends Item { public ItemSpaceNavigator() { this.setUnstackable(); - this.setColor(TextColor.DARK_GREEN); + this.setColor(Color.DARK_GREEN); this.setMagnetic(); } @@ -30,20 +30,20 @@ public class ItemSpaceNavigator extends Item { @Clientside public String getHotbarText(EntityNPC player, ItemStack stack) { BlockPos pos = player.getPosition(); - return TextColor.ORANGE + this.localTime + " / " + - String.format("%s bei %d, %d, %d", player.worldObj.dimension.getDisplay() + TextColor.ORANGE, + return Color.ORANGE + this.localTime + " / " + + String.format("%s bei %d, %d, %d", player.worldObj.dimension.getDisplay() + Color.ORANGE, pos.getX(), pos.getY(), pos.getZ()); } @Clientside public void addInformation(ItemStack stack, EntityNPC player, List tooltip) { - tooltip.add(TextColor.ORANGE + this.localTime); + tooltip.add(Color.ORANGE + this.localTime); String[] dims = player.worldObj.dimension.getBaseNames(); for(int z = dims.length - 1; z >= 0; z--) { - tooltip.add(TextColor.ORANGE + dims[z]); + tooltip.add(Color.ORANGE + dims[z]); } BlockPos pos = player.getPosition(); - tooltip.add(TextColor.ORANGE + String.format("%s bei %d, %d, %d", player.worldObj.dimension.getDisplay() - + TextColor.ORANGE, pos.getX(), pos.getY(), pos.getZ())); + tooltip.add(Color.ORANGE + String.format("%s bei %d, %d, %d", player.worldObj.dimension.getDisplay() + + Color.ORANGE, pos.getX(), pos.getY(), pos.getZ())); } } diff --git a/common/src/main/java/common/item/tool/ItemWand.java b/common/src/main/java/common/item/tool/ItemWand.java index 31b8250e..e5876e3f 100755 --- a/common/src/main/java/common/item/tool/ItemWand.java +++ b/common/src/main/java/common/item/tool/ItemWand.java @@ -12,7 +12,7 @@ import common.util.BlockPos; import common.util.Clientside; import common.util.ExtMath; import common.util.Facing; -import common.util.TextColor; +import common.util.Color; import common.util.Vec3; import common.world.World; import common.world.AWorldServer; @@ -43,7 +43,7 @@ public abstract class ItemWand extends Item { @Clientside public void addInformation(ItemStack stack, EntityNPC playerIn, List tooltip) { - tooltip.add(TextColor.DARK_GREEN + "Reichweite: " + TextColor.GREEN + this.getRange(stack, playerIn) + " Blöcke"); + tooltip.add(Color.DARK_GREEN + "Reichweite: " + Color.GREEN + this.getRange(stack, playerIn) + " Blöcke"); } public abstract int getRange(ItemStack stack, EntityNPC player); diff --git a/common/src/main/java/common/item/tool/ItemWeatherToken.java b/common/src/main/java/common/item/tool/ItemWeatherToken.java index 21538f56..e816c648 100755 --- a/common/src/main/java/common/item/tool/ItemWeatherToken.java +++ b/common/src/main/java/common/item/tool/ItemWeatherToken.java @@ -4,7 +4,7 @@ import common.entity.npc.EntityNPC; import common.init.SoundEvent; import common.item.Item; import common.item.ItemStack; -import common.util.TextColor; +import common.util.Color; import common.world.Weather; import common.world.World; import common.world.AWorldServer; @@ -15,7 +15,7 @@ public class ItemWeatherToken extends Item { public ItemWeatherToken(Weather weather) { this.weather = weather; this.setUnstackable(); - this.setColor(TextColor.VIOLET); + this.setColor(Color.VIOLET); this.setDisplay("Wetterkristall (" + this.weather.getDisplay() + ")"); this.setMagnetic(); } diff --git a/common/src/main/java/common/item/weapon/ItemBanHammer.java b/common/src/main/java/common/item/weapon/ItemBanHammer.java index e61983e8..9d73c692 100755 --- a/common/src/main/java/common/item/weapon/ItemBanHammer.java +++ b/common/src/main/java/common/item/weapon/ItemBanHammer.java @@ -9,13 +9,13 @@ import common.item.CheatTab; import common.item.ItemStack; import common.item.tool.ItemWand; import common.util.BoundingBox; -import common.util.TextColor; +import common.util.Color; import common.util.Vec3; import common.world.AWorldServer; public class ItemBanHammer extends ItemWand { public ItemBanHammer() { - this.setColor(TextColor.DARK_RED); + this.setColor(Color.DARK_RED); this.setTab(CheatTab.WEAPONS); this.setMagnetic(); } diff --git a/common/src/main/java/common/item/weapon/ItemExterminator.java b/common/src/main/java/common/item/weapon/ItemExterminator.java index 98abcdb4..28ff033b 100755 --- a/common/src/main/java/common/item/weapon/ItemExterminator.java +++ b/common/src/main/java/common/item/weapon/ItemExterminator.java @@ -6,14 +6,14 @@ import common.init.SoundEvent; import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; -import common.util.TextColor; +import common.util.Color; import common.world.World; import common.world.AWorldServer; public class ItemExterminator extends Item { public ItemExterminator() { this.setUnstackable(); - this.setColor(TextColor.DARK_RED); + this.setColor(Color.DARK_RED); this.setTab(CheatTab.WEAPONS); this.setMagnetic(); } @@ -22,11 +22,11 @@ public class ItemExterminator extends Item { if(!world.client && player.connection.isAdmin()) { world.playSoundAtEntity(player, SoundEvent.CLICK, 1.0F); if(world.dimension == Space.INSTANCE) - player.connection.addHotbar(TextColor.RED + "Der Weltraum kann nicht zerstört werden (lol)"); + player.connection.addHotbar(Color.RED + "Der Weltraum kann nicht zerstört werden (lol)"); else if(!((AWorldServer)world).exterminate()) - player.connection.addHotbar(TextColor.YELLOW + "Die Welt %s ist bereits zerstört", world.dimension.getDisplay()); + player.connection.addHotbar(Color.YELLOW + "Die Welt %s ist bereits zerstört", world.dimension.getDisplay()); else - player.connection.addHotbar(TextColor.CRIMSON + "Die Welt %s wurde vernichtet >:)-", world.dimension.getDisplay()); + player.connection.addHotbar(Color.CRIMSON + "Die Welt %s wurde vernichtet >:)-", world.dimension.getDisplay()); // if (!playerIn.capabilities.isCreativeMode) // { diff --git a/common/src/main/java/common/item/weapon/ItemTrident.java b/common/src/main/java/common/item/weapon/ItemTrident.java index d7a5bbf2..89efff59 100755 --- a/common/src/main/java/common/item/weapon/ItemTrident.java +++ b/common/src/main/java/common/item/weapon/ItemTrident.java @@ -4,13 +4,13 @@ import common.entity.npc.EntityNPC; import common.item.CheatTab; import common.item.ItemStack; import common.item.tool.ItemWand; -import common.util.TextColor; +import common.util.Color; import common.util.Vec3; import common.world.AWorldServer; public class ItemTrident extends ItemWand { public ItemTrident() { - this.setColor(TextColor.NEON); + this.setColor(Color.NEON); this.setTab(CheatTab.WEAPONS); this.setMagnetic(); } diff --git a/common/src/main/java/common/log/Log.java b/common/src/main/java/common/log/Log.java index 752bb4eb..2c18704e 100644 --- a/common/src/main/java/common/log/Log.java +++ b/common/src/main/java/common/log/Log.java @@ -6,7 +6,7 @@ import java.util.List; import common.collect.Lists; import common.network.IThreadListener; -import common.util.TextColor; +import common.util.Color; import common.util.Util; public enum Log { @@ -68,7 +68,7 @@ public enum Log { if(((c >= CHR_COLORS1) && (c <= CHR_COLORE1)) || ((c >= CHR_COLORS2) && (c <= CHR_COLORE2))) { if(pos - last != 0) System.err.print(str.substring(last, pos)); - color = TextColor.getColor(c); // (c >= CHR_COLORS2) && (c <= CHR_COLORE2) ? aux_colors[c - CHR_COLORS2] : text_colors[c - CHR_COLORS1]; + color = Color.getColor(c); // (c >= CHR_COLORS2) && (c <= CHR_COLORE2) ? aux_colors[c - CHR_COLORS2] : text_colors[c - CHR_COLORS1]; if(colors) System.err.printf("\u001b[38;2;%d;%d;%dm", (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff); last = ++pos; @@ -143,8 +143,8 @@ public enum Log { public void log(LogLevel level, String msg) { if(level.ordinal() > Log.level.ordinal()) return; - String prefix = String.format(TextColor.DARK_GRAY + "[" + TextColor.GREEN + "%s" + TextColor.DARK_GRAY + "][" + TextColor.LIGHT_GRAY + "%s" + TextColor.DARK_GRAY + "|" + TextColor.LIGHT_GRAY + "%s" + - TextColor.DARK_GRAY + "][%s%s" + TextColor.DARK_GRAY + "] ", + String prefix = String.format(Color.DARK_GRAY + "[" + Color.GREEN + "%s" + Color.DARK_GRAY + "][" + Color.LIGHT_GRAY + "%s" + Color.DARK_GRAY + "|" + Color.LIGHT_GRAY + "%s" + + Color.DARK_GRAY + "][%s%s" + Color.DARK_GRAY + "] ", str_time(Util.rtime()), this.prefix, Thread.currentThread().getName(), level.color, level.log); String[] lines = msg.split("\n"); if(/* Game.getGame() == null || */ Log.sync.isMainThread()) { diff --git a/common/src/main/java/common/log/LogLevel.java b/common/src/main/java/common/log/LogLevel.java index 3eb3e203..9a259df2 100644 --- a/common/src/main/java/common/log/LogLevel.java +++ b/common/src/main/java/common/log/LogLevel.java @@ -3,22 +3,22 @@ package common.log; import common.util.Displayable; import common.util.ExtMath; import common.util.Identifyable; -import common.util.TextColor; +import common.util.Color; public enum LogLevel implements Displayable, Identifyable { - SILENT("silent", "Nichts", "UNK?", TextColor.BLACK), - USER("user", "Benutzer", "USER", TextColor.WHITE), - ERROR("error", "Fehler", "ERR!", TextColor.RED), - WARN("warn", "Warnung", "WARN", TextColor.YELLOW), - INFO("info", "Info", "INFO", TextColor.BLUE), - PERF("perf", "Leistung", "PERF", TextColor.CYAN), - DEBUG("debug", "*Debug*", "DBG#", TextColor.MAGENTA), - TRACE("trace", "*Trace*", "TRC#", TextColor.VIOLET); + SILENT("silent", "Nichts", "UNK?", Color.BLACK), + USER("user", "Benutzer", "USER", Color.WHITE), + ERROR("error", "Fehler", "ERR!", Color.RED), + WARN("warn", "Warnung", "WARN", Color.YELLOW), + INFO("info", "Info", "INFO", Color.BLUE), + PERF("perf", "Leistung", "PERF", Color.CYAN), + DEBUG("debug", "*Debug*", "DBG#", Color.MAGENTA), + TRACE("trace", "*Trace*", "TRC#", Color.VIOLET); public final String id; public final String name; public final String log; - public final TextColor color; + public final Color color; public static LogLevel parse(String str) { for(LogLevel level : values()) { @@ -33,7 +33,7 @@ public enum LogLevel implements Displayable, Identifyable { } } - private LogLevel(String id, String name, String log, TextColor color) { + private LogLevel(String id, String name, String log, Color color) { this.id = id; this.name = name; this.log = log; diff --git a/common/src/main/java/common/tileentity/Device.java b/common/src/main/java/common/tileentity/Device.java index 4eeeb21d..800a9720 100755 --- a/common/src/main/java/common/tileentity/Device.java +++ b/common/src/main/java/common/tileentity/Device.java @@ -11,20 +11,20 @@ import common.rng.Random; import common.tags.TagObject; import java.util.List; import common.util.ExtMath; -import common.util.TextColor; +import common.util.Color; public abstract class Device extends TileEntity implements IInventory, ITickable { public static enum Status { - OFF(TextColor.DARK_GRAY, "Inaktiv"), - COOLING(TextColor.YELLOW, "Abkühlen ..."), - RUNNING(TextColor.GREEN, "Aktiv"), - OVERHEAT(TextColor.RED, "Überhitzt!"), - BROKEN(TextColor.BLACK, "Defekt!"); + OFF(Color.DARK_GRAY, "Inaktiv"), + COOLING(Color.YELLOW, "Abkühlen ..."), + RUNNING(Color.GREEN, "Aktiv"), + OVERHEAT(Color.RED, "Überhitzt!"), + BROKEN(Color.BLACK, "Defekt!"); - public final TextColor color; + public final Color color; public final String name; - private Status(TextColor color, String name) { + private Status(Color color, String name) { this.color = color; this.name = name; } diff --git a/common/src/main/java/common/util/TextColor.java b/common/src/main/java/common/util/Color.java similarity index 81% rename from common/src/main/java/common/util/TextColor.java rename to common/src/main/java/common/util/Color.java index 7717218a..61e6ac98 100755 --- a/common/src/main/java/common/util/TextColor.java +++ b/common/src/main/java/common/util/Color.java @@ -5,13 +5,13 @@ import java.util.regex.Pattern; import common.collect.Maps; -public enum TextColor implements Identifyable, Displayable { +public enum Color implements Identifyable, Displayable { CRIMSON(0x02, 0x601010, "crimson", 'C', "Blutrot", "Blutrotes", "Blutroter", "Blutrote"), DARK_RED(0x03, 0x7f0000, "dark_red", 'r', "Dunkelrot", "Dunkelrotes", "Dunkelroter", "Dunkelrote"), RED(0x04, 0xcf0000, "red", 'R', "Rot", "Rotes", "Roter", "Rote"), DARK_BROWN(0x05, 0x56250b, "dark_brown", 'w', "Dunkelbraun", "Dunkelbraunes", "Dunkelbrauner", "Dunkelbraune"), ORANGE(0x06, 0xff7000, "orange", 'o', "Orange", "Oranges", "Oranger", "Orange"), - BROWN(0x07, 0x8c5606, "brown", 'W', "Braun", "Braunes", "Brauner", "Braune", "cocoa_powder", "Gemahlene Kakaobohnen"), + BROWN(0x07, 0x8c5606, "brown", 'W', "Braun", "Braunes", "Brauner", "Braune"), LIGHT_BROWN(0x08, 0x9c7636, "light_brown", 'l', "Hellbraun", "Hellbraunes", "Hellbrauner", "Hellbraune"), BEIGE(0x09, 0xcfcfaf, "beige", 'L', "Beige", "Beiges", "Beiger", "Beige"), YELLOW(0x0b, 0xbfbf00, "yellow", 'y', "Gelb", "Gelbes", "Gelber", "Gelbe"), @@ -23,22 +23,22 @@ public enum TextColor implements Identifyable, Displayable { CYAN(0x12, 0x00bfbf, "cyan", 'c', "Türkis", "Türkises", "Türkiser", "Türkise"), NEON(0x13, 0x80c0f0, "neon", 'n', "Neongrün", "Neongrünes", "Neongrüner", "Neongrüne"), MIDNIGHT(0x14, 0x000080, "midnight", 'm', "Mitternachtsblau", "Mitternachtsblaues", "Mitternachtsblauer", "Mitternachtsblaue"), - BLUE(0x15, 0x0000cf, "blue", 'b', "Blau", "Blaues", "Blauer", "Blaue", "lapis_lazuli", "Lapislazuli"), + BLUE(0x15, 0x0000cf, "blue", 'b', "Blau", "Blaues", "Blauer", "Blaue"), LIGHT_BLUE(0x16, 0x5f5fff, "light_blue", 'B', "Hellblau", "Hellblaues", "Hellblauer", "Hellblaue"), VIOLET(0x17, 0x6000ff, "violet", 'V', "Violett", "Violettes", "Violetter", "Violette"), DARK_VIOLET(0x18, 0x5400be, "dark_violet", 'v', "Dunkelviolett", "Dunkelviolettes", "Dunkelvioletter", "Dunkelviolette"), DARK_MAGENTA(0x19, 0x6f006f, "dark_magenta", 'm', "Dunkelmagenta", "Dunkelmagenta", "Dunkelmagenta", "Dunkelmagenta"), MAGENTA(0x1a, 0xbf00bf, "magenta", 'M', "Magenta", "Magenta", "Magenta", "Magenta"), - WHITE(0x1b, 0xffffff, "white", '4', "Weiß", "Weißes", "Weißer", "Weiße", "bonemeal", "Knochenmehl"), + WHITE(0x1b, 0xffffff, "white", '4', "Weiß", "Weißes", "Weißer", "Weiße"), LIGHT_GRAY(0x1c, 0xc0c0c0, "light_gray", '3', "Hellgrau", "Hellgraues", "Hellgrauer", "Hellgraue"), GRAY(0x1d, 0x808080, "gray", '2', "Grau", "Graues", "Grauer", "Graue"), DARK_GRAY(0x1e, 0x585858, "dark_gray", '1', "Dunkelgrau", "Dunkelgraues", "Dunkelgrauer", "Dunkelgraue"), - BLACK(0x1f, 0x000000, "black", '0', "Schwarz", "Schwarzes", "Schwarzer", "Schwarze", "ink_sack", "Tintenbeutel"); + BLACK(0x1f, 0x000000, "black", '0', "Schwarz", "Schwarzes", "Schwarzer", "Schwarze"); public static final char RESET = 0x01; public static final char COMMAND = 0x11; - private static final Map LOOKUP = Maps.newHashMap(); + private static final Map LOOKUP = Maps.newHashMap(); private static final Map CODE_LOOKUP = Maps.newHashMap(); private static final Pattern STRIP_PATTERN = Pattern.compile("[\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000b\u000c\r\u000e\u000f" + "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f]"); @@ -56,11 +56,9 @@ public enum TextColor implements Identifyable, Displayable { private final String subject; private final String msubject; private final String fsubject; - private final String dye; - private final String dyeName; static { - for(TextColor color : values()) { + for(Color color : values()) { if(color.code < COLORS.length) { COLORS[color.code] = color.color; SHADOW[color.code] = color.shadow; @@ -86,16 +84,16 @@ public enum TextColor implements Identifyable, Displayable { return code < SHADOW.length ? SHADOW[code] : 0x000000; } - public static TextColor byName(String name) { - TextColor type = LOOKUP.get(name.toLowerCase()); + public static Color byName(String name) { + Color type = LOOKUP.get(name.toLowerCase()); return type == null ? WHITE : type; } - public static TextColor getExact(String name) { + public static Color getExact(String name) { return LOOKUP.get(name.toLowerCase()); } - private TextColor(int code, int color, String id, char colorId, String display, String subject, String msubject, String fsubject, String dye, String dyeName) { + private Color(int code, int color, String id, char colorId, String display, String subject, String msubject, String fsubject) { this.format = Character.toString(this.code = (char)code); this.color = color; this.shadow = Util.mixColor(Util.mixColor(this.color, 0x000000), 0x000000); @@ -105,12 +103,6 @@ public enum TextColor implements Identifyable, Displayable { this.subject = subject; this.msubject = msubject; this.fsubject = fsubject; - this.dye = dye; - this.dyeName = dyeName; - } - - private TextColor(int code, int color, String id, char colorId, String display, String subject, String msubject, String fsubject) { - this(code, color, id, colorId, display, subject, msubject, fsubject, id + "_dye", msubject + " Farbstoff"); } public String toString() { @@ -129,14 +121,6 @@ public enum TextColor implements Identifyable, Displayable { return type == null ? this.display : (type < 0 ? this.fsubject : (type > 0 ? this.msubject : this.subject)); } - public String getDye() { - return this.dye; - } - - public String getDyeName() { - return this.dyeName; - } - public int getColor() { return this.color; } diff --git a/server/src/main/java/server/Server.java b/server/src/main/java/server/Server.java index 14d809fa..c053e4fb 100755 --- a/server/src/main/java/server/Server.java +++ b/server/src/main/java/server/Server.java @@ -87,7 +87,7 @@ import common.util.ExtMath; import common.util.Pair; import common.util.PortalType; import common.util.Position; -import common.util.TextColor; +import common.util.Color; import common.util.Triplet; import common.util.Util; import common.util.Var; @@ -1074,8 +1074,8 @@ public final class Server implements IThreadListener, Executor { nplayer.setHealth(nplayer.getHealth()); conn.sendPlayerAbilities(); if(message != null) - conn.addHotbar(TextColor.DARK_RED + message); - conn.addFeed(TextColor.RED + "* Bei %d, %d, %d in Dimension %s gestorben", pos.getX(), pos.getY(), pos.getZ(), + conn.addHotbar(Color.DARK_RED + message); + conn.addFeed(Color.RED + "* Bei %d, %d, %d in Dimension %s gestorben", pos.getX(), pos.getY(), pos.getZ(), old.worldObj.dimension.getDisplay()); } diff --git a/server/src/main/java/server/clipboard/ReorderRegistry.java b/server/src/main/java/server/clipboard/ReorderRegistry.java index 936a26eb..73788658 100755 --- a/server/src/main/java/server/clipboard/ReorderRegistry.java +++ b/server/src/main/java/server/clipboard/ReorderRegistry.java @@ -15,7 +15,7 @@ import common.block.tech.BlockAnvil; import common.init.BlockRegistry; import common.init.Blocks; import common.init.WoodType; -import common.util.TextColor; +import common.util.Color; import common.util.Vec3i; import common.world.State; @@ -48,7 +48,7 @@ public abstract class ReorderRegistry { PLACE_LAST.add(BlockRegistry.byName(wood.getName() + "_sapling")); } // PLACE_LAST.add(Blocks.bed); - for(TextColor color : BlockBed.COLORS) { + for(Color color : BlockBed.COLORS) { PLACE_LAST.add(BlockRegistry.byName(color.getName() + "_bed")); } PLACE_LAST.add(Blocks.tallgrass); diff --git a/server/src/main/java/server/command/ColorParser.java b/server/src/main/java/server/command/ColorParser.java index 0f0c75c7..2386bc27 100644 --- a/server/src/main/java/server/command/ColorParser.java +++ b/server/src/main/java/server/command/ColorParser.java @@ -1,6 +1,6 @@ package server.command; -import common.util.TextColor; +import common.util.Color; public class ColorParser extends IntParser { public ColorParser(String name, Integer def, Object ... completions) { @@ -8,7 +8,7 @@ public class ColorParser extends IntParser { } public ColorParser(String name, Integer def) { - this(name, def, (Object[])TextColor.values()); + this(name, def, (Object[])Color.values()); } public Integer parse(CommandEnvironment env, String input) { @@ -16,7 +16,7 @@ public class ColorParser extends IntParser { input = input.substring(1); } else { - TextColor color = TextColor.getExact(input); + Color color = Color.getExact(input); if(color != null) return color.getColor(); } diff --git a/server/src/main/java/server/command/Command.java b/server/src/main/java/server/command/Command.java index 87beeb78..14628c3d 100644 --- a/server/src/main/java/server/command/Command.java +++ b/server/src/main/java/server/command/Command.java @@ -9,7 +9,7 @@ import common.collect.Lists; import common.collect.Maps; import common.util.BlockPos; import common.util.CharValidator; -import common.util.TextColor; +import common.util.Color; import common.util.Vec3; import common.world.World; import server.command.DoubleParser.DefType; @@ -23,8 +23,8 @@ public abstract class Command implements Executable { private int parPos = 0; private boolean parReq = true; - public static String asCommand(TextColor color, String command, Object ... args) { - return String.format(TextColor.DARK_GRAY + "[" + TextColor.COMMAND + "%s" + TextColor.DARK_GRAY + "]" + (color == null ? TextColor.RESET : color), String.format(command, args)); + public static String asCommand(Color color, String command, Object ... args) { + return String.format(Color.DARK_GRAY + "[" + Color.COMMAND + "%s" + Color.DARK_GRAY + "]" + (color == null ? Color.RESET : color), String.format(command, args)); } protected Command(String name) { diff --git a/server/src/main/java/server/command/CommandEnvironment.java b/server/src/main/java/server/command/CommandEnvironment.java index 4941e489..15c0c060 100644 --- a/server/src/main/java/server/command/CommandEnvironment.java +++ b/server/src/main/java/server/command/CommandEnvironment.java @@ -12,7 +12,7 @@ import common.collect.Lists; import common.collect.Maps; import common.collect.Sets; import common.log.Log; -import common.util.TextColor; +import common.util.Color; import server.Server; import server.command.commands.*; @@ -171,13 +171,13 @@ public class CommandEnvironment { catch(RunException e) { Throwable cause = e; do { - exec.log(TextColor.RED + cause.getMessage()); + exec.log(Color.RED + cause.getMessage()); cause = cause.getCause(); } while(cause != null); } catch(Throwable t) { - exec.log(TextColor.RED + "Fehler: %s", t.getMessage()); + exec.log(Color.RED + "Fehler: %s", t.getMessage()); Log.CONSOLE.error(t, "Fehler beim Ausführen von Befehl '%s'", cmd); } finally { diff --git a/server/src/main/java/server/command/commands/CommandExterminatus.java b/server/src/main/java/server/command/commands/CommandExterminatus.java index 4bc99108..ac195836 100644 --- a/server/src/main/java/server/command/commands/CommandExterminatus.java +++ b/server/src/main/java/server/command/commands/CommandExterminatus.java @@ -1,7 +1,7 @@ package server.command.commands; import common.dimension.Space; -import common.util.TextColor; +import common.util.Color; import server.command.Command; import server.command.CommandEnvironment; import server.command.Executor; @@ -20,8 +20,8 @@ public class CommandExterminatus extends Command { throw new RunException("Der Weltraum kann nicht zerstört werden (lol?)"); else if(world.isExterminated()) throw new RunException("Dimension %s ist bereits zerstört", world.dimension.getDisplay()); - exec.log(TextColor.YELLOW + "Dimension %s wird zerstört ...", world.dimension.getDisplay()); + exec.log(Color.YELLOW + "Dimension %s wird zerstört ...", world.dimension.getDisplay()); world.exterminate(); - exec.log(TextColor.CRIMSON + "Die Welt %s wurde vernichtet >:)-", world.dimension.getDisplay()); + exec.log(Color.CRIMSON + "Die Welt %s wurde vernichtet >:)-", world.dimension.getDisplay()); } } diff --git a/server/src/main/java/server/command/commands/CommandGod.java b/server/src/main/java/server/command/commands/CommandGod.java index b3449f1e..f88f8310 100644 --- a/server/src/main/java/server/command/commands/CommandGod.java +++ b/server/src/main/java/server/command/commands/CommandGod.java @@ -4,7 +4,7 @@ import java.util.List; import common.effect.Effect; import common.entity.npc.EntityNPC; -import common.util.TextColor; +import common.util.Color; import server.command.Command; import server.command.CommandEnvironment; import server.command.Executor; @@ -25,7 +25,7 @@ public class CommandGod extends Command { for(EntityNPC player : players) { player.setGodMode(!remove); if(!quiet) - player.connection.addFeed(!remove ? (TextColor.GREEN + "Statuseffekte wurden hinzugefügt") : (TextColor.RED + "Statuseffekte wurden entfernt")); + player.connection.addFeed(!remove ? (Color.GREEN + "Statuseffekte wurden hinzugefügt") : (Color.RED + "Statuseffekte wurden entfernt")); if(quiet || player.connection != exec) exec.log("Statuseffekte " + (!remove ? "an %s gegeben" : "von %s entfernt"), player.getCommandName()); } diff --git a/server/src/main/java/server/command/commands/CommandLoad.java b/server/src/main/java/server/command/commands/CommandLoad.java index 9cfa2ea9..e45e0789 100644 --- a/server/src/main/java/server/command/commands/CommandLoad.java +++ b/server/src/main/java/server/command/commands/CommandLoad.java @@ -14,7 +14,7 @@ import common.init.Blocks; import common.init.NameRegistry; import common.packet.SPacketDimensions; import common.rng.Random; -import common.util.TextColor; +import common.util.Color; import server.Server; import server.command.ArgumentParser; import server.command.Command; @@ -126,7 +126,7 @@ public class CommandLoad extends Command { if(Converter.convert(dir, name, pos -> env.getServer().schedule(() -> { Planet planet = registerPlanet(env.getServer(), star, name, display, sky, fog, clouds, orbit, rotation, (float)offset, (float)gravity, (float)temperature, brightness); this.loadingDim = null; - exec.log(TextColor.GREEN + "Welt %s wurde erfolgreich in Dimension '%s' konvertiert", dir, display); + exec.log(Color.GREEN + "Welt %s wurde erfolgreich in Dimension '%s' konvertiert", dir, display); if(teleport && pos != null) { Player player = env.getServer().getPlayer(((Player)exec).getUser()); if(player != null && player.getPresentEntity() != null) @@ -137,12 +137,12 @@ public class CommandLoad extends Command { throw new RunException("Welt %s konnte nicht konvertiert werden", dir); } else { - exec.log(TextColor.ACID + "Welt %s wird in Dimension '%s' konvertiert ...", dir, display); + exec.log(Color.ACID + "Welt %s wird in Dimension '%s' konvertiert ...", dir, display); } return; } Planet planet = registerPlanet(env.getServer(), star, name, display, sky, fog, clouds, orbit, rotation, (float)offset, (float)gravity, (float)temperature, brightness); - exec.log(TextColor.GREEN + "Dimension '%s' wurde registriert", display); + exec.log(Color.GREEN + "Dimension '%s' wurde registriert", display); if(teleport && ((Player)exec).getPresentEntity() != null) ((Player)exec).getPresentEntity().teleport(CommandWorld.adjust(env.getServer().getWorld(planet), ((Player)exec).getPresentEntity().getPosition()), planet); } diff --git a/server/src/main/java/server/command/commands/CommandNoclip.java b/server/src/main/java/server/command/commands/CommandNoclip.java index a89be804..7400ee7e 100644 --- a/server/src/main/java/server/command/commands/CommandNoclip.java +++ b/server/src/main/java/server/command/commands/CommandNoclip.java @@ -3,7 +3,7 @@ package server.command.commands; import java.util.List; import common.entity.npc.EntityNPC; -import common.util.TextColor; +import common.util.Color; import server.command.Command; import server.command.CommandEnvironment; import server.command.Executor; @@ -27,7 +27,7 @@ public class CommandNoclip extends Command { continue; player.setNoclip(!remove); if(!quiet) - player.connection.addFeed((!remove ? TextColor.GREEN : TextColor.RED) + "NoClip wurde " + (!remove ? "eingeschaltet" : "ausgeschaltet")); + player.connection.addFeed((!remove ? Color.GREEN : Color.RED) + "NoClip wurde " + (!remove ? "eingeschaltet" : "ausgeschaltet")); if(quiet || player.connection != exec) exec.log("NoClip für %s " + (!remove ? "eingeschaltet" : "ausgeschaltet"), player.getCommandName()); done++; diff --git a/server/src/main/java/server/command/commands/CommandPasswd.java b/server/src/main/java/server/command/commands/CommandPasswd.java index c82b2867..485350a7 100644 --- a/server/src/main/java/server/command/commands/CommandPasswd.java +++ b/server/src/main/java/server/command/commands/CommandPasswd.java @@ -4,7 +4,7 @@ import java.security.MessageDigest; import common.network.IPlayer; import common.util.EncryptUtil; -import common.util.TextColor; +import common.util.Color; import server.command.Command; import server.command.CommandEnvironment; import server.command.Executor; @@ -50,20 +50,20 @@ public class CommandPasswd extends Command { protected void accept() { User plr = env.getServer().getUser(user.getUser()); if(!((Player)exec).isAdmin() || plr == null || (plr.isAdmin() && plr != exec) || (plr.getPasswordHash() == null && plr == exec) || (plr.getPubkey() != null && plr == exec)) { - exec.log(TextColor.DARK_RED + "Ein Fehler ist aufgetreten"); + exec.log(Color.DARK_RED + "Ein Fehler ist aufgetreten"); return; } if(this.checkField != null && !MessageDigest.isEqual(EncryptUtil.hashPassword(this.checkField.get(), plr.getPasswordHash().second()), plr.getPasswordHash().first())) { - exec.log(TextColor.RED + "Falsches Passwort eingegeben"); + exec.log(Color.RED + "Falsches Passwort eingegeben"); return; } if(!this.passwordField.get().equals(this.confirmField.get())) { - exec.log(TextColor.RED + "Passwörter stimmen nicht überein"); + exec.log(Color.RED + "Passwörter stimmen nicht überein"); return; } plr.setPasswordHash(EncryptUtil.hashPassword(this.passwordField.get())); plr.setPubkey(null); - exec.log(TextColor.GREEN + "Passwort" + (plr != exec ? " für %s" : "") + " gesetzt", plr.getUser()); + exec.log(Color.GREEN + "Passwort" + (plr != exec ? " für %s" : "") + " gesetzt", plr.getUser()); } }); } @@ -74,7 +74,7 @@ public class CommandPasswd extends Command { throw new RunException("Das Passwort ist zu kurz, mindestens 8 Zeichen sind erforderlich"); user.setPasswordHash(EncryptUtil.hashPassword(password)); user.setPubkey(null); - exec.log(TextColor.GREEN + "Passwort für %s gesetzt", user.getUser()); + exec.log(Color.GREEN + "Passwort für %s gesetzt", user.getUser()); } } } diff --git a/server/src/main/java/server/command/commands/CommandPlayers.java b/server/src/main/java/server/command/commands/CommandPlayers.java index 0edf5317..ebc8c6d6 100644 --- a/server/src/main/java/server/command/commands/CommandPlayers.java +++ b/server/src/main/java/server/command/commands/CommandPlayers.java @@ -4,7 +4,7 @@ import java.util.List; import common.entity.npc.EntityNPC; import common.util.ExtMath; -import common.util.TextColor; +import common.util.Color; import server.command.Command; import server.command.CommandEnvironment; import server.command.Executor; @@ -21,13 +21,13 @@ public class CommandPlayers extends Command { public void exec(CommandEnvironment env, Executor exec, boolean coords) { List players = env.getServer().getPlayers(); if(players.isEmpty()) { - exec.log(TextColor.DARK_GRAY + "Es sind keine Spieler online"); + exec.log(Color.DARK_GRAY + "Es sind keine Spieler online"); return; } - exec.log(TextColor.GREEN + "Es " + (players.size() == 1 ? "ist" : "sind") + " " + TextColor.YELLOW + "%d" + TextColor.GREEN + " Spieler online", players.size()); + exec.log(Color.GREEN + "Es " + (players.size() == 1 ? "ist" : "sind") + " " + Color.YELLOW + "%d" + Color.GREEN + " Spieler online", players.size()); for(Player player : players) { EntityNPC entity = player.getPresentEntity(); - exec.log("%s%s" + TextColor.GRAY + ": '%s" + TextColor.GRAY + "'" + (coords && entity != null ? " [" + TextColor.ORANGE + "%s @ %d, %d, %d" + TextColor.GRAY + "]" : ""), player.isAdmin() ? TextColor.RED : TextColor.NEON, player.getUser(), entity == null ? TextColor.DARK_GRAY + "<->" : TextColor.ACID + entity.getCommandName(), entity == null ? null : entity.worldObj.dimension.getDisplay(), entity == null ? null : ExtMath.floord(entity.posX), entity == null ? null : ExtMath.floord(entity.posY), entity == null ? null : ExtMath.floord(entity.posZ)); + exec.log("%s%s" + Color.GRAY + ": '%s" + Color.GRAY + "'" + (coords && entity != null ? " [" + Color.ORANGE + "%s @ %d, %d, %d" + Color.GRAY + "]" : ""), player.isAdmin() ? Color.RED : Color.NEON, player.getUser(), entity == null ? Color.DARK_GRAY + "<->" : Color.ACID + entity.getCommandName(), entity == null ? null : entity.worldObj.dimension.getDisplay(), entity == null ? null : ExtMath.floord(entity.posX), entity == null ? null : ExtMath.floord(entity.posY), entity == null ? null : ExtMath.floord(entity.posZ)); } } } diff --git a/server/src/main/java/server/command/commands/CommandPubkey.java b/server/src/main/java/server/command/commands/CommandPubkey.java index 36824061..7669823b 100644 --- a/server/src/main/java/server/command/commands/CommandPubkey.java +++ b/server/src/main/java/server/command/commands/CommandPubkey.java @@ -6,7 +6,7 @@ import java.security.PublicKey; import common.network.IPlayer; import common.util.EncryptUtil; import common.util.Pair; -import common.util.TextColor; +import common.util.Color; import server.command.Command; import server.command.CommandEnvironment; import server.command.Executor; @@ -48,11 +48,11 @@ public class CommandPubkey extends Command { protected void accept() { User plr = env.getServer().getUser(user.getUser()); if(!((Player)exec).isAdmin() || plr == null || (plr.isAdmin() && plr != exec)) { - exec.log(TextColor.DARK_RED + "Ein Fehler ist aufgetreten"); + exec.log(Color.DARK_RED + "Ein Fehler ist aufgetreten"); return; } if(this.checkField != null && plr.getPasswordHash() != null && !MessageDigest.isEqual(EncryptUtil.hashPassword(this.checkField.get(), plr.getPasswordHash().second()), plr.getPasswordHash().first())) { - exec.log(TextColor.RED + "Falsches Passwort eingegeben"); + exec.log(Color.RED + "Falsches Passwort eingegeben"); return; } Pair key; @@ -60,12 +60,12 @@ public class CommandPubkey extends Command { key = EncryptUtil.parseArmoredPubkey(this.keyField.get()); } catch(IllegalArgumentException e) { - exec.log(TextColor.RED + "Ungültiger Schlüssel"); + exec.log(Color.RED + "Ungültiger Schlüssel"); return; } plr.setPasswordHash(null); plr.setPubkey(key.first()); - exec.log(TextColor.GREEN + "Schlüssel" + (plr != exec ? " für %s" : "") + " gesetzt", plr.getUser()); + exec.log(Color.GREEN + "Schlüssel" + (plr != exec ? " für %s" : "") + " gesetzt", plr.getUser()); } }); } @@ -81,7 +81,7 @@ public class CommandPubkey extends Command { } user.setPasswordHash(null); user.setPubkey(key.first()); - exec.log(TextColor.GREEN + "Schlüssel für %s gesetzt", user.getUser()); + exec.log(Color.GREEN + "Schlüssel für %s gesetzt", user.getUser()); } } } diff --git a/server/src/main/java/server/command/commands/CommandRegister.java b/server/src/main/java/server/command/commands/CommandRegister.java index cc569e01..d96acc35 100644 --- a/server/src/main/java/server/command/commands/CommandRegister.java +++ b/server/src/main/java/server/command/commands/CommandRegister.java @@ -2,7 +2,7 @@ package server.command.commands; import common.network.IPlayer; import common.util.EncryptUtil; -import common.util.TextColor; +import common.util.Color; import server.command.Command; import server.command.CommandEnvironment; import server.command.Executor; @@ -45,18 +45,18 @@ public class CommandRegister extends Command { protected void accept() { if(!((Player)exec).isAdmin() || env.getServer().getUser(username) != null || env.getServer().loadPlayerData(username) != null) { - exec.log(TextColor.DARK_RED + "Ein Fehler ist aufgetreten"); + exec.log(Color.DARK_RED + "Ein Fehler ist aufgetreten"); return; } if(!this.passwordField.get().equals(this.confirmField.get())) { - exec.log(TextColor.RED + "Passwörter stimmen nicht überein"); + exec.log(Color.RED + "Passwörter stimmen nicht überein"); return; } User user = new User(username); user.setPasswordHash(EncryptUtil.hashPassword(this.passwordField.get())); user.setAdmin(admin); env.getServer().addUser(user); - exec.log(TextColor.GREEN + "Spieler %s registriert", username); + exec.log(Color.GREEN + "Spieler %s registriert", username); } }); } @@ -69,7 +69,7 @@ public class CommandRegister extends Command { user.setPasswordHash(EncryptUtil.hashPassword(password)); user.setAdmin(admin); env.getServer().addUser(user); - exec.log(TextColor.GREEN + "Spieler %s registriert", username); + exec.log(Color.GREEN + "Spieler %s registriert", username); } } } diff --git a/server/src/main/java/server/command/commands/CommandRegkey.java b/server/src/main/java/server/command/commands/CommandRegkey.java index 741b8574..bdb5ec5e 100644 --- a/server/src/main/java/server/command/commands/CommandRegkey.java +++ b/server/src/main/java/server/command/commands/CommandRegkey.java @@ -5,7 +5,7 @@ import java.security.PublicKey; import common.network.IPlayer; import common.util.EncryptUtil; import common.util.Pair; -import common.util.TextColor; +import common.util.Color; import server.command.Command; import server.command.CommandEnvironment; import server.command.Executor; @@ -48,7 +48,7 @@ public class CommandRegkey extends Command { protected void accept() { if(!((Player)exec).isAdmin() || env.getServer().getUser(username) != null || env.getServer().loadPlayerData(username) != null) { - exec.log(TextColor.DARK_RED + "Ein Fehler ist aufgetreten"); + exec.log(Color.DARK_RED + "Ein Fehler ist aufgetreten"); return; } Pair key; @@ -56,14 +56,14 @@ public class CommandRegkey extends Command { key = EncryptUtil.parseArmoredPubkey(this.keyField.get()); } catch(IllegalArgumentException e) { - exec.log(TextColor.RED + "Ungültiger Schlüssel"); + exec.log(Color.RED + "Ungültiger Schlüssel"); return; } User user = new User(username); user.setPubkey(key.first()); user.setAdmin(admin); env.getServer().addUser(user); - exec.log(TextColor.GREEN + "Spieler %s registriert", username); + exec.log(Color.GREEN + "Spieler %s registriert", username); } }); } @@ -81,7 +81,7 @@ public class CommandRegkey extends Command { user.setPubkey(key.first()); user.setAdmin(admin); env.getServer().addUser(user); - exec.log(TextColor.GREEN + "Spieler %s registriert", username); + exec.log(Color.GREEN + "Spieler %s registriert", username); } } } diff --git a/server/src/main/java/server/command/commands/CommandSave.java b/server/src/main/java/server/command/commands/CommandSave.java index e974d130..bd96d38c 100644 --- a/server/src/main/java/server/command/commands/CommandSave.java +++ b/server/src/main/java/server/command/commands/CommandSave.java @@ -2,7 +2,7 @@ package server.command.commands; import common.packet.SPacketMessage; import common.packet.SPacketMessage.Type; -import common.util.TextColor; +import common.util.Color; import server.command.Command; import server.command.CommandEnvironment; import server.command.Executor; @@ -19,18 +19,18 @@ public class CommandSave extends Command { public void exec(CommandEnvironment env, Executor exec, boolean message, boolean flush) { if(message) - env.getServer().sendPacket(new SPacketMessage(TextColor.RED + "Speichere Serverdaten, der Server könnte kurz einfrieren", Type.FEED)); - exec.log(TextColor.ORANGE + "Speichere Spielerdaten ..."); + env.getServer().sendPacket(new SPacketMessage(Color.RED + "Speichere Serverdaten, der Server könnte kurz einfrieren", Type.FEED)); + exec.log(Color.ORANGE + "Speichere Spielerdaten ..."); env.getServer().saveAllPlayerData(true); - exec.log(TextColor.ORANGE + "Speichere Weltdaten ..."); + exec.log(Color.ORANGE + "Speichere Weltdaten ..."); env.getServer().saveAllWorlds(true); env.getServer().resetSaveTimer(); if(flush) { - exec.log(TextColor.ORANGE + "Beende E/A ..."); + exec.log(Color.ORANGE + "Beende E/A ..."); Region.finishWrite(); } - exec.log(TextColor.DARK_GREEN + "Alle Serverdaten wurden gespeichert"); + exec.log(Color.DARK_GREEN + "Alle Serverdaten wurden gespeichert"); if(message) - env.getServer().sendPacket(new SPacketMessage(TextColor.GREEN + "Die Serverdaten wurden gespeichert", Type.FEED)); + env.getServer().sendPacket(new SPacketMessage(Color.GREEN + "Die Serverdaten wurden gespeichert", Type.FEED)); } } diff --git a/server/src/main/java/server/command/commands/CommandSv.java b/server/src/main/java/server/command/commands/CommandSv.java index e823bb7a..90c48db2 100644 --- a/server/src/main/java/server/command/commands/CommandSv.java +++ b/server/src/main/java/server/command/commands/CommandSv.java @@ -5,7 +5,7 @@ import java.util.Map.Entry; import common.collect.Lists; import common.packet.SPacketServerConfig; -import common.util.TextColor; +import common.util.Color; import server.command.ArgumentSplitter; import server.command.Command; import server.command.CommandEnvironment; @@ -41,17 +41,17 @@ public class CommandSv extends Command { private String formatVariable(String name, SVar sv, String separator, boolean censor) { String value = sv.get(); - StringBuilder sb = new StringBuilder(TextColor.YELLOW + name + TextColor.GRAY + " " + separator + " "); + StringBuilder sb = new StringBuilder(Color.YELLOW + name + Color.GRAY + " " + separator + " "); if(sv.noDef && sv.def.equals(value)) - sb.append(TextColor.DARK_GRAY + "[ - ]"); + sb.append(Color.DARK_GRAY + "[ - ]"); else if(censor && name.equals("password") && !value.isEmpty()) - sb.append(TextColor.NEON + "'****'"); + sb.append(Color.NEON + "'****'"); else if(sv.type == ValueType.STRING) - sb.append(TextColor.NEON + "'" + value + "'"); + sb.append(Color.NEON + "'" + value + "'"); else - sb.append(((sv.type == ValueType.BOOLEAN ? (value.equals("true") ? TextColor.GREEN : TextColor.RED) : TextColor.BLUE)) + value); + sb.append(((sv.type == ValueType.BOOLEAN ? (value.equals("true") ? Color.GREEN : Color.RED) : Color.BLUE)) + value); if(!sv.def.equals(value)) - sb.append(TextColor.GRAY + " (" + (sv.noDef ? TextColor.DARK_GRAY + "[ - ]" : TextColor.BROWN + sv.def) + TextColor.GRAY + ")"); + sb.append(Color.GRAY + " (" + (sv.noDef ? Color.DARK_GRAY + "[ - ]" : Color.BROWN + sv.def) + Color.GRAY + ")"); return sb.toString(); } @@ -62,7 +62,7 @@ public class CommandSv extends Command { for(Entry entry : env.getServer().getVariables().entrySet()) { exec.log(this.formatVariable(entry.getKey(), entry.getValue(), "=", true)); } - exec.log(TextColor.GREEN + "SVARs insgesamt registriert: %d", env.getServer().getVariables().size()); + exec.log(Color.GREEN + "SVARs insgesamt registriert: %d", env.getServer().getVariables().size()); return null; } SVar sv = env.getServer().getVariables().get(variable); @@ -82,7 +82,7 @@ public class CommandSv extends Command { Integer.parseInt(value); } catch(NumberFormatException e) { - throw new RunException(TextColor.DARK_RED + "'%s' ist keine gültige Zahl", value); + throw new RunException(Color.DARK_RED + "'%s' ist keine gültige Zahl", value); } } else if(sv.type == ValueType.FLOAT) { @@ -90,7 +90,7 @@ public class CommandSv extends Command { Float.parseFloat(value); } catch(NumberFormatException e) { - throw new RunException(TextColor.DARK_RED + "'%s' ist keine gültige Zahl", value); + throw new RunException(Color.DARK_RED + "'%s' ist keine gültige Zahl", value); } } sv.set(value, false, true); diff --git a/server/src/main/java/server/command/commands/CommandUsers.java b/server/src/main/java/server/command/commands/CommandUsers.java index abf3b5d2..01147ae1 100644 --- a/server/src/main/java/server/command/commands/CommandUsers.java +++ b/server/src/main/java/server/command/commands/CommandUsers.java @@ -2,7 +2,7 @@ package server.command.commands; import java.util.Collection; -import common.util.TextColor; +import common.util.Color; import server.command.Command; import server.command.CommandEnvironment; import server.command.Executor; @@ -16,12 +16,12 @@ public class CommandUsers extends Command { public void exec(CommandEnvironment env, Executor exec) { Collection users = env.getServer().getUsers(); if(users.isEmpty()) { - exec.log(TextColor.DARK_GRAY + "Es sind keine Spieler registriert"); + exec.log(Color.DARK_GRAY + "Es sind keine Spieler registriert"); return; } - exec.log(TextColor.GREEN + "Es " + (users.size() == 1 ? "ist" : "sind") + " " + TextColor.YELLOW + "%d" + TextColor.GREEN + " Spieler registriert", users.size()); + exec.log(Color.GREEN + "Es " + (users.size() == 1 ? "ist" : "sind") + " " + Color.YELLOW + "%d" + Color.GREEN + " Spieler registriert", users.size()); for(User user : users) { - exec.log("%s%s" + TextColor.GRAY + ": %s" + TextColor.GRAY + ", %s", user.isAdmin() ? TextColor.RED : TextColor.NEON, user.getUser(), user.isOnline() ? TextColor.DARK_GREEN + "Online" : TextColor.DARK_GRAY + "Offline", user.getPubkey() != null ? TextColor.YELLOW + "Pubkey" : (user.getPasswordHash() != null ? TextColor.MAGENTA + "Passwort" : TextColor.BLACK + "Kein Login")); + exec.log("%s%s" + Color.GRAY + ": %s" + Color.GRAY + ", %s", user.isAdmin() ? Color.RED : Color.NEON, user.getUser(), user.isOnline() ? Color.DARK_GREEN + "Online" : Color.DARK_GRAY + "Offline", user.getPubkey() != null ? Color.YELLOW + "Pubkey" : (user.getPasswordHash() != null ? Color.MAGENTA + "Passwort" : Color.BLACK + "Kein Login")); } } } diff --git a/server/src/main/java/server/command/commands/CommandWarps.java b/server/src/main/java/server/command/commands/CommandWarps.java index 6f323a9b..284c1d32 100644 --- a/server/src/main/java/server/command/commands/CommandWarps.java +++ b/server/src/main/java/server/command/commands/CommandWarps.java @@ -6,7 +6,7 @@ import java.util.Map.Entry; import common.dimension.Dimension; import common.util.ExtMath; import common.util.Position; -import common.util.TextColor; +import common.util.Color; import server.command.Command; import server.command.CommandEnvironment; import server.command.Executor; @@ -22,7 +22,7 @@ public class CommandWarps extends Command { public void exec(CommandEnvironment env, Executor exec, Dimension dim) { Map warps = env.getServer().getWarps(); if(warps.isEmpty()) { - exec.log(TextColor.DARK_GRAY + "Es sind keine Warps definiert"); + exec.log(Color.DARK_GRAY + "Es sind keine Warps definiert"); return; } int n = 0; @@ -32,15 +32,15 @@ public class CommandWarps extends Command { n++; } if(dim != null && n == 0) { - exec.log(TextColor.DARK_GRAY + "Es sind keine Warps in %s vorhanden", dim.getDisplay()); + exec.log(Color.DARK_GRAY + "Es sind keine Warps in %s vorhanden", dim.getDisplay()); return; } - exec.log(TextColor.GREEN + "Es " + (n == 1 ? "ist" : "sind") + " " + TextColor.YELLOW + "%d" + TextColor.GREEN + " Warp" + (n == 1 ? "" : "s") + " " + (dim == null ? "" : "in Dimension %s ") + "vorhanden", n, dim == null ? null : dim.getDisplay()); + exec.log(Color.GREEN + "Es " + (n == 1 ? "ist" : "sind") + " " + Color.YELLOW + "%d" + Color.GREEN + " Warp" + (n == 1 ? "" : "s") + " " + (dim == null ? "" : "in Dimension %s ") + "vorhanden", n, dim == null ? null : dim.getDisplay()); for(Entry warp : warps.entrySet()) { Position pos = warp.getValue(); Dimension wdim = pos.getDimension(); if(wdim != null && (dim == null || wdim == dim)) - exec.log(TextColor.NEON + "%s" + TextColor.GRAY + ": " + TextColor.ORANGE + "%s" + (dim == null ? " @ " : "") + "%d, %d, %d", warp.getKey(), dim != null ? "" : wdim.getDisplay(), ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord)); + exec.log(Color.NEON + "%s" + Color.GRAY + ": " + Color.ORANGE + "%s" + (dim == null ? " @ " : "") + "%d, %d, %d", warp.getKey(), dim != null ? "" : wdim.getDisplay(), ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord)); } } } diff --git a/server/src/main/java/server/network/LoginHandler.java b/server/src/main/java/server/network/LoginHandler.java index c8a14d90..fe934c98 100755 --- a/server/src/main/java/server/network/LoginHandler.java +++ b/server/src/main/java/server/network/LoginHandler.java @@ -22,7 +22,7 @@ import common.packet.RPacketRequestEncrypt; import common.packet.RPacketResponse; import common.packet.RPacketServerConfig; import common.util.EncryptUtil; -import common.util.TextColor; +import common.util.Color; import server.Server; import server.vars.SVars; @@ -68,7 +68,7 @@ public class LoginHandler implements ILoginHandler public void onDisconnect(String reason) { - Log.NETWORK.info(this.getConnectionInfo() + " wurde beim Login getrennt: " + TextColor.stripCodes(reason)); + Log.NETWORK.info(this.getConnectionInfo() + " wurde beim Login getrennt: " + Color.stripCodes(reason)); } public String getConnectionInfo() diff --git a/server/src/main/java/server/network/Player.java b/server/src/main/java/server/network/Player.java index 90513c30..8ec45c38 100755 --- a/server/src/main/java/server/network/Player.java +++ b/server/src/main/java/server/network/Player.java @@ -116,7 +116,7 @@ import common.util.Facing; import common.util.IntHashMap; import common.util.PortalType; import common.util.Position; -import common.util.TextColor; +import common.util.Color; import common.util.Vec3i; import common.util.WorldPos; import common.vars.Vars; @@ -559,24 +559,24 @@ public class Player extends User implements Executor, IPlayer public void sendPickupMessage(Entity entity, int amount) { if(entity instanceof EntityItem) if(amount == 1) - this.addFeed(TextColor.DARK_GREEN + "* %s aufgelesen", - ((EntityItem)entity).getEntityItem().getColoredName(TextColor.DARK_GREEN)); + this.addFeed(Color.DARK_GREEN + "* %s aufgelesen", + ((EntityItem)entity).getEntityItem().getColoredName(Color.DARK_GREEN)); else - this.addFeed(TextColor.DARK_GREEN + "* %d %s aufgelesen", amount, - ((EntityItem)entity).getEntityItem().getColoredName(TextColor.DARK_GREEN)); + this.addFeed(Color.DARK_GREEN + "* %d %s aufgelesen", amount, + ((EntityItem)entity).getEntityItem().getColoredName(Color.DARK_GREEN)); else if(entity instanceof EntityArrow) - this.addFeed(TextColor.DARK_GREEN + "* Pfeil aufgelesen", amount); + this.addFeed(Color.DARK_GREEN + "* Pfeil aufgelesen", amount); else if(entity instanceof EntityXp) - this.addFeed(TextColor.GREEN + "* %d Erfahrung gesammelt", amount); + this.addFeed(Color.GREEN + "* %d Erfahrung gesammelt", amount); } public void sendThrowMessage(ItemStack stack) { if(stack.getSize() == 1) - this.addFeed(TextColor.DARK_RED + "* %s weg geworfen", - stack.getColoredName(TextColor.DARK_RED)); + this.addFeed(Color.DARK_RED + "* %s weg geworfen", + stack.getColoredName(Color.DARK_RED)); else - this.addFeed(TextColor.DARK_RED + "* %d %s weg geworfen", stack.getSize(), - stack.getColoredName(TextColor.DARK_RED)); + this.addFeed(Color.DARK_RED + "* %d %s weg geworfen", stack.getSize(), + stack.getColoredName(Color.DARK_RED)); } @@ -683,7 +683,7 @@ public class Player extends User implements Executor, IPlayer { if (chest.getLockCode() != null && !this.entity.canOpen(chest.getLockCode())) { - this.addHotbar(TextColor.RED + "%s ist verschlossen!", chest.getName()); + this.addHotbar(Color.RED + "%s ist verschlossen!", chest.getName()); this.sendPacket(new SPacketSoundEffect(SoundEvent.DOOR, this.entity.posX, this.entity.posY, this.entity.posZ, 1.0F)); return; } @@ -1337,14 +1337,14 @@ public class Player extends User implements Executor, IPlayer BlockPos point = pos == null ? this.entity.getPosition() : pos; String msg = this.selectPoint(point, false); if(msg != null) - this.addHotbar(TextColor.DARK_RED + msg); + this.addHotbar(Color.DARK_RED + msg); } private void selectPos2(BlockPos pos) { BlockPos point = pos == null ? this.entity.getPosition() : pos; String msg = this.selectPoint(point, true); if(msg != null) - this.addHotbar(TextColor.MIDNIGHT + msg); + this.addHotbar(Color.MIDNIGHT + msg); } private String selectPoint(BlockPos position, boolean second) { @@ -1389,7 +1389,7 @@ public class Player extends User implements Executor, IPlayer } if(this.edit == EditAction.TRANSFORM && (this.rotation != 0 || this.flipX || this.flipZ)) msg += "; " + this.getRotationInfo(); - this.addHotbar(TextColor.YELLOW + msg); + this.addHotbar(Color.YELLOW + msg); } private int getSelectionArea() { @@ -1433,7 +1433,7 @@ public class Player extends User implements Executor, IPlayer to = to.add(transform.mulX(this.selOffset.getX(), this.selOffset.getZ()), this.selOffset.getY(), transform.mulZ(this.selOffset.getX(), this.selOffset.getZ())); } placer.commit(); - this.addHotbar(TextColor.YELLOW + "Zwischenablage wurde bei %d, %d, %d eingefügt", to.getX(), to.getY(), to.getZ()); + this.addHotbar(Color.YELLOW + "Zwischenablage wurde bei %d, %d, %d eingefügt", to.getX(), to.getY(), to.getZ()); return true; } @@ -1505,7 +1505,7 @@ public class Player extends User implements Executor, IPlayer this.flipX = this.flipZ = false; BlockPos pos = this.entity.getPosition(); this.selOffset = new Vec3i(mx - pos.getX(), my - pos.getY(), mz - pos.getZ()); - this.addHotbar(TextColor.YELLOW + "Auswahl wurde in die Zwischenablage kopiert"); + this.addHotbar(Color.YELLOW + "Auswahl wurde in die Zwischenablage kopiert"); return true; } @@ -1534,7 +1534,7 @@ public class Player extends User implements Executor, IPlayer else return; String info = this.getRotationInfo(); - this.addHotbar(TextColor.YELLOW + (info.isEmpty() ? "Keine Drehung" : info)); + this.addHotbar(Color.YELLOW + (info.isEmpty() ? "Keine Drehung" : info)); } private void rotateClipboard() { @@ -1542,7 +1542,7 @@ public class Player extends User implements Executor, IPlayer return; this.rotation = (this.rotation + 90) % 360; String info = this.getRotationInfo(); - this.addHotbar(TextColor.YELLOW + (info.isEmpty() ? "Keine Drehung" : info)); + this.addHotbar(Color.YELLOW + (info.isEmpty() ? "Keine Drehung" : info)); } public TagObject readCharacter() { @@ -1576,7 +1576,7 @@ public class Player extends User implements Executor, IPlayer public void onDisconnect(String reason) { - Log.NETWORK.info(this.getUser() + " wurde getrennt: " + TextColor.stripCodes(reason)); + Log.NETWORK.info(this.getUser() + " wurde getrennt: " + Color.stripCodes(reason)); this.server.sendPacket(new SPacketMessage(String.format("%s hat das Spiel verlassen", this.getUser()), Type.FEED)); this.server.removePlayer(this); } @@ -1690,10 +1690,10 @@ public class Player extends User implements Executor, IPlayer Player target = this.server.getPlayer(space < 0 ? line.substring(1) : line.substring(1, space)); if(target == null) return false; - target.addChat(this.entity.getColoredName(TextColor.LIGHT_GRAY) + " -> " + target.entity.getColoredName(TextColor.LIGHT_GRAY) + " " + + target.addChat(this.entity.getColoredName(Color.LIGHT_GRAY) + " -> " + target.entity.getColoredName(Color.LIGHT_GRAY) + " " + line); if(target != this) - this.addChat(target.entity.getColoredName(TextColor.LIGHT_GRAY) + " -> " + this.entity.getColoredName(TextColor.LIGHT_GRAY) + " " + + this.addChat(target.entity.getColoredName(Color.LIGHT_GRAY) + " -> " + this.entity.getColoredName(Color.LIGHT_GRAY) + " " + line); return true; } @@ -1704,7 +1704,7 @@ public class Player extends User implements Executor, IPlayer String str = line.substring(1).trim(); if(str.isEmpty()) return false; - this.server.sendPacket(new SPacketMessage(String.format(TextColor.LIGHT_GRAY + "* %s %s", this.entity.getColoredName(TextColor.LIGHT_GRAY), str), Type.CHAT)); + this.server.sendPacket(new SPacketMessage(String.format(Color.LIGHT_GRAY + "* %s %s", this.entity.getColoredName(Color.LIGHT_GRAY), str), Type.CHAT)); return true; } @@ -1715,7 +1715,7 @@ public class Player extends User implements Executor, IPlayer this.entity.flying &= this.entity.hasEffect(Effect.FLYING) || this.entity.canNaturallyFly(); this.entity.fallDistance = 0.0F; this.sendPlayerAbilities(); - this.addFeed(TextColor.RED + "NoClip wurde deaktiviert"); + this.addFeed(Color.RED + "NoClip wurde deaktiviert"); } } @@ -1873,7 +1873,7 @@ public class Player extends User implements Executor, IPlayer if(this.isAdmin()) this.server.getScriptEnvironment().execute(command, this); else - this.addConsole(TextColor.DARK_RED + "Nur Admins können Befehle ausführen"); + this.addConsole(Color.DARK_RED + "Nur Admins können Befehle ausführen"); } private List completeCommand(String command) { @@ -1891,7 +1891,7 @@ public class Player extends User implements Executor, IPlayer public void log(String msg) { if(this.forcedExec != null) - this.forcedExec.log(TextColor.ACID + "Als " + TextColor.GREEN + "%s" + TextColor.DARK_GRAY + ": " + TextColor.RESET + "%s", this.getUser(), msg); + this.forcedExec.log(Color.ACID + "Als " + Color.GREEN + "%s" + Color.DARK_GRAY + ": " + Color.RESET + "%s", this.getUser(), msg); else this.addConsole(msg); } @@ -1934,7 +1934,7 @@ public class Player extends User implements Executor, IPlayer case CHAT: if(!this.sendPlayer(msg) && !this.sendEmote(msg)) - this.server.sendPacket(new SPacketMessage(String.format("%s %s", this.entity.getColoredName(TextColor.LIGHT_GRAY), msg), Type.CHAT)); + this.server.sendPacket(new SPacketMessage(String.format("%s %s", this.entity.getColoredName(Color.LIGHT_GRAY), msg), Type.CHAT)); break; case DISPLAY: @@ -2653,14 +2653,14 @@ public class Player extends User implements Executor, IPlayer if(this.isAdmin()) { boolean god = !this.entity.hasEffect(Effect.HASTE) || this.entity.getEffect(Effect.HASTE).getAmplifier() != 255; this.entity.setGodMode(god); - this.addFeed(god ? (TextColor.GREEN + "Statuseffekte wurden hinzugefügt") : (TextColor.RED + "Statuseffekte wurden entfernt")); + this.addFeed(god ? (Color.GREEN + "Statuseffekte wurden hinzugefügt") : (Color.RED + "Statuseffekte wurden entfernt")); } break; case NOCLIP: if(this.isAdmin()) { this.entity.setNoclip(!this.entity.noclip); - this.addFeed((this.entity.noclip ? TextColor.GREEN : TextColor.RED) + "NoClip ist jetzt " + (this.entity.noclip ? "eingeschaltet" : "ausgeschaltet")); + this.addFeed((this.entity.noclip ? Color.GREEN : Color.RED) + "NoClip ist jetzt " + (this.entity.noclip ? "eingeschaltet" : "ausgeschaltet")); } break; @@ -2670,7 +2670,7 @@ public class Player extends User implements Executor, IPlayer this.entity.removeEffect(Effect.SPEED); else this.entity.addEffect(new StatusEffect(Effect.SPEED, Integer.MAX_VALUE, 19)); - this.addFeed(TextColor.GREEN + "Deine Geschwindigkeit wurde auf %dx geändert", (int)(this.entity.getAIMoveSpeed() * 10.0f)); + this.addFeed(Color.GREEN + "Deine Geschwindigkeit wurde auf %dx geändert", (int)(this.entity.getAIMoveSpeed() * 10.0f)); // int speed = this.playerEntity.speed != 1.0f ? 1 : 5; // this.playerEntity.speed = (float)speed; // this.playerEntity.sendPlayerAbilities(); @@ -2684,7 +2684,7 @@ public class Player extends User implements Executor, IPlayer this.entity.setHealth(this.entity.getMaxHealth()); this.entity.setManaPoints(this.entity.getMaxMana()); this.entity.clearEffects(true); - this.addFeed(TextColor.DARK_GREEN + "Du wurdest geheilt"); + this.addFeed(Color.DARK_GREEN + "Du wurdest geheilt"); } break; @@ -2745,7 +2745,7 @@ public class Player extends User implements Executor, IPlayer mem = Runtime.getRuntime().freeMemory() - mem; mem = mem < 0L ? 0L : mem; // sender.addConsole("Server-JVM GC ausgeführt: ", ); - this.addFeed(TextColor.DARK_GREEN + "%s%s MB freigegeben, %s MB von %s MB verwendet (%s %%)", worlds > 0 ? worlds + " entladen, " : "", mem / 1024L / 1024L, (Runtime.getRuntime().totalMemory() - + this.addFeed(Color.DARK_GREEN + "%s%s MB freigegeben, %s MB von %s MB verwendet (%s %%)", worlds > 0 ? worlds + " entladen, " : "", mem / 1024L / 1024L, (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024L / 1024L, Runtime.getRuntime().totalMemory() / 1024L / 1024L, Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory()); } @@ -2919,11 +2919,11 @@ public class Player extends User implements Executor, IPlayer if(!slot.isItemValid(stack)) return; if(old.getSize() == 1) - this.addFeed(TextColor.DARK_RED + "* %s zerstört", - old.getColoredName(TextColor.DARK_RED)); + this.addFeed(Color.DARK_RED + "* %s zerstört", + old.getColoredName(Color.DARK_RED)); else - this.addFeed(TextColor.DARK_RED + "* %d %s zerstört", old.getSize(), - old.getColoredName(TextColor.DARK_RED)); + this.addFeed(Color.DARK_RED + "* %d %s zerstört", old.getSize(), + old.getColoredName(Color.DARK_RED)); } } else if(!slot.isItemValid(stack)) @@ -2933,11 +2933,11 @@ public class Player extends User implements Executor, IPlayer this.entity.openContainer.detectAndSendChanges(); this.entity.worldObj.playSoundAtEntity(this.entity, SoundEvent.POP, 0.2F); if(amount == 1) - this.addFeed(TextColor.DARK_GREEN + "* %s geschummelt", - stack.getColoredName(TextColor.DARK_GREEN)); + this.addFeed(Color.DARK_GREEN + "* %s geschummelt", + stack.getColoredName(Color.DARK_GREEN)); else - this.addFeed(TextColor.DARK_GREEN + "* %d %s geschummelt", amount, - stack.getColoredName(TextColor.DARK_GREEN)); + this.addFeed(Color.DARK_GREEN + "* %d %s geschummelt", amount, + stack.getColoredName(Color.DARK_GREEN)); } public void processSign(CPacketSign packetIn) @@ -2971,7 +2971,7 @@ public class Player extends User implements Executor, IPlayer // boolean color = this.playerEntity.canUse(Permissions.SIGNFORMAT); for (int i = 0; i < lines.length; ++i) { - tileentitysign.text[i] = TextColor.stripCodes(lines[i]); // lines[i]; // color ? lines[i] : ChatFormat.stripCodes(lines[i]); + tileentitysign.text[i] = Color.stripCodes(lines[i]); // lines[i]; // color ? lines[i] : ChatFormat.stripCodes(lines[i]); } // if(this.signCommand != null) { diff --git a/server/src/main/java/server/world/Converter.java b/server/src/main/java/server/world/Converter.java index e2e21173..d785607c 100644 --- a/server/src/main/java/server/world/Converter.java +++ b/server/src/main/java/server/world/Converter.java @@ -108,7 +108,7 @@ import common.util.BlockPos; import common.util.Facing; import common.util.Facing.Axis; import common.util.NibbleArray; -import common.util.TextColor; +import common.util.Color; import common.world.State; public abstract class Converter { @@ -290,9 +290,9 @@ public abstract class Converter { private static final Map ENTITY_MAP = Maps.newHashMap(); private static final Map> TILE_MAP = Maps.newHashMap(); private static final State[] BLOCK_MAP = new State[65536]; - private static final TextColor[] COLOR_LOOKUP = new TextColor[] { - TextColor.WHITE, TextColor.ORANGE, TextColor.MAGENTA, TextColor.LIGHT_BLUE, TextColor.YELLOW, TextColor.GREEN, TextColor.MAGENTA, TextColor.GRAY, - TextColor.LIGHT_GRAY, TextColor.CYAN, TextColor.VIOLET, TextColor.BLUE, TextColor.BROWN, TextColor.DARK_GREEN, TextColor.RED, TextColor.BLACK + private static final Color[] COLOR_LOOKUP = new Color[] { + Color.WHITE, Color.ORANGE, Color.MAGENTA, Color.LIGHT_BLUE, Color.YELLOW, Color.GREEN, Color.MAGENTA, Color.GRAY, + Color.LIGHT_GRAY, Color.CYAN, Color.VIOLET, Color.BLUE, Color.BROWN, Color.DARK_GREEN, Color.RED, Color.BLACK }; private static void mapEntity(Class clazz, String ... names) {