Update #25 - Fixed world difficulty glitch

This commit is contained in:
lax1dude 2024-03-06 18:42:24 -08:00
parent 8ab65942c5
commit b8ce123807
7 changed files with 52 additions and 10 deletions

View File

@ -1 +1 @@
u24
u25

View File

@ -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) {

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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");
}

View File

@ -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