mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 17:37:42 +01:00
fix decompile errors
This commit is contained in:
107
patches/server/0104-Configurable-daylight-cycle.patch
Normal file
107
patches/server/0104-Configurable-daylight-cycle.patch
Normal file
@@ -0,0 +1,107 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 10 Oct 2020 14:29:55 -0500
|
||||
Subject: [PATCH] Configurable daylight cycle
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java
|
||||
index 689ad22925b2561f7c8db961743eb1f821dbb25f..fa3c960992cc240161817e54659d83fed259f2fe 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java
|
||||
@@ -5,7 +5,7 @@ import net.minecraft.network.protocol.Packet;
|
||||
|
||||
public class ClientboundSetTimePacket implements Packet<ClientGamePacketListener> {
|
||||
private final long gameTime;
|
||||
- private final long dayTime;
|
||||
+ private long dayTime; public void setDayTime(long dayTime) { this.dayTime = dayTime; } // Purpur
|
||||
|
||||
public ClientboundSetTimePacket(long time, long timeOfDay, boolean doDaylightCycle) {
|
||||
this.gameTime = time % 192000; // Paper - fix guardian beam
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 11d5b4d1e0400e9e2baacbf9690ce1ababe85139..ce90ecb258c954146fbe7a9f393cbe29061d0e9a 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1528,7 +1528,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
long worldTime = world.getGameTime();
|
||||
final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight);
|
||||
for (Player entityhuman : world.players()) {
|
||||
- if (!(entityhuman instanceof ServerPlayer) || (tickCount + entityhuman.getId()) % 20 != 0) {
|
||||
+ if (!(entityhuman instanceof ServerPlayer) || (!world.isForceTime() && (tickCount + entityhuman.getId()) % 20 != 0)) { // Purpur
|
||||
continue;
|
||||
}
|
||||
ServerPlayer entityplayer = (ServerPlayer) entityhuman;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 476047528dc9dbb7983f47e960f4d3e2fa1044ee..ce01371b78b995c46d4143c2d177b448720760af 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -210,6 +210,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
private final StructureManager structureManager;
|
||||
private final StructureCheck structureCheck;
|
||||
private final boolean tickTime;
|
||||
+ private double preciseTime; // Purpur
|
||||
+ private boolean forceTime; // Purpur
|
||||
public long lastMidTickExecuteFailure; // Paper - execute chunk tasks mid tick
|
||||
|
||||
// CraftBukkit start
|
||||
@@ -584,6 +586,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
|
||||
|
||||
this.asyncChunkTaskManager = new com.destroystokyo.paper.io.chunk.ChunkTaskManager(this); // Paper
|
||||
+ this.preciseTime = this.serverLevelData.getDayTime(); // Purpur
|
||||
}
|
||||
|
||||
public void setWeatherParameters(int clearDuration, int rainDuration, boolean raining, boolean thundering) {
|
||||
@@ -754,6 +757,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
this.serverLevelData.setGameTime(i);
|
||||
this.serverLevelData.getScheduledEvents().tick(this.server, i);
|
||||
if (this.levelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
|
||||
+ // Purpur start
|
||||
+ int incrementTicks = isDay() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks;
|
||||
+ if (incrementTicks != 12000) {
|
||||
+ this.preciseTime += 12000 / (double) incrementTicks;
|
||||
+ this.setDayTime(this.preciseTime);
|
||||
+ } else
|
||||
+ // Purpur end
|
||||
this.setDayTime(this.levelData.getDayTime() + 1L);
|
||||
}
|
||||
|
||||
@@ -762,7 +772,21 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
public void setDayTime(long timeOfDay) {
|
||||
this.serverLevelData.setDayTime(timeOfDay);
|
||||
+ // Purpur start
|
||||
+ this.preciseTime = timeOfDay;
|
||||
+ this.forceTime = false;
|
||||
}
|
||||
+ public void setDayTime(double i) {
|
||||
+ this.serverLevelData.setDayTime((long) i);
|
||||
+ this.forceTime = true;
|
||||
+ // Purpur end
|
||||
+ }
|
||||
+
|
||||
+ // Purpur start
|
||||
+ public boolean isForceTime() {
|
||||
+ return this.forceTime;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
|
||||
public void tickCustomSpawners(boolean spawnMonsters, boolean spawnAnimals) {
|
||||
Iterator iterator = this.customSpawners.iterator();
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index fca524c9ca25a08d5230fb62f658588a0149c7dd..074864c2181340d2744cbbb9d4066e37f36870c5 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -121,6 +121,13 @@ public class PurpurWorldConfig {
|
||||
raidCooldownSeconds = getInt("gameplay-mechanics.raid-cooldown-seconds", raidCooldownSeconds);
|
||||
}
|
||||
|
||||
+ public int daytimeTicks = 12000;
|
||||
+ public int nighttimeTicks = 12000;
|
||||
+ private void daytimeCycleSettings() {
|
||||
+ daytimeTicks = getInt("gameplay-mechanics.daylight-cycle-ticks.daytime", daytimeTicks);
|
||||
+ nighttimeTicks = getInt("gameplay-mechanics.daylight-cycle-ticks.nighttime", nighttimeTicks);
|
||||
+ }
|
||||
+
|
||||
public int elytraDamagePerSecond = 1;
|
||||
public double elytraDamageMultiplyBySpeed = 0;
|
||||
public boolean elytraIgnoreUnbreaking = false;
|
||||
Reference in New Issue
Block a user