Implement Aqua Affinity enchantment (#6408)

This commit is contained in:
zSALLAZAR 2024-08-06 16:12:47 +02:00 committed by GitHub
parent 787afb6b00
commit c4a2b6494d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 0 deletions

View File

@ -43,6 +43,7 @@ final class EnchantmentIdMap{
$this->register(EnchantmentIds::PROJECTILE_PROTECTION, VanillaEnchantments::PROJECTILE_PROTECTION());
$this->register(EnchantmentIds::THORNS, VanillaEnchantments::THORNS());
$this->register(EnchantmentIds::RESPIRATION, VanillaEnchantments::RESPIRATION());
$this->register(EnchantmentIds::AQUA_AFFINITY, VanillaEnchantments::AQUA_AFFINITY());
$this->register(EnchantmentIds::SHARPNESS, VanillaEnchantments::SHARPNESS());
//TODO: smite, bane of arthropods (these don't make sense now because their applicable mobs don't exist yet)

View File

@ -56,6 +56,7 @@ final class AvailableEnchantmentRegistry{
$this->register(Enchantments::PROJECTILE_PROTECTION(), [Tags::ARMOR], []);
$this->register(Enchantments::THORNS(), [Tags::CHESTPLATE], [Tags::HELMET, Tags::LEGGINGS, Tags::BOOTS]);
$this->register(Enchantments::RESPIRATION(), [Tags::HELMET], []);
$this->register(Enchantments::AQUA_AFFINITY(), [Tags::HELMET], []);
$this->register(Enchantments::SHARPNESS(), [Tags::SWORD, Tags::AXE], []);
$this->register(Enchantments::KNOCKBACK(), [Tags::SWORD], []);
$this->register(Enchantments::FIRE_ASPECT(), [Tags::SWORD], []);

View File

@ -52,6 +52,7 @@ final class StringToEnchantmentParser extends StringToTParser{
$result->register("protection", fn() => VanillaEnchantments::PROTECTION());
$result->register("punch", fn() => VanillaEnchantments::PUNCH());
$result->register("respiration", fn() => VanillaEnchantments::RESPIRATION());
$result->register("aqua_affinity", fn() => VanillaEnchantments::AQUA_AFFINITY());
$result->register("sharpness", fn() => VanillaEnchantments::SHARPNESS());
$result->register("silk_touch", fn() => VanillaEnchantments::SILK_TOUCH());
$result->register("swift_sneak", fn() => VanillaEnchantments::SWIFT_SNEAK());

View File

@ -33,6 +33,7 @@ use pocketmine\utils\RegistryTrait;
* @see build/generate-registry-annotations.php
* @generate-registry-docblock
*
* @method static Enchantment AQUA_AFFINITY()
* @method static ProtectionEnchantment BLAST_PROTECTION()
* @method static Enchantment EFFICIENCY()
* @method static ProtectionEnchantment FEATHER_FALLING()
@ -144,6 +145,15 @@ final class VanillaEnchantments{
fn(int $level) : int => 10 * $level,
30
));
self::register("AQUA_AFFINITY", new Enchantment(
KnownTranslationFactory::enchantment_waterWorker(),
Rarity::RARE,
0,
0,
1,
null,
40
));
self::register("SHARPNESS", new SharpnessEnchantment(
KnownTranslationFactory::enchantment_damage_all(),