diff --git a/build-data/paper.at b/build-data/paper.at index da0e0eefe..303fe449c 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -254,6 +254,7 @@ public net.minecraft.world.entity.Mob lootTable public net.minecraft.world.entity.Mob lootTableSeed public net.minecraft.world.entity.OminousItemSpawner setItem(Lnet/minecraft/world/item/ItemStack;)V public net.minecraft.world.entity.OminousItemSpawner spawnItemAfterTicks +public net.minecraft.world.entity.ai.attributes.Attribute sentiment public net.minecraft.world.entity.ai.attributes.AttributeSupplier getAttributeInstance(Lnet/minecraft/core/Holder;)Lnet/minecraft/world/entity/ai/attributes/AttributeInstance; public net.minecraft.world.entity.ai.control.MoveControl$Operation public net.minecraft.world.entity.ai.gossip.GossipContainer gossips diff --git a/paper-api/src/main/java/org/bukkit/attribute/Attribute.java b/paper-api/src/main/java/org/bukkit/attribute/Attribute.java index 78361d62f..ecf497fb3 100644 --- a/paper-api/src/main/java/org/bukkit/attribute/Attribute.java +++ b/paper-api/src/main/java/org/bukkit/attribute/Attribute.java @@ -163,6 +163,12 @@ public interface Attribute extends OldEnum, Keyed, Translatable, net. return Registry.ATTRIBUTE.getOrThrow(NamespacedKey.minecraft(key)); } + /** + * {@return the sentiment of this attribute} + */ + @NotNull + Sentiment getSentiment(); + /** * @param name of the attribute. * @return the attribute with the given name. @@ -185,4 +191,17 @@ public interface Attribute extends OldEnum, Keyed, Translatable, net. static Attribute[] values() { return Lists.newArrayList(Registry.ATTRIBUTE).toArray(new Attribute[0]); } + + /** + * An attribute sentiment describes the intent behind the attribute, meaning + * whether it is supposed to be a positive, neutral, or negative attribute. + */ + enum Sentiment { + // Start generate - AttributeSentiment + // @GeneratedFrom 1.21.8 + POSITIVE, + NEUTRAL, + NEGATIVE; + // End generate - AttributeSentiment + } } diff --git a/paper-generator/src/main/java/io/papermc/generator/Rewriters.java b/paper-generator/src/main/java/io/papermc/generator/Rewriters.java index bfdcef0d4..8d5fbdbd2 100644 --- a/paper-generator/src/main/java/io/papermc/generator/Rewriters.java +++ b/paper-generator/src/main/java/io/papermc/generator/Rewriters.java @@ -48,6 +48,7 @@ import org.bukkit.Sound; import org.bukkit.SoundCategory; import org.bukkit.Statistic; import org.bukkit.Tag; +import org.bukkit.attribute.Attribute; import org.bukkit.block.Biome; import org.bukkit.block.BlockType; import org.bukkit.block.banner.PatternType; @@ -129,6 +130,7 @@ public final class Rewriters { .register("SalmonVariant", Salmon.Variant.class, new EnumCloneRewriter<>(net.minecraft.world.entity.animal.Salmon.Variant.class)) .register("ArmadilloState", Armadillo.State.class, new EnumCloneRewriter<>(net.minecraft.world.entity.animal.armadillo.Armadillo.ArmadilloState.class)) .register("SoundCategory", SoundCategory.class, new EnumCloneRewriter<>(SoundSource.class)) + .register("AttributeSentiment", Attribute.Sentiment.class, new EnumCloneRewriter<>(net.minecraft.world.entity.ai.attributes.Attribute.Sentiment.class)) .register("ItemUseAnimation", ItemUseAnimation.class, new EnumCloneRewriter<>(net.minecraft.world.item.ItemUseAnimation.class)) .register("ItemRarity", ItemRarity.class, new EnumCloneRewriter<>(Rarity.class) { @Override diff --git a/paper-server/patches/sources/net/minecraft/stats/ServerRecipeBook.java.patch b/paper-server/patches/sources/net/minecraft/stats/ServerRecipeBook.java.patch index 7de947f6c..2a7a85913 100644 --- a/paper-server/patches/sources/net/minecraft/stats/ServerRecipeBook.java.patch +++ b/paper-server/patches/sources/net/minecraft/stats/ServerRecipeBook.java.patch @@ -5,9 +5,9 @@ ResourceKey> resourceKey = recipeHolder.id(); if (!this.known.contains(resourceKey) && !recipeHolder.value().isSpecial()) { + // Paper start - PlayerRecipeDiscoverEvent event -+ org.bukkit.event.player.PlayerRecipeDiscoverEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerRecipeListUpdateEvent(player, recipeHolder); ++ final org.bukkit.event.player.PlayerRecipeDiscoverEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerRecipeListUpdateEvent(player, recipeHolder); + if (event.isCancelled()) continue; -+ // Paper end ++ // Paper end - PlayerRecipeDiscoverEvent event this.add(resourceKey); this.addHighlight(resourceKey); this.displayResolver diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttribute.java b/paper-server/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttribute.java index ef4e24219..bdb4d0b55 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttribute.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttribute.java @@ -56,6 +56,11 @@ public class CraftAttribute extends OldEnumHolderable