Skip to content

Commit ae5f006

Browse files
author
eaglercraft
committed
u25
1 parent 573420e commit ae5f006

File tree

6 files changed

+29
-11
lines changed

6 files changed

+29
-11
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ teavm.js {
2626
obfuscated = true
2727
sourceMap = true
2828
targetFileName = "../classes.js"
29-
optimization = org.teavm.gradle.api.OptimizationLevel.AGGRESSIVE
29+
optimization = org.teavm.gradle.api.OptimizationLevel.BALANCED // no fps boost was observed with "AGGRESSIVE"
3030
outOfProcess = false
3131
fastGlobalAnalysis = false
3232
processMemory = 512

src/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftVersion.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class EaglercraftVersion {
1010
/// Customize these to fit your fork:
1111

1212
public static final String projectForkName = "EaglercraftX";
13-
public static final String projectForkVersion = "u24";
13+
public static final String projectForkVersion = "u25";
1414
public static final String projectForkVendor = "lax1dude";
1515

1616
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
@@ -20,7 +20,7 @@ public class EaglercraftVersion {
2020
public static final String projectOriginName = "EaglercraftX";
2121
public static final String projectOriginAuthor = "lax1dude";
2222
public static final String projectOriginRevision = "1.8";
23-
public static final String projectOriginVersion = "u24";
23+
public static final String projectOriginVersion = "u25";
2424

2525
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
2626

@@ -31,7 +31,7 @@ public class EaglercraftVersion {
3131
public static final boolean enableUpdateService = true;
3232

3333
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
34-
public static final int updateBundlePackageVersionInt = 24;
34+
public static final int updateBundlePackageVersionInt = 25;
3535

3636
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;
3737

src/main/java/net/lax1dude/eaglercraft/v1_8/sp/server/EaglerIntegratedServerWorker.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,11 @@ private static void handleIPCPacket(IPCPacketBase ipc) {
257257
case IPCPacket0ASetWorldDifficulty.ID: {
258258
IPCPacket0ASetWorldDifficulty pkt = (IPCPacket0ASetWorldDifficulty)ipc;
259259
if(!isServerStopped()) {
260-
currentProcess.setDifficultyForAllWorlds(EnumDifficulty.getDifficultyEnum(pkt.difficulty));
260+
if(pkt.difficulty == (byte)-1) {
261+
currentProcess.setDifficultyLockedForAllWorlds(true);
262+
}else {
263+
currentProcess.setDifficultyForAllWorlds(EnumDifficulty.getDifficultyEnum(pkt.difficulty));
264+
}
261265
}else {
262266
logger.warn("Client tried to set difficulty while server was stopped");
263267
}

src/main/java/net/minecraft/client/gui/GuiOptions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ public void confirmClicked(boolean flag, int i) {
140140
this.mc.displayGuiScreen(this);
141141
if (i == 109 && flag && this.mc.theWorld != null) {
142142
this.mc.theWorld.getWorldInfo().setDifficultyLocked(true);
143+
SingleplayerServerController.setDifficulty(-1);
143144
this.field_175356_r.func_175229_b(true);
144145
this.field_175356_r.enabled = false;
145146
this.field_175357_i.enabled = false;

src/main/java/net/minecraft/network/play/server/S41PacketServerDifficulty.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,16 @@ public void processPacket(INetHandlerPlayClient inethandlerplayclient) {
5050
* Reads the raw packet data from the data stream.
5151
*/
5252
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
53-
this.difficulty = EnumDifficulty.getDifficultyEnum(parPacketBuffer.readUnsignedByte());
53+
int i = parPacketBuffer.readUnsignedByte();
54+
this.difficulty = EnumDifficulty.getDifficultyEnum(i & 3);
55+
this.difficultyLocked = (i & 4) != 0;
5456
}
5557

5658
/**+
5759
* Writes the raw packet data to the data stream.
5860
*/
5961
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
60-
parPacketBuffer.writeByte(this.difficulty.getDifficultyId());
62+
parPacketBuffer.writeByte(this.difficulty.getDifficultyId() | (this.difficultyLocked ? 4 : 0));
6163
}
6264

6365
public boolean isDifficultyLocked() {

src/main/java/net/minecraft/server/MinecraftServer.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import net.minecraft.entity.Entity;
2424
import net.minecraft.entity.player.EntityPlayer;
2525
import net.minecraft.network.play.server.S03PacketTimeUpdate;
26+
import net.minecraft.network.play.server.S41PacketServerDifficulty;
2627
import net.minecraft.profiler.Profiler;
2728
import net.minecraft.server.management.ServerConfigurationManager;
2829
import net.minecraft.util.BlockPos;
@@ -194,13 +195,12 @@ protected void loadAllWorlds(ISaveHandler isavehandler, String s1, WorldSettings
194195
}
195196

196197
this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j]));
197-
if (!this.isSinglePlayer()) {
198-
this.worldServers[j].getWorldInfo().setGameType(this.getGameType());
199-
}
200198
}
201199

202200
this.serverConfigManager.setPlayerManager(this.worldServers);
203-
this.setDifficultyForAllWorlds(this.getDifficulty());
201+
if (this.worldServers[0].getWorldInfo().getDifficulty() == null) {
202+
this.setDifficultyForAllWorlds(this.getDifficulty());
203+
}
204204
this.isSpawnChunksLoaded = this.worldServers[0].getWorldInfo().getGameRulesInstance()
205205
.getBoolean("loadSpawnChunks");
206206
if (this.isSpawnChunksLoaded) {
@@ -756,6 +756,17 @@ public void setDifficultyForAllWorlds(EnumDifficulty enumdifficulty) {
756756
}
757757
}
758758
}
759+
this.getConfigurationManager().sendPacketToAllPlayers(new S41PacketServerDifficulty(
760+
this.worldServers[0].getDifficulty(), this.worldServers[0].getWorldInfo().isDifficultyLocked()));
761+
}
762+
763+
public void setDifficultyLockedForAllWorlds(boolean locked) {
764+
for (int i = 0; i < this.worldServers.length; ++i) {
765+
WorldServer worldserver = this.worldServers[i];
766+
if (worldserver != null) {
767+
worldserver.getWorldInfo().setDifficultyLocked(locked);
768+
}
769+
}
759770

760771
}
761772

0 commit comments

Comments
 (0)