Merge branch 'master' into 1.17

This commit is contained in:
gnembon committed 2021-01-07 00:41:15 -04:00
commit ed4afa15ff
49 files changed
+593 -211

No files matched your search

+37 -4
View File
@@ -7,7 +7,6 @@ import java.util.function.BiConsumer;
import carpet.CarpetServer;
import carpet.network.ServerNetworkHandler;
import carpet.utils.Messenger;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
@@ -26,10 +25,43 @@ public class TickSpeed
public static ServerCommandSource tick_warp_sender = null;
public static int player_active_timeout = 0;
public static boolean process_entities = true;
public static boolean deepFreeze = false;
public static boolean is_paused = false;
private static boolean deepFreeze = false;
private static boolean is_paused = false;
public static boolean is_superHot = false;
/**
* @return Whether or not the game is in a frozen state.
* You should normally use {@link #process_entities} instead,
* since that one accounts for tick steps and superhot
*/
public static boolean isPaused() {
return is_paused;
}
/**
* Whether or not the game is deeply frozen.
* This can be used for things that you may not normally want
* to freeze, but may need to in some situations.
* This should be checked with {@link #process_entities} to make sure the
* current tick is actually frozen, not only the game
* @return Whether or not the game is deeply frozen.
*/
public static boolean deeplyFrozen() {
return deepFreeze;
}
/**
* Used to update the frozen state of the game.
* Handles connected clients as well.
* @param isPaused Whether or not the game is paused
* @param isDeepFreeze Whether or not the game is deeply frozen
*/
public static void setFrozenState(boolean isPaused, boolean isDeepFreeze) {
is_paused = isPaused;
deepFreeze = isPaused ? isDeepFreeze : false;
ServerNetworkHandler.updateFrozenStateToConnectedPlayers();
}
/**
* Functional interface that listens for tickrate changes. This is
* implemented to allow tickrate compatibility with other mods etc.
@@ -66,6 +98,7 @@ public class TickSpeed
public static void add_ticks_to_run_in_pause(int ticks)
{
player_active_timeout = PLAYER_GRACE+ticks;
ServerNetworkHandler.updateTickPlayerActiveTimeoutToConnectedPlayers();
}
public static BaseText tickrate_advance(ServerPlayerEntity player, int advance, String callback, ServerCommandSource source)
@@ -155,7 +188,7 @@ public class TickSpeed
}
}
public static void tick(MinecraftServer server)
public static void tick()
{
process_entities = true;
if (player_active_timeout > 0)