mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-28 21:47:55 +01:00
add mobcaps command patch
This commit is contained in:
parent
9beac6a2a4
commit
7382bd2847
@ -10,7 +10,7 @@ Also has a hover text on each mob category listing what entity types are
|
||||
in said category
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
index 85beb460aa59313cf2ace2d6a6bf24938e3e2b80..f9064589216c679d9305988534aba8ef94b9a5fe 100644
|
||||
index f436ab35798c9b6e6cb2eb60d2c02cbf9b742e69..4d7575087947f3b199dd895cd9aa02a7d61768b1 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
@@ -3,6 +3,7 @@ package com.destroystokyo.paper;
|
||||
@ -21,12 +21,13 @@ index 85beb460aa59313cf2ace2d6a6bf24938e3e2b80..f9064589216c679d9305988534aba8ef
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -10,6 +11,12 @@ import com.google.common.collect.Maps;
|
||||
@@ -10,6 +11,13 @@ import com.google.common.collect.Maps;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.internal.Streams;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.ComponentLike;
|
||||
+import net.kyori.adventure.text.JoinConfiguration;
|
||||
+import net.kyori.adventure.text.TextComponent;
|
||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+import net.kyori.adventure.text.format.TextColor;
|
||||
@ -34,7 +35,7 @@ index 85beb460aa59313cf2ace2d6a6bf24938e3e2b80..f9064589216c679d9305988534aba8ef
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MCUtil;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
@@ -19,10 +26,12 @@ import net.minecraft.server.level.ServerLevel;
|
||||
@@ -19,10 +27,12 @@ import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.level.ThreadedLevelLightEngine;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
@ -47,7 +48,7 @@ index 85beb460aa59313cf2ace2d6a6bf24938e3e2b80..f9064589216c679d9305988534aba8ef
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -55,11 +64,12 @@ import java.util.List;
|
||||
@@ -55,11 +65,12 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@ -61,7 +62,7 @@ index 85beb460aa59313cf2ace2d6a6bf24938e3e2b80..f9064589216c679d9305988534aba8ef
|
||||
|
||||
public PaperCommand(String name) {
|
||||
super(name);
|
||||
@@ -92,6 +102,10 @@ public class PaperCommand extends Command {
|
||||
@@ -92,6 +103,10 @@ public class PaperCommand extends Command {
|
||||
return getListMatchingLast(sender, args, "help", "chunks");
|
||||
}
|
||||
break;
|
||||
@ -72,7 +73,7 @@ index 85beb460aa59313cf2ace2d6a6bf24938e3e2b80..f9064589216c679d9305988534aba8ef
|
||||
case "chunkinfo":
|
||||
List<String> worldNames = new ArrayList<>();
|
||||
worldNames.add("*");
|
||||
@@ -188,6 +202,12 @@ public class PaperCommand extends Command {
|
||||
@@ -188,6 +203,12 @@ public class PaperCommand extends Command {
|
||||
case "syncloadinfo":
|
||||
this.doSyncLoadInfo(sender, args);
|
||||
break;
|
||||
@ -85,7 +86,7 @@ index 85beb460aa59313cf2ace2d6a6bf24938e3e2b80..f9064589216c679d9305988534aba8ef
|
||||
case "ver":
|
||||
if (!testPermission(sender, "version")) break; // "ver" needs a special check because it's an alias. All other commands are checked up before the switch statement (because they are present in the SUBCOMMANDS set)
|
||||
case "version":
|
||||
@@ -246,6 +266,184 @@ public class PaperCommand extends Command {
|
||||
@@ -246,6 +267,184 @@ public class PaperCommand extends Command {
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,7 +162,7 @@ index 85beb460aa59313cf2ace2d6a6bf24938e3e2b80..f9064589216c679d9305988534aba8ef
|
||||
+ } else {
|
||||
+ chunks = state.getSpawnableChunkCount();
|
||||
+ }
|
||||
+ sender.sendMessage(TextComponent.ofChildren(
|
||||
+ sender.sendMessage(Component.join(JoinConfiguration.noSeparators(),
|
||||
+ Component.text("Mobcaps for world: "),
|
||||
+ Component.text(world.getName(), NamedTextColor.AQUA),
|
||||
+ Component.text(" (" + chunks + " spawnable chunks)")
|
||||
@ -209,7 +210,7 @@ index 85beb460aa59313cf2ace2d6a6bf24938e3e2b80..f9064589216c679d9305988534aba8ef
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ sender.sendMessage(TextComponent.ofChildren(Component.text("Mobcaps for player: "), Component.text(player.getName(), NamedTextColor.GREEN)));
|
||||
+ sender.sendMessage(Component.join(JoinConfiguration.noSeparators(), Component.text("Mobcaps for player: "), Component.text(player.getName(), NamedTextColor.GREEN)));
|
||||
+ sender.sendMessage(this.buildMobcapsComponent(
|
||||
+ category -> level.chunkSource.chunkMap.getMobCountNear(serverPlayer, category),
|
||||
+ category -> NaturalSpawner.limitForCategory(level, category)
|
||||
@ -222,7 +223,7 @@ index 85beb460aa59313cf2ace2d6a6bf24938e3e2b80..f9064589216c679d9305988534aba8ef
|
||||
+ final MobCategory category = entry.getKey();
|
||||
+ final TextColor color = entry.getValue();
|
||||
+
|
||||
+ final Component categoryHover = TextComponent.ofChildren(
|
||||
+ final Component categoryHover = Component.join(JoinConfiguration.noSeparators(),
|
||||
+ Component.text("Entity types in category ", TextColor.color(0xE0E0E0)),
|
||||
+ Component.text(category.getName(), color),
|
||||
+ Component.text(':', NamedTextColor.GRAY),
|
@ -9,10 +9,10 @@ the function. I saw approximately 1/3rd of the function
|
||||
on the copy.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
index f436ab35798c9b6e6cb2eb60d2c02cbf9b742e69..85beb460aa59313cf2ace2d6a6bf24938e3e2b80 100644
|
||||
index 4d7575087947f3b199dd895cd9aa02a7d61768b1..315bd2408e4a45993c9b2572e0ab5260a70522ec 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
@@ -277,7 +277,7 @@ public class PaperCommand extends Command {
|
||||
@@ -476,7 +476,7 @@ public class PaperCommand extends Command {
|
||||
int ticking = 0;
|
||||
int entityTicking = 0;
|
||||
|
@ -36,7 +36,7 @@ index 03439b92297d8a2d73f21ddb57b3b2087f70907c..45930793e7fffe6ce243c7637cb9c0e9
|
||||
nbttagcompound.putString("Status", chunk.getStatus().getName());
|
||||
BlendingData blendingdata = chunk.getBlendingData();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
index a750b40be3ba5ba258ca2540ab0398deac5a6c5e..3c1724a86cccd3d66459f6c21ed358b47d2d0eac 100644
|
||||
index b1b1fa19cfd533d5625a462af399c5fd055629b0..a99a0ea2d04ebee66982a7da9422ae7a64127d3b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
@@ -38,7 +38,7 @@ public class ChunkStorage implements AutoCloseable {
|
@ -19,7 +19,7 @@ index eada966d7f108a6081be7a848f5c1dfcb1eed676..a977f7483f37df473096b2234dc1308b
|
||||
public static final Timing midTickChunkTasks = Timings.ofSafe("Mid Tick Chunk Tasks");
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 7dfccd2e72ac5ec8b03b3439b034975ddadd759e..c3dc87998400bf57ddd31a29a3a4e506407adcb8 100644
|
||||
index 45700b146ac3f1b7df153c096a03651ae771378d..1c03c4eb5e70a502bb3b9136f2582969ed16f5dd 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -821,6 +821,7 @@ public class ServerChunkCache extends ChunkSource {
|
@ -8,7 +8,7 @@ Lighting is purged on update anyways, so let's not add more
|
||||
into the conversion process
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
index 3c1724a86cccd3d66459f6c21ed358b47d2d0eac..e490116a75c5a07e501339ca5e299fb425af84f4 100644
|
||||
index a99a0ea2d04ebee66982a7da9422ae7a64127d3b..d44154ba43e06934d7889f2f20d1a27765504574 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
@@ -44,6 +44,7 @@ public class ChunkStorage implements AutoCloseable {
|
@ -22,7 +22,7 @@ With this change I could get all 200 on at 0ms ping.
|
||||
So in general this patch should reduce Netty I/O thread load.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index c3dc87998400bf57ddd31a29a3a4e506407adcb8..f46aa97e00c9238daeeb9730551949959c750a0b 100644
|
||||
index 1c03c4eb5e70a502bb3b9136f2582969ed16f5dd..32bc1d29c8dcb7814449c5ea5cbc1aab4c2a73fc 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -1040,7 +1040,24 @@ public class ServerChunkCache extends ChunkSource {
|
@ -287,10 +287,10 @@ index 6be462975523dae9ff436ba1643b2042ec66e554..929f48675a10fdd64cb351305389d680
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
index 63ba93538d990fdd4c9e8c491bb715adc8d57986..e9a37fc6791366ea421f2766a36dc2e014ab7951 100644
|
||||
index 928025438af179711c42381fc3eaeac74cd20c59..c48d0773e7f1af4bc247d777eccc8a42c7e17601 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
@@ -269,7 +269,7 @@ public final class NaturalSpawner {
|
||||
@@ -275,7 +275,7 @@ public final class NaturalSpawner {
|
||||
blockposition_mutableblockposition.set(l, i, i1);
|
||||
double d0 = (double) l + 0.5D;
|
||||
double d1 = (double) i1 + 0.5D;
|
||||
@ -299,7 +299,7 @@ index 63ba93538d990fdd4c9e8c491bb715adc8d57986..e9a37fc6791366ea421f2766a36dc2e0
|
||||
|
||||
if (entityhuman != null) {
|
||||
double d2 = entityhuman.distanceToSqr(d0, (double) i, d1);
|
||||
@@ -342,7 +342,7 @@ public final class NaturalSpawner {
|
||||
@@ -348,7 +348,7 @@ public final class NaturalSpawner {
|
||||
}
|
||||
|
||||
private static boolean isRightDistanceToPlayerAndSpawnPoint(ServerLevel world, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double squaredDistance) {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Don't log debug logging being disabled
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
index ba0e8902e7205bc6da88efd28be70ece04cc1974..ec7938202e3890bccb809a8092362458d0f4ca75 100644
|
||||
index 5097623eee5c1c9412f0c4a14f70b93e21ea295e..3b9dfaf9e6a63220754738dc966ee72cb91f80a4 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
@@ -382,7 +382,7 @@ public class SpigotConfig
|
@ -5,7 +5,7 @@ Subject: [PATCH] Dont count named piglins and hoglins towards mob cap
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
index e9a37fc6791366ea421f2766a36dc2e014ab7951..578d7282190ca97368529cd24b578d31399c4867 100644
|
||||
index c48d0773e7f1af4bc247d777eccc8a42c7e17601..429ed5a583e0332593edd9c073ea1614c595bff0 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
@@ -83,7 +83,7 @@ public final class NaturalSpawner {
|
@ -4331,10 +4331,10 @@ index 0000000000000000000000000000000000000000..dd995e25ae620ae36cd5eecb2fe10ad0
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
index 85beb460aa59313cf2ace2d6a6bf24938e3e2b80..2ef4b4c2ff81d0fa33d4630593266066d8e6a6f3 100644
|
||||
index 315bd2408e4a45993c9b2572e0ab5260a70522ec..c0d123bff1825366c30aadd3ad8a7fde68ef74e4 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
@@ -501,6 +501,46 @@ public class PaperCommand extends Command {
|
||||
@@ -700,6 +700,46 @@ public class PaperCommand extends Command {
|
||||
}
|
||||
}
|
||||
|
||||
@ -4381,7 +4381,7 @@ index 85beb460aa59313cf2ace2d6a6bf24938e3e2b80..2ef4b4c2ff81d0fa33d4630593266066
|
||||
private void doFixLight(CommandSender sender, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("Only players can use this command");
|
||||
@@ -509,7 +549,7 @@ public class PaperCommand extends Command {
|
||||
@@ -708,7 +748,7 @@ public class PaperCommand extends Command {
|
||||
int radius = 2;
|
||||
if (args.length > 1) {
|
||||
try {
|
||||
@ -4390,7 +4390,7 @@ index 85beb460aa59313cf2ace2d6a6bf24938e3e2b80..2ef4b4c2ff81d0fa33d4630593266066
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage("Not a number");
|
||||
return;
|
||||
@@ -522,6 +562,13 @@ public class PaperCommand extends Command {
|
||||
@@ -721,6 +761,13 @@ public class PaperCommand extends Command {
|
||||
ServerLevel world = (ServerLevel) handle.level;
|
||||
ThreadedLevelLightEngine lightengine = world.getChunkSource().getLightEngine();
|
||||
|
Loading…
Reference in New Issue
Block a user