Fixed minor bugs
This commit is contained in:
parent
c591161ba5
commit
30ad33dcef
Binary file not shown.
|
@ -1,28 +1,20 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class ChatClickData
|
public class ChatClickData {
|
||||||
{
|
|
||||||
public static final Pattern pattern = Pattern.compile("^(?:(https?)://)?([-\\w_\\.]{2,}\\.[a-z]{2,4})(/\\S*)?$");
|
public static final Pattern pattern = Pattern.compile("^(?:(https?)://)?([-\\w_\\.]{2,}\\.[a-z]{2,4})(/\\S*)?$");
|
||||||
private final FontRenderer fontR;
|
private final FontRenderer fontR;
|
||||||
private final ChatLine line;
|
private final ChatLine line;
|
||||||
private final int field_78312_d;
|
|
||||||
private final int field_78313_e;
|
|
||||||
private final String field_78310_f;
|
private final String field_78310_f;
|
||||||
|
|
||||||
/** The URL which was clicked on. */
|
/** The URL which was clicked on. */
|
||||||
private final String clickedUrl;
|
private final String clickedUrl;
|
||||||
|
|
||||||
public ChatClickData(FontRenderer par1FontRenderer, ChatLine par2ChatLine, int par3, int par4)
|
public ChatClickData(FontRenderer par1FontRenderer, ChatLine par2ChatLine, int par3, int par4) {
|
||||||
{
|
|
||||||
this.fontR = par1FontRenderer;
|
this.fontR = par1FontRenderer;
|
||||||
this.line = par2ChatLine;
|
this.line = par2ChatLine;
|
||||||
this.field_78312_d = par3;
|
|
||||||
this.field_78313_e = par4;
|
|
||||||
this.field_78310_f = par1FontRenderer.trimStringToWidth(par2ChatLine.getChatLineString(), par3);
|
this.field_78310_f = par1FontRenderer.trimStringToWidth(par2ChatLine.getChatLineString(), par3);
|
||||||
this.clickedUrl = this.findClickedUrl();
|
this.clickedUrl = this.findClickedUrl();
|
||||||
}
|
}
|
||||||
|
@ -30,62 +22,45 @@ public class ChatClickData
|
||||||
/**
|
/**
|
||||||
* Gets the URL which was clicked on.
|
* Gets the URL which was clicked on.
|
||||||
*/
|
*/
|
||||||
public String getClickedUrl()
|
public String getClickedUrl() {
|
||||||
{
|
|
||||||
return this.clickedUrl;
|
return this.clickedUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* computes the URI from the clicked chat data object
|
* computes the URI from the clicked chat data object
|
||||||
*/
|
*/
|
||||||
public URI getURI()
|
public String getURI() {
|
||||||
{
|
|
||||||
String var1 = this.getClickedUrl();
|
String var1 = this.getClickedUrl();
|
||||||
|
|
||||||
if (var1 == null)
|
if (var1 == null) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
Matcher var2 = pattern.matcher(var1);
|
Matcher var2 = pattern.matcher(var1);
|
||||||
|
|
||||||
if (var2.matches())
|
if (var2.matches()) {
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
String var3 = var2.group(0);
|
String var3 = var2.group(0);
|
||||||
|
|
||||||
if (var2.group(1) == null)
|
if (var2.group(1) == null) {
|
||||||
{
|
|
||||||
var3 = "http://" + var3;
|
var3 = "http://" + var3;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new URI(var3);
|
return var3;
|
||||||
}
|
|
||||||
catch (URISyntaxException var4)
|
|
||||||
{
|
|
||||||
System.err.printf("Couldn\'t create URI from chat", var4);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String findClickedUrl()
|
private String findClickedUrl() {
|
||||||
{
|
|
||||||
int var1 = this.field_78310_f.lastIndexOf(" ", this.field_78310_f.length()) + 1;
|
int var1 = this.field_78310_f.lastIndexOf(" ", this.field_78310_f.length()) + 1;
|
||||||
|
|
||||||
if (var1 < 0)
|
if (var1 < 0) {
|
||||||
{
|
|
||||||
var1 = 0;
|
var1 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int var2 = this.line.getChatLineString().indexOf(" ", var1);
|
int var2 = this.line.getChatLineString().indexOf(" ", var1);
|
||||||
|
|
||||||
if (var2 < 0)
|
if (var2 < 0) {
|
||||||
{
|
|
||||||
var2 = this.line.getChatLineString().length();
|
var2 = this.line.getChatLineString().length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,99 +6,60 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public enum EnumChatFormatting
|
public enum EnumChatFormatting {
|
||||||
{
|
BLACK('0'), DARK_BLUE('1'), DARK_GREEN('2'), DARK_AQUA('3'), DARK_RED('4'), DARK_PURPLE('5'), GOLD('6'), GRAY('7'), DARK_GRAY('8'), BLUE('9'), GREEN('a'), AQUA('b'), RED('c'), LIGHT_PURPLE('d'), YELLOW('e'), WHITE('f'),
|
||||||
BLACK('0'),
|
OBFUSCATED('k', true), BOLD('l', true), STRIKETHROUGH('m', true), UNDERLINE('n', true), ITALIC('o', true), RESET('r');
|
||||||
DARK_BLUE('1'),
|
|
||||||
DARK_GREEN('2'),
|
|
||||||
DARK_AQUA('3'),
|
|
||||||
DARK_RED('4'),
|
|
||||||
DARK_PURPLE('5'),
|
|
||||||
GOLD('6'),
|
|
||||||
GRAY('7'),
|
|
||||||
DARK_GRAY('8'),
|
|
||||||
BLUE('9'),
|
|
||||||
GREEN('a'),
|
|
||||||
AQUA('b'),
|
|
||||||
RED('c'),
|
|
||||||
LIGHT_PURPLE('d'),
|
|
||||||
YELLOW('e'),
|
|
||||||
WHITE('f'),
|
|
||||||
OBFUSCATED('k', true),
|
|
||||||
BOLD('l', true),
|
|
||||||
STRIKETHROUGH('m', true),
|
|
||||||
UNDERLINE('n', true),
|
|
||||||
ITALIC('o', true),
|
|
||||||
RESET('r');
|
|
||||||
private static final Map field_96321_w = new HashMap();
|
private static final Map field_96321_w = new HashMap();
|
||||||
private static final Map field_96331_x = new HashMap();
|
private static final Map field_96331_x = new HashMap();
|
||||||
private static final Pattern field_96330_y = Pattern.compile("(?i)" + String.valueOf('\u00a7') + "[0-9A-FK-OR]");
|
private static final Pattern field_96330_y = Pattern.compile("(?i)" + String.valueOf((char)0x00a7) + "[0-9A-FK-OR]");
|
||||||
private final char field_96329_z;
|
private final char field_96329_z;
|
||||||
private final boolean field_96303_A;
|
private final boolean field_96303_A;
|
||||||
private final String field_96304_B;
|
private final String field_96304_B;
|
||||||
|
|
||||||
private EnumChatFormatting(char par3)
|
private EnumChatFormatting(char par3) {
|
||||||
{
|
|
||||||
this(par3, false);
|
this(par3, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private EnumChatFormatting(char par3, boolean par4)
|
private EnumChatFormatting(char par3, boolean par4) {
|
||||||
{
|
|
||||||
this.field_96329_z = par3;
|
this.field_96329_z = par3;
|
||||||
this.field_96303_A = par4;
|
this.field_96303_A = par4;
|
||||||
this.field_96304_B = "\u00a7" + par3;
|
this.field_96304_B = "" + (char)0x00a7 + par3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public char func_96298_a()
|
public char func_96298_a() {
|
||||||
{
|
|
||||||
return this.field_96329_z;
|
return this.field_96329_z;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean func_96301_b()
|
public boolean func_96301_b() {
|
||||||
{
|
|
||||||
return this.field_96303_A;
|
return this.field_96303_A;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public boolean func_96302_c() {
|
||||||
* Checks if typo is a color.
|
|
||||||
*/
|
|
||||||
public boolean isColor()
|
|
||||||
{
|
|
||||||
return !this.field_96303_A && this != RESET;
|
return !this.field_96303_A && this != RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String func_96297_d()
|
public String func_96297_d() {
|
||||||
{
|
|
||||||
return this.name().toLowerCase();
|
return this.name().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
|
||||||
return this.field_96304_B;
|
return this.field_96304_B;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String func_110646_a(String par0Str)
|
public static EnumChatFormatting func_96300_b(String par0Str) {
|
||||||
{
|
return par0Str == null ? null : (EnumChatFormatting) field_96331_x.get(par0Str.toLowerCase());
|
||||||
return par0Str == null ? null : field_96330_y.matcher(par0Str).replaceAll("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnumChatFormatting func_96300_b(String par0Str)
|
public static Collection func_96296_a(boolean par0, boolean par1) {
|
||||||
{
|
|
||||||
return par0Str == null ? null : (EnumChatFormatting)field_96331_x.get(par0Str.toLowerCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Collection func_96296_a(boolean par0, boolean par1)
|
|
||||||
{
|
|
||||||
ArrayList var2 = new ArrayList();
|
ArrayList var2 = new ArrayList();
|
||||||
EnumChatFormatting[] var3 = values();
|
EnumChatFormatting[] var3 = values();
|
||||||
int var4 = var3.length;
|
int var4 = var3.length;
|
||||||
|
|
||||||
for (int var5 = 0; var5 < var4; ++var5)
|
for (int var5 = 0; var5 < var4; ++var5) {
|
||||||
{
|
|
||||||
EnumChatFormatting var6 = var3[var5];
|
EnumChatFormatting var6 = var3[var5];
|
||||||
|
|
||||||
if ((!var6.isColor() || par0) && (!var6.func_96301_b() || par1))
|
if ((!var6.func_96302_c() || par0) && (!var6.func_96301_b() || par1)) {
|
||||||
{
|
|
||||||
var2.add(var6.func_96297_d());
|
var2.add(var6.func_96297_d());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,8 +71,7 @@ public enum EnumChatFormatting
|
||||||
EnumChatFormatting[] var0 = values();
|
EnumChatFormatting[] var0 = values();
|
||||||
int var1 = var0.length;
|
int var1 = var0.length;
|
||||||
|
|
||||||
for (int var2 = 0; var2 < var1; ++var2)
|
for (int var2 = 0; var2 < var1; ++var2) {
|
||||||
{
|
|
||||||
EnumChatFormatting var3 = var0[var2];
|
EnumChatFormatting var3 = var0[var2];
|
||||||
field_96321_w.put(Character.valueOf(var3.func_96298_a()), var3);
|
field_96321_w.put(Character.valueOf(var3.func_96298_a()), var3);
|
||||||
field_96331_x.put(var3.func_96297_d(), var3);
|
field_96331_x.put(var3.func_96297_d(), var3);
|
||||||
|
|
|
@ -1,50 +1,49 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GuiChat extends GuiScreen
|
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||||
{
|
|
||||||
|
public class GuiChat extends GuiScreen {
|
||||||
private String field_73898_b = "";
|
private String field_73898_b = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* keeps position of which chat message you will select when you press up, (does not increase for duplicated
|
* keeps position of which chat message you will select when you press up, (does
|
||||||
* messages sent immediately after each other)
|
* not increase for duplicated messages sent immediately after each other)
|
||||||
*/
|
*/
|
||||||
private int sentHistoryCursor = -1;
|
private int sentHistoryCursor = -1;
|
||||||
private boolean field_73897_d;
|
private boolean field_73897_d = false;
|
||||||
private boolean field_73905_m;
|
private boolean field_73905_m = false;
|
||||||
private int field_73903_n;
|
private int field_73903_n = 0;
|
||||||
private List field_73904_o = new ArrayList();
|
private List field_73904_o = new ArrayList();
|
||||||
|
|
||||||
/** used to pass around the URI to various dialogues and to the host os */
|
/** used to pass around the URI to various dialogues and to the host os */
|
||||||
private URI clickedURI;
|
private String clickedURI = null;
|
||||||
|
|
||||||
/** Chat entry field */
|
/** Chat entry field */
|
||||||
protected GuiTextField inputField;
|
protected GuiTextField inputField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* is the text that appears when you press the chat key and the input box appears pre-filled
|
* is the text that appears when you press the chat key and the input box
|
||||||
|
* appears pre-filled
|
||||||
*/
|
*/
|
||||||
private String defaultInputFieldText = "";
|
private String defaultInputFieldText = "";
|
||||||
|
|
||||||
public GuiChat() {}
|
public GuiChat() {
|
||||||
|
}
|
||||||
|
|
||||||
public GuiChat(String par1Str)
|
public GuiChat(String par1Str) {
|
||||||
{
|
|
||||||
this.defaultInputFieldText = par1Str;
|
this.defaultInputFieldText = par1Str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the buttons (and other controls) to the screen in question.
|
* Adds the buttons (and other controls) to the screen in question.
|
||||||
*/
|
*/
|
||||||
public void initGui()
|
public void initGui() {
|
||||||
{
|
|
||||||
EaglerAdapter.enableRepeatEvents(true);
|
EaglerAdapter.enableRepeatEvents(true);
|
||||||
|
this.buttonList.add(new GuiButton(69, this.width - 100, 3, 97, 20, "Exit Chat"));
|
||||||
this.sentHistoryCursor = this.mc.ingameGUI.getChatGUI().getSentMessages().size();
|
this.sentHistoryCursor = this.mc.ingameGUI.getChatGUI().getSentMessages().size();
|
||||||
this.inputField = new GuiTextField(this.fontRenderer, 4, this.height - 12, this.width - 4, 12);
|
this.inputField = new GuiTextField(this.fontRenderer, 4, this.height - 12, this.width - 4, 12);
|
||||||
this.inputField.setMaxStringLength(100);
|
this.inputField.setMaxStringLength(100);
|
||||||
|
@ -54,11 +53,16 @@ public class GuiChat extends GuiScreen
|
||||||
this.inputField.setCanLoseFocus(false);
|
this.inputField.setCanLoseFocus(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||||
|
if (par1GuiButton.id == 69) {
|
||||||
|
this.mc.displayGuiScreen(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the screen is unloaded. Used to disable keyboard repeat events
|
* Called when the screen is unloaded. Used to disable keyboard repeat events
|
||||||
*/
|
*/
|
||||||
public void onGuiClosed()
|
public void onGuiClosed() {
|
||||||
{
|
|
||||||
EaglerAdapter.enableRepeatEvents(false);
|
EaglerAdapter.enableRepeatEvents(false);
|
||||||
this.mc.ingameGUI.getChatGUI().resetScroll();
|
this.mc.ingameGUI.getChatGUI().resetScroll();
|
||||||
}
|
}
|
||||||
|
@ -66,94 +70,67 @@ public class GuiChat extends GuiScreen
|
||||||
/**
|
/**
|
||||||
* Called from the main game loop to update the screen.
|
* Called from the main game loop to update the screen.
|
||||||
*/
|
*/
|
||||||
public void updateScreen()
|
public void updateScreen() {
|
||||||
{
|
|
||||||
this.inputField.updateCursorCounter();
|
this.inputField.updateCursorCounter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
|
* Fired when a key is typed. This is the equivalent of
|
||||||
|
* KeyListener.keyTyped(KeyEvent e).
|
||||||
*/
|
*/
|
||||||
protected void keyTyped(char par1, int par2)
|
protected void keyTyped(char par1, int par2) {
|
||||||
{
|
|
||||||
this.field_73905_m = false;
|
this.field_73905_m = false;
|
||||||
|
|
||||||
if (par2 == 15)
|
if (par2 == 15) {
|
||||||
{
|
|
||||||
this.completePlayerName();
|
this.completePlayerName();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
this.field_73897_d = false;
|
this.field_73897_d = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (par2 == 1)
|
if (par2 == 1) {
|
||||||
{
|
this.mc.displayGuiScreen((GuiScreen) null);
|
||||||
this.mc.displayGuiScreen((GuiScreen)null);
|
} else if (par2 == 28) {
|
||||||
}
|
|
||||||
else if (par2 != 28 && par2 != 156)
|
|
||||||
{
|
|
||||||
if (par2 == 200)
|
|
||||||
{
|
|
||||||
this.getSentHistory(-1);
|
|
||||||
}
|
|
||||||
else if (par2 == 208)
|
|
||||||
{
|
|
||||||
this.getSentHistory(1);
|
|
||||||
}
|
|
||||||
else if (par2 == 201)
|
|
||||||
{
|
|
||||||
this.mc.ingameGUI.getChatGUI().scroll(this.mc.ingameGUI.getChatGUI().func_96127_i() - 1);
|
|
||||||
}
|
|
||||||
else if (par2 == 209)
|
|
||||||
{
|
|
||||||
this.mc.ingameGUI.getChatGUI().scroll(-this.mc.ingameGUI.getChatGUI().func_96127_i() + 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.inputField.textboxKeyTyped(par1, par2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
String var3 = this.inputField.getText().trim();
|
String var3 = this.inputField.getText().trim();
|
||||||
|
|
||||||
if (var3.length() > 0)
|
if (var3.length() > 0) {
|
||||||
{
|
|
||||||
this.mc.ingameGUI.getChatGUI().addToSentMessages(var3);
|
this.mc.ingameGUI.getChatGUI().addToSentMessages(var3);
|
||||||
|
|
||||||
if (!this.mc.handleClientCommand(var3))
|
if (!this.mc.handleClientCommand(var3)) {
|
||||||
{
|
|
||||||
this.mc.thePlayer.sendChatMessage(var3);
|
this.mc.thePlayer.sendChatMessage(var3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mc.displayGuiScreen((GuiScreen)null);
|
this.mc.displayGuiScreen((GuiScreen) null);
|
||||||
|
} else if (par2 == 200) {
|
||||||
|
this.getSentHistory(-1);
|
||||||
|
} else if (par2 == 208) {
|
||||||
|
this.getSentHistory(1);
|
||||||
|
} else if (par2 == 201) {
|
||||||
|
this.mc.ingameGUI.getChatGUI().scroll(this.mc.ingameGUI.getChatGUI().func_96127_i() - 1);
|
||||||
|
} else if (par2 == 209) {
|
||||||
|
this.mc.ingameGUI.getChatGUI().scroll(-this.mc.ingameGUI.getChatGUI().func_96127_i() + 1);
|
||||||
|
} else {
|
||||||
|
this.inputField.textboxKeyTyped(par1, par2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles mouse input.
|
* Handles mouse input.
|
||||||
*/
|
*/
|
||||||
public void handleMouseInput()
|
public void handleMouseInput() {
|
||||||
{
|
|
||||||
super.handleMouseInput();
|
super.handleMouseInput();
|
||||||
int var1 = EaglerAdapter.mouseGetEventDWheel();
|
int var1 = EaglerAdapter.mouseGetEventDWheel();
|
||||||
|
|
||||||
if (var1 != 0)
|
if (var1 != 0) {
|
||||||
{
|
if (var1 > 1) {
|
||||||
if (var1 > 1)
|
|
||||||
{
|
|
||||||
var1 = 1;
|
var1 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var1 < -1)
|
if (var1 < -1) {
|
||||||
{
|
|
||||||
var1 = -1;
|
var1 = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isShiftKeyDown())
|
if (!isShiftKeyDown()) {
|
||||||
{
|
|
||||||
var1 *= 7;
|
var1 *= 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,26 +141,19 @@ public class GuiChat extends GuiScreen
|
||||||
/**
|
/**
|
||||||
* Called when the mouse is clicked.
|
* Called when the mouse is clicked.
|
||||||
*/
|
*/
|
||||||
protected void mouseClicked(int par1, int par2, int par3)
|
protected void mouseClicked(int par1, int par2, int par3) {
|
||||||
{
|
if (par3 == 0 && this.mc.gameSettings.chatLinks) {
|
||||||
if (par3 == 0 && this.mc.gameSettings.chatLinks)
|
|
||||||
{
|
|
||||||
ChatClickData var4 = this.mc.ingameGUI.getChatGUI().func_73766_a(EaglerAdapter.mouseGetX(), EaglerAdapter.mouseGetY());
|
ChatClickData var4 = this.mc.ingameGUI.getChatGUI().func_73766_a(EaglerAdapter.mouseGetX(), EaglerAdapter.mouseGetY());
|
||||||
|
|
||||||
if (var4 != null)
|
if (var4 != null) {
|
||||||
{
|
String var5 = var4.getURI();
|
||||||
URI var5 = var4.getURI();
|
|
||||||
|
|
||||||
if (var5 != null)
|
if (var5 != null) {
|
||||||
{
|
if (this.mc.gameSettings.chatLinksPrompt) {
|
||||||
if (this.mc.gameSettings.chatLinksPrompt)
|
|
||||||
{
|
|
||||||
this.clickedURI = var5;
|
this.clickedURI = var5;
|
||||||
this.mc.displayGuiScreen(new GuiConfirmOpenLink(this, var4.getClickedUrl(), 0, false));
|
this.mc.displayGuiScreen(new GuiConfirmOpenLink(this, var5, 0, false));
|
||||||
}
|
} else {
|
||||||
else
|
EaglerAdapter.openLink(var5);
|
||||||
{
|
|
||||||
this.func_73896_a(var5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -195,13 +165,10 @@ public class GuiChat extends GuiScreen
|
||||||
super.mouseClicked(par1, par2, par3);
|
super.mouseClicked(par1, par2, par3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void confirmClicked(boolean par1, int par2)
|
public void confirmClicked(boolean par1, int par2) {
|
||||||
{
|
if (par2 == 0) {
|
||||||
if (par2 == 0)
|
if (par1) {
|
||||||
{
|
EaglerAdapter.openLink(this.clickedURI);
|
||||||
if (par1)
|
|
||||||
{
|
|
||||||
this.func_73896_a(this.clickedURI);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clickedURI = null;
|
this.clickedURI = null;
|
||||||
|
@ -209,38 +176,19 @@ public class GuiChat extends GuiScreen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void func_73896_a(URI par1URI)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Class var2 = Class.forName("java.awt.Desktop");
|
|
||||||
Object var3 = var2.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
|
|
||||||
var2.getMethod("browse", new Class[] {URI.class}).invoke(var3, new Object[] {par1URI});
|
|
||||||
}
|
|
||||||
catch (Throwable var4)
|
|
||||||
{
|
|
||||||
var4.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autocompletes player name
|
* Autocompletes player name
|
||||||
*/
|
*/
|
||||||
public void completePlayerName()
|
public void completePlayerName() {
|
||||||
{
|
|
||||||
String var3;
|
String var3;
|
||||||
|
|
||||||
if (this.field_73897_d)
|
if (this.field_73897_d) {
|
||||||
{
|
|
||||||
this.inputField.deleteFromCursor(this.inputField.func_73798_a(-1, this.inputField.getCursorPosition(), false) - this.inputField.getCursorPosition());
|
this.inputField.deleteFromCursor(this.inputField.func_73798_a(-1, this.inputField.getCursorPosition(), false) - this.inputField.getCursorPosition());
|
||||||
|
|
||||||
if (this.field_73903_n >= this.field_73904_o.size())
|
if (this.field_73903_n >= this.field_73904_o.size()) {
|
||||||
{
|
|
||||||
this.field_73903_n = 0;
|
this.field_73903_n = 0;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
int var1 = this.inputField.func_73798_a(-1, this.inputField.getCursorPosition(), false);
|
int var1 = this.inputField.func_73798_a(-1, this.inputField.getCursorPosition(), false);
|
||||||
this.field_73904_o.clear();
|
this.field_73904_o.clear();
|
||||||
this.field_73903_n = 0;
|
this.field_73903_n = 0;
|
||||||
|
@ -248,8 +196,7 @@ public class GuiChat extends GuiScreen
|
||||||
var3 = this.inputField.getText().substring(0, this.inputField.getCursorPosition());
|
var3 = this.inputField.getText().substring(0, this.inputField.getCursorPosition());
|
||||||
this.func_73893_a(var3, var2);
|
this.func_73893_a(var3, var2);
|
||||||
|
|
||||||
if (this.field_73904_o.isEmpty())
|
if (this.field_73904_o.isEmpty()) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,16 +204,13 @@ public class GuiChat extends GuiScreen
|
||||||
this.inputField.deleteFromCursor(var1 - this.inputField.getCursorPosition());
|
this.inputField.deleteFromCursor(var1 - this.inputField.getCursorPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.field_73904_o.size() > 1)
|
if (this.field_73904_o.size() > 1) {
|
||||||
{
|
|
||||||
StringBuilder var4 = new StringBuilder();
|
StringBuilder var4 = new StringBuilder();
|
||||||
|
|
||||||
for (Iterator var5 = this.field_73904_o.iterator(); var5.hasNext(); var4.append(var3))
|
for (Iterator var5 = this.field_73904_o.iterator(); var5.hasNext(); var4.append(var3)) {
|
||||||
{
|
var3 = (String) var5.next();
|
||||||
var3 = (String)var5.next();
|
|
||||||
|
|
||||||
if (var4.length() > 0)
|
if (var4.length() > 0) {
|
||||||
{
|
|
||||||
var4.append(", ");
|
var4.append(", ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,52 +218,42 @@ public class GuiChat extends GuiScreen
|
||||||
this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(var4.toString(), 1);
|
this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(var4.toString(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.inputField.writeText((String)this.field_73904_o.get(this.field_73903_n++));
|
this.inputField.writeText((String) this.field_73904_o.get(this.field_73903_n++));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void func_73893_a(String par1Str, String par2Str)
|
private void func_73893_a(String par1Str, String par2Str) {
|
||||||
{
|
if (par1Str.length() >= 1) {
|
||||||
if (par1Str.length() >= 1)
|
|
||||||
{
|
|
||||||
this.mc.thePlayer.sendQueue.addToSendQueue(new Packet203AutoComplete(par1Str));
|
this.mc.thePlayer.sendQueue.addToSendQueue(new Packet203AutoComplete(par1Str));
|
||||||
this.field_73905_m = true;
|
this.field_73905_m = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* input is relative and is applied directly to the sentHistoryCursor so -1 is the previous message, 1 is the next
|
* input is relative and is applied directly to the sentHistoryCursor so -1 is
|
||||||
* message from the current cursor position
|
* the previous message, 1 is the next message from the current cursor position
|
||||||
*/
|
*/
|
||||||
public void getSentHistory(int par1)
|
public void getSentHistory(int par1) {
|
||||||
{
|
|
||||||
int var2 = this.sentHistoryCursor + par1;
|
int var2 = this.sentHistoryCursor + par1;
|
||||||
int var3 = this.mc.ingameGUI.getChatGUI().getSentMessages().size();
|
int var3 = this.mc.ingameGUI.getChatGUI().getSentMessages().size();
|
||||||
|
|
||||||
if (var2 < 0)
|
if (var2 < 0) {
|
||||||
{
|
|
||||||
var2 = 0;
|
var2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var2 > var3)
|
if (var2 > var3) {
|
||||||
{
|
|
||||||
var2 = var3;
|
var2 = var3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var2 != this.sentHistoryCursor)
|
if (var2 != this.sentHistoryCursor) {
|
||||||
{
|
if (var2 == var3) {
|
||||||
if (var2 == var3)
|
|
||||||
{
|
|
||||||
this.sentHistoryCursor = var3;
|
this.sentHistoryCursor = var3;
|
||||||
this.inputField.setText(this.field_73898_b);
|
this.inputField.setText(this.field_73898_b);
|
||||||
}
|
} else {
|
||||||
else
|
if (this.sentHistoryCursor == var3) {
|
||||||
{
|
|
||||||
if (this.sentHistoryCursor == var3)
|
|
||||||
{
|
|
||||||
this.field_73898_b = this.inputField.getText();
|
this.field_73898_b = this.inputField.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.inputField.setText((String)this.mc.ingameGUI.getChatGUI().getSentMessages().get(var2));
|
this.inputField.setText((String) this.mc.ingameGUI.getChatGUI().getSentMessages().get(var2));
|
||||||
this.sentHistoryCursor = var2;
|
this.sentHistoryCursor = var2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -328,33 +262,27 @@ public class GuiChat extends GuiScreen
|
||||||
/**
|
/**
|
||||||
* Draws the screen and all the components in it.
|
* Draws the screen and all the components in it.
|
||||||
*/
|
*/
|
||||||
public void drawScreen(int par1, int par2, float par3)
|
public void drawScreen(int par1, int par2, float par3) {
|
||||||
{
|
|
||||||
drawRect(2, this.height - 14, this.width - 2, this.height - 2, Integer.MIN_VALUE);
|
drawRect(2, this.height - 14, this.width - 2, this.height - 2, Integer.MIN_VALUE);
|
||||||
this.inputField.drawTextBox();
|
this.inputField.drawTextBox();
|
||||||
super.drawScreen(par1, par2, par3);
|
super.drawScreen(par1, par2, par3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void func_73894_a(String[] par1ArrayOfStr)
|
public void func_73894_a(String[] par1ArrayOfStr) {
|
||||||
{
|
if (this.field_73905_m) {
|
||||||
if (this.field_73905_m)
|
|
||||||
{
|
|
||||||
this.field_73904_o.clear();
|
this.field_73904_o.clear();
|
||||||
String[] var2 = par1ArrayOfStr;
|
String[] var2 = par1ArrayOfStr;
|
||||||
int var3 = par1ArrayOfStr.length;
|
int var3 = par1ArrayOfStr.length;
|
||||||
|
|
||||||
for (int var4 = 0; var4 < var3; ++var4)
|
for (int var4 = 0; var4 < var3; ++var4) {
|
||||||
{
|
|
||||||
String var5 = var2[var4];
|
String var5 = var2[var4];
|
||||||
|
|
||||||
if (var5.length() > 0)
|
if (var5.length() > 0) {
|
||||||
{
|
|
||||||
this.field_73904_o.add(var5);
|
this.field_73904_o.add(var5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.field_73904_o.size() > 0)
|
if (this.field_73904_o.size() > 0) {
|
||||||
{
|
|
||||||
this.field_73897_d = true;
|
this.field_73897_d = true;
|
||||||
this.completePlayerName();
|
this.completePlayerName();
|
||||||
}
|
}
|
||||||
|
@ -362,10 +290,14 @@ public class GuiChat extends GuiScreen
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this GUI should pause the game when it is displayed in single-player
|
* Returns true if this GUI should pause the game when it is displayed in
|
||||||
|
* single-player
|
||||||
*/
|
*/
|
||||||
public boolean doesGuiPauseGame()
|
public boolean doesGuiPauseGame() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean blockHotKeys() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import net.lax1dude.eaglercraft.IntegratedServer;
|
||||||
import net.lax1dude.eaglercraft.WebsocketNetworkManager;
|
import net.lax1dude.eaglercraft.WebsocketNetworkManager;
|
||||||
import net.lax1dude.eaglercraft.WorkerNetworkManager;
|
import net.lax1dude.eaglercraft.WorkerNetworkManager;
|
||||||
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.RateLimit;
|
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.RateLimit;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
public class NetClientHandler extends NetHandler {
|
public class NetClientHandler extends NetHandler {
|
||||||
/** True if kicked or disconnected from the server. */
|
/** True if kicked or disconnected from the server. */
|
||||||
|
@ -644,7 +645,8 @@ public class NetClientHandler extends NetHandler {
|
||||||
|
|
||||||
public void handleChat(Packet3Chat par1Packet3Chat)
|
public void handleChat(Packet3Chat par1Packet3Chat)
|
||||||
{
|
{
|
||||||
this.mc.ingameGUI.getChatGUI().printChatMessage(par1Packet3Chat.message);
|
JSONObject jsonObject = new JSONObject(par1Packet3Chat.message);
|
||||||
|
this.mc.ingameGUI.getChatGUI().printChatMessage(jsonObject.getString("text"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleAnimation(Packet18Animation par1Packet18Animation)
|
public void handleAnimation(Packet18Animation par1Packet18Animation)
|
||||||
|
|
|
@ -321,16 +321,7 @@ public abstract class RendererLivingEntity extends Render
|
||||||
|
|
||||||
EaglerAdapter.glRotatef(var5 * this.getDeathMaxRotation(par1EntityLivingBase), 0.0F, 0.0F, 1.0F);
|
EaglerAdapter.glRotatef(var5 * this.getDeathMaxRotation(par1EntityLivingBase), 0.0F, 0.0F, 1.0F);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
String var6 = EnumChatFormatting.func_110646_a(par1EntityLivingBase.getEntityName());
|
|
||||||
|
|
||||||
if ((var6.equals("Dinnerbone") || var6.equals("Grumm")) && (!(par1EntityLivingBase instanceof EntityPlayer) || !((EntityPlayer)par1EntityLivingBase).getHideCape()))
|
|
||||||
{
|
|
||||||
EaglerAdapter.glTranslatef(0.0F, par1EntityLivingBase.height + 0.1F, 0.0F);
|
|
||||||
EaglerAdapter.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float renderSwingProgress(EntityLivingBase par1EntityLivingBase, float par2)
|
protected float renderSwingProgress(EntityLivingBase par1EntityLivingBase, float par2)
|
||||||
|
|
Loading…
Reference in New Issue