This commit is contained in:
eaglercraft 2024-03-06 19:01:47 -08:00
parent 573420e1b8
commit ae5f006afe
6 changed files with 29 additions and 11 deletions

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

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

@ -140,6 +140,7 @@ public class GuiOptions extends GuiScreen implements GuiYesNoCallback {
this.mc.displayGuiScreen(this);
if (i == 109 && flag && this.mc.theWorld != null) {
this.mc.theWorld.getWorldInfo().setDifficultyLocked(true);
SingleplayerServerController.setDifficulty(-1);
this.field_175356_r.func_175229_b(true);
this.field_175356_r.enabled = false;
this.field_175357_i.enabled = false;

View File

@ -50,14 +50,16 @@ public class S41PacketServerDifficulty implements Packet<INetHandlerPlayClient>
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.difficulty = EnumDifficulty.getDifficultyEnum(parPacketBuffer.readUnsignedByte());
int i = parPacketBuffer.readUnsignedByte();
this.difficulty = EnumDifficulty.getDifficultyEnum(i & 3);
this.difficultyLocked = (i & 4) != 0;
}
/**+
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeByte(this.difficulty.getDifficultyId());
parPacketBuffer.writeByte(this.difficulty.getDifficultyId() | (this.difficultyLocked ? 4 : 0));
}
public boolean isDifficultyLocked() {

View File

@ -23,6 +23,7 @@ import net.minecraft.crash.CrashReport;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.play.server.S03PacketTimeUpdate;
import net.minecraft.network.play.server.S41PacketServerDifficulty;
import net.minecraft.profiler.Profiler;
import net.minecraft.server.management.ServerConfigurationManager;
import net.minecraft.util.BlockPos;
@ -194,13 +195,12 @@ public abstract class MinecraftServer implements Runnable, ICommandSender, IThre
}
this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j]));
if (!this.isSinglePlayer()) {
this.worldServers[j].getWorldInfo().setGameType(this.getGameType());
}
}
this.serverConfigManager.setPlayerManager(this.worldServers);
if (this.worldServers[0].getWorldInfo().getDifficulty() == null) {
this.setDifficultyForAllWorlds(this.getDifficulty());
}
this.isSpawnChunksLoaded = this.worldServers[0].getWorldInfo().getGameRulesInstance()
.getBoolean("loadSpawnChunks");
if (this.isSpawnChunksLoaded) {
@ -756,6 +756,17 @@ public abstract class MinecraftServer implements Runnable, ICommandSender, IThre
}
}
}
this.getConfigurationManager().sendPacketToAllPlayers(new S41PacketServerDifficulty(
this.worldServers[0].getDifficulty(), this.worldServers[0].getWorldInfo().isDifficultyLocked()));
}
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);
}
}
}