need to remove sp classes from clientside source

This commit is contained in:
catfoolyou 2025-03-21 17:00:42 -04:00
parent 75ae2b02c8
commit 1d659d2493
18 changed files with 1735221 additions and 37380 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" /> <bytecodeTargetLevel target="18" />
</component> </component>
</project> </project>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-18" project-jdk-type="JavaSDK" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="corretto-18" project-jdk-type="JavaSDK" />
</project> </project>

View File

@ -1,3 +1,6 @@
#!/bin/sh #!/bin/sh
chmod +x gradlew chmod +x gradlew
./gradlew generateJavascript
cd sp-server
chmod +x gradlew
./gradlew generateJavascript ./gradlew generateJavascript

View File

@ -40,7 +40,7 @@ def folder = "javascript"
def name = "classes.js" def name = "classes.js"
teavm.js { teavm.js {
obfuscated = true obfuscated = false
sourceMap = true sourceMap = true
targetFileName = "../" + name targetFileName = "../" + name
optimization = OptimizationLevel.AGGRESSIVE optimization = OptimizationLevel.AGGRESSIVE

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -142,7 +142,7 @@ gameMode.adventure=Adventure Mode
gameMode.hardcore=Hardcore Mode! gameMode.hardcore=Hardcore Mode!
gameMode.changed=Your game mode has been updated gameMode.changed=Your game mode has been updated
selectWorld.gameMode=Game Mode selectWorld.gameMode=Game Mode:
selectWorld.gameMode.survival=Survival selectWorld.gameMode.survival=Survival
selectWorld.gameMode.survival.line1=Search for resources, crafting, gain selectWorld.gameMode.survival.line1=Search for resources, crafting, gain
selectWorld.gameMode.survival.line2=levels, health and hunger selectWorld.gameMode.survival.line2=levels, health and hunger

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
</project> </project>

View File

@ -36,7 +36,7 @@ def folder = "../javascript"
def name = "classes_server.js" def name = "classes_server.js"
teavm.js { teavm.js {
obfuscated = true obfuscated = false
sourceMap = true sourceMap = true
targetFileName = "../" + name targetFileName = "../" + name
optimization = OptimizationLevel.AGGRESSIVE optimization = OptimizationLevel.AGGRESSIVE

View File

@ -98,8 +98,8 @@ public class NetLoginHandler extends NetHandler {
if (!this.clientUsername.equals(StringUtils.stripControlCodes(this.clientUsername))) { if (!this.clientUsername.equals(StringUtils.stripControlCodes(this.clientUsername))) {
this.kickUser("Invalid username!"); this.kickUser("Invalid username!");
} else { } else {
if (par1Packet2ClientProtocol.getProtocolVersion() != 61) { if (par1Packet2ClientProtocol.getProtocolVersion() != 78) {
if (par1Packet2ClientProtocol.getProtocolVersion() > 61) { if (par1Packet2ClientProtocol.getProtocolVersion() > 78) {
this.kickUser("Outdated server!"); this.kickUser("Outdated server!");
} else { } else {
this.kickUser("Outdated client!"); this.kickUser("Outdated client!");
@ -167,7 +167,7 @@ public class NetLoginHandler extends NetHandler {
String var3 = null; String var3 = null;
if (par1Packet254ServerPing.readSuccessfully == 1) { if (par1Packet254ServerPing.readSuccessfully == 1) {
List var4 = Arrays.asList(new Serializable[] { Integer.valueOf(1), Integer.valueOf(61), List var4 = Arrays.asList(new Serializable[] { Integer.valueOf(1), Integer.valueOf(78),
this.mcServer.getMinecraftVersion(), this.mcServer.getMOTD(), this.mcServer.getMinecraftVersion(), this.mcServer.getMOTD(),
Integer.valueOf(var2.getCurrentPlayerCount()), Integer.valueOf(var2.getMaxPlayers()) }); Integer.valueOf(var2.getCurrentPlayerCount()), Integer.valueOf(var2.getMaxPlayers()) });
Object var6; Object var6;

View File

@ -1,13 +1,12 @@
package net.minecraft.src; package net.minecraft.src;
import java.util.List;
import net.lax1dude.eaglercraft.EaglerAdapter; import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglercraftRandom; import net.lax1dude.eaglercraft.EaglercraftRandom;
import net.lax1dude.eaglercraft.IntegratedServer; import net.lax1dude.eaglercraft.IntegratedServer;
import java.util.List; public class GuiCreateWorld extends GuiScreen {
public class GuiCreateWorld extends GuiScreen
{
private GuiScreen parentGuiScreen; private GuiScreen parentGuiScreen;
private GuiTextField textboxWorldName; private GuiTextField textboxWorldName;
private GuiTextField textboxSeed; private GuiTextField textboxSeed;
@ -16,20 +15,21 @@ public class GuiCreateWorld extends GuiScreen
/** hardcore', 'creative' or 'survival */ /** hardcore', 'creative' or 'survival */
private String gameMode = "survival"; private String gameMode = "survival";
private boolean generateStructures = true; private boolean generateStructures = true;
private boolean commandsAllowed; private boolean commandsAllowed = false;
/** True iif player has clicked buttonAllowCommands at least once */ /** True iif player has clicked buttonAllowCommands at least once */
private boolean commandsToggled; private boolean commandsToggled = false;
/** toggles when GUIButton 7 is pressed */ /** toggles when GUIButton 7 is pressed */
private boolean bonusItems; private boolean bonusItems = false;
/** True if and only if gameMode.equals("hardcore") */ /** True if and only if gameMode.equals("hardcore") */
private boolean isHardcore; private boolean isHardcore = false;
private boolean createClicked; private boolean createClicked;
/** /**
* True if the extra options (Seed box, structure toggle button, world type button, etc.) are being shown * True if the extra options (Seed box, structure toggle button, world type
* button, etc.) are being shown
*/ */
private boolean moreOptions; private boolean moreOptions;
@ -37,7 +37,8 @@ public class GuiCreateWorld extends GuiScreen
private GuiButton buttonGameMode; private GuiButton buttonGameMode;
/** /**
* The GUIButton that you click to get to options like the seed when creating a world. * The GUIButton that you click to get to options like the seed when creating a
* world.
*/ */
private GuiButton moreWorldOptions; private GuiButton moreWorldOptions;
@ -63,7 +64,7 @@ public class GuiCreateWorld extends GuiScreen
/** E.g. New World, Neue Welt, Nieuwe wereld, Neuvo Mundo */ /** E.g. New World, Neue Welt, Nieuwe wereld, Neuvo Mundo */
private String localizedNewWorldText; private String localizedNewWorldText;
private int worldTypeId; private int worldTypeId = 0;
/** Generator options to use when creating the world. */ /** Generator options to use when creating the world. */
public String generatorOptionsToUse = ""; public String generatorOptionsToUse = "";
@ -71,10 +72,11 @@ public class GuiCreateWorld extends GuiScreen
/** /**
* If the world name is one of these, it'll be surrounded with underscores. * If the world name is one of these, it'll be surrounded with underscores.
*/ */
private static final String[] ILLEGAL_WORLD_NAMES = new String[] {"CON", "COM", "PRN", "AUX", "CLOCK$", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}; private static final String[] ILLEGAL_WORLD_NAMES = new String[] { "CON", "COM", "PRN", "AUX", "CLOCK$", "NUL",
"COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4",
"LPT5", "LPT6", "LPT7", "LPT8", "LPT9" };
public GuiCreateWorld(GuiScreen par1GuiScreen) public GuiCreateWorld(GuiScreen par1GuiScreen) {
{
this.parentGuiScreen = par1GuiScreen; this.parentGuiScreen = par1GuiScreen;
this.seed = ""; this.seed = "";
this.localizedNewWorldText = StatCollector.translateToLocal("selectWorld.newWorld"); this.localizedNewWorldText = StatCollector.translateToLocal("selectWorld.newWorld");
@ -83,8 +85,7 @@ public class GuiCreateWorld 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.textboxWorldName.updateCursorCounter(); this.textboxWorldName.updateCursorCounter();
this.textboxSeed.updateCursorCounter(); this.textboxSeed.updateCursorCounter();
} }
@ -92,23 +93,31 @@ public class GuiCreateWorld extends GuiScreen
/** /**
* 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() {
{ StringTranslate var1 = StringTranslate.getInstance();
EaglerAdapter.enableRepeatEvents(true); EaglerAdapter.enableRepeatEvents(true);
this.buttonList.clear(); this.buttonList.clear();
this.buttonList.add(new GuiButton(0, this.width / 2 - 155, this.height - 28, 150, 20, StatCollector.translateToLocal("selectWorld.create"))); this.buttonList.add(new GuiButton(0, this.width / 2 - 155, this.height - 28, 150, 20,
this.buttonList.add(new GuiButton(1, this.width / 2 + 5, this.height - 28, 150, 20, StatCollector.translateToLocal("gui.cancel"))); var1.translateKey("selectWorld.create")));
this.buttonList.add(this.buttonGameMode = new GuiButton(2, this.width / 2 - 75, 115, 150, 20, StatCollector.translateToLocal("selectWorld.gameMode"))); this.buttonList.add(new GuiButton(1, this.width / 2 + 5, this.height - 28, 150, 20, var1.translateKey("gui.cancel")));
this.buttonList.add(this.moreWorldOptions = new GuiButton(3, this.width / 2 - 75, 187, 150, 20, StatCollector.translateToLocal("selectWorld.moreWorldOptions"))); this.buttonList.add(this.buttonGameMode = new GuiButton(2, this.width / 2 - 75, 115, 150, 20,
this.buttonList.add(this.buttonGenerateStructures = new GuiButton(4, this.width / 2 - 155, 100, 150, 20, StatCollector.translateToLocal("selectWorld.mapFeatures"))); var1.translateKey("selectWorld.gameMode")));
this.buttonList.add(this.moreWorldOptions = new GuiButton(3, this.width / 2 - 75, 187, 150, 20,
var1.translateKey("selectWorld.moreWorldOptions")));
this.buttonList.add(this.buttonGenerateStructures = new GuiButton(4, this.width / 2 - 155, 100, 150, 20,
var1.translateKey("selectWorld.mapFeatures")));
this.buttonGenerateStructures.drawButton = false; this.buttonGenerateStructures.drawButton = false;
this.buttonList.add(this.buttonBonusItems = new GuiButton(7, this.width / 2 + 5, 151, 150, 20, StatCollector.translateToLocal("selectWorld.bonusItems"))); this.buttonList.add(this.buttonBonusItems = new GuiButton(7, this.width / 2 + 5, 151, 150, 20,
var1.translateKey("selectWorld.bonusItems")));
this.buttonBonusItems.drawButton = false; this.buttonBonusItems.drawButton = false;
this.buttonList.add(this.buttonWorldType = new GuiButton(5, this.width / 2 + 5, 100, 150, 20, StatCollector.translateToLocal("selectWorld.mapType"))); this.buttonList.add(this.buttonWorldType = new GuiButton(5, this.width / 2 + 5, 100, 150, 20,
var1.translateKey("selectWorld.mapType")));
this.buttonWorldType.drawButton = false; this.buttonWorldType.drawButton = false;
this.buttonList.add(this.buttonAllowCommands = new GuiButton(6, this.width / 2 - 155, 151, 150, 20, StatCollector.translateToLocal("selectWorld.allowCommands"))); this.buttonList.add(this.buttonAllowCommands = new GuiButton(6, this.width / 2 - 155, 151, 150, 20,
var1.translateKey("selectWorld.allowCommands")));
this.buttonAllowCommands.drawButton = false; this.buttonAllowCommands.drawButton = false;
this.buttonList.add(this.buttonCustomize = new GuiButton(8, this.width / 2 + 5, 120, 150, 20, StatCollector.translateToLocal("selectWorld.customizeType"))); this.buttonList.add(this.buttonCustomize = new GuiButton(8, this.width / 2 + 5, 120, 150, 20,
var1.translateKey("selectWorld.customizeType")));
this.buttonCustomize.drawButton = false; this.buttonCustomize.drawButton = false;
this.textboxWorldName = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 60, 200, 20); this.textboxWorldName = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 60, 200, 20);
this.textboxWorldName.setFocused(true); this.textboxWorldName.setFocused(true);
@ -121,8 +130,9 @@ public class GuiCreateWorld extends GuiScreen
} }
/** /**
* Makes a the name for a world save folder based on your world name, replacing specific characters for _s and * Makes a the name for a world save folder based on your world name, replacing
* appending -s to the end until a free name is available. * specific characters for _s and appending -s to the end until a free name is
* available.
*/ */
private void makeUseableName() { private void makeUseableName() {
this.folderName = makeUsableName(this.textboxWorldName.getText().trim()); this.folderName = makeUsableName(this.textboxWorldName.getText().trim());
@ -143,43 +153,41 @@ public class GuiCreateWorld extends GuiScreen
return func_73913_a(s); return func_73913_a(s);
} }
private void updateButtonText() private void updateButtonText() {
{ StringTranslate var1 = StringTranslate.getInstance();
this.buttonGameMode.displayString = StatCollector.translateToLocal("selectWorld.gameMode") + " " + StatCollector.translateToLocal("selectWorld.gameMode." + this.gameMode); this.buttonGameMode.displayString = var1.translateKey("selectWorld.gameMode") + " "
this.gameModeDescriptionLine1 = StatCollector.translateToLocal("selectWorld.gameMode." + this.gameMode + ".line1"); + var1.translateKey("selectWorld.gameMode." + this.gameMode);
this.gameModeDescriptionLine2 = StatCollector.translateToLocal("selectWorld.gameMode." + this.gameMode + ".line2"); this.gameModeDescriptionLine1 = var1.translateKey("selectWorld.gameMode." + this.gameMode + ".line1");
this.buttonGenerateStructures.displayString = StatCollector.translateToLocal("selectWorld.mapFeatures") + " "; this.gameModeDescriptionLine2 = var1.translateKey("selectWorld.gameMode." + this.gameMode + ".line2");
this.buttonGenerateStructures.displayString = var1.translateKey("selectWorld.mapFeatures") + " ";
if (this.generateStructures) if (this.generateStructures) {
{ this.buttonGenerateStructures.displayString = this.buttonGenerateStructures.displayString
this.buttonGenerateStructures.displayString = this.buttonGenerateStructures.displayString + StatCollector.translateToLocal("options.on"); + var1.translateKey("options.on");
} } else {
else this.buttonGenerateStructures.displayString = this.buttonGenerateStructures.displayString
{ + var1.translateKey("options.off");
this.buttonGenerateStructures.displayString = this.buttonGenerateStructures.displayString + StatCollector.translateToLocal("options.off");
} }
this.buttonBonusItems.displayString = StatCollector.translateToLocal("selectWorld.bonusItems") + " "; this.buttonBonusItems.displayString = var1.translateKey("selectWorld.bonusItems") + " ";
if (this.bonusItems && !this.isHardcore) if (this.bonusItems && !this.isHardcore) {
{ this.buttonBonusItems.displayString = this.buttonBonusItems.displayString + var1.translateKey("options.on");
this.buttonBonusItems.displayString = this.buttonBonusItems.displayString + StatCollector.translateToLocal("options.on"); } else {
} this.buttonBonusItems.displayString = this.buttonBonusItems.displayString
else + var1.translateKey("options.off");
{
this.buttonBonusItems.displayString = this.buttonBonusItems.displayString + StatCollector.translateToLocal("options.off");
} }
this.buttonWorldType.displayString = StatCollector.translateToLocal("selectWorld.mapType") + " " + StatCollector.translateToLocal(WorldType.worldTypes[this.worldTypeId].getTranslateName()); this.buttonWorldType.displayString = var1.translateKey("selectWorld.mapType") + " "
this.buttonAllowCommands.displayString = StatCollector.translateToLocal("selectWorld.allowCommands") + " "; + var1.translateKey(WorldType.worldTypes[this.worldTypeId].getTranslateName());
this.buttonAllowCommands.displayString = var1.translateKey("selectWorld.allowCommands") + " ";
if (this.commandsAllowed && !this.isHardcore) if (this.commandsAllowed && !this.isHardcore) {
{ this.buttonAllowCommands.displayString = this.buttonAllowCommands.displayString
this.buttonAllowCommands.displayString = this.buttonAllowCommands.displayString + StatCollector.translateToLocal("options.on"); + var1.translateKey("options.on");
} } else {
else this.buttonAllowCommands.displayString = this.buttonAllowCommands.displayString
{ + var1.translateKey("options.off");
this.buttonAllowCommands.displayString = this.buttonAllowCommands.displayString + StatCollector.translateToLocal("options.off");
} }
} }
@ -216,28 +224,22 @@ public class GuiCreateWorld extends GuiScreen
/** /**
* 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);
} }
/** /**
* Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). * Fired when a control is clicked. This is the equivalent of
* ActionListener.actionPerformed(ActionEvent e).
*/ */
protected void actionPerformed(GuiButton par1GuiButton) protected void actionPerformed(GuiButton par1GuiButton) {
{ if (par1GuiButton.enabled) {
if (par1GuiButton.enabled) if (par1GuiButton.id == 1) {
{
if (par1GuiButton.id == 1)
{
this.mc.displayGuiScreen(this.parentGuiScreen); this.mc.displayGuiScreen(this.parentGuiScreen);
} } else if (par1GuiButton.id == 0) {
else if (par1GuiButton.id == 0) this.mc.displayGuiScreen((GuiScreen) null);
{
this.mc.displayGuiScreen((GuiScreen)null);
if (this.createClicked) if (this.createClicked) {
{
return; return;
} }
@ -245,50 +247,38 @@ public class GuiCreateWorld extends GuiScreen
long var2 = (new EaglercraftRandom()).nextLong(); long var2 = (new EaglercraftRandom()).nextLong();
String var4 = this.textboxSeed.getText(); String var4 = this.textboxSeed.getText();
if (!MathHelper.stringNullOrLengthZero(var4)) if (!MathHelper.stringNullOrLengthZero(var4)) {
{ try {
try
{
long var5 = Long.parseLong(var4); long var5 = Long.parseLong(var4);
if (var5 != 0L) if (var5 != 0L) {
{
var2 = var5; var2 = var5;
} }
} } catch (NumberFormatException var7) {
catch (NumberFormatException var7) var2 = (long) var4.hashCode();
{
var2 = (long)var4.hashCode();
} }
} }
EnumGameType var8 = EnumGameType.getByName(this.gameMode); EnumGameType var8 = EnumGameType.getByName(this.gameMode);
WorldSettings var6 = new WorldSettings(var2, var8, this.generateStructures, this.isHardcore, WorldType.worldTypes[this.worldTypeId]); WorldSettings var6 = new WorldSettings(var2, var8, this.generateStructures, this.isHardcore,
WorldType.worldTypes[this.worldTypeId]);
var6.func_82750_a(this.generatorOptionsToUse); var6.func_82750_a(this.generatorOptionsToUse);
if (this.bonusItems && !this.isHardcore) if (this.bonusItems && !this.isHardcore) {
{
var6.enableBonusChest(); var6.enableBonusChest();
} }
if (this.commandsAllowed && !this.isHardcore) if (this.commandsAllowed && !this.isHardcore) {
{
var6.enableCommands(); var6.enableCommands();
} }
System.out.println("created world, launching integratedserver");
this.mc.launchIntegratedServer(this.folderName, this.textboxWorldName.getText().trim(), var6); this.mc.launchIntegratedServer(this.folderName, this.textboxWorldName.getText().trim(), var6);
//this.mc.statFileWriter.readStat(StatList.createWorldStat, 1); } else if (par1GuiButton.id == 3) {
}
else if (par1GuiButton.id == 3)
{
this.func_82287_i(); this.func_82287_i();
} } else if (par1GuiButton.id == 2) {
else if (par1GuiButton.id == 2) if (this.gameMode.equals("survival")) {
{ if (!this.commandsToggled) {
if (this.gameMode.equals("survival"))
{
if (!this.commandsToggled)
{
this.commandsAllowed = false; this.commandsAllowed = false;
} }
@ -298,11 +288,8 @@ public class GuiCreateWorld extends GuiScreen
this.buttonAllowCommands.enabled = false; this.buttonAllowCommands.enabled = false;
this.buttonBonusItems.enabled = false; this.buttonBonusItems.enabled = false;
this.updateButtonText(); this.updateButtonText();
} } else if (this.gameMode.equals("hardcore")) {
else if (this.gameMode.equals("hardcore")) if (!this.commandsToggled) {
{
if (!this.commandsToggled)
{
this.commandsAllowed = true; this.commandsAllowed = true;
} }
@ -312,11 +299,8 @@ public class GuiCreateWorld extends GuiScreen
this.isHardcore = false; this.isHardcore = false;
this.buttonAllowCommands.enabled = true; this.buttonAllowCommands.enabled = true;
this.buttonBonusItems.enabled = true; this.buttonBonusItems.enabled = true;
} } else {
else if (!this.commandsToggled) {
{
if (!this.commandsToggled)
{
this.commandsAllowed = false; this.commandsAllowed = false;
} }
@ -328,32 +312,24 @@ public class GuiCreateWorld extends GuiScreen
} }
this.updateButtonText(); this.updateButtonText();
} } else if (par1GuiButton.id == 4) {
else if (par1GuiButton.id == 4)
{
this.generateStructures = !this.generateStructures; this.generateStructures = !this.generateStructures;
this.updateButtonText(); this.updateButtonText();
} } else if (par1GuiButton.id == 7) {
else if (par1GuiButton.id == 7)
{
this.bonusItems = !this.bonusItems; this.bonusItems = !this.bonusItems;
this.updateButtonText(); this.updateButtonText();
} } else if (par1GuiButton.id == 5) {
else if (par1GuiButton.id == 5)
{
++this.worldTypeId; ++this.worldTypeId;
if (this.worldTypeId >= WorldType.worldTypes.length) if (this.worldTypeId >= WorldType.worldTypes.length) {
{
this.worldTypeId = 0; this.worldTypeId = 0;
} }
while (WorldType.worldTypes[this.worldTypeId] == null || !WorldType.worldTypes[this.worldTypeId].getCanBeCreated()) while (WorldType.worldTypes[this.worldTypeId] == null
{ || !WorldType.worldTypes[this.worldTypeId].getCanBeCreated()) {
++this.worldTypeId; ++this.worldTypeId;
if (this.worldTypeId >= WorldType.worldTypes.length) if (this.worldTypeId >= WorldType.worldTypes.length) {
{
this.worldTypeId = 0; this.worldTypeId = 0;
} }
} }
@ -361,27 +337,21 @@ public class GuiCreateWorld extends GuiScreen
this.generatorOptionsToUse = ""; this.generatorOptionsToUse = "";
this.updateButtonText(); this.updateButtonText();
this.func_82288_a(this.moreOptions); this.func_82288_a(this.moreOptions);
} } else if (par1GuiButton.id == 6) {
else if (par1GuiButton.id == 6)
{
this.commandsToggled = true; this.commandsToggled = true;
this.commandsAllowed = !this.commandsAllowed; this.commandsAllowed = !this.commandsAllowed;
this.updateButtonText(); this.updateButtonText();
} } else if (par1GuiButton.id == 8) {
else if (par1GuiButton.id == 8)
{
this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.generatorOptionsToUse)); this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.generatorOptionsToUse));
} }
} }
} }
private void func_82287_i() private void func_82287_i() {
{
this.func_82288_a(!this.moreOptions); this.func_82288_a(!this.moreOptions);
} }
private void func_82288_a(boolean par1) private void func_82288_a(boolean par1) {
{
this.moreOptions = par1; this.moreOptions = par1;
this.buttonGameMode.drawButton = !this.moreOptions; this.buttonGameMode.drawButton = !this.moreOptions;
this.buttonGenerateStructures.drawButton = this.moreOptions; this.buttonGenerateStructures.drawButton = this.moreOptions;
@ -389,55 +359,47 @@ public class GuiCreateWorld extends GuiScreen
this.buttonWorldType.drawButton = this.moreOptions; this.buttonWorldType.drawButton = this.moreOptions;
this.buttonAllowCommands.drawButton = this.moreOptions; this.buttonAllowCommands.drawButton = this.moreOptions;
this.buttonCustomize.drawButton = this.moreOptions && WorldType.worldTypes[this.worldTypeId] == WorldType.FLAT; this.buttonCustomize.drawButton = this.moreOptions && WorldType.worldTypes[this.worldTypeId] == WorldType.FLAT;
StringTranslate var2;
if (this.moreOptions) if (this.moreOptions) {
{ var2 = StringTranslate.getInstance();
this.moreWorldOptions.displayString = StatCollector.translateToLocal("gui.done"); this.moreWorldOptions.displayString = var2.translateKey("gui.done");
} } else {
else var2 = StringTranslate.getInstance();
{ this.moreWorldOptions.displayString = var2.translateKey("selectWorld.moreWorldOptions");
this.moreWorldOptions.displayString = StatCollector.translateToLocal("selectWorld.moreWorldOptions");
} }
} }
/** /**
* 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) {
{ if (this.textboxWorldName.isFocused() && !this.moreOptions) {
if (this.textboxWorldName.isFocused() && !this.moreOptions)
{
this.textboxWorldName.textboxKeyTyped(par1, par2); this.textboxWorldName.textboxKeyTyped(par1, par2);
this.localizedNewWorldText = this.textboxWorldName.getText(); this.localizedNewWorldText = this.textboxWorldName.getText();
} } else if (this.textboxSeed.isFocused() && this.moreOptions) {
else if (this.textboxSeed.isFocused() && this.moreOptions)
{
this.textboxSeed.textboxKeyTyped(par1, par2); this.textboxSeed.textboxKeyTyped(par1, par2);
this.seed = this.textboxSeed.getText(); this.seed = this.textboxSeed.getText();
} }
if (par2 == 28 || par2 == 156) if (par1 == 13) {
{ this.actionPerformed((GuiButton) this.buttonList.get(0));
this.actionPerformed((GuiButton)this.buttonList.get(0));
} }
((GuiButton)this.buttonList.get(0)).enabled = this.textboxWorldName.getText().length() > 0; ((GuiButton) this.buttonList.get(0)).enabled = this.textboxWorldName.getText().length() > 0;
this.makeUseableName(); this.makeUseableName();
} }
/** /**
* 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) {
{
super.mouseClicked(par1, par2, par3); super.mouseClicked(par1, par2, par3);
if (this.moreOptions) if (this.moreOptions) {
{
this.textboxSeed.mouseClicked(par1, par2, par3); this.textboxSeed.mouseClicked(par1, par2, par3);
} } else {
else
{
this.textboxWorldName.mouseClicked(par1, par2, par3); this.textboxWorldName.mouseClicked(par1, par2, par3);
} }
} }
@ -445,23 +407,27 @@ public class GuiCreateWorld 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) {
{ StringTranslate var4 = StringTranslate.getInstance();
this.drawDefaultBackground(); this.drawDefaultBackground();
this.drawCenteredString(this.fontRenderer, StatCollector.translateToLocal("selectWorld.create"), this.width / 2, 20, 16777215); this.drawCenteredString(this.fontRenderer, var4.translateKey("selectWorld.create"), this.width / 2, 20,
16777215);
if (this.moreOptions) if (this.moreOptions) {
{ this.drawString(this.fontRenderer, var4.translateKey("selectWorld.enterSeed"), this.width / 2 - 100, 47,
this.drawString(this.fontRenderer, StatCollector.translateToLocal("selectWorld.enterSeed"), this.width / 2 - 100, 47, 10526880); 10526880);
this.drawString(this.fontRenderer, StatCollector.translateToLocal("selectWorld.seedInfo"), this.width / 2 - 100, 85, 10526880); this.drawString(this.fontRenderer, var4.translateKey("selectWorld.seedInfo"), this.width / 2 - 100, 85,
this.drawString(this.fontRenderer, StatCollector.translateToLocal("selectWorld.mapFeatures.info"), this.width / 2 - 150, 122, 10526880); 10526880);
this.drawString(this.fontRenderer, StatCollector.translateToLocal("selectWorld.allowCommands.info"), this.width / 2 - 150, 172, 10526880); this.drawString(this.fontRenderer, var4.translateKey("selectWorld.mapFeatures.info"), this.width / 2 - 150,
122, 10526880);
this.drawString(this.fontRenderer, var4.translateKey("selectWorld.allowCommands.info"),
this.width / 2 - 150, 172, 10526880);
this.textboxSeed.drawTextBox(); this.textboxSeed.drawTextBox();
} } else {
else this.drawString(this.fontRenderer, var4.translateKey("selectWorld.enterName"), this.width / 2 - 100, 47,
{ 10526880);
this.drawString(this.fontRenderer, StatCollector.translateToLocal("selectWorld.enterName"), this.width / 2 - 100, 47, 10526880); this.drawString(this.fontRenderer, var4.translateKey("selectWorld.resultFolder") + " " + this.folderName,
this.drawString(this.fontRenderer, StatCollector.translateToLocal("selectWorld.resultFolder") + " " + this.folderName, this.width / 2 - 100, 85, 10526880); this.width / 2 - 100, 85, 10526880);
this.textboxWorldName.drawTextBox(); this.textboxWorldName.drawTextBox();
this.drawString(this.fontRenderer, this.gameModeDescriptionLine1, this.width / 2 - 100, 137, 10526880); this.drawString(this.fontRenderer, this.gameModeDescriptionLine1, this.width / 2 - 100, 137, 10526880);
this.drawString(this.fontRenderer, this.gameModeDescriptionLine2, this.width / 2 - 100, 149, 10526880); this.drawString(this.fontRenderer, this.gameModeDescriptionLine2, this.width / 2 - 100, 149, 10526880);
@ -472,23 +438,18 @@ public class GuiCreateWorld extends GuiScreen
public void func_82286_a(WorldInfo par1WorldInfo) public void func_82286_a(WorldInfo par1WorldInfo)
{ {
this.localizedNewWorldText = StatCollector.translateToLocalFormatted("selectWorld.newWorld.copyOf", new Object[] {par1WorldInfo.getWorldName()}); this.localizedNewWorldText = StatCollector.translateToLocalFormatted("selectWorld.newWorld.copyOf", par1WorldInfo.getWorldName());
this.seed = par1WorldInfo.getSeed() + ""; this.seed = par1WorldInfo.getSeed() + "";
this.worldTypeId = par1WorldInfo.getTerrainType().getWorldTypeID(); this.worldTypeId = par1WorldInfo.getTerrainType().getWorldTypeID();
this.generatorOptionsToUse = par1WorldInfo.getGeneratorOptions(); this.generatorOptionsToUse = par1WorldInfo.getGeneratorOptions();
this.generateStructures = par1WorldInfo.isMapFeaturesEnabled(); this.generateStructures = par1WorldInfo.isMapFeaturesEnabled();
this.commandsAllowed = par1WorldInfo.areCommandsAllowed(); this.commandsAllowed = par1WorldInfo.areCommandsAllowed();
if (par1WorldInfo.isHardcoreModeEnabled()) if (par1WorldInfo.isHardcoreModeEnabled()) {
{
this.gameMode = "hardcore"; this.gameMode = "hardcore";
} } else if (par1WorldInfo.getGameType().isSurvivalOrAdventure()) {
else if (par1WorldInfo.getGameType().isSurvivalOrAdventure())
{
this.gameMode = "survival"; this.gameMode = "survival";
} } else if (par1WorldInfo.getGameType().isCreative()) {
else if (par1WorldInfo.getGameType().isCreative())
{
this.gameMode = "creative"; this.gameMode = "creative";
} }
} }

View File

@ -1,19 +1,25 @@
package net.minecraft.src; package net.minecraft.src;
import net.lax1dude.eaglercraft.IntegratedServer;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedList;
import java.util.List; import java.util.List;
public class GuiSelectWorld extends GuiScreen import net.lax1dude.eaglercraft.EaglerAdapter;
{ import net.lax1dude.eaglercraft.GuiScreenBackupWorld;
import net.lax1dude.eaglercraft.GuiScreenCreateWorldSelection;
import net.lax1dude.eaglercraft.GuiScreenLANConnect;
import net.lax1dude.eaglercraft.GuiScreenSingleplayerLoading;
import net.lax1dude.eaglercraft.IntegratedServer;
public class GuiSelectWorld extends GuiScreen {
/** simple date formater */ /** simple date formater */
private final DateFormat dateFormatter = new SimpleDateFormat(); private final DateFormat dateFormatter = new SimpleDateFormat();
/** /**
* A reference to the screen object that created this. Used for navigating between screens. * A reference to the screen object that created this. Used for navigating
* between screens.
*/ */
protected GuiScreen parentScreen; protected GuiScreen parentScreen;
@ -21,13 +27,13 @@ public class GuiSelectWorld extends GuiScreen
protected String screenTitle = "Select world"; protected String screenTitle = "Select world";
/** True if a world has been selected. */ /** True if a world has been selected. */
private boolean selected; private boolean selected = false;
/** the currently selected world */ /** the currently selected world */
private int selectedWorld; private int selectedWorld;
/** The save list for the world selection screen */ /** The save list for the world selection screen */
private List saveList; private List<SaveFormatComparator> saveList;
private GuiWorldSlot worldSlotContainer; private GuiWorldSlot worldSlotContainer;
/** E.g. World, Welt, Monde, Mundo */ /** E.g. World, Welt, Monde, Mundo */
@ -35,7 +41,8 @@ public class GuiSelectWorld extends GuiScreen
private String localizedMustConvertText; private String localizedMustConvertText;
/** /**
* The game mode text that is displayed with each world on the world selection list. * The game mode text that is displayed with each world on the world selection
* list.
*/ */
private String[] localizedGameModeText = new String[3]; private String[] localizedGameModeText = new String[3];
@ -50,41 +57,53 @@ public class GuiSelectWorld extends GuiScreen
/** The rename button in the world selection GUI */ /** The rename button in the world selection GUI */
private GuiButton buttonRename; private GuiButton buttonRename;
private GuiButton buttonRecreate; private GuiButton buttonBackup;
public GuiSelectWorld(GuiScreen par1GuiScreen) private boolean hasRequestedWorlds = false;
{ private boolean waitingForWorlds = false;
public GuiSelectWorld(GuiScreen par1GuiScreen) {
this.parentScreen = par1GuiScreen; this.parentScreen = par1GuiScreen;
} }
/** /**
* 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() {
{ StringTranslate var1 = StringTranslate.getInstance();
this.screenTitle = StatCollector.translateToLocal("selectWorld.title"); this.screenTitle = var1.translateKey("selectWorld.title");
this.saveList = new LinkedList();
try if(IntegratedServer.isReady()) {
{ hasRequestedWorlds = true;
this.loadSaves(); waitingForWorlds = true;
} IntegratedServer.requestWorldList();
catch (Exception var2) }else {
{ IntegratedServer.unloadWorld();
var2.printStackTrace(); hasRequestedWorlds = false;
this.mc.displayGuiScreen(new GuiErrorScreen("Unable to load words", var2.getMessage()));
return;
} }
this.localizedWorldText = StatCollector.translateToLocal("selectWorld.world"); this.localizedWorldText = var1.translateKey("selectWorld.world");
this.localizedMustConvertText = StatCollector.translateToLocal("selectWorld.conversion"); this.localizedMustConvertText = var1.translateKey("selectWorld.conversion");
this.localizedGameModeText[EnumGameType.SURVIVAL.getID()] = StatCollector.translateToLocal("gameMode.survival"); this.localizedGameModeText[EnumGameType.SURVIVAL.getID()] = var1.translateKey("gameMode.survival");
this.localizedGameModeText[EnumGameType.CREATIVE.getID()] = StatCollector.translateToLocal("gameMode.creative"); this.localizedGameModeText[EnumGameType.CREATIVE.getID()] = var1.translateKey("gameMode.creative");
this.localizedGameModeText[EnumGameType.ADVENTURE.getID()] = StatCollector.translateToLocal("gameMode.adventure"); this.localizedGameModeText[EnumGameType.ADVENTURE.getID()] = var1.translateKey("gameMode.adventure");
this.worldSlotContainer = new GuiWorldSlot(this); this.worldSlotContainer = new GuiWorldSlot(this);
this.worldSlotContainer.registerScrollButtons(this.buttonList, 4, 5); this.worldSlotContainer.registerScrollButtons(this.buttonList, 4, 5);
this.initButtons(); this.initButtons();
} }
public void updateScreen() {
if(!hasRequestedWorlds && IntegratedServer.isReady()) {
hasRequestedWorlds = true;
waitingForWorlds = true;
IntegratedServer.requestWorldList();
}else if(waitingForWorlds && IntegratedServer.getWorldList() != null) {
waitingForWorlds = false;
this.loadSaves();
}
}
/** /**
* loads the saves * loads the saves
*/ */
@ -94,7 +113,7 @@ public class GuiSelectWorld extends GuiScreen
for(NBTTagCompound n : levels) { for(NBTTagCompound n : levels) {
WorldInfo w = new WorldInfo(n.getCompoundTag("Data")); WorldInfo w = new WorldInfo(n.getCompoundTag("Data"));
this.saveList.add(new SaveFormatComparator(n.getString("folderName"), w.getWorldName(), w.getLastTimePlayed(), this.saveList.add(new SaveFormatComparator(n.getString("folderName"), w.getWorldName(), w.getLastTimePlayed(),
w.getSizeOnDisk(), w.getGameType(), false, w.isHardcoreModeEnabled(), w.areCommandsAllowed())); // n was at the end, FIX THIS SHIT w.getSizeOnDisk(), w.getGameType(), false, w.isHardcoreModeEnabled(), w.areCommandsAllowed(), n));
} }
Collections.sort(this.saveList); Collections.sort(this.saveList);
this.selectedWorld = -1; this.selectedWorld = -1;
@ -103,21 +122,19 @@ public class GuiSelectWorld extends GuiScreen
/** /**
* returns the file name of the specified save number * returns the file name of the specified save number
*/ */
protected String getSaveFileName(int par1) protected String getSaveFileName(int par1) {
{ return ((SaveFormatComparator) this.saveList.get(par1)).getFileName();
return ((SaveFormatComparator)this.saveList.get(par1)).getFileName();
} }
/** /**
* returns the name of the saved game * returns the name of the saved game
*/ */
protected String getSaveName(int par1) protected String getSaveName(int par1) {
{ String var2 = ((SaveFormatComparator) this.saveList.get(par1)).getDisplayName();
String var2 = ((SaveFormatComparator)this.saveList.get(par1)).getDisplayName();
if (var2 == null || MathHelper.stringNullOrLengthZero(var2)) if (var2 == null || MathHelper.stringNullOrLengthZero(var2)) {
{ StringTranslate var3 = StringTranslate.getInstance();
var2 = StatCollector.translateToLocal("selectWorld.world") + " " + (par1 + 1); var2 = var3.translateKey("selectWorld.world") + " " + (par1 + 1);
} }
return var2; return var2;
@ -126,65 +143,50 @@ public class GuiSelectWorld extends GuiScreen
/** /**
* intilize the buttons for this GUI * intilize the buttons for this GUI
*/ */
public void initButtons() public void initButtons() {
{ StringTranslate var1 = StringTranslate.getInstance();
this.buttonList.add(this.buttonSelect = new GuiButton(1, this.width / 2 - 154, this.height - 52, 150, 20, StatCollector.translateToLocal("selectWorld.select"))); this.buttonList.add(this.buttonSelect = new GuiButton(1, this.width / 2 - 154, this.height - 52, 150, 20, var1.translateKey("selectWorld.select")));
this.buttonList.add(new GuiButton(3, this.width / 2 + 4, this.height - 52, 150, 20, StatCollector.translateToLocal("selectWorld.create"))); this.buttonList.add(new GuiButton(3, this.width / 2 + 4, this.height - 52, 150, 20, var1.translateKey("selectWorld.create")));
this.buttonList.add(this.buttonRename = new GuiButton(6, this.width / 2 - 154, this.height - 28, 72, 20, StatCollector.translateToLocal("selectWorld.rename"))); this.buttonList.add(this.buttonRename = new GuiButton(6, this.width / 2 - 154, this.height - 28, 72, 20, var1.translateKey("selectWorld.rename")));
this.buttonList.add(this.buttonDelete = new GuiButton(2, this.width / 2 - 76, this.height - 28, 72, 20, StatCollector.translateToLocal("selectWorld.delete"))); this.buttonList.add(this.buttonDelete = new GuiButton(2, this.width / 2 - 76, this.height - 28, 72, 20, var1.translateKey("selectWorld.delete")));
this.buttonList.add(this.buttonRecreate = new GuiButton(7, this.width / 2 + 4, this.height - 28, 72, 20, StatCollector.translateToLocal("selectWorld.recreate"))); this.buttonList.add(this.buttonBackup = new GuiButton(7, this.width / 2 + 4, this.height - 28, 72, 20, var1.translateKey("selectWorld.backup")));
this.buttonList.add(new GuiButton(0, this.width / 2 + 82, this.height - 28, 72, 20, StatCollector.translateToLocal("gui.cancel"))); this.buttonList.add(new GuiButton(0, this.width / 2 + 82, this.height - 28, 72, 20, var1.translateKey("gui.cancel")));
this.buttonSelect.enabled = false; this.buttonSelect.enabled = false;
this.buttonDelete.enabled = false; this.buttonDelete.enabled = false;
this.buttonRename.enabled = false; this.buttonRename.enabled = false;
this.buttonRecreate.enabled = false; this.buttonBackup.enabled = false;
} }
/** /**
* Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). * Fired when a control is clicked. This is the equivalent of
* ActionListener.actionPerformed(ActionEvent e).
*/ */
protected void actionPerformed(GuiButton par1GuiButton) protected void actionPerformed(GuiButton par1GuiButton) {
{ if (par1GuiButton.enabled) {
if (par1GuiButton.enabled) if (par1GuiButton.id == 2) {
{
if (par1GuiButton.id == 2)
{
String var2 = this.getSaveName(this.selectedWorld); String var2 = this.getSaveName(this.selectedWorld);
if (var2 != null) if (var2 != null) {
{
this.deleting = true; this.deleting = true;
GuiYesNo var3 = getDeleteWorldScreen(this, var2, this.selectedWorld); GuiYesNo var3 = getDeleteWorldScreen(this, var2, this.selectedWorld);
this.mc.displayGuiScreen(var3); this.mc.displayGuiScreen(var3);
} }
} //this.mc.displayGuiScreen(new GuiScreenSingleplayerNotImplemented(this, "delete world"));
else if (par1GuiButton.id == 1) } else if (par1GuiButton.id == 1) {
{
this.selectWorld(this.selectedWorld); this.selectWorld(this.selectedWorld);
} } else if (par1GuiButton.id == 3) {
else if (par1GuiButton.id == 3) this.mc.displayGuiScreen(new GuiScreenCreateWorldSelection(this));
{ } else if (par1GuiButton.id == 6) {
this.mc.displayGuiScreen(new GuiCreateWorld(this));
}
else if (par1GuiButton.id == 6)
{
this.mc.displayGuiScreen(new GuiRenameWorld(this, this.getSaveFileName(this.selectedWorld))); this.mc.displayGuiScreen(new GuiRenameWorld(this, this.getSaveFileName(this.selectedWorld)));
} } else if (par1GuiButton.id == 0) {
else if (par1GuiButton.id == 0)
{
this.mc.displayGuiScreen(this.parentScreen); this.mc.displayGuiScreen(this.parentScreen);
} } else if (par1GuiButton.id == 7) {
else if (par1GuiButton.id == 7) //GuiCreateWorld var5 = new GuiCreateWorld(this);
{ //var5.func_82286_a(new WorldInfo(this.saveList.get(this.selectedWorld).levelDat));
GuiCreateWorld var5 = new GuiCreateWorld(this); //this.mc.displayGuiScreen(var5);
ISaveHandler var6 = this.mc.getSaveLoader().getSaveLoader(this.getSaveFileName(this.selectedWorld), false); this.mc.displayGuiScreen(new GuiScreenBackupWorld(this, this.getSaveFileName(this.selectedWorld),
WorldInfo var4 = var6.loadWorldInfo(); ((SaveFormatComparator)getSize(this).get(selectedWorld)).levelDat));
var6.flush(); } else {
var5.func_82286_a(var4);
this.mc.displayGuiScreen(var5);
}
else
{
this.worldSlotContainer.actionPerformed(par1GuiButton); this.worldSlotContainer.actionPerformed(par1GuiButton);
} }
} }
@ -215,122 +217,124 @@ public class GuiSelectWorld extends GuiScreen
} }
} }
public void confirmClicked(boolean par1, int par2) public void confirmClicked(boolean par1, int par2) {
{ if (this.deleting) {
if (this.deleting)
{
this.deleting = false; this.deleting = false;
/*
if (par1) if (par1) {
{ waitingForWorlds = true;
ISaveFormat var3 = this.mc.getSaveLoader(); IntegratedServer.requestWorldList();
var3.flushCache(); }
var3.deleteWorldDirectory(this.getSaveFileName(par2)); */
if (par1) {
try IntegratedServer.deleteWorld(this.getSaveFileName(par2));
{ this.mc.displayGuiScreen(new GuiScreenSingleplayerLoading(this, "selectWorld.progress.deleting", () -> IntegratedServer.isReady()));
this.loadSaves(); }else {
} this.mc.displayGuiScreen(this);
catch (Exception var5)
{
var5.printStackTrace();
}
} }
this.mc.displayGuiScreen(this);
} }
} }
/** /**
* 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) {
{
this.worldSlotContainer.drawScreen(par1, par2, par3); this.worldSlotContainer.drawScreen(par1, par2, par3);
this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215); this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215);
// EaglerAdapter.glPushMatrix();
// EaglerAdapter.glScalef(0.75f, 0.75f, 0.75f);
//
// String text = StringTranslate.getInstance().translateKey("directConnect.lanWorld");
// int w = mc.fontRenderer.getStringWidth(text);
// boolean hover = par1 > 1 && par2 > 1 && par1 < (w * 3 / 4) + 7 && par2 < 12;
//
// drawString(mc.fontRenderer, EnumChatFormatting.UNDERLINE + text, 5, 5, hover ? 0xFFEEEE22 : 0xFFCCCCCC);
//
// EaglerAdapter.glPopMatrix();
super.drawScreen(par1, par2, par3); super.drawScreen(par1, par2, par3);
} }
public void mouseClicked(int xx, int yy, int btn) {
String text = StringTranslate.getInstance().translateKey("directConnect.lanWorld");
int w = mc.fontRenderer.getStringWidth(text);
if(xx > 2 && yy > 2 && xx < (w * 3 / 4) + 5 && yy < 12) {
mc.displayGuiScreen(new GuiScreenLANConnect(this));
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
}
super.mouseClicked(xx, yy, btn);
}
/** /**
* Gets a GuiYesNo screen with the warning, buttons, etc. * Gets a GuiYesNo screen with the warning, buttons, etc.
*/ */
public static GuiYesNo getDeleteWorldScreen(GuiScreen par0GuiScreen, String par1Str, int par2) public static GuiYesNo getDeleteWorldScreen(GuiScreen par0GuiScreen, String par1Str, int par2) {
{ StringTranslate var3 = StringTranslate.getInstance();
String var3 = StatCollector.translateToLocal("selectWorld.deleteQuestion"); String var4 = var3.translateKey("selectWorld.deleteQuestion");
String var4 = "\'" + par1Str + "\' " + StatCollector.translateToLocal("selectWorld.deleteWarning"); String var5 = "\'" + par1Str + "\' " + var3.translateKey("selectWorld.deleteWarning");
String var5 = StatCollector.translateToLocal("selectWorld.deleteButton"); String var6 = var3.translateKey("selectWorld.deleteButton");
String var6 = StatCollector.translateToLocal("gui.cancel"); String var7 = var3.translateKey("gui.cancel");
GuiYesNo var7 = new GuiYesNo(par0GuiScreen, var3, var4, var5, var6, par2); GuiYesNo var8 = new GuiYesNo(par0GuiScreen, var4, var5, var6, var7, par2);
return var7; return var8;
} }
static List getSize(GuiSelectWorld par0GuiSelectWorld) static List getSize(GuiSelectWorld par0GuiSelectWorld) {
{
return par0GuiSelectWorld.saveList; return par0GuiSelectWorld.saveList;
} }
/** /**
* called whenever an element in this gui is selected * called whenever an element in this gui is selected
*/ */
static int onElementSelected(GuiSelectWorld par0GuiSelectWorld, int par1) static int onElementSelected(GuiSelectWorld par0GuiSelectWorld, int par1) {
{
return par0GuiSelectWorld.selectedWorld = par1; return par0GuiSelectWorld.selectedWorld = par1;
} }
/** /**
* returns the world currently selected * returns the world currently selected
*/ */
static int getSelectedWorld(GuiSelectWorld par0GuiSelectWorld) static int getSelectedWorld(GuiSelectWorld par0GuiSelectWorld) {
{
return par0GuiSelectWorld.selectedWorld; return par0GuiSelectWorld.selectedWorld;
} }
/** /**
* returns the select button * returns the select button
*/ */
static GuiButton getSelectButton(GuiSelectWorld par0GuiSelectWorld) static GuiButton getSelectButton(GuiSelectWorld par0GuiSelectWorld) {
{
return par0GuiSelectWorld.buttonSelect; return par0GuiSelectWorld.buttonSelect;
} }
/** /**
* returns the rename button * returns the rename button
*/ */
static GuiButton getRenameButton(GuiSelectWorld par0GuiSelectWorld) static GuiButton getRenameButton(GuiSelectWorld par0GuiSelectWorld) {
{
return par0GuiSelectWorld.buttonDelete; return par0GuiSelectWorld.buttonDelete;
} }
/** /**
* returns the delete button * returns the delete button
*/ */
static GuiButton getDeleteButton(GuiSelectWorld par0GuiSelectWorld) static GuiButton getDeleteButton(GuiSelectWorld par0GuiSelectWorld) {
{
return par0GuiSelectWorld.buttonRename; return par0GuiSelectWorld.buttonRename;
} }
static GuiButton func_82312_f(GuiSelectWorld par0GuiSelectWorld) static GuiButton func_82312_f(GuiSelectWorld par0GuiSelectWorld) {
{ return par0GuiSelectWorld.buttonBackup;
return par0GuiSelectWorld.buttonRecreate;
} }
static String func_82313_g(GuiSelectWorld par0GuiSelectWorld) static String func_82313_g(GuiSelectWorld par0GuiSelectWorld) {
{
return par0GuiSelectWorld.localizedWorldText; return par0GuiSelectWorld.localizedWorldText;
} }
static DateFormat func_82315_h(GuiSelectWorld par0GuiSelectWorld) static DateFormat func_82315_h(GuiSelectWorld par0GuiSelectWorld) {
{
return par0GuiSelectWorld.dateFormatter; return par0GuiSelectWorld.dateFormatter;
} }
static String func_82311_i(GuiSelectWorld par0GuiSelectWorld) static String func_82311_i(GuiSelectWorld par0GuiSelectWorld) {
{
return par0GuiSelectWorld.localizedMustConvertText; return par0GuiSelectWorld.localizedMustConvertText;
} }
static String[] func_82314_j(GuiSelectWorld par0GuiSelectWorld) static String[] func_82314_j(GuiSelectWorld par0GuiSelectWorld) {
{
return par0GuiSelectWorld.localizedGameModeText; return par0GuiSelectWorld.localizedGameModeText;
} }
} }

View File

@ -4,6 +4,7 @@ import net.lax1dude.eaglercraft.*;
import net.lax1dude.eaglercraft.adapter.Tessellator; import net.lax1dude.eaglercraft.adapter.Tessellator;
import net.lax1dude.eaglercraft.glemu.FixedFunctionShader; import net.lax1dude.eaglercraft.glemu.FixedFunctionShader;
import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
@ -1243,64 +1244,12 @@ public class Minecraft
/** /**
* Arguments: World foldername, World ingame name, WorldSettings * Arguments: World foldername, World ingame name, WorldSettings
*/ */
public void launchIntegratedServer(String par1Str, String par2Str, WorldSettings par3WorldSettings) // FIX THIS SHIT public void launchIntegratedServer(String folderName, String trim, WorldSettings var6) {
{ this.loadWorld((WorldClient)null);
/*this.loadWorld((WorldClient)null);
System.gc();
ISaveHandler var4 = this.saveLoader.getSaveLoader(par1Str, false);
WorldInfo var5 = var4.loadWorldInfo();
if (var5 == null && par3WorldSettings != null) IntegratedServer.loadWorld(folderName, gameSettings.difficulty, var6);
{
var5 = new WorldInfo(par3WorldSettings, par1Str);
var4.saveWorldInfo(var5);
}
if (par3WorldSettings == null) this.displayGuiScreen(new GuiScreenSingleplayerLoading(new GuiScreenSingleplayerConnecting(new GuiMainMenu(), "Connecting to " + folderName), "Loading world: " + folderName, () -> IntegratedServer.isWorldRunning()));
{
par3WorldSettings = new WorldSettings(var5);
}
this.statFileWriter.readStat(StatList.startGameStat, 1);
this.theIntegratedServer = new IntegratedServer(this, par1Str, par2Str, par3WorldSettings);
this.theIntegratedServer.startServerThread();
this.integratedServerIsRunning = true;
this.loadingScreen.displayProgressMessage(I18n.getString("menu.loadingLevel"));
while (!this.theIntegratedServer.serverIsInRunLoop())
{
String var6 = this.theIntegratedServer.getUserMessage();
if (var6 != null)
{
this.loadingScreen.resetProgresAndWorkingMessage(I18n.getString(var6));
}
else
{
this.loadingScreen.resetProgresAndWorkingMessage("");
}
try
{
Thread.sleep(200L);
}
catch (InterruptedException var9)
{
;
}
}
this.displayGuiScreen((GuiScreen)null);
try
{
NetClientHandler var10 = new NetClientHandler(this, this.theIntegratedServer);
this.myNetworkManager = var10.getNetManager();
}
catch (IOException var8)
{
this.displayCrashReport(this.addGraphicsAndWorldToCrashReport(new CrashReport("Connecting to integrated server", var8)));
}*/
} }
/** /**

View File

@ -1,7 +1,6 @@
package net.minecraft.src; package net.minecraft.src;
public class SaveFormatComparator implements Comparable public class SaveFormatComparator implements Comparable {
{
/** the file name of this save */ /** the file name of this save */
private final String fileName; private final String fileName;
@ -16,8 +15,10 @@ public class SaveFormatComparator implements Comparable
private final boolean hardcore; private final boolean hardcore;
private final boolean cheatsEnabled; private final boolean cheatsEnabled;
public SaveFormatComparator(String par1Str, String par2Str, long par3, long par5, EnumGameType par7EnumGameType, boolean par8, boolean par9, boolean par10) public final NBTTagCompound levelDat;
{
public SaveFormatComparator(String par1Str, String par2Str, long par3, long par5, EnumGameType par7EnumGameType,
boolean par8, boolean par9, boolean par10, NBTTagCompound levelDat) {
this.fileName = par1Str; this.fileName = par1Str;
this.displayName = par2Str; this.displayName = par2Str;
this.lastTimePlayed = par3; this.lastTimePlayed = par3;
@ -26,62 +27,56 @@ public class SaveFormatComparator implements Comparable
this.requiresConversion = par8; this.requiresConversion = par8;
this.hardcore = par9; this.hardcore = par9;
this.cheatsEnabled = par10; this.cheatsEnabled = par10;
this.levelDat = levelDat;
} }
/** /**
* return the file name * return the file name
*/ */
public String getFileName() public String getFileName() {
{
return this.fileName; return this.fileName;
} }
/** /**
* return the display name of the save * return the display name of the save
*/ */
public String getDisplayName() public String getDisplayName() {
{
return this.displayName; return this.displayName;
} }
public boolean requiresConversion() public boolean requiresConversion() {
{
return this.requiresConversion; return this.requiresConversion;
} }
public long getLastTimePlayed() public long getLastTimePlayed() {
{
return this.lastTimePlayed; return this.lastTimePlayed;
} }
public int compareTo(SaveFormatComparator par1SaveFormatComparator) public int compareTo(SaveFormatComparator par1SaveFormatComparator) {
{ return this.lastTimePlayed < par1SaveFormatComparator.lastTimePlayed ? 1
return this.lastTimePlayed < par1SaveFormatComparator.lastTimePlayed ? 1 : (this.lastTimePlayed > par1SaveFormatComparator.lastTimePlayed ? -1 : this.fileName.compareTo(par1SaveFormatComparator.fileName)); : (this.lastTimePlayed > par1SaveFormatComparator.lastTimePlayed ? -1
: this.fileName.compareTo(par1SaveFormatComparator.fileName));
} }
/** /**
* Gets the EnumGameType. * Gets the EnumGameType.
*/ */
public EnumGameType getEnumGameType() public EnumGameType getEnumGameType() {
{
return this.theEnumGameType; return this.theEnumGameType;
} }
public boolean isHardcoreModeEnabled() public boolean isHardcoreModeEnabled() {
{
return this.hardcore; return this.hardcore;
} }
/** /**
* @return {@code true} if cheats are enabled for this world * @return {@code true} if cheats are enabled for this world
*/ */
public boolean getCheatsEnabled() public boolean getCheatsEnabled() {
{
return this.cheatsEnabled; return this.cheatsEnabled;
} }
public int compareTo(Object par1Obj) public int compareTo(Object par1Obj) {
{ return this.compareTo((SaveFormatComparator) par1Obj);
return this.compareTo((SaveFormatComparator)par1Obj);
} }
} }