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

@@ -526,22 +526,22 @@
- private void respawnEntityOnShoulder(CompoundTag entityCompound) {
+ private boolean respawnEntityOnShoulder(CompoundTag entityCompound) { // CraftBukkit void->boolean
+ // Paper start - release entity api - return entity - overload
+ // Paper start - release entity api - return entity - overload
+ return this.respawnEntityOnShoulder0(entityCompound) != null;
+ }
+ @Nullable
+ private Entity respawnEntityOnShoulder0(CompoundTag entityCompound) { // CraftBukkit void->boolean
+ // Paper end - release entity api - return entity - overload
+ // Paper end - release entity api - return entity - overload
if (this.level() instanceof ServerLevel serverLevel && !entityCompound.isEmpty()) {
try (ProblemReporter.ScopedCollector scopedCollector = new ProblemReporter.ScopedCollector(this.problemPath(), LOGGER)) {
- EntityType.create(
+ return EntityType.create(
+ return EntityType.create( // Paper - release entity api
TagValueInput.create(scopedCollector.forChild(() -> ".shoulder"), serverLevel.registryAccess(), entityCompound),
serverLevel,
EntitySpawnReason.LOAD
)
- .ifPresent(entity -> {
+ .map(entity -> { // Paper
+ .map(entity -> { // Paper - release entity api
if (entity instanceof TamableAnimal tamableAnimal) {
tamableAnimal.setOwner(this);
}
@@ -549,7 +549,7 @@
entity.setPos(this.getX(), this.getY() + 0.7F, this.getZ());
- 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
}
}

View File

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

View File

@@ -128,7 +128,7 @@
private static GameRules.Type<GameRules.BooleanValue> create(
- 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<>(
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<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<>(
BoolArgumentType::bool,
type -> new GameRules.BooleanValue(type, defaultValue),