diff --git a/build-data/paper.at b/build-data/paper.at index e7b5fcf29df5..99cbcc236fbb 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -754,6 +754,7 @@ public net.minecraft.world.level.storage.DimensionDataStorage cache public net.minecraft.world.level.storage.LevelStorageSource baseDir public net.minecraft.world.level.storage.LevelStorageSource$LevelStorageAccess levelDirectory public net.minecraft.world.level.storage.PrimaryLevelData settings +public net.minecraft.world.level.storage.TagValueInput input public net.minecraft.world.scores.Objective displayName public net.minecraft.world.scores.criteria.ObjectiveCriteria CRITERIA_CACHE public-f net.minecraft.server.MinecraftServer potionBrewing diff --git a/paper-server/patches/sources/net/minecraft/world/entity/EntityType.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/EntityType.java.patch index 5c732b5bef81..f9fd5c447e5e 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/EntityType.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/EntityType.java.patch @@ -1,5 +1,13 @@ --- a/net/minecraft/world/entity/EntityType.java +++ b/net/minecraft/world/entity/EntityType.java +@@ -185,6 +_,7 @@ + import org.slf4j.Logger; + + public class EntityType implements FeatureElement, EntityTypeTest { ++ private static final boolean DEBUG_ENTITIES_WITH_INVALID_IDS = Boolean.getBoolean("paper.debugEntitiesWithInvalidIds"); // Paper - Add logging for debugging entity tags with invalid ids + private static final Logger LOGGER = LogUtils.getLogger(); + private final Holder.Reference> builtInRegistryHolder = BuiltInRegistries.ENTITY_TYPE.createIntrusiveHolder(this); + public static final Codec> CODEC = BuiltInRegistries.ENTITY_TYPE.byNameCodec(); @@ -1265,6 +_,22 @@ boolean shouldOffsetY, boolean shouldOffsetYMore @@ -108,7 +116,7 @@ entityData.loadInto(entity); } } -@@ -1429,9 +_,20 @@ +@@ -1429,10 +_,28 @@ } public static Optional create(ValueInput input, Level level, EntitySpawnReason spawnReason) { @@ -121,15 +129,24 @@ return Util.ifElse( by(input).map(entityType -> entityType.create(level, spawnReason)), - entity -> entity.load(input), +- () -> LOGGER.warn("Skipping Entity with id {}", input.getStringOr("id", "[invalid]")) + // Paper start - Don't fire sync event during generation + entity -> { + if (generation) entity.generation = true; // Paper - Don't fire sync event during generation + entity.load(input); + }, + // Paper end - Don't fire sync event during generation - () -> LOGGER.warn("Skipping Entity with id {}", input.getStringOr("id", "[invalid]")) ++ // Paper start - Add logging for debugging entity tags with invalid ids ++ () -> { ++ LOGGER.warn("Skipping Entity with id {}", input.getStringOr("id", "[invalid]")); ++ if ((DEBUG_ENTITIES_WITH_INVALID_IDS || level.getCraftServer().getServer().isDebugging()) && input instanceof TagValueInput tagInput) { ++ LOGGER.warn("Skipped entity tag: {}", tagInput.input); ++ } ++ } ++ // Paper end - Add logging for debugging entity tags with invalid ids ); } + @@ -1588,8 +_,23 @@ return this.builtInRegistryHolder; }