u25
This commit is contained in:
parent
573420e1b8
commit
ae5f006afe
6 changed files with 29 additions and 11 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
this.setDifficultyForAllWorlds(this.getDifficulty());
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue