diff options
author | Tec <daniel112092@gmail.com> | 2022-02-08 19:43:58 +0100 |
---|---|---|
committer | Tec <daniel112092@gmail.com> | 2022-02-08 19:43:58 +0100 |
commit | c3362115cbad2396a7b53d60c3f2ac54f3c2cb06 (patch) | |
tree | 69dbfe6b351530b10685c797db79280968718fe5 /src/main/java | |
parent | b2ef85e9d1ca3a87fcdc680503303c3784c83677 (diff) | |
download | GT5-Unofficial-c3362115cbad2396a7b53d60c3f2ac54f3c2cb06.tar.gz GT5-Unofficial-c3362115cbad2396a7b53d60c3f2ac54f3c2cb06.tar.bz2 GT5-Unofficial-c3362115cbad2396a7b53d60c3f2ac54f3c2cb06.zip |
Small changes
Diffstat (limited to 'src/main/java')
4 files changed, 93 insertions, 21 deletions
diff --git a/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java b/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java index 826ed3af5d..60c3df47f9 100644 --- a/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java +++ b/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java @@ -7,9 +7,13 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; +import java.io.IOException; +import java.io.InputStream; + @SideOnly(Side.CLIENT) public class TecTechFontRender extends FontRenderer { public static final TecTechFontRender INSTANCE = new TecTechFontRender(); @@ -52,15 +56,15 @@ public class TecTechFontRender extends FontRenderer { p_78258_4_ = (p_78258_4_ & 16579836) >> 2 | p_78258_4_ & -16777216; } - this.red = (float)(p_78258_4_ >> 16 & 255) / 255.0F; - this.blue = (float)(p_78258_4_ >> 8 & 255) / 255.0F; - this.green = (float)(p_78258_4_ & 255) / 255.0F; - this.alpha = (float)(p_78258_4_ >> 24 & 255) / 255.0F; + this.red = (float) (p_78258_4_ >> 16 & 255) / 255.0F; + this.blue = (float) (p_78258_4_ >> 8 & 255) / 255.0F; + this.green = (float) (p_78258_4_ & 255) / 255.0F; + this.alpha = (float) (p_78258_4_ >> 24 & 255) / 255.0F; this.setColor(this.red, this.blue, this.green, this.alpha); - this.posX = (float)p_78258_2_; - this.posY = (float)p_78258_3_; + this.posX = (float) p_78258_2_; + this.posY = (float) p_78258_3_; this.renderStringAtPos(p_78258_1_, p_78258_5_); - return (int)this.posX; + return (int) this.posX; } } @@ -75,10 +79,10 @@ public class TecTechFontRender extends FontRenderer { } private void renderStringAtPos(String p_78255_1_, boolean p_78255_2_) { - for(int i = 0; i < p_78255_1_.length(); ++i) { + for (int i = 0; i < p_78255_1_.length(); ++i) { char c0 = p_78255_1_.charAt(i); - int j; - int k; + int j; + int k; if (c0 == 167 && i + 1 < p_78255_1_.length()) { j = "0123456789abcdefklmnor".indexOf(p_78255_1_.toLowerCase().charAt(i + 1)); if (j < 16) { @@ -97,7 +101,7 @@ public class TecTechFontRender extends FontRenderer { k = this.colorCode[j]; this.textColor = k; - this.setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha); + this.setColor((float) (k >> 16) / 255.0F, (float) (k >> 8 & 255) / 255.0F, (float) (k & 255) / 255.0F, this.alpha); } else if (j == 16) { this.randomStyle = true; } else if (j == 17) { @@ -123,12 +127,12 @@ public class TecTechFontRender extends FontRenderer { if (this.randomStyle && j != -1) { do { k = this.fontRandom.nextInt(this.charWidth.length); - } while(this.charWidth[j] != this.charWidth[k]); + } while (this.charWidth[j] != this.charWidth[k]); j = k; } - float f1 = this.unicodeFlag ? 0.5F : 1.0F; + float f1 = this.unicodeFlag ? 0.5F : 1.0F; boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_; if (flag1) { this.posX -= f1; @@ -164,11 +168,51 @@ public class TecTechFontRender extends FontRenderer { } + @Override + protected void doDraw(float f) { + Tessellator tessellator = Tessellator.instance; + + if (this.strikethroughStyle) { + GL11.glDisable(GL11.GL_TEXTURE_2D); + tessellator.startDrawingQuads(); + tessellator.addVertex(this.posX, this.posY + (float) (this.FONT_HEIGHT / 2), 0.0D); + tessellator.addVertex(this.posX + f, this.posY + (float) (this.FONT_HEIGHT / 2), 0.0D); + tessellator.addVertex(this.posX + f, this.posY + (float) (this.FONT_HEIGHT / 2) - 1.0F, 0.0D); + tessellator.addVertex(this.posX, this.posY + (float) (this.FONT_HEIGHT / 2) - 1.0F, 0.0D); + tessellator.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + if (this.underlineStyle) { + GL11.glDisable(GL11.GL_TEXTURE_2D); + tessellator.startDrawingQuads(); + int l = this.underlineStyle ? -1 : 0; + tessellator.addVertex(this.posX + (float) l, this.posY + (float) this.FONT_HEIGHT, 0.0D); + tessellator.addVertex(this.posX + f, this.posY + (float) this.FONT_HEIGHT, 0.0D); + tessellator.addVertex(this.posX + f, this.posY + (float) this.FONT_HEIGHT - 1.0F, 0.0D); + tessellator.addVertex(this.posX + (float) l, this.posY + (float) this.FONT_HEIGHT - 1.0F, 0.0D); + tessellator.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + this.posX += (float) ((int) f); + } + private float renderCharAtPos(int p_78278_1_, char p_78278_2_, boolean p_78278_3_) { return p_78278_2_ == ' ' ? 4.0F : ("\u00C0\u00C1\u00C2\u00C8\u00CA\u00CB\u00CD\u00D3\u00D4\u00D5\u00DA\u00DF\u00E3\u00F5\u011F\u0130\u0131\u0152\u0153\u015E\u015F\u0174\u0175\u017E\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7\u00EA\u00EB\u00E8\u00EF\u00EE\u00EC\u00C4\u00C5\u00C9\u00E6\u00C6\u00F4\u00F6\u00F2\u00FB\u00F9\u00FF\u00D6\u00DC\u00F8\u00A3\u00D8\u00D7\u0192\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA\u00BF\u00AE\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\u03B2\u0393\u03C0\u03A3\u03C3\u03BC\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u2205\u2208\u2229\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u0000".indexOf(p_78278_2_) != -1 && !this.unicodeFlag ? this.renderDefaultChar(p_78278_1_, p_78278_3_) : this.renderUnicodeChar(p_78278_2_, p_78278_3_)); } @Override + protected float renderDefaultChar(int p_78266_1_, boolean p_78266_2_) { + return super.renderDefaultChar(p_78266_1_, p_78266_2_); + } + + @Override + protected float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_) { + return super.renderUnicodeChar(p_78277_1_, p_78277_2_); + } + + @Override public int drawString(String str, int x, int y, int color, boolean dropShadow) { switch (Minecraft.getMinecraft().gameSettings.guiScale) { case 0: @@ -306,6 +350,26 @@ public class TecTechFontRender extends FontRenderer { } } + @Override + protected void setColor(float r, float g, float b, float a) { + super.setColor(r, g, b, a); + } + + @Override + protected void enableAlpha() { + super.enableAlpha(); + } + + @Override + protected void bindTexture(ResourceLocation location) { + super.bindTexture(location); + } + + @Override + protected InputStream getResourceInputStream(ResourceLocation location) throws IOException { + return super.getResourceInputStream(location); + } + private int drawStringFront(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_) { GL11.glEnable(3008); resetStyles(); diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java index 32b0893d8b..fdbd98fee0 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java +++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java @@ -24,6 +24,11 @@ public class CancerCommand implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) { if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) { + EntityPlayerMP player=(EntityPlayerMP)sender; + if(args==null || args.length==0){ + sender.addChatMessage(new ChatComponentText("Cancer amount: "+TecTech.anomalyHandler.getCancer(player))); + return; + } double amount; try { amount = Double.parseDouble(args[0]); @@ -31,11 +36,6 @@ public class CancerCommand implements ICommand { sender.addChatMessage(new ChatComponentText("Cannot parse amount!")); return; } - if(amount<0||amount>2){ - sender.addChatMessage(new ChatComponentText("Invalid amount provided!")); - return; - } - EntityPlayerMP player=(EntityPlayerMP)sender; if(player.capabilities.isCreativeMode){ sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!")); }else { @@ -67,7 +67,7 @@ public class CancerCommand implements ICommand { @Override public String getCommandUsage(ICommandSender p_71518_1_) { - return "cancer_EM [Amount 0.0-2.0]"; + return "cancer_EM [Amount]"; } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java index 4190cd0dba..b486b73295 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java +++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java @@ -20,6 +20,11 @@ public class ChargeCommand implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) { if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) { + EntityPlayerMP player=(EntityPlayerMP)sender; + if(args==null || args.length==0){ + sender.addChatMessage(new ChatComponentText("Charge amount: "+TecTech.anomalyHandler.getCharge(player))); + return; + } double amount; try { amount = Double.parseDouble(args[0]); @@ -27,7 +32,6 @@ public class ChargeCommand implements ICommand { sender.addChatMessage(new ChatComponentText("Cannot parse amount!")); return; } - EntityPlayerMP player=(EntityPlayerMP)sender; if(player.capabilities.isCreativeMode){ sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!")); }else { diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/MassCommand.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/MassCommand.java index 3d0ade5082..05bba9433b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/MassCommand.java +++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/MassCommand.java @@ -20,6 +20,11 @@ public class MassCommand implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) { if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) { + EntityPlayerMP player=(EntityPlayerMP)sender; + if(args==null || args.length==0){ + sender.addChatMessage(new ChatComponentText("Msdd amount: "+TecTech.anomalyHandler.getMass(player))); + return; + } double amount; try { amount = Double.parseDouble(args[0]); @@ -27,7 +32,6 @@ public class MassCommand implements ICommand { sender.addChatMessage(new ChatComponentText("Cannot parse amount!")); return; } - EntityPlayerMP player=(EntityPlayerMP)sender; if(player.capabilities.isCreativeMode){ sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!")); }else { |