Compare commits
3 Commits
d2d261301c
...
c651bb8041
Author | SHA1 | Date |
---|---|---|
|
c651bb8041 | |
|
d770f9c841 | |
|
f7d97a445d |
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<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>
|
|
@ -10,7 +10,7 @@ sourceSets {
|
|||
java {
|
||||
srcDirs(
|
||||
"src/main/java",
|
||||
"src/lwjgl/java"
|
||||
"src/teavm/java"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -25,10 +25,10 @@ tasks.withType(JavaCompile) {
|
|||
options.compilerArgs << "-Xmaxerrs" << "1000"
|
||||
}
|
||||
|
||||
sourceSets.main.resources.srcDirs += 'src/lwjgl/java/javazoom/jl/decoder'
|
||||
//sourceSets.main.resources.srcDirs += 'src/lwjgl/java/javazoom/jl/decoder'
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: './lwjgl-rundir/', include: '*.jar')
|
||||
//implementation fileTree(dir: './lwjgl-rundir/', include: '*.jar')
|
||||
|
||||
teavm(teavm.libs.jso)
|
||||
teavm(teavm.libs.jsoApis)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
45854
javascript/classes.js
45854
javascript/classes.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -19,7 +19,7 @@ try {
|
|||
*/
|
||||
const relayId = Math.floor(Math.random() * 3);
|
||||
window.eaglercraftOpts = {
|
||||
container: "game_frame", assetsURI: "assets.epk", serverWorkerURI: null, worldsFolder: "TEST",
|
||||
container: "game_frame", assetsURI: "assets.epk", serverWorkerURI: "worker_bootstrap.js", worldsFolder: "TEST",
|
||||
assetOverrides: {
|
||||
// "title/no-pano-blur.flag": "",
|
||||
"records/wait.mp3": "wait.mp3",
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -5,7 +5,7 @@ import java.util.List;
|
|||
|
||||
public class ConfigConstants {
|
||||
|
||||
public static final String version = "25w11c";
|
||||
public static final String version = "25w12a";
|
||||
public static final String mainMenuString = "Eaglercraft " + version;
|
||||
|
||||
public static final String forkMe = "https://git.zelz.net/catfoolyou/Project164";
|
||||
|
|
|
@ -534,22 +534,14 @@ public class IntegratedServer {
|
|||
@JSBody(params = { "wb" }, script = "onmessage = function(o) { wb(o.data.ch, o.data.dat); };")
|
||||
private static native void registerPacketHandler(WorkerBinaryPacketHandler wb);
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
public static void startServer() {
|
||||
registerPacketHandler(new WorkerBinaryPacketHandlerImpl());
|
||||
|
||||
isRunning = true;
|
||||
|
||||
sendIPCPacket(new IPCPacketFFProcessKeepAlive(0xFF));
|
||||
|
||||
while(isRunning) {
|
||||
|
||||
mainLoop();
|
||||
|
||||
SysUtil.immediateContinue();
|
||||
}
|
||||
|
||||
// yee
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class SkinsPlugin {
|
|||
System.arraycopy(data, 0, conc2, conc.length, data.length);
|
||||
conc = conc2;
|
||||
}
|
||||
player.playerNetServerHandler.sendPacket(new Packet250CustomPayload("EAG|UserSkin", conc));
|
||||
player.playerNetServerHandler.sendPacketToPlayer(new Packet250CustomPayload("EAG|UserSkin", conc));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -81,7 +81,7 @@ public class SkinsPlugin {
|
|||
for(Object o : player.mcServer.getConfigurationManager().playerEntityList) {
|
||||
EntityPlayerMP pl = (EntityPlayerMP) o;
|
||||
if(!pl.username.equals(user)) {
|
||||
pl.playerNetServerHandler.sendPacket(new Packet250CustomPayload("EAG|SkinLayers", bpacket));
|
||||
pl.playerNetServerHandler.sendPacketToPlayer(new Packet250CustomPayload("EAG|SkinLayers", bpacket));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -89,7 +89,7 @@ public class VFSChunkLoader implements IChunkLoader {
|
|||
try {
|
||||
NBTTagCompound chunkFileSave = new NBTTagCompound();
|
||||
chunkFileSave.setCompoundTag("Level", chunkFile);
|
||||
save = CompressedStreamTools.compressChunk(chunkFileSave);
|
||||
save = CompressedStreamTools.compress(chunkFileSave);
|
||||
}catch(IOException e) {
|
||||
System.err.println("Corrupted chunk could not be serialized: [" + var2.xPosition + ", " + var2.zPosition + "]");
|
||||
return;
|
||||
|
@ -262,7 +262,7 @@ public class VFSChunkLoader implements IChunkLoader {
|
|||
Entity var20 = (Entity) var18.next();
|
||||
var11 = new NBTTagCompound();
|
||||
|
||||
if (var20.addEntityID(var11)) {
|
||||
if (var20.writeToNBTOptional(var11)) {
|
||||
par1Chunk.hasEntities = true;
|
||||
var16.appendTag(var11);
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ public class VFSChunkLoader implements IChunkLoader {
|
|||
var15.setInteger("y", var14.yCoord);
|
||||
var15.setInteger("z", var14.zCoord);
|
||||
var15.setInteger("t", (int) (var14.scheduledTime - var22));
|
||||
var15.setInteger("p", var14.field_82754_f);
|
||||
var15.setInteger("p", var14.priority);
|
||||
var12.appendTag(var15);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ public class VFSSaveHandler implements ISaveHandler, IPlayerFileData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IPlayerFileData getPlayerNBTManager() {
|
||||
public IPlayerFileData getSaveHandler() {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerMisc;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -15,7 +17,20 @@ public class AchievementMap {
|
|||
}
|
||||
|
||||
/** Maps a achievement id with it's unique GUID. */
|
||||
private Map guidMap = new HashMap();
|
||||
private static Map guidMap = new HashMap();
|
||||
|
||||
public static void init(){
|
||||
try {
|
||||
String[] strs = EaglerMisc.bytesToLines(Minecraft.getMinecraft().texturePackList.getSelectedTexturePack().getResourceAsBytes("/achievement/map.txt"));
|
||||
for(String str : strs) {
|
||||
String[] var3 = str.split(",");
|
||||
int var4 = Integer.parseInt(var3[0]);
|
||||
guidMap.put(Integer.valueOf(var4), var3[1]);
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
var5.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private AchievementMap(List<String> guid) {
|
||||
for (String var2 : guid) {
|
||||
|
|
|
@ -2,6 +2,9 @@ package net.minecraft.src;
|
|||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
import net.lax1dude.eaglercraft.IntegratedServer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GuiCreateWorld extends GuiScreen
|
||||
{
|
||||
|
@ -121,24 +124,8 @@ 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
|
||||
* appending -s to the end until a free name is available.
|
||||
*/
|
||||
private void makeUseableName()
|
||||
{
|
||||
this.folderName = this.textboxWorldName.getText().trim();
|
||||
char[] var1 = ChatAllowedCharacters.allowedCharactersArray;
|
||||
int var2 = var1.length;
|
||||
|
||||
for (int var3 = 0; var3 < var2; ++var3)
|
||||
{
|
||||
char var4 = var1[var3];
|
||||
this.folderName = this.folderName.replace(var4, '_');
|
||||
}
|
||||
|
||||
if (MathHelper.stringNullOrLengthZero(this.folderName))
|
||||
{
|
||||
this.folderName = "World";
|
||||
}
|
||||
|
||||
this.folderName = func_73913_a(this.mc.getSaveLoader(), this.folderName);
|
||||
private void makeUseableName() {
|
||||
this.folderName = makeUsableName(this.textboxWorldName.getText().trim());
|
||||
}
|
||||
|
||||
public static String makeUsableName(String s) {
|
||||
|
@ -153,7 +140,7 @@ public class GuiCreateWorld extends GuiScreen
|
|||
if (MathHelper.stringNullOrLengthZero(s)) {
|
||||
s = "World";
|
||||
}
|
||||
return s; // FIX THIS!!!
|
||||
return func_73913_a(s);
|
||||
}
|
||||
|
||||
private void updateButtonText()
|
||||
|
@ -196,25 +183,31 @@ public class GuiCreateWorld extends GuiScreen
|
|||
}
|
||||
}
|
||||
|
||||
public static String func_73913_a(ISaveFormat par0ISaveFormat, String par1Str)
|
||||
{
|
||||
public static String func_73913_a(String par1Str) {
|
||||
par1Str = par1Str.replaceAll("[\\./\"]", "_");
|
||||
String[] var2 = ILLEGAL_WORLD_NAMES;
|
||||
int var3 = var2.length;
|
||||
|
||||
for (int var4 = 0; var4 < var3; ++var4)
|
||||
{
|
||||
for (int var4 = 0; var4 < var3; ++var4) {
|
||||
String var5 = var2[var4];
|
||||
|
||||
if (par1Str.equalsIgnoreCase(var5))
|
||||
{
|
||||
if (par1Str.equalsIgnoreCase(var5)) {
|
||||
par1Str = "_" + par1Str + "_";
|
||||
}
|
||||
}
|
||||
|
||||
while (par0ISaveFormat.getWorldInfo(par1Str) != null)
|
||||
{
|
||||
par1Str = par1Str + "-";
|
||||
List<NBTTagCompound> l = IntegratedServer.getWorldList();
|
||||
if(l != null) {
|
||||
boolean shit = true;
|
||||
while(shit) {
|
||||
shit = false;
|
||||
for(NBTTagCompound nbt : l) {
|
||||
if(par1Str.equals(nbt.getString("folderName"))) {
|
||||
par1Str = par1Str + "-";
|
||||
shit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return par1Str;
|
||||
|
|
|
@ -142,7 +142,7 @@ public class GuiMainMenu extends GuiScreen {
|
|||
StringTranslate var2 = StringTranslate.getInstance();
|
||||
int var4 = this.height / 4 + 48;
|
||||
|
||||
if(EaglerAdapter.isIntegratedServerAvailable()) { // EaglerAdapter.isIntegratedServerAvailable()
|
||||
if(EnumBrowser.getBrowser() != EnumBrowser.DESKTOP) { // EaglerAdapter.isIntegratedServerAvailable()
|
||||
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, var4, var2.translateKey("menu.singleplayer")));
|
||||
this.buttonList.add(new GuiButton(2, this.width / 2 - 100, var4 + 24 * 1, var2.translateKey("menu.multiplayer")));
|
||||
this.buttonList.add(new GuiButton(3, this.width / 2 - 100, var4 + 24 * 2, var2.translateKey("menu.forkme")));
|
||||
|
|
|
@ -1,91 +1,102 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.GuiScreenSingleplayerLoading;
|
||||
import net.lax1dude.eaglercraft.IntegratedServer;
|
||||
|
||||
public class GuiRenameWorld extends GuiScreen
|
||||
{
|
||||
public class GuiRenameWorld extends GuiScreen {
|
||||
private GuiScreen parentGuiScreen;
|
||||
private GuiTextField theGuiTextField;
|
||||
private final String worldName;
|
||||
private final boolean duplicate;
|
||||
|
||||
public GuiRenameWorld(GuiScreen par1GuiScreen, String par2Str)
|
||||
{
|
||||
public GuiRenameWorld(GuiScreen par1GuiScreen, String par2Str) {
|
||||
this.parentGuiScreen = par1GuiScreen;
|
||||
this.worldName = par2Str;
|
||||
this.duplicate = false;
|
||||
}
|
||||
|
||||
public GuiRenameWorld(GuiScreen par1GuiScreen, String par2Str, boolean d) {
|
||||
this.parentGuiScreen = par1GuiScreen;
|
||||
this.worldName = par2Str;
|
||||
this.duplicate = d;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from the main game loop to update the screen.
|
||||
*/
|
||||
public void updateScreen()
|
||||
{
|
||||
public void updateScreen() {
|
||||
this.theGuiTextField.updateCursorCounter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the buttons (and other controls) to the screen in question.
|
||||
*/
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
StringTranslate var1 = StringTranslate.getInstance();
|
||||
EaglerAdapter.enableRepeatEvents(true);
|
||||
this.buttonList.clear();
|
||||
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, StatCollector.translateToLocal("selectWorld.renameButton")));
|
||||
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, StatCollector.translateToLocal("gui.cancel")));
|
||||
ISaveFormat var1 = this.mc.getSaveLoader();
|
||||
WorldInfo var2 = var1.getWorldInfo(this.worldName);
|
||||
String var3 = var2.getWorldName();
|
||||
this.theGuiTextField = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 60, 200, 20);
|
||||
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12,
|
||||
var1.translateKey(duplicate ? "selectWorld.duplicateButton" : "selectWorld.renameButton")));
|
||||
this.buttonList.add(
|
||||
new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, var1.translateKey("gui.cancel")));
|
||||
//ISaveFormat var2 = this.mc.getSaveLoader();
|
||||
//WorldInfo var3 = var2.getWorldInfo(this.worldName);
|
||||
String var4 = worldName; //var3.getWorldName(); //TODO: add rename logic
|
||||
if(duplicate) {
|
||||
var4 = "Copy of " + var4;
|
||||
}
|
||||
this.theGuiTextField = new GuiTextField(this.fontRenderer, this.width / 2 - 100, this.height / 4 + 3, 200, 20);
|
||||
this.theGuiTextField.setFocused(true);
|
||||
this.theGuiTextField.setText(var3);
|
||||
this.theGuiTextField.setText(var4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the screen is unloaded. Used to disable keyboard repeat events
|
||||
*/
|
||||
public void onGuiClosed()
|
||||
{
|
||||
public void onGuiClosed() {
|
||||
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)
|
||||
{
|
||||
if (par1GuiButton.enabled)
|
||||
{
|
||||
if (par1GuiButton.id == 1)
|
||||
{
|
||||
this.mc.displayGuiScreen(this.parentGuiScreen);
|
||||
}
|
||||
else if (par1GuiButton.id == 0)
|
||||
{
|
||||
ISaveFormat var2 = this.mc.getSaveLoader();
|
||||
var2.renameWorld(this.worldName, this.theGuiTextField.getText().trim());
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if (par1GuiButton.enabled) {
|
||||
if (par1GuiButton.id == 1) {
|
||||
this.mc.displayGuiScreen(this.parentGuiScreen);
|
||||
} else if (par1GuiButton.id == 0) {
|
||||
//ISaveFormat var2 = this.mc.getSaveLoader();
|
||||
//var2.renameWorld(this.worldName, this.theGuiTextField.getText().trim());
|
||||
String str = theGuiTextField.getText().trim();
|
||||
if(duplicate) {
|
||||
IntegratedServer.copyMoveWorld(worldName, GuiCreateWorld.makeUsableName(str), str, true);
|
||||
}else {
|
||||
IntegratedServer.setWorldName(worldName, str);
|
||||
}
|
||||
this.mc.displayGuiScreen(new GuiScreenSingleplayerLoading(this.parentGuiScreen, "selectWorld.progress." + (duplicate ? "copying" : "renaming"), () -> IntegratedServer.isReady()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.theGuiTextField.textboxKeyTyped(par1, par2);
|
||||
((GuiButton)this.buttonList.get(0)).enabled = this.theGuiTextField.getText().trim().length() > 0;
|
||||
((GuiButton) this.buttonList.get(0)).enabled = this.theGuiTextField.getText().trim().length() > 0;
|
||||
|
||||
if (par2 == 28 || par2 == 156)
|
||||
{
|
||||
this.actionPerformed((GuiButton)this.buttonList.get(0));
|
||||
if (par1 == 13) {
|
||||
this.actionPerformed((GuiButton) this.buttonList.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
this.theGuiTextField.mouseClicked(par1, par2, par3);
|
||||
}
|
||||
|
@ -93,11 +104,11 @@ public class GuiRenameWorld extends GuiScreen
|
|||
/**
|
||||
* 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.drawCenteredString(this.fontRenderer, StatCollector.translateToLocal("selectWorld.renameTitle"), this.width / 2, 20, 16777215);
|
||||
this.drawString(this.fontRenderer, StatCollector.translateToLocal("selectWorld.enterName"), this.width / 2 - 100, 47, 10526880);
|
||||
this.drawCenteredString(this.fontRenderer, var4.translateKey("selectWorld." + (duplicate ? "duplicateTitle" : "renameTitle")), this.width / 2, this.height / 4 - 60 + 20, 16777215);
|
||||
this.drawString(this.fontRenderer, var4.translateKey("selectWorld.enterName"), this.width / 2 - 100, this.height / 4 - 60 + 50, 10526880);
|
||||
this.theGuiTextField.drawTextBox();
|
||||
super.drawScreen(par1, par2, par3);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.IntegratedServer;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
|
@ -86,10 +88,14 @@ public class GuiSelectWorld extends GuiScreen
|
|||
/**
|
||||
* loads the saves
|
||||
*/
|
||||
private void loadSaves() throws Exception
|
||||
{
|
||||
ISaveFormat var1 = this.mc.getSaveLoader();
|
||||
this.saveList = var1.getSaveList();
|
||||
private void loadSaves() {
|
||||
this.saveList.clear();
|
||||
List<NBTTagCompound> levels = IntegratedServer.getWorldList();
|
||||
for(NBTTagCompound n : levels) {
|
||||
WorldInfo w = new WorldInfo(n.getCompoundTag("Data"));
|
||||
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
|
||||
}
|
||||
Collections.sort(this.saveList);
|
||||
this.selectedWorld = -1;
|
||||
}
|
||||
|
@ -187,32 +193,25 @@ public class GuiSelectWorld extends GuiScreen
|
|||
/**
|
||||
* Gets the selected world.
|
||||
*/
|
||||
public void selectWorld(int par1)
|
||||
{
|
||||
this.mc.displayGuiScreen((GuiScreen)null);
|
||||
public void selectWorld(int par1) {
|
||||
this.mc.displayGuiScreen((GuiScreen) null);
|
||||
|
||||
if (!this.selected)
|
||||
{
|
||||
if (!this.selected) {
|
||||
this.selected = true;
|
||||
String var2 = this.getSaveFileName(par1);
|
||||
|
||||
if (var2 == null)
|
||||
{
|
||||
if (var2 == null) {
|
||||
var2 = "World" + par1;
|
||||
}
|
||||
|
||||
String var3 = this.getSaveName(par1);
|
||||
|
||||
if (var3 == null)
|
||||
{
|
||||
if (var3 == null) {
|
||||
var3 = "World" + par1;
|
||||
}
|
||||
|
||||
if (this.mc.getSaveLoader().canLoadWorld(var2))
|
||||
{
|
||||
this.mc.launchIntegratedServer(var2, var3, (WorldSettings)null);
|
||||
//this.mc.statFileWriter.readStat(StatList.loadWorldStat, 1);
|
||||
}
|
||||
this.mc.launchIntegratedServer(var2, var3, (WorldSettings) null);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,48 +1,27 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ISaveFormat
|
||||
{
|
||||
public interface ISaveFormat {
|
||||
/**
|
||||
* Returns back a loader for the specified save directory
|
||||
*/
|
||||
ISaveHandler getSaveLoader(String var1, boolean var2);
|
||||
|
||||
List getSaveList() throws Exception;
|
||||
|
||||
void flushCache();
|
||||
|
||||
/**
|
||||
* gets the world info
|
||||
*/
|
||||
WorldInfo getWorldInfo(String var1);
|
||||
|
||||
/**
|
||||
* @args: Takes one argument - the name of the directory of the world to delete. @desc: Delete the world by deleting
|
||||
* the associated directory recursively.
|
||||
* @args: Takes one argument - the name of the directory of the world to
|
||||
* delete. @desc: Delete the world by deleting the associated directory
|
||||
* recursively.
|
||||
*/
|
||||
boolean deleteWorldDirectory(String var1);
|
||||
|
||||
/**
|
||||
* @args: Takes two arguments - first the name of the directory containing the world and second the new name for
|
||||
* that world. @desc: Renames the world by storing the new name in level.dat. It does *not* rename the directory
|
||||
* containing the world data.
|
||||
*/
|
||||
void renameWorld(String var1, String var2);
|
||||
|
||||
/**
|
||||
* Checks if the save directory uses the old map format
|
||||
* gets if the map is old chunk saving (true) or McRegion (false)
|
||||
*/
|
||||
boolean isOldMapFormat(String var1);
|
||||
|
||||
/**
|
||||
* Converts the specified map to the new map format. Args: worldName, loadingScreen
|
||||
* converts the map to mcRegion
|
||||
*/
|
||||
boolean convertMapFormat(String var1, IProgressUpdate var2);
|
||||
|
||||
/**
|
||||
* Return whether the given world can be loaded.
|
||||
*/
|
||||
boolean canLoadWorld(String var1);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import net.lax1dude.eaglercraft.sp.VFile;
|
||||
|
||||
public interface ISaveHandler
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ public interface ISaveHandler
|
|||
/**
|
||||
* Gets the file location of the given map
|
||||
*/
|
||||
File getMapFileFromName(String var1);
|
||||
VFile getMapFileFromName(String var1);
|
||||
|
||||
/**
|
||||
* Returns the name of the directory where world information is saved.
|
||||
|
|
|
@ -13,7 +13,7 @@ public class ItemMap extends ItemMapBase
|
|||
public static MapData getMPMapData(short par0, World par1World)
|
||||
{
|
||||
String var2 = "map_" + par0;
|
||||
MapData var3 = (MapData)par1World.loadItemData(MapData.class, var2);
|
||||
MapData var3 = (MapData)par1World.loadItemData((s) -> new MapData(s), var2);
|
||||
|
||||
if (var3 == null)
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ public class ItemMap extends ItemMapBase
|
|||
public MapData getMapData(ItemStack par1ItemStack, World par2World)
|
||||
{
|
||||
String var3 = "map_" + par1ItemStack.getItemDamage();
|
||||
MapData var4 = (MapData)par2World.loadItemData(MapData.class, var3);
|
||||
MapData var4 = (MapData)par2World.loadItemData((s) -> new MapData(s), var3);
|
||||
|
||||
if (var4 == null && !par2World.isRemote)
|
||||
{
|
||||
|
|
|
@ -219,7 +219,7 @@ public abstract class MapGenStructure extends MapGenBase
|
|||
{
|
||||
if (this.field_143029_e == null)
|
||||
{
|
||||
this.field_143029_e = (MapGenStructureData)par1World.loadItemData(MapGenStructureData.class, this.func_143025_a());
|
||||
this.field_143029_e = (MapGenStructureData)par1World.loadItemData((s) -> new MapGenStructureData(s), this.func_143025_a());
|
||||
|
||||
if (this.field_143029_e == null)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.sp.VFile;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class MapStorage
|
||||
{
|
||||
|
@ -34,47 +37,32 @@ public class MapStorage
|
|||
* Loads an existing MapDataBase corresponding to the given String id from disk, instantiating the given Class, or
|
||||
* returns null if none such file exists. args: Class to instantiate, String dataid
|
||||
*/
|
||||
public WorldSavedData loadData(Class par1Class, String par2Str)
|
||||
{
|
||||
WorldSavedData var3 = (WorldSavedData)this.loadedDataMap.get(par2Str);
|
||||
public WorldSavedData loadData(Function<String, WorldSavedData> par1Class, String par2Str) {
|
||||
WorldSavedData var3 = (WorldSavedData) this.loadedDataMap.get(par2Str);
|
||||
|
||||
if (var3 != null)
|
||||
{
|
||||
if (var3 != null) {
|
||||
return var3;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.saveHandler != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
File var4 = this.saveHandler.getMapFileFromName(par2Str);
|
||||
} else {
|
||||
if (this.saveHandler != null) {
|
||||
try {
|
||||
VFile var4 = this.saveHandler.getMapFileFromName(par2Str);
|
||||
|
||||
if (var4 != null && var4.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
var3 = (WorldSavedData)par1Class.getConstructor(new Class[] {String.class}).newInstance(new Object[] {par2Str});
|
||||
}
|
||||
catch (Exception var7)
|
||||
{
|
||||
if (var4 != null && var4.exists()) {
|
||||
try {
|
||||
var3 = (WorldSavedData) par1Class.apply(par2Str);
|
||||
} catch (Exception var7) {
|
||||
throw new RuntimeException("Failed to instantiate " + par1Class.toString(), var7);
|
||||
}
|
||||
|
||||
FileInputStream var5 = new FileInputStream(var4);
|
||||
NBTTagCompound var6 = CompressedStreamTools.readCompressed(var5);
|
||||
var5.close();
|
||||
NBTTagCompound var6 = CompressedStreamTools.readCompressed(var4.getInputStream());
|
||||
var3.readFromNBT(var6.getCompoundTag("data"));
|
||||
}
|
||||
}
|
||||
catch (Exception var8)
|
||||
{
|
||||
} catch (Exception var8) {
|
||||
var8.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (var3 != null)
|
||||
{
|
||||
if (var3 != null) {
|
||||
this.loadedDataMap.put(par2Str, var3);
|
||||
this.loadedDataList.add(var3);
|
||||
}
|
||||
|
@ -124,27 +112,21 @@ public class MapStorage
|
|||
/**
|
||||
* Saves the given MapDataBase to disk.
|
||||
*/
|
||||
private void saveData(WorldSavedData par1WorldSavedData)
|
||||
{
|
||||
if (this.saveHandler != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
File var2 = this.saveHandler.getMapFileFromName(par1WorldSavedData.mapName);
|
||||
private void saveData(WorldSavedData par1WorldSavedData) {
|
||||
if (this.saveHandler != null) {
|
||||
try {
|
||||
VFile var2 = this.saveHandler.getMapFileFromName(par1WorldSavedData.mapName);
|
||||
|
||||
if (var2 != null)
|
||||
{
|
||||
if (var2 != null) {
|
||||
NBTTagCompound var3 = new NBTTagCompound();
|
||||
par1WorldSavedData.writeToNBT(var3);
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setCompoundTag("data", var3);
|
||||
FileOutputStream var5 = new FileOutputStream(var2);
|
||||
CompressedStreamTools.writeCompressed(var4, var5);
|
||||
var5.close();
|
||||
OutputStream st = var2.getOutputStream();
|
||||
CompressedStreamTools.writeCompressed(var4, st);
|
||||
st.close();
|
||||
}
|
||||
}
|
||||
catch (Exception var6)
|
||||
{
|
||||
} catch (Exception var6) {
|
||||
var6.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -153,42 +135,34 @@ public class MapStorage
|
|||
/**
|
||||
* Loads the idCounts Map from the 'idcounts' file.
|
||||
*/
|
||||
private void loadIdCounts()
|
||||
{
|
||||
try
|
||||
{
|
||||
private void loadIdCounts() {
|
||||
try {
|
||||
this.idCounts.clear();
|
||||
|
||||
if (this.saveHandler == null)
|
||||
{
|
||||
if (this.saveHandler == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
File var1 = this.saveHandler.getMapFileFromName("idcounts");
|
||||
VFile var1 = this.saveHandler.getMapFileFromName("idcounts");
|
||||
|
||||
if (var1 != null && var1.exists())
|
||||
{
|
||||
DataInputStream var2 = new DataInputStream(new FileInputStream(var1));
|
||||
if (var1 != null && var1.exists()) {
|
||||
DataInputStream var2 = new DataInputStream(var1.getInputStream());
|
||||
NBTTagCompound var3 = CompressedStreamTools.read(var2);
|
||||
var2.close();
|
||||
Iterator var4 = var3.getTags().iterator();
|
||||
|
||||
while (var4.hasNext())
|
||||
{
|
||||
NBTBase var5 = (NBTBase)var4.next();
|
||||
while (var4.hasNext()) {
|
||||
NBTBase var5 = (NBTBase) var4.next();
|
||||
|
||||
if (var5 instanceof NBTTagShort)
|
||||
{
|
||||
NBTTagShort var6 = (NBTTagShort)var5;
|
||||
if (var5 instanceof NBTTagShort) {
|
||||
NBTTagShort var6 = (NBTTagShort) var5;
|
||||
String var7 = var6.getName();
|
||||
short var8 = var6.data;
|
||||
this.idCounts.put(var7, Short.valueOf(var8));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception var9)
|
||||
{
|
||||
} catch (Exception var9) {
|
||||
var9.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -196,50 +170,39 @@ public class MapStorage
|
|||
/**
|
||||
* Returns an unique new data id for the given prefix and saves the idCounts map to the 'idcounts' file.
|
||||
*/
|
||||
public int getUniqueDataId(String par1Str)
|
||||
{
|
||||
Short var2 = (Short)this.idCounts.get(par1Str);
|
||||
public int getUniqueDataId(String par1Str) {
|
||||
Short var2 = (Short) this.idCounts.get(par1Str);
|
||||
|
||||
if (var2 == null)
|
||||
{
|
||||
var2 = Short.valueOf((short)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
var2 = Short.valueOf((short)(var2.shortValue() + 1));
|
||||
if (var2 == null) {
|
||||
var2 = Short.valueOf((short) 0);
|
||||
} else {
|
||||
var2 = Short.valueOf((short) (var2.shortValue() + 1));
|
||||
}
|
||||
|
||||
this.idCounts.put(par1Str, var2);
|
||||
|
||||
if (this.saveHandler == null)
|
||||
{
|
||||
if (this.saveHandler == null) {
|
||||
return var2.shortValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
File var3 = this.saveHandler.getMapFileFromName("idcounts");
|
||||
} else {
|
||||
try {
|
||||
VFile var3 = this.saveHandler.getMapFileFromName("idcounts");
|
||||
|
||||
if (var3 != null)
|
||||
{
|
||||
if (var3 != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
Iterator var5 = this.idCounts.keySet().iterator();
|
||||
|
||||
while (var5.hasNext())
|
||||
{
|
||||
String var6 = (String)var5.next();
|
||||
short var7 = ((Short)this.idCounts.get(var6)).shortValue();
|
||||
while (var5.hasNext()) {
|
||||
String var6 = (String) var5.next();
|
||||
short var7 = ((Short) this.idCounts.get(var6)).shortValue();
|
||||
var4.setShort(var6, var7);
|
||||
}
|
||||
|
||||
DataOutputStream var9 = new DataOutputStream(new FileOutputStream(var3));
|
||||
OutputStream os = var3.getOutputStream();
|
||||
DataOutputStream var9 = new DataOutputStream(os);
|
||||
CompressedStreamTools.write(var4, var9);
|
||||
var9.close();
|
||||
os.close();
|
||||
}
|
||||
}
|
||||
catch (Exception var8)
|
||||
{
|
||||
} catch (Exception var8) {
|
||||
var8.printStackTrace();
|
||||
}
|
||||
|
||||
|
|
|
@ -187,6 +187,7 @@ public class Minecraft
|
|||
ColorizerGrass.setGrassBiomeColorizer(this.renderEngine.getTextureContents("/misc/grasscolor.png"));
|
||||
ColorizerFoliage.setFoliageBiomeColorizer(this.renderEngine.getTextureContents("/misc/foliagecolor.png"));
|
||||
this.entityRenderer = new EntityRenderer(this);
|
||||
AchievementMap.init();
|
||||
StatList.nopInit();
|
||||
RenderManager.instance = new RenderManager();
|
||||
RenderManager.instance.itemRenderer = new ItemRenderer(this);
|
||||
|
|
|
@ -10,6 +10,15 @@ public class Packet2ClientProtocol extends Packet {
|
|||
private String serverHost;
|
||||
private int viewDistance;
|
||||
|
||||
public Packet2ClientProtocol() {
|
||||
}
|
||||
|
||||
public Packet2ClientProtocol(int par1, String par2Str, String par3Str, int par4) {
|
||||
this.protocolVersion = par1;
|
||||
this.username = par2Str;
|
||||
this.serverHost = par3Str;
|
||||
this.viewDistance = par4;
|
||||
}
|
||||
/**
|
||||
* Abstract. Reads the raw packet data from the data stream.
|
||||
*/
|
||||
|
|
|
@ -66,12 +66,7 @@ public class PlayerSelector
|
|||
{
|
||||
Matcher var2 = tokenPattern.matcher(par1Str);
|
||||
|
||||
if (!var2.matches())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (var2.matches()) {
|
||||
Map var3 = getArgumentMap(var2.group(2));
|
||||
String var4 = var2.group(1);
|
||||
int var5 = getDefaultMinimumRange(var4);
|
||||
|
@ -84,90 +79,70 @@ public class PlayerSelector
|
|||
Map var12 = func_96560_a(var3);
|
||||
String var13 = null;
|
||||
String var14 = null;
|
||||
boolean var15 = false;
|
||||
|
||||
if (var3.containsKey("rm"))
|
||||
{
|
||||
var5 = MathHelper.parseIntWithDefault((String)var3.get("rm"), var5);
|
||||
var15 = true;
|
||||
if (var3.containsKey("rm")) {
|
||||
var5 = MathHelper.parseIntWithDefault((String) var3.get("rm"), var5);
|
||||
}
|
||||
|
||||
if (var3.containsKey("r"))
|
||||
{
|
||||
var6 = MathHelper.parseIntWithDefault((String)var3.get("r"), var6);
|
||||
var15 = true;
|
||||
if (var3.containsKey("r")) {
|
||||
var6 = MathHelper.parseIntWithDefault((String) var3.get("r"), var6);
|
||||
}
|
||||
|
||||
if (var3.containsKey("lm"))
|
||||
{
|
||||
var7 = MathHelper.parseIntWithDefault((String)var3.get("lm"), var7);
|
||||
if (var3.containsKey("lm")) {
|
||||
var7 = MathHelper.parseIntWithDefault((String) var3.get("lm"), var7);
|
||||
}
|
||||
|
||||
if (var3.containsKey("l"))
|
||||
{
|
||||
var8 = MathHelper.parseIntWithDefault((String)var3.get("l"), var8);
|
||||
if (var3.containsKey("l")) {
|
||||
var8 = MathHelper.parseIntWithDefault((String) var3.get("l"), var8);
|
||||
}
|
||||
|
||||
if (var3.containsKey("x"))
|
||||
{
|
||||
var11.posX = MathHelper.parseIntWithDefault((String)var3.get("x"), var11.posX);
|
||||
var15 = true;
|
||||
if (var3.containsKey("x")) {
|
||||
var11.posX = MathHelper.parseIntWithDefault((String) var3.get("x"), var11.posX);
|
||||
}
|
||||
|
||||
if (var3.containsKey("y"))
|
||||
{
|
||||
var11.posY = MathHelper.parseIntWithDefault((String)var3.get("y"), var11.posY);
|
||||
var15 = true;
|
||||
if (var3.containsKey("y")) {
|
||||
var11.posY = MathHelper.parseIntWithDefault((String) var3.get("y"), var11.posY);
|
||||
}
|
||||
|
||||
if (var3.containsKey("z"))
|
||||
{
|
||||
var11.posZ = MathHelper.parseIntWithDefault((String)var3.get("z"), var11.posZ);
|
||||
var15 = true;
|
||||
if (var3.containsKey("z")) {
|
||||
var11.posZ = MathHelper.parseIntWithDefault((String) var3.get("z"), var11.posZ);
|
||||
}
|
||||
|
||||
if (var3.containsKey("m"))
|
||||
{
|
||||
var10 = MathHelper.parseIntWithDefault((String)var3.get("m"), var10);
|
||||
if (var3.containsKey("m")) {
|
||||
var10 = MathHelper.parseIntWithDefault((String) var3.get("m"), var10);
|
||||
}
|
||||
|
||||
if (var3.containsKey("c"))
|
||||
{
|
||||
var9 = MathHelper.parseIntWithDefault((String)var3.get("c"), var9);
|
||||
if (var3.containsKey("c")) {
|
||||
var9 = MathHelper.parseIntWithDefault((String) var3.get("c"), var9);
|
||||
}
|
||||
|
||||
if (var3.containsKey("team"))
|
||||
{
|
||||
var14 = (String)var3.get("team");
|
||||
if (var3.containsKey("team")) {
|
||||
var14 = (String) var3.get("team");
|
||||
}
|
||||
|
||||
if (var3.containsKey("name"))
|
||||
{
|
||||
var13 = (String)var3.get("name");
|
||||
if (var3.containsKey("name")) {
|
||||
var13 = (String) var3.get("name");
|
||||
}
|
||||
|
||||
World var16 = var15 ? par0ICommandSender.getEntityWorld() : null;
|
||||
List var17;
|
||||
List var15;
|
||||
|
||||
if (!var4.equals("p") && !var4.equals("a"))
|
||||
{
|
||||
if (!var4.equals("r"))
|
||||
{
|
||||
if (!var4.equals("p") && !var4.equals("a")) {
|
||||
if (!var4.equals("r")) {
|
||||
return null;
|
||||
} else {
|
||||
var15 = MinecraftServer.getServer().getConfigurationManager().findPlayers(var11, var5, var6, 0, var10, var7, var8, var12, var13, var14);
|
||||
Collections.shuffle(var15);
|
||||
var15 = var15.subList(0, Math.min(var9, var15.size()));
|
||||
return var15 != null && !var15.isEmpty() ? (EntityPlayerMP[]) var15.toArray(new EntityPlayerMP[0])
|
||||
: new EntityPlayerMP[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
var17 = MinecraftServer.getServer().getConfigurationManager().findPlayers(var11, var5, var6, 0, var10, var7, var8, var12, var13, var14, var16);
|
||||
Collections.shuffle(var17);
|
||||
var17 = var17.subList(0, Math.min(var9, var17.size()));
|
||||
return var17 != null && !var17.isEmpty() ? (EntityPlayerMP[])var17.toArray(new EntityPlayerMP[0]) : new EntityPlayerMP[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var17 = MinecraftServer.getServer().getConfigurationManager().findPlayers(var11, var5, var6, var9, var10, var7, var8, var12, var13, var14, var16);
|
||||
return var17 != null && !var17.isEmpty() ? (EntityPlayerMP[])var17.toArray(new EntityPlayerMP[0]) : new EntityPlayerMP[0];
|
||||
} else {
|
||||
var15 = MinecraftServer.getServer().getConfigurationManager().findPlayers(var11, var5, var6, var9, var10, var7, var8, var12, var13, var14);
|
||||
return var15 != null && !var15.isEmpty() ? (EntityPlayerMP[]) var15.toArray(new EntityPlayerMP[0])
|
||||
: new EntityPlayerMP[0];
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public class RegionFileCache
|
||||
{
|
||||
/** A map containing Files as keys and RegionFiles as values */
|
||||
private static final Map regionsByFilename = new HashMap();
|
||||
|
||||
public static synchronized RegionFile createOrLoadRegionFile(File par0File, int par1, int par2)
|
||||
{
|
||||
File var3 = new File(par0File, "region");
|
||||
File var4 = new File(var3, "r." + (par1 >> 5) + "." + (par2 >> 5) + ".mca");
|
||||
RegionFile var5 = (RegionFile)regionsByFilename.get(var4);
|
||||
|
||||
if (var5 != null)
|
||||
{
|
||||
return var5;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!var3.exists())
|
||||
{
|
||||
var3.mkdirs();
|
||||
}
|
||||
|
||||
if (regionsByFilename.size() >= 256)
|
||||
{
|
||||
clearRegionFileReferences();
|
||||
}
|
||||
|
||||
RegionFile var6 = new RegionFile(var4);
|
||||
regionsByFilename.put(var4, var6);
|
||||
return var6;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the current Chunk Map Cache
|
||||
*/
|
||||
public static synchronized void clearRegionFileReferences()
|
||||
{
|
||||
Iterator var0 = regionsByFilename.values().iterator();
|
||||
|
||||
while (var0.hasNext())
|
||||
{
|
||||
RegionFile var1 = (RegionFile)var0.next();
|
||||
|
||||
try
|
||||
{
|
||||
if (var1 != null)
|
||||
{
|
||||
var1.close();
|
||||
}
|
||||
}
|
||||
catch (IOException var3)
|
||||
{
|
||||
var3.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
regionsByFilename.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an input stream for the specified chunk. Args: worldDir, chunkX, chunkZ
|
||||
*/
|
||||
public static DataInputStream getChunkInputStream(File par0File, int par1, int par2)
|
||||
{
|
||||
RegionFile var3 = createOrLoadRegionFile(par0File, par1, par2);
|
||||
return var3.getChunkDataInputStream(par1 & 31, par2 & 31);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an output stream for the specified chunk. Args: worldDir, chunkX, chunkZ
|
||||
*/
|
||||
public static DataOutputStream getChunkOutputStream(File par0File, int par1, int par2)
|
||||
{
|
||||
RegionFile var3 = createOrLoadRegionFile(par0File, par1, par2);
|
||||
return var3.getChunkDataOutputStream(par1 & 31, par2 & 31);
|
||||
}
|
||||
}
|
|
@ -1,230 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SaveFormatOld implements ISaveFormat
|
||||
{
|
||||
/**
|
||||
* Reference to the File object representing the directory for the world saves
|
||||
*/
|
||||
protected final File savesDirectory;
|
||||
|
||||
public SaveFormatOld(File par1File)
|
||||
{
|
||||
if (!par1File.exists())
|
||||
{
|
||||
par1File.mkdirs();
|
||||
}
|
||||
|
||||
this.savesDirectory = par1File;
|
||||
}
|
||||
|
||||
public List getSaveList() throws Exception
|
||||
{
|
||||
ArrayList var1 = new ArrayList();
|
||||
|
||||
for (int var2 = 0; var2 < 5; ++var2)
|
||||
{
|
||||
String var3 = "World" + (var2 + 1);
|
||||
WorldInfo var4 = this.getWorldInfo(var3);
|
||||
|
||||
if (var4 != null)
|
||||
{
|
||||
var1.add(new SaveFormatComparator(var3, "", var4.getLastTimePlayed(), var4.getSizeOnDisk(), var4.getGameType(), false, var4.isHardcoreModeEnabled(), var4.areCommandsAllowed()));
|
||||
}
|
||||
}
|
||||
|
||||
return var1;
|
||||
}
|
||||
|
||||
public void flushCache() {}
|
||||
|
||||
/**
|
||||
* gets the world info
|
||||
*/
|
||||
public WorldInfo getWorldInfo(String par1Str)
|
||||
{
|
||||
File var2 = new File(this.savesDirectory, par1Str);
|
||||
|
||||
if (!var2.exists())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
File var3 = new File(var2, "level.dat");
|
||||
NBTTagCompound var4;
|
||||
NBTTagCompound var5;
|
||||
|
||||
if (var3.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
var4 = CompressedStreamTools.readCompressed(new FileInputStream(var3));
|
||||
var5 = var4.getCompoundTag("Data");
|
||||
return new WorldInfo(var5);
|
||||
}
|
||||
catch (Exception var7)
|
||||
{
|
||||
var7.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
var3 = new File(var2, "level.dat_old");
|
||||
|
||||
if (var3.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
var4 = CompressedStreamTools.readCompressed(new FileInputStream(var3));
|
||||
var5 = var4.getCompoundTag("Data");
|
||||
return new WorldInfo(var5);
|
||||
}
|
||||
catch (Exception var6)
|
||||
{
|
||||
var6.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @args: Takes two arguments - first the name of the directory containing the world and second the new name for
|
||||
* that world. @desc: Renames the world by storing the new name in level.dat. It does *not* rename the directory
|
||||
* containing the world data.
|
||||
*/
|
||||
public void renameWorld(String par1Str, String par2Str)
|
||||
{
|
||||
File var3 = new File(this.savesDirectory, par1Str);
|
||||
|
||||
if (var3.exists())
|
||||
{
|
||||
File var4 = new File(var3, "level.dat");
|
||||
|
||||
if (var4.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
NBTTagCompound var5 = CompressedStreamTools.readCompressed(new FileInputStream(var4));
|
||||
NBTTagCompound var6 = var5.getCompoundTag("Data");
|
||||
var6.setString("LevelName", par2Str);
|
||||
CompressedStreamTools.writeCompressed(var5, new FileOutputStream(var4));
|
||||
}
|
||||
catch (Exception var7)
|
||||
{
|
||||
var7.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @args: Takes one argument - the name of the directory of the world to delete. @desc: Delete the world by deleting
|
||||
* the associated directory recursively.
|
||||
*/
|
||||
public boolean deleteWorldDirectory(String par1Str)
|
||||
{
|
||||
File var2 = new File(this.savesDirectory, par1Str);
|
||||
|
||||
if (!var2.exists())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Deleting level " + par1Str);
|
||||
|
||||
for (int var3 = 1; var3 <= 5; ++var3)
|
||||
{
|
||||
System.out.println("Attempt " + var3 + "...");
|
||||
|
||||
if (deleteFiles(var2.listFiles()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
System.out.println("Unsuccessful in deleting contents.");
|
||||
|
||||
if (var3 < 5)
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep(500L);
|
||||
}
|
||||
catch (InterruptedException var5)
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return var2.delete();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @args: Takes one argument - the list of files and directories to delete. @desc: Deletes the files and directory
|
||||
* listed in the list recursively.
|
||||
*/
|
||||
protected static boolean deleteFiles(File[] par0ArrayOfFile)
|
||||
{
|
||||
for (int var1 = 0; var1 < par0ArrayOfFile.length; ++var1)
|
||||
{
|
||||
File var2 = par0ArrayOfFile[var1];
|
||||
System.out.println("Deleting " + var2);
|
||||
|
||||
if (var2.isDirectory() && !deleteFiles(var2.listFiles()))
|
||||
{
|
||||
System.out.println("Couldn\'t delete directory " + var2);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!var2.delete())
|
||||
{
|
||||
System.out.println("Couldn\'t delete file " + var2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns back a loader for the specified save directory
|
||||
*/
|
||||
public ISaveHandler getSaveLoader(String par1Str, boolean par2)
|
||||
{
|
||||
return new SaveHandler(this.savesDirectory, par1Str, par2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the save directory uses the old map format
|
||||
*/
|
||||
public boolean isOldMapFormat(String par1Str)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the specified map to the new map format. Args: worldName, loadingScreen
|
||||
*/
|
||||
public boolean convertMapFormat(String par1Str, IProgressUpdate par2IProgressUpdate)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether the given world can be loaded.
|
||||
*/
|
||||
public boolean canLoadWorld(String par1Str)
|
||||
{
|
||||
File var2 = new File(this.savesDirectory, par1Str);
|
||||
return var2.isDirectory();
|
||||
}
|
||||
}
|
|
@ -1,345 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class SaveHandler implements ISaveHandler, IPlayerFileData
|
||||
{
|
||||
/** The directory in which to save world data. */
|
||||
private final File worldDirectory;
|
||||
|
||||
/** The directory in which to save player data. */
|
||||
private final File playersDirectory;
|
||||
private final File mapDataDir;
|
||||
|
||||
/**
|
||||
* The time in milliseconds when this field was initialized. Stored in the session lock file.
|
||||
*/
|
||||
private final long initializationTime = EaglerAdapter.steadyTimeMillis();
|
||||
|
||||
/** The directory name of the world */
|
||||
private final String saveDirectoryName;
|
||||
|
||||
public SaveHandler(File par1File, String par2Str, boolean par3)
|
||||
{
|
||||
this.worldDirectory = new File(par1File, par2Str);
|
||||
this.worldDirectory.mkdirs();
|
||||
this.playersDirectory = new File(this.worldDirectory, "players");
|
||||
this.mapDataDir = new File(this.worldDirectory, "data");
|
||||
this.mapDataDir.mkdirs();
|
||||
this.saveDirectoryName = par2Str;
|
||||
|
||||
if (par3)
|
||||
{
|
||||
this.playersDirectory.mkdirs();
|
||||
}
|
||||
|
||||
this.setSessionLock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a session lock file for this process
|
||||
*/
|
||||
private void setSessionLock()
|
||||
{
|
||||
try
|
||||
{
|
||||
File var1 = new File(this.worldDirectory, "session.lock");
|
||||
DataOutputStream var2 = new DataOutputStream(new FileOutputStream(var1));
|
||||
|
||||
try
|
||||
{
|
||||
var2.writeLong(this.initializationTime);
|
||||
}
|
||||
finally
|
||||
{
|
||||
var2.close();
|
||||
}
|
||||
}
|
||||
catch (IOException var7)
|
||||
{
|
||||
var7.printStackTrace();
|
||||
throw new RuntimeException("Failed to check session lock, aborting");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the File object corresponding to the base directory of this world.
|
||||
*/
|
||||
protected File getWorldDirectory()
|
||||
{
|
||||
return this.worldDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the session lock to prevent save collisions
|
||||
*/
|
||||
public void checkSessionLock() throws MinecraftException
|
||||
{
|
||||
try
|
||||
{
|
||||
File var1 = new File(this.worldDirectory, "session.lock");
|
||||
DataInputStream var2 = new DataInputStream(new FileInputStream(var1));
|
||||
|
||||
try
|
||||
{
|
||||
if (var2.readLong() != this.initializationTime)
|
||||
{
|
||||
throw new MinecraftException("The save is being accessed from another location, aborting");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
var2.close();
|
||||
}
|
||||
}
|
||||
catch (IOException var7)
|
||||
{
|
||||
throw new MinecraftException("Failed to check session lock, aborting");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chunk loader with the provided world provider
|
||||
*/
|
||||
public IChunkLoader getChunkLoader(WorldProvider par1WorldProvider)
|
||||
{
|
||||
throw new RuntimeException("Old Chunk Storage is no longer supported.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads and returns the world info
|
||||
*/
|
||||
public WorldInfo loadWorldInfo()
|
||||
{
|
||||
File var1 = new File(this.worldDirectory, "level.dat");
|
||||
NBTTagCompound var2;
|
||||
NBTTagCompound var3;
|
||||
|
||||
if (var1.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
var2 = CompressedStreamTools.readCompressed(new FileInputStream(var1));
|
||||
var3 = var2.getCompoundTag("Data");
|
||||
return new WorldInfo(var3);
|
||||
}
|
||||
catch (Exception var5)
|
||||
{
|
||||
var5.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
var1 = new File(this.worldDirectory, "level.dat_old");
|
||||
|
||||
if (var1.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
var2 = CompressedStreamTools.readCompressed(new FileInputStream(var1));
|
||||
var3 = var2.getCompoundTag("Data");
|
||||
return new WorldInfo(var3);
|
||||
}
|
||||
catch (Exception var4)
|
||||
{
|
||||
var4.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the given World Info with the given NBTTagCompound as the Player.
|
||||
*/
|
||||
public void saveWorldInfoWithPlayer(WorldInfo par1WorldInfo, NBTTagCompound par2NBTTagCompound)
|
||||
{
|
||||
NBTTagCompound var3 = par1WorldInfo.cloneNBTCompound(par2NBTTagCompound);
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setTag("Data", var3);
|
||||
|
||||
try
|
||||
{
|
||||
File var5 = new File(this.worldDirectory, "level.dat_new");
|
||||
File var6 = new File(this.worldDirectory, "level.dat_old");
|
||||
File var7 = new File(this.worldDirectory, "level.dat");
|
||||
CompressedStreamTools.writeCompressed(var4, new FileOutputStream(var5));
|
||||
|
||||
if (var6.exists())
|
||||
{
|
||||
var6.delete();
|
||||
}
|
||||
|
||||
var7.renameTo(var6);
|
||||
|
||||
if (var7.exists())
|
||||
{
|
||||
var7.delete();
|
||||
}
|
||||
|
||||
var5.renameTo(var7);
|
||||
|
||||
if (var5.exists())
|
||||
{
|
||||
var5.delete();
|
||||
}
|
||||
}
|
||||
catch (Exception var8)
|
||||
{
|
||||
var8.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the passed in world info.
|
||||
*/
|
||||
public void saveWorldInfo(WorldInfo par1WorldInfo)
|
||||
{
|
||||
NBTTagCompound var2 = par1WorldInfo.getNBTTagCompound();
|
||||
NBTTagCompound var3 = new NBTTagCompound();
|
||||
var3.setTag("Data", var2);
|
||||
|
||||
try
|
||||
{
|
||||
File var4 = new File(this.worldDirectory, "level.dat_new");
|
||||
File var5 = new File(this.worldDirectory, "level.dat_old");
|
||||
File var6 = new File(this.worldDirectory, "level.dat");
|
||||
CompressedStreamTools.writeCompressed(var3, new FileOutputStream(var4));
|
||||
|
||||
if (var5.exists())
|
||||
{
|
||||
var5.delete();
|
||||
}
|
||||
|
||||
var6.renameTo(var5);
|
||||
|
||||
if (var6.exists())
|
||||
{
|
||||
var6.delete();
|
||||
}
|
||||
|
||||
var4.renameTo(var6);
|
||||
|
||||
if (var4.exists())
|
||||
{
|
||||
var4.delete();
|
||||
}
|
||||
}
|
||||
catch (Exception var7)
|
||||
{
|
||||
var7.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the player data to disk from the specified PlayerEntityMP.
|
||||
*/
|
||||
public void writePlayerData(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
try
|
||||
{
|
||||
NBTTagCompound var2 = new NBTTagCompound();
|
||||
par1EntityPlayer.writeToNBT(var2);
|
||||
File var3 = new File(this.playersDirectory, par1EntityPlayer.getCommandSenderName() + ".dat.tmp");
|
||||
File var4 = new File(this.playersDirectory, par1EntityPlayer.getCommandSenderName() + ".dat");
|
||||
CompressedStreamTools.writeCompressed(var2, new FileOutputStream(var3));
|
||||
|
||||
if (var4.exists())
|
||||
{
|
||||
var4.delete();
|
||||
}
|
||||
|
||||
var3.renameTo(var4);
|
||||
}
|
||||
catch (Exception var5)
|
||||
{
|
||||
MinecraftServer.getServer().getLogAgent().logWarning("Failed to save player data for " + par1EntityPlayer.getCommandSenderName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the player data from disk into the specified PlayerEntityMP.
|
||||
*/
|
||||
public NBTTagCompound readPlayerData(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
NBTTagCompound var2 = this.getPlayerData(par1EntityPlayer.getCommandSenderName());
|
||||
|
||||
if (var2 != null)
|
||||
{
|
||||
par1EntityPlayer.readFromNBT(var2);
|
||||
}
|
||||
|
||||
return var2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the player data for the given playername as a NBTTagCompound.
|
||||
*/
|
||||
public NBTTagCompound getPlayerData(String par1Str)
|
||||
{
|
||||
try
|
||||
{
|
||||
File var2 = new File(this.playersDirectory, par1Str + ".dat");
|
||||
|
||||
if (var2.exists())
|
||||
{
|
||||
return CompressedStreamTools.readCompressed(new FileInputStream(var2));
|
||||
}
|
||||
}
|
||||
catch (Exception var3)
|
||||
{
|
||||
MinecraftServer.getServer().getLogAgent().logWarning("Failed to load player data for " + par1Str);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns null if no saveHandler is relevent (eg. SMP)
|
||||
*/
|
||||
public IPlayerFileData getSaveHandler()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of usernames for which player.dat exists for.
|
||||
*/
|
||||
public String[] getAvailablePlayerDat()
|
||||
{
|
||||
String[] var1 = this.playersDirectory.list();
|
||||
|
||||
for (int var2 = 0; var2 < var1.length; ++var2)
|
||||
{
|
||||
if (var1[var2].endsWith(".dat"))
|
||||
{
|
||||
var1[var2] = var1[var2].substring(0, var1[var2].length() - 4);
|
||||
}
|
||||
}
|
||||
|
||||
return var1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to flush all changes to disk, waiting for them to complete.
|
||||
*/
|
||||
public void flush() {}
|
||||
|
||||
/**
|
||||
* Gets the file location of the given map
|
||||
*/
|
||||
public File getMapFileFromName(String par1Str)
|
||||
{
|
||||
return new File(this.mapDataDir, par1Str + ".dat");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the directory where world information is saved.
|
||||
*/
|
||||
public String getWorldDirectoryName()
|
||||
{
|
||||
return this.saveDirectoryName;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import net.lax1dude.eaglercraft.sp.VFile;
|
||||
|
||||
public class SaveHandlerMP implements ISaveHandler
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ public class SaveHandlerMP implements ISaveHandler
|
|||
/**
|
||||
* Gets the file location of the given map
|
||||
*/
|
||||
public File getMapFileFromName(String par1Str)
|
||||
public VFile getMapFileFromName(String par1Str)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -63,4 +63,4 @@ public class SaveHandlerMP implements ISaveHandler
|
|||
{
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -652,82 +652,78 @@ public abstract class ServerConfigurationManager
|
|||
/**
|
||||
* Find all players in a specified range and narrowing down by other parameters
|
||||
*/
|
||||
public List findPlayers(ChunkCoordinates par1ChunkCoordinates, int par2, int par3, int par4, int par5, int par6, int par7, Map par8Map, String par9Str, String par10Str, World par11World)
|
||||
{
|
||||
if (this.playerEntityList.isEmpty())
|
||||
{
|
||||
public List findPlayers(ChunkCoordinates par1ChunkCoordinates, int par2, int par3, int par4, int par5, int par6,
|
||||
int par7, Map par8Map, String par9Str, String par10Str) {
|
||||
if (this.playerEntityList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
Object var12 = new ArrayList();
|
||||
boolean var13 = par4 < 0;
|
||||
boolean var14 = par9Str != null && par9Str.startsWith("!");
|
||||
boolean var15 = par10Str != null && par10Str.startsWith("!");
|
||||
int var16 = par2 * par2;
|
||||
int var17 = par3 * par3;
|
||||
} else {
|
||||
Object var11 = new ArrayList();
|
||||
boolean var12 = par4 < 0;
|
||||
int var13 = par2 * par2;
|
||||
int var14 = par3 * par3;
|
||||
par4 = MathHelper.abs_int(par4);
|
||||
|
||||
if (var14)
|
||||
{
|
||||
par9Str = par9Str.substring(1);
|
||||
}
|
||||
for (int var15 = 0; var15 < this.playerEntityList.size(); ++var15) {
|
||||
EntityPlayerMP var16 = (EntityPlayerMP) this.playerEntityList.get(var15);
|
||||
boolean var17;
|
||||
|
||||
if (var15)
|
||||
{
|
||||
par10Str = par10Str.substring(1);
|
||||
}
|
||||
if (par9Str != null) {
|
||||
var17 = par9Str.startsWith("!");
|
||||
|
||||
for (int var18 = 0; var18 < this.playerEntityList.size(); ++var18)
|
||||
{
|
||||
EntityPlayerMP var19 = (EntityPlayerMP)this.playerEntityList.get(var18);
|
||||
|
||||
if ((par11World == null || var19.worldObj == par11World) && (par9Str == null || var14 != par9Str.equalsIgnoreCase(var19.getEntityName())))
|
||||
{
|
||||
if (par10Str != null)
|
||||
{
|
||||
Team var20 = var19.getTeam();
|
||||
String var21 = var20 == null ? "" : var20.func_96661_b();
|
||||
|
||||
if (var15 == par10Str.equalsIgnoreCase(var21))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (var17) {
|
||||
par9Str = par9Str.substring(1);
|
||||
}
|
||||
|
||||
if (par1ChunkCoordinates != null && (par2 > 0 || par3 > 0))
|
||||
{
|
||||
float var22 = par1ChunkCoordinates.getDistanceSquaredToChunkCoordinates(var19.getPlayerCoordinates());
|
||||
if (var17 == par9Str.equalsIgnoreCase(var16.getEntityName())) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (par2 > 0 && var22 < (float)var16 || par3 > 0 && var22 > (float)var17)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (par10Str != null) {
|
||||
var17 = par10Str.startsWith("!");
|
||||
|
||||
if (var17) {
|
||||
par10Str = par10Str.substring(1);
|
||||
}
|
||||
|
||||
if (this.func_96457_a(var19, par8Map) && (par5 == EnumGameType.NOT_SET.getID() || par5 == var19.theItemInWorldManager.getGameType().getID()) && (par6 <= 0 || var19.experienceLevel >= par6) && var19.experienceLevel <= par7)
|
||||
{
|
||||
((List)var12).add(var19);
|
||||
Team var18 = var16.getTeam();
|
||||
String var19 = var18 == null ? "" : var18.func_96661_b();
|
||||
|
||||
if (var17 == par10Str.equalsIgnoreCase(var19)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (par1ChunkCoordinates != null && (par2 > 0 || par3 > 0)) {
|
||||
float var20 = par1ChunkCoordinates
|
||||
.getDistanceSquaredToChunkCoordinates(var16.getPlayerCoordinates());
|
||||
|
||||
if (par2 > 0 && var20 < (float) var13 || par3 > 0 && var20 > (float) var14) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.func_96457_a(var16, par8Map)
|
||||
&& (par5 == EnumGameType.NOT_SET.getID()
|
||||
|| par5 == var16.theItemInWorldManager.getGameType().getID())
|
||||
&& (par6 <= 0 || var16.experienceLevel >= par6) && var16.experienceLevel <= par7) {
|
||||
((List) var11).add(var16);
|
||||
}
|
||||
}
|
||||
|
||||
if (par1ChunkCoordinates != null)
|
||||
{
|
||||
Collections.sort((List)var12, new PlayerPositionComparator(par1ChunkCoordinates));
|
||||
if (par1ChunkCoordinates != null) {
|
||||
Collections.sort((List) var11, new PlayerPositionComparator(par1ChunkCoordinates));
|
||||
}
|
||||
|
||||
if (var13)
|
||||
{
|
||||
Collections.reverse((List)var12);
|
||||
if (var12) {
|
||||
Collections.reverse((List) var11);
|
||||
}
|
||||
|
||||
if (par4 > 0)
|
||||
{
|
||||
var12 = ((List)var12).subList(0, Math.min(par4, ((List)var12).size()));
|
||||
if (par4 > 0) {
|
||||
var11 = ((List) var11).subList(0, Math.min(par4, ((List) var11).size()));
|
||||
}
|
||||
|
||||
return (List)var12;
|
||||
return (List) var11;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.lax1dude.eaglercraft.EaglercraftRandom;
|
|||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
public abstract class World implements IBlockAccess
|
||||
{
|
||||
|
@ -143,7 +144,7 @@ public abstract class World implements IBlockAccess
|
|||
this.worldInfo = new WorldInfo(par4WorldSettings, par2Str);
|
||||
this.provider = par3WorldProvider;
|
||||
this.mapStorage = new MapStorage(par1ISaveHandler);
|
||||
VillageCollection var7 = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, "villages");
|
||||
VillageCollection var7 = (VillageCollection) this.mapStorage.loadData((s) -> new VillageCollection(s), "villages");
|
||||
|
||||
if (var7 == null)
|
||||
{
|
||||
|
@ -202,7 +203,7 @@ public abstract class World implements IBlockAccess
|
|||
this.worldInfo.setServerInitialized(true);
|
||||
}
|
||||
|
||||
VillageCollection var7 = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, "villages");
|
||||
VillageCollection var7 = (VillageCollection) this.mapStorage.loadData((s) -> new VillageCollection(s), "villages");
|
||||
|
||||
if (var7 == null)
|
||||
{
|
||||
|
@ -3898,8 +3899,7 @@ public abstract class World implements IBlockAccess
|
|||
* Loads an existing MapDataBase corresponding to the given String id from disk using the MapStorage, instantiating
|
||||
* the given Class, or returns null if none such file exists. args: Class to instantiate, String dataid
|
||||
*/
|
||||
public WorldSavedData loadItemData(Class par1Class, String par2Str)
|
||||
{
|
||||
public WorldSavedData loadItemData(Function<String, WorldSavedData> par1Class, String par2Str) {
|
||||
return this.mapStorage.loadData(par1Class, par2Str);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ public class WorldServer extends World
|
|||
|
||||
this.worldTeleporter = new Teleporter(this);
|
||||
this.worldScoreboard = new ServerScoreboard(par1MinecraftServer);
|
||||
ScoreboardSaveData var8 = (ScoreboardSaveData)this.mapStorage.loadData(ScoreboardSaveData.class, "scoreboard");
|
||||
ScoreboardSaveData var8 = (ScoreboardSaveData) this.mapStorage.loadData((s) -> new ScoreboardSaveData(s), "scoreboard");
|
||||
|
||||
if (var8 == null)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue