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

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