Readd dropped diff

Additionally, add some identifying messages to paper comments added by
our more junior developer during the update process.
This commit is contained in:
Bjarne Koll
2025-05-31 14:23:06 +02:00
parent 8c9747458e
commit 4a903d8124
3 changed files with 14 additions and 11 deletions

View File

@@ -535,13 +535,13 @@
if (this.level() instanceof ServerLevel serverLevel && !entityCompound.isEmpty()) { if (this.level() instanceof ServerLevel serverLevel && !entityCompound.isEmpty()) {
try (ProblemReporter.ScopedCollector scopedCollector = new ProblemReporter.ScopedCollector(this.problemPath(), LOGGER)) { try (ProblemReporter.ScopedCollector scopedCollector = new ProblemReporter.ScopedCollector(this.problemPath(), LOGGER)) {
- EntityType.create( - EntityType.create(
+ return EntityType.create( + return EntityType.create( // Paper - release entity api
TagValueInput.create(scopedCollector.forChild(() -> ".shoulder"), serverLevel.registryAccess(), entityCompound), TagValueInput.create(scopedCollector.forChild(() -> ".shoulder"), serverLevel.registryAccess(), entityCompound),
serverLevel, serverLevel,
EntitySpawnReason.LOAD EntitySpawnReason.LOAD
) )
- .ifPresent(entity -> { - .ifPresent(entity -> {
+ .map(entity -> { // Paper + .map(entity -> { // Paper - release entity api
if (entity instanceof TamableAnimal tamableAnimal) { if (entity instanceof TamableAnimal tamableAnimal) {
tamableAnimal.setOwner(this); tamableAnimal.setOwner(this);
} }
@@ -549,7 +549,7 @@
entity.setPos(this.getX(), this.getY() + 0.7F, this.getZ()); entity.setPos(this.getX(), this.getY() + 0.7F, this.getZ());
- serverLevel.addWithUUID(entity); - serverLevel.addWithUUID(entity);
- }); - });
+ return serverLevel.addWithUUID(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY) ? entity : null; // Paper + return serverLevel.addWithUUID(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY) ? entity : null; // Paper - spawn reason
+ }).orElse(null); // Paper - release entity api - return entity + }).orElse(null); // Paper - release entity api - return entity
} }
} }

View File

@@ -120,10 +120,13 @@
this.spawnCount = input.getIntOr("SpawnCount", 4); this.spawnCount = input.getIntOr("SpawnCount", 4);
this.maxNearbyEntities = input.getIntOr("MaxNearbyEntities", 6); this.maxNearbyEntities = input.getIntOr("MaxNearbyEntities", 6);
this.requiredPlayerRange = input.getIntOr("RequiredPlayerRange", 16); this.requiredPlayerRange = input.getIntOr("RequiredPlayerRange", 16);
@@ -216,6 +_,19 @@ @@ -216,9 +_,19 @@
} }
public void save(ValueOutput output) { public void save(ValueOutput output) {
- output.putShort("Delay", (short)this.spawnDelay);
- output.putShort("MinSpawnDelay", (short)this.minSpawnDelay);
- output.putShort("MaxSpawnDelay", (short)this.maxSpawnDelay);
+ // Paper start + // Paper start
+ if (this.spawnDelay > Short.MAX_VALUE) { + if (this.spawnDelay > Short.MAX_VALUE) {
+ output.putInt("Paper.Delay", this.spawnDelay); + output.putInt("Paper.Delay", this.spawnDelay);
@@ -137,6 +140,6 @@
+ output.putShort("MinSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.minSpawnDelay)); + output.putShort("MinSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.minSpawnDelay));
+ output.putShort("MaxSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.maxSpawnDelay)); + output.putShort("MaxSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.maxSpawnDelay));
+ // Paper end + // Paper end
output.putShort("Delay", (short)this.spawnDelay); output.putShort("SpawnCount", (short)this.spawnCount);
output.putShort("MinSpawnDelay", (short)this.minSpawnDelay); output.putShort("MaxNearbyEntities", (short)this.maxNearbyEntities);
output.putShort("MaxSpawnDelay", (short)this.maxSpawnDelay); output.putShort("RequiredPlayerRange", (short)this.requiredPlayerRange);

View File

@@ -128,7 +128,7 @@
private static GameRules.Type<GameRules.BooleanValue> create( private static GameRules.Type<GameRules.BooleanValue> create(
- boolean defaultValue, BiConsumer<MinecraftServer, GameRules.BooleanValue> changeListener, FeatureFlagSet requiredFeatures - boolean defaultValue, BiConsumer<MinecraftServer, GameRules.BooleanValue> changeListener, FeatureFlagSet requiredFeatures
+ boolean defaultValue, BiConsumer<ServerLevel, GameRules.BooleanValue> changeListener, FeatureFlagSet requiredFeatures // Paper + boolean defaultValue, BiConsumer<ServerLevel, GameRules.BooleanValue> changeListener, FeatureFlagSet requiredFeatures // Paper - per world gamerules
) { ) {
return new GameRules.Type<>( return new GameRules.Type<>(
BoolArgumentType::bool, BoolArgumentType::bool,
@@ -137,7 +137,7 @@
} }
- static GameRules.Type<GameRules.BooleanValue> create(boolean defaultValue, BiConsumer<MinecraftServer, GameRules.BooleanValue> changeListener) { - static GameRules.Type<GameRules.BooleanValue> create(boolean defaultValue, BiConsumer<MinecraftServer, GameRules.BooleanValue> changeListener) {
+ static GameRules.Type<GameRules.BooleanValue> create(boolean defaultValue, BiConsumer<ServerLevel, GameRules.BooleanValue> changeListener) { // Paper + static GameRules.Type<GameRules.BooleanValue> create(boolean defaultValue, BiConsumer<ServerLevel, GameRules.BooleanValue> changeListener) { // Paper - per world gamerules
return new GameRules.Type<>( return new GameRules.Type<>(
BoolArgumentType::bool, BoolArgumentType::bool,
type -> new GameRules.BooleanValue(type, defaultValue), type -> new GameRules.BooleanValue(type, defaultValue),