new: creativePlayersLoadChunks carpet rule (#1314)
enabled by default: behavior like vanilla disabled: creative players do not load chunks like spectators with gamerule spectatorsGenerateChunks false
This commit is contained in:
1 parent
fa8d2b75d0
commit
5c4e18ead1
3 files changed
+32
-1
No files matched your search
@@ -1092,4 +1092,13 @@ public class CarpetSettings
|
|||||||
return "Cannot be negative, can be true, false, or # > 0";
|
return "Cannot be negative, can be true, false, or # > 0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Rule(
|
||||||
|
desc = "Creative players load chunks, or they don't! Just like spectators!",
|
||||||
|
extra = {"Toggling behaves exactly as if the player is in spectator mode and toggling the gamerule spectatorsGenerateChunks."
|
||||||
|
},
|
||||||
|
category = {CREATIVE, FEATURE}
|
||||||
|
)
|
||||||
|
public static boolean creativePlayersLoadChunks = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.server.level.ChunkMap;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Mixin(ChunkMap.class)
|
||||||
|
public class ChunkMap_creativePlayersLoadChunksMixin {
|
||||||
|
|
||||||
|
@Inject(method = "skipPlayer(Lnet/minecraft/server/level/ServerPlayer;)Z", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void startProfilerSection(ServerPlayer serverPlayer, CallbackInfoReturnable<Boolean> cir)
|
||||||
|
{
|
||||||
|
if (!CarpetSettings.creativePlayersLoadChunks && serverPlayer.isCreative()) {
|
||||||
|
cir.setReturnValue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -190,7 +190,8 @@
|
|||||||
"LivingEntity_creativeFlyMixin",
|
"LivingEntity_creativeFlyMixin",
|
||||||
"Level_updateSuppressionCrashFixMixin",
|
"Level_updateSuppressionCrashFixMixin",
|
||||||
"MinecraftServer_updateSuppressionCrashFixMixin",
|
"MinecraftServer_updateSuppressionCrashFixMixin",
|
||||||
"ServerPlayer_updateSuppressionCrashFixMixin"
|
"ServerPlayer_updateSuppressionCrashFixMixin",
|
||||||
|
"ChunkMap_creativePlayersLoadChunksMixin"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"Timer_tickSpeedMixin",
|
"Timer_tickSpeedMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user