diff --git a/client_version b/client_version index 582626e..bd5ab57 100644 --- a/client_version +++ b/client_version @@ -1 +1 @@ -u24 \ No newline at end of file +u25 \ No newline at end of file diff --git a/patches/minecraft/net/minecraft/client/gui/GuiOptions.edit.java b/patches/minecraft/net/minecraft/client/gui/GuiOptions.edit.java index 41c88f9..b818f0a 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiOptions.edit.java +++ b/patches/minecraft/net/minecraft/client/gui/GuiOptions.edit.java @@ -59,7 +59,11 @@ ~ I18n.format("options.debugConsoleButton", new Object[0]))); ~ btn.enabled = EagRuntime.getPlatformType() != EnumPlatformType.DESKTOP; -> CHANGE 24 : 25 @ 24 : 25 +> INSERT 17 : 18 @ 17 + ++ SingleplayerServerController.setDifficulty(-1); + +> CHANGE 7 : 8 @ 7 : 8 ~ protected void actionPerformed(GuiButton parGuiButton) { diff --git a/patches/minecraft/net/minecraft/network/play/server/S41PacketServerDifficulty.edit.java b/patches/minecraft/net/minecraft/network/play/server/S41PacketServerDifficulty.edit.java index 6d88f89..2647d52 100644 --- a/patches/minecraft/net/minecraft/network/play/server/S41PacketServerDifficulty.edit.java +++ b/patches/minecraft/net/minecraft/network/play/server/S41PacketServerDifficulty.edit.java @@ -9,4 +9,14 @@ + +> CHANGE 22 : 25 @ 22 : 23 + +~ int i = parPacketBuffer.readUnsignedByte(); +~ this.difficulty = EnumDifficulty.getDifficultyEnum(i & 3); +~ this.difficultyLocked = (i & 4) != 0; + +> CHANGE 3 : 4 @ 3 : 4 + +~ parPacketBuffer.writeByte(this.difficulty.getDifficultyId() | (this.difficultyLocked ? 4 : 0)); + > EOF diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.edit.java b/patches/minecraft/net/minecraft/server/MinecraftServer.edit.java index fae012e..1070e89 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.edit.java +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.edit.java @@ -30,7 +30,9 @@ > DELETE 8 @ 8 : 11 -> DELETE 1 @ 1 : 3 +> CHANGE 1 : 2 @ 1 : 3 + +~ import net.minecraft.network.play.server.S41PacketServerDifficulty; > DELETE 1 @ 1 : 2 @@ -118,8 +120,13 @@ > DELETE 1 @ 1 : 2 -> CHANGE 39 : 44 @ 39 : 40 +> DELETE 32 @ 32 : 35 +> CHANGE 3 : 11 @ 3 : 5 + +~ if (this.worldServers[0].getWorldInfo().getDifficulty() == null) { +~ this.setDifficultyForAllWorlds(this.getDifficulty()); +~ } ~ this.isSpawnChunksLoaded = this.worldServers[0].getWorldInfo().getGameRulesInstance() ~ .getBoolean("loadSpawnChunks"); ~ if (this.isSpawnChunksLoaded) { @@ -248,7 +255,24 @@ > DELETE 4 @ 4 : 8 -> DELETE 35 @ 35 : 55 +> INSERT 16 : 19 @ 16 + ++ this.getConfigurationManager().sendPacketToAllPlayers(new S41PacketServerDifficulty( ++ this.worldServers[0].getDifficulty(), this.worldServers[0].getWorldInfo().isDifficultyLocked())); ++ } + +> INSERT 1 : 9 @ 1 + ++ public void setDifficultyLockedForAllWorlds(boolean locked) { ++ for (int i = 0; i < this.worldServers.length; ++i) { ++ WorldServer worldserver = this.worldServers[i]; ++ if (worldserver != null) { ++ worldserver.getWorldInfo().setDifficultyLocked(locked); ++ } ++ } ++ + +> DELETE 18 @ 18 : 38 > DELETE 13 @ 13 : 64 diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftVersion.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftVersion.java index 5534ccd..1e96f51 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftVersion.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftVersion.java @@ -10,7 +10,7 @@ public class EaglercraftVersion { /// Customize these to fit your fork: public static final String projectForkName = "EaglercraftX"; - public static final String projectForkVersion = "u24"; + public static final String projectForkVersion = "u25"; public static final String projectForkVendor = "lax1dude"; public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; @@ -20,7 +20,7 @@ public class EaglercraftVersion { public static final String projectOriginName = "EaglercraftX"; public static final String projectOriginAuthor = "lax1dude"; public static final String projectOriginRevision = "1.8"; - public static final String projectOriginVersion = "u24"; + public static final String projectOriginVersion = "u25"; public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace @@ -31,7 +31,7 @@ public class EaglercraftVersion { public static final boolean enableUpdateService = true; public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client"; - public static final int updateBundlePackageVersionInt = 24; + public static final int updateBundlePackageVersionInt = 25; public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName; diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/server/EaglerIntegratedServerWorker.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/server/EaglerIntegratedServerWorker.java index b19c20c..f695ebe 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/server/EaglerIntegratedServerWorker.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/server/EaglerIntegratedServerWorker.java @@ -257,7 +257,11 @@ public class EaglerIntegratedServerWorker { case IPCPacket0ASetWorldDifficulty.ID: { IPCPacket0ASetWorldDifficulty pkt = (IPCPacket0ASetWorldDifficulty)ipc; if(!isServerStopped()) { - currentProcess.setDifficultyForAllWorlds(EnumDifficulty.getDifficultyEnum(pkt.difficulty)); + if(pkt.difficulty == (byte)-1) { + currentProcess.setDifficultyLockedForAllWorlds(true); + }else { + currentProcess.setDifficultyForAllWorlds(EnumDifficulty.getDifficultyEnum(pkt.difficulty)); + } }else { logger.warn("Client tried to set difficulty while server was stopped"); } diff --git a/sources/setup/workspace_template/build.gradle b/sources/setup/workspace_template/build.gradle index 34d3181..4579994 100644 --- a/sources/setup/workspace_template/build.gradle +++ b/sources/setup/workspace_template/build.gradle @@ -26,7 +26,7 @@ teavm.js { obfuscated = true sourceMap = true targetFileName = "../classes.js" - optimization = org.teavm.gradle.api.OptimizationLevel.AGGRESSIVE + optimization = org.teavm.gradle.api.OptimizationLevel.BALANCED // no fps boost was observed with "AGGRESSIVE" outOfProcess = false fastGlobalAnalysis = false processMemory = 512