diff --git a/build-data/paper.at b/build-data/paper.at index 13f5525a66..b86bf069b2 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -140,12 +140,10 @@ public net.minecraft.world.effect.MobEffect attributeModifiers public net.minecraft.world.effect.MobEffect$AttributeTemplate public net.minecraft.world.effect.MobEffectInstance hiddenEffect public net.minecraft.world.entity.AreaEffectCloud durationOnUse -public net.minecraft.world.entity.AreaEffectCloud ownerUUID public net.minecraft.world.entity.AreaEffectCloud potionContents public net.minecraft.world.entity.AreaEffectCloud radiusOnUse public net.minecraft.world.entity.AreaEffectCloud radiusPerTick public net.minecraft.world.entity.AreaEffectCloud reapplicationDelay -public net.minecraft.world.entity.AreaEffectCloud updateColor()V public net.minecraft.world.entity.AreaEffectCloud waitTime public net.minecraft.world.entity.Display DATA_POS_ROT_INTERPOLATION_DURATION_ID public net.minecraft.world.entity.Display createTransformation(Lnet/minecraft/network/syncher/SynchedEntityData;)Lcom/mojang/math/Transformation; @@ -330,14 +328,8 @@ public net.minecraft.world.entity.animal.wolf.Wolf setSoundVariant(Lnet/minecraf public net.minecraft.world.entity.animal.wolf.Wolf setVariant(Lnet/minecraft/core/Holder;)V public net.minecraft.world.entity.boss.enderdragon.EnderDragon subEntities public net.minecraft.world.entity.boss.wither.WitherBoss bossEvent -public net.minecraft.world.entity.decoration.ArmorStand bodyPose public net.minecraft.world.entity.decoration.ArmorStand disabledSlots -public net.minecraft.world.entity.decoration.ArmorStand headPose public net.minecraft.world.entity.decoration.ArmorStand isDisabled(Lnet/minecraft/world/entity/EquipmentSlot;)Z -public net.minecraft.world.entity.decoration.ArmorStand leftArmPose -public net.minecraft.world.entity.decoration.ArmorStand leftLegPose -public net.minecraft.world.entity.decoration.ArmorStand rightArmPose -public net.minecraft.world.entity.decoration.ArmorStand rightLegPose public net.minecraft.world.entity.decoration.ArmorStand setMarker(Z)V public net.minecraft.world.entity.decoration.ArmorStand setSmall(Z)V public net.minecraft.world.entity.decoration.HangingEntity setDirection(Lnet/minecraft/core/Direction;)V @@ -364,8 +356,6 @@ public net.minecraft.world.entity.monster.Creeper explodeCreeper()V public net.minecraft.world.entity.monster.Creeper explosionRadius public net.minecraft.world.entity.monster.Creeper maxSwell public net.minecraft.world.entity.monster.Creeper swell -public net.minecraft.world.entity.monster.Drowned groundNavigation -public net.minecraft.world.entity.monster.Drowned waterNavigation public net.minecraft.world.entity.monster.EnderMan teleport()Z public net.minecraft.world.entity.monster.EnderMan teleportTowards(Lnet/minecraft/world/entity/Entity;)Z public net.minecraft.world.entity.monster.Endermite life @@ -449,9 +439,6 @@ public net.minecraft.world.entity.projectile.Arrow updateColor()V public net.minecraft.world.entity.projectile.EvokerFangs warmupDelayTicks public net.minecraft.world.entity.projectile.EyeOfEnder life public net.minecraft.world.entity.projectile.EyeOfEnder surviveAfterDeath -public net.minecraft.world.entity.projectile.EyeOfEnder tx -public net.minecraft.world.entity.projectile.EyeOfEnder ty -public net.minecraft.world.entity.projectile.EyeOfEnder tz public net.minecraft.world.entity.projectile.FireworkRocketEntity DATA_ATTACHED_TO_TARGET public net.minecraft.world.entity.projectile.FireworkRocketEntity DATA_ID_FIREWORKS_ITEM public net.minecraft.world.entity.projectile.FireworkRocketEntity DATA_SHOT_AT_ANGLE @@ -471,11 +458,9 @@ public net.minecraft.world.entity.projectile.FishingHook timeUntilHooked public net.minecraft.world.entity.projectile.FishingHook timeUntilLured public net.minecraft.world.entity.projectile.FishingHook$FishHookState public net.minecraft.world.entity.projectile.LargeFireball explosionPower -public net.minecraft.world.entity.projectile.Projectile cachedOwner public net.minecraft.world.entity.projectile.Projectile hasBeenShot public net.minecraft.world.entity.projectile.Projectile leftOwner public net.minecraft.world.entity.projectile.Projectile owner -public net.minecraft.world.entity.projectile.Projectile ownerUUID public net.minecraft.world.entity.projectile.ShulkerBullet currentMoveDirection public net.minecraft.world.entity.projectile.ShulkerBullet flightSteps public net.minecraft.world.entity.projectile.ShulkerBullet targetDeltaX @@ -616,7 +601,6 @@ public net.minecraft.world.level.block.entity.BedBlockEntity color public net.minecraft.world.level.block.entity.BeehiveBlockEntity savedFlowerPos public net.minecraft.world.level.block.entity.BellBlockEntity resonating public net.minecraft.world.level.block.entity.BellBlockEntity resonationTicks -public net.minecraft.world.level.block.entity.BlockEntity saveId(Lnet/minecraft/nbt/CompoundTag;)V public net.minecraft.world.level.block.entity.BlockEntityType validBlocks public net.minecraft.world.level.block.entity.BrewingStandBlockEntity brewTime public net.minecraft.world.level.block.entity.BrewingStandBlockEntity fuel @@ -629,7 +613,6 @@ public net.minecraft.world.level.block.entity.ChestBlockEntity openersCounter public net.minecraft.world.level.block.entity.ChestBlockEntity playSound(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/sounds/SoundEvent;)V public net.minecraft.world.level.block.entity.ChiseledBookShelfBlockEntity lastInteractedSlot public net.minecraft.world.level.block.entity.ConduitBlockEntity destroyTarget -public net.minecraft.world.level.block.entity.ConduitBlockEntity destroyTargetUUID public net.minecraft.world.level.block.entity.ConduitBlockEntity effectBlocks public net.minecraft.world.level.block.entity.ConduitBlockEntity getDestroyRangeAABB(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/phys/AABB; public net.minecraft.world.level.block.entity.CrafterBlockEntity craftingTicksRemaining @@ -665,13 +648,14 @@ public net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity age public net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity exactTeleport public net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity exitPortal public net.minecraft.world.level.block.entity.TrialSpawnerBlockEntity trialSpawner +public net.minecraft.world.level.block.entity.trialspawner.TrialSpawner config public net.minecraft.world.level.block.entity.trialspawner.TrialSpawner isOminous public net.minecraft.world.level.block.entity.trialspawner.TrialSpawner stateAccessor -public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData cooldownEndsAt -public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData currentMobs -public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData detectedPlayers -public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData nextMobSpawnsAt -public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData nextSpawnData +public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerStateData cooldownEndsAt +public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerStateData currentMobs +public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerStateData detectedPlayers +public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerStateData nextMobSpawnsAt +public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerStateData nextSpawnData public net.minecraft.world.level.block.entity.vault.VaultBlockEntity serverData public net.minecraft.world.level.block.entity.vault.VaultServerData getRewardedPlayers()Ljava/util/Set; public net.minecraft.world.level.block.entity.vault.VaultServerData pauseStateUpdatingUntil(J)V @@ -690,7 +674,6 @@ public net.minecraft.world.level.chunk.LevelChunk level public net.minecraft.world.level.chunk.LevelChunk loaded public net.minecraft.world.level.chunk.LevelChunkSection states public net.minecraft.world.level.chunk.PalettedContainer registry -public net.minecraft.world.level.chunk.status.ChunkStatusTasks postLoadProtoChunk(Lnet/minecraft/server/level/ServerLevel;Ljava/util/List;)V public net.minecraft.world.level.chunk.storage.EntityStorage entityDeserializerQueue public net.minecraft.world.level.chunk.storage.EntityStorage level public net.minecraft.world.level.chunk.storage.RegionFileStorage regionCache @@ -777,10 +760,6 @@ public-f net.minecraft.world.level.LevelSettings hardcore public-f net.minecraft.world.level.LevelSettings levelName public-f net.minecraft.world.level.block.ChestBlock MENU_PROVIDER_COMBINER public-f net.minecraft.world.level.block.entity.BannerBlockEntity baseColor -public-f net.minecraft.world.level.block.entity.trialspawner.TrialSpawner normalConfig -public-f net.minecraft.world.level.block.entity.trialspawner.TrialSpawner ominousConfig -public-f net.minecraft.world.level.block.entity.trialspawner.TrialSpawner requiredPlayerRange -public-f net.minecraft.world.level.block.entity.trialspawner.TrialSpawner targetCooldownLength public-f net.minecraft.world.level.saveddata.maps.MapItemSavedData centerX public-f net.minecraft.world.level.saveddata.maps.MapItemSavedData centerZ public-f net.minecraft.world.level.saveddata.maps.MapItemSavedData dimension diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java.patch index 2e87418253..ea3f2309d0 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java.patch @@ -36,3 +36,39 @@ for (ItemStack itemStack : randomItems) { DefaultDispenseItemBehavior.spawnItem(level, itemStack, 2, Direction.UP, Vec3.atBottomCenterOf(pos).relative(Direction.UP, 1.2)); } +@@ -402,6 +_,35 @@ + this.requiredPlayerRange + ); + } ++ ++ // Paper start - trial spawner API - withers ++ public TrialSpawner.FullConfig overrideTargetCooldownLength(final int targetCooldownLength) { ++ return new TrialSpawner.FullConfig( ++ this.normal, ++ this.ominous, ++ targetCooldownLength, ++ this.requiredPlayerRange ++ ); ++ } ++ ++ public TrialSpawner.FullConfig overrideRequiredPlayerRange(final int requiredPlayerRange) { ++ return new TrialSpawner.FullConfig( ++ this.normal, ++ this.ominous, ++ this.targetCooldownLength, ++ requiredPlayerRange ++ ); ++ } ++ ++ public TrialSpawner.FullConfig overrideConfigs(final Holder normal, final Holder ominous) { ++ return new TrialSpawner.FullConfig( ++ normal, ++ ominous, ++ this.targetCooldownLength, ++ this.requiredPlayerRange ++ ); ++ } ++ // Paper end - trial spawner API - withers + } + + public interface StateAccessor { diff --git a/paper-server/patches/sources/net/minecraft/world/level/storage/TagValueInput.java.patch b/paper-server/patches/sources/net/minecraft/world/level/storage/TagValueInput.java.patch new file mode 100644 index 0000000000..ef4dfa83d6 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/storage/TagValueInput.java.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/world/level/storage/TagValueInput.java ++++ b/net/minecraft/world/level/storage/TagValueInput.java +@@ -37,6 +_,16 @@ + this.input = input; + } + ++ // Paper start - utility methods ++ public static ValueInput createGlobalDiscarding(final CompoundTag compoundTag) { ++ return create(ProblemReporter.DISCARDING, net.minecraft.server.MinecraftServer.getServer().registryAccess(), compoundTag); ++ } ++ ++ public static ValueInput createDiscarding(final HolderLookup.Provider provider, final CompoundTag compoundTag) { ++ return create(ProblemReporter.DISCARDING, provider, compoundTag); ++ } ++ // Paper end - utility methods ++ + public static ValueInput create(ProblemReporter problemReporter, HolderLookup.Provider lookup, CompoundTag input) { + return new TagValueInput(problemReporter, new ValueInputContextHelper(lookup, NbtOps.INSTANCE), input); + } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftTrialSpawner.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftTrialSpawner.java index 069d22e4aa..238fc32103 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftTrialSpawner.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftTrialSpawner.java @@ -7,7 +7,7 @@ import java.util.UUID; import net.minecraft.core.Holder; import net.minecraft.world.level.block.TrialSpawnerBlock; import net.minecraft.world.level.block.entity.TrialSpawnerBlockEntity; -import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData; +import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerStateData; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; @@ -23,8 +23,8 @@ public class CraftTrialSpawner extends CraftBlockEntityState> type = net.minecraft.world.entity.EntityType.by(this.spawnPotentialsDefinition.unwrap().get(0).value().getEntityToSpawn()); - return type.map(CraftEntityType::minecraftToBukkit).orElse(null); + Optional> type = net.minecraft.world.entity.EntityType.by(TagValueInput.createGlobalDiscarding( + this.spawnPotentialsDefinition.unwrap().getFirst().value().getEntityToSpawn() + )); + return type.map(CraftEntityType::minecraftToBukkit).orElse(null); } @Override @@ -74,7 +77,7 @@ public class CraftTrialSpawnerConfiguration implements TrialSpawnerConfiguration Preconditions.checkArgument(entityType != EntityType.UNKNOWN, "Can't spawn EntityType %s from mob spawners!", entityType); SpawnData data = new SpawnData(); - data.getEntityToSpawn().putString(Entity.ID_TAG, BuiltInRegistries.ENTITY_TYPE.getKey(CraftEntityType.bukkitToMinecraft(entityType)).toString()); + data.getEntityToSpawn().putString(Entity.TAG_ID, BuiltInRegistries.ENTITY_TYPE.getKey(CraftEntityType.bukkitToMinecraft(entityType)).toString()); this.getTrialData().nextSpawnData = Optional.of(data); this.spawnPotentialsDefinition = WeightedList.of(data); } @@ -121,7 +124,7 @@ public class CraftTrialSpawnerConfiguration implements TrialSpawnerConfiguration @Override public int getDelay() { - return this.ticksBetweenSpawn; + return this.ticksBetweenSpawn; } @Override @@ -287,16 +290,16 @@ public class CraftTrialSpawnerConfiguration implements TrialSpawnerConfiguration @Override public int getRequiredPlayerRange() { - return this.snapshot.trialSpawner.getRequiredPlayerRange(); + return this.snapshot.trialSpawner.getRequiredPlayerRange(); } @Override public void setRequiredPlayerRange(int requiredPlayerRange) { - this.snapshot.trialSpawner.requiredPlayerRange = requiredPlayerRange; + this.snapshot.trialSpawner.config = this.snapshot.trialSpawner.config.overrideRequiredPlayerRange(requiredPlayerRange); } - private TrialSpawnerData getTrialData() { - return this.snapshot.getTrialSpawner().getData(); + private TrialSpawnerStateData getTrialData() { + return this.snapshot.getTrialSpawner().getStateData(); } protected TrialSpawnerConfig toMinecraft() {