|
1 | 1 | --- a/net/minecraft/world/entity/EntityType.java |
2 | 2 | +++ b/net/minecraft/world/entity/EntityType.java |
| 3 | +@@ -185,6 +_,7 @@ |
| 4 | + import org.slf4j.Logger; |
| 5 | + |
| 6 | + public class EntityType<T extends Entity> implements FeatureElement, EntityTypeTest<Entity, T> { |
| 7 | ++ private static final boolean DEBUG_ENTITIES_WITH_INVALID_IDS = Boolean.getBoolean("paper.debugEntitiesWithInvalidIds"); // Paper - Add logging for debugging entity tags with invalid ids |
| 8 | + private static final Logger LOGGER = LogUtils.getLogger(); |
| 9 | + private final Holder.Reference<EntityType<?>> builtInRegistryHolder = BuiltInRegistries.ENTITY_TYPE.createIntrusiveHolder(this); |
| 10 | + public static final Codec<EntityType<?>> CODEC = BuiltInRegistries.ENTITY_TYPE.byNameCodec(); |
3 | 11 | @@ -1265,6 +_,22 @@ |
4 | 12 | boolean shouldOffsetY, |
5 | 13 | boolean shouldOffsetYMore |
|
108 | 116 | entityData.loadInto(entity); |
109 | 117 | } |
110 | 118 | } |
111 | | -@@ -1429,9 +_,20 @@ |
| 119 | +@@ -1429,10 +_,28 @@ |
112 | 120 | } |
113 | 121 |
|
114 | 122 | public static Optional<Entity> create(ValueInput input, Level level, EntitySpawnReason spawnReason) { |
|
121 | 129 | return Util.ifElse( |
122 | 130 | by(input).map(entityType -> entityType.create(level, spawnReason)), |
123 | 131 | - entity -> entity.load(input), |
| 132 | +- () -> LOGGER.warn("Skipping Entity with id {}", input.getStringOr("id", "[invalid]")) |
124 | 133 | + // Paper start - Don't fire sync event during generation |
125 | 134 | + entity -> { |
126 | 135 | + if (generation) entity.generation = true; // Paper - Don't fire sync event during generation |
127 | 136 | + entity.load(input); |
128 | 137 | + }, |
129 | 138 | + // Paper end - Don't fire sync event during generation |
130 | | - () -> LOGGER.warn("Skipping Entity with id {}", input.getStringOr("id", "[invalid]")) |
| 139 | ++ // Paper start - Add logging for debugging entity tags with invalid ids |
| 140 | ++ () -> { |
| 141 | ++ LOGGER.warn("Skipping Entity with id {}", input.getStringOr("id", "[invalid]")); |
| 142 | ++ if ((DEBUG_ENTITIES_WITH_INVALID_IDS || level.getCraftServer().getServer().isDebugging()) && input instanceof TagValueInput tagInput) { |
| 143 | ++ LOGGER.warn("Skipped entity tag: {}", tagInput.input); |
| 144 | ++ } |
| 145 | ++ } |
| 146 | ++ // Paper end - Add logging for debugging entity tags with invalid ids |
131 | 147 | ); |
132 | 148 | } |
| 149 | + |
133 | 150 | @@ -1588,8 +_,23 @@ |
134 | 151 | return this.builtInRegistryHolder; |
135 | 152 | } |
|
0 commit comments