From 93b8bd9265d9c1a2730dc0ebdd0ef9dbd3495379 Mon Sep 17 00:00:00 2001 From: WakelessSloth56 Date: Wed, 21 Feb 2024 18:31:39 +0800 Subject: [PATCH] feat(ench): register 3 new enchantments tide, harvest, observer [skip ci] --- .../enchantment/HEEnchantments.java | 6 ++ .../enchantment/impl/AimEnchantment.java | 4 +- .../impl/CurseOfSacrificingEnchantment.java | 8 ++- .../enchantment/impl/HarvestEnchantment.java | 68 +++++++++++++++++++ .../enchantment/impl/ObserverEnchantment.java | 66 ++++++++++++++++++ .../enchantment/impl/TideEnchantment.java | 63 +++++++++++++++++ .../assets/harmonicench/lang/en_us.json | 3 + .../assets/harmonicench/lang/zh_cn.json | 3 + 8 files changed, 218 insertions(+), 3 deletions(-) create mode 100644 src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/HarvestEnchantment.java create mode 100644 src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/ObserverEnchantment.java create mode 100644 src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/TideEnchantment.java diff --git a/src/main/java/org/auioc/mcmod/harmonicench/enchantment/HEEnchantments.java b/src/main/java/org/auioc/mcmod/harmonicench/enchantment/HEEnchantments.java index 2d3efc0..127acf1 100644 --- a/src/main/java/org/auioc/mcmod/harmonicench/enchantment/HEEnchantments.java +++ b/src/main/java/org/auioc/mcmod/harmonicench/enchantment/HEEnchantments.java @@ -37,16 +37,19 @@ import org.auioc.mcmod.harmonicench.enchantment.impl.ForgingEnchantment; import org.auioc.mcmod.harmonicench.enchantment.impl.FreeRidingEnchantment; import org.auioc.mcmod.harmonicench.enchantment.impl.HandinessEnchantment; +import org.auioc.mcmod.harmonicench.enchantment.impl.HarvestEnchantment; import org.auioc.mcmod.harmonicench.enchantment.impl.IceAspectEnchantment; import org.auioc.mcmod.harmonicench.enchantment.impl.LongEnchantment; import org.auioc.mcmod.harmonicench.enchantment.impl.LuckOfTheSnowEnchantment; import org.auioc.mcmod.harmonicench.enchantment.impl.MobAffinityEnchantment; +import org.auioc.mcmod.harmonicench.enchantment.impl.ObserverEnchantment; import org.auioc.mcmod.harmonicench.enchantment.impl.ProficiencyEnchantment; import org.auioc.mcmod.harmonicench.enchantment.impl.RapierEnchantment; import org.auioc.mcmod.harmonicench.enchantment.impl.SafeTeleportingEnchantment; import org.auioc.mcmod.harmonicench.enchantment.impl.SiphoningEnchantment; import org.auioc.mcmod.harmonicench.enchantment.impl.SnipingEnchantment; import org.auioc.mcmod.harmonicench.enchantment.impl.SunAffinityEnchantment; +import org.auioc.mcmod.harmonicench.enchantment.impl.TideEnchantment; import java.util.function.Supplier; @@ -83,5 +86,8 @@ private static DeferredHolder register(S public static final DeferredHolder LONG = register("long", LongEnchantment::new); public static final DeferredHolder AIM = register("aim", AimEnchantment::new); public static final DeferredHolder BLUNT = register("blunt", BluntEnchantment::new); + public static final DeferredHolder TIDE = register("tide", TideEnchantment::new); + public static final DeferredHolder HARVEST = register("harvest", HarvestEnchantment::new); + public static final DeferredHolder OBSERVER = register("observer", ObserverEnchantment::new); } diff --git a/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/AimEnchantment.java b/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/AimEnchantment.java index 12d51f4..9e13bed 100644 --- a/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/AimEnchantment.java +++ b/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/AimEnchantment.java @@ -87,7 +87,9 @@ public int getMaxCost(int lvl) { } @Override - public boolean isTreasureOnly() { return true; } + public boolean isTreasureOnly() { + return true; + } @Override public float onLivingHurt(int lvl, boolean isSource, EquipmentSlot slot, LivingEntity target, DamageSource source, float amount) { diff --git a/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/CurseOfSacrificingEnchantment.java b/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/CurseOfSacrificingEnchantment.java index 8753e48..4ae1d7b 100644 --- a/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/CurseOfSacrificingEnchantment.java +++ b/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/CurseOfSacrificingEnchantment.java @@ -82,10 +82,14 @@ public int getMaxCost(int lvl) { } @Override - public boolean isTreasureOnly() { return true; } + public boolean isTreasureOnly() { + return true; + } @Override - public boolean isCurse() { return true; } + public boolean isCurse() { + return true; + } @Override public void onInventoryTick(int lvl, ItemStack itemStack, Player player, Level level, int index, boolean selected) { diff --git a/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/HarvestEnchantment.java b/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/HarvestEnchantment.java new file mode 100644 index 0000000..5712da8 --- /dev/null +++ b/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/HarvestEnchantment.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2024 AUIOC.ORG + * + * This file is part of HarmonicEnchantments, a mod made for Minecraft. + * + * ArnicaLib is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +package org.auioc.mcmod.harmonicench.enchantment.impl; + +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ShovelItem; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.Enchantments; +import org.auioc.mcmod.arnicalib.game.enchantment.HEnchantmentCategory; +import org.auioc.mcmod.harmoniclib.enchantment.api.HLEnchantment; + +/** + * 收割 Harvest TODO + *

+ * 提高收割作物(以及生物)的速度。 + *

    + *
+ * + * @author WakelessSloth56 + * @author Libellule505 + * @since 2.1.0 + */ +public class HarvestEnchantment extends HLEnchantment { + + public HarvestEnchantment() { + super( + Enchantment.Rarity.VERY_RARE, + HEnchantmentCategory.HOE, + EquipmentSlot.MAINHAND, + 3, + (o) -> o != Enchantments.BLOCK_EFFICIENCY + ); + } + + @Override + public int getMinCost(int lvl) { + return 15 + (lvl - 1) * 9; + } + + @Override + public int getMaxCost(int lvl) { + return super.getMinCost(lvl) + 50; + } + + @Override + public boolean canEnchant(ItemStack itemStack) { + return itemStack.getItem() instanceof ShovelItem || super.canEnchant(itemStack); + } + +} diff --git a/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/ObserverEnchantment.java b/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/ObserverEnchantment.java new file mode 100644 index 0000000..7b15759 --- /dev/null +++ b/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/ObserverEnchantment.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 AUIOC.ORG + * + * This file is part of HarmonicEnchantments, a mod made for Minecraft. + * + * ArnicaLib is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +package org.auioc.mcmod.harmonicench.enchantment.impl; + +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.enchantment.Enchantment; +import org.auioc.mcmod.arnicalib.game.enchantment.HEnchantmentCategory; +import org.auioc.mcmod.harmonicench.enchantment.HEEnchantments; +import org.auioc.mcmod.harmoniclib.enchantment.api.HLEnchantment; + +/** + * 观测 Observer TODO + *

+ * 在晴朗的夜晚,了解天象。 + *

    + *
+ * + * @author WakelessSloth56 + * @author Libellule505 + * @since 2.1.0 + */ +public class ObserverEnchantment extends HLEnchantment { + + public ObserverEnchantment() { + super( + Enchantment.Rarity.VERY_RARE, + HEnchantmentCategory.SPYGLASS, + new EquipmentSlot[] { EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND }, + 2, + (o) -> o != HEEnchantments.AIM.get() + ); + } + + @Override + public int getMinCost(int lvl) { + return lvl * 10; + } + + @Override + public int getMaxCost(int lvl) { + return getMinCost(lvl) + 15; + } + + @Override + public boolean isTreasureOnly() { + return true; + } + +} diff --git a/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/TideEnchantment.java b/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/TideEnchantment.java new file mode 100644 index 0000000..12d98b1 --- /dev/null +++ b/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/TideEnchantment.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2024 AUIOC.ORG + * + * This file is part of HarmonicEnchantments, a mod made for Minecraft. + * + * ArnicaLib is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +package org.auioc.mcmod.harmonicench.enchantment.impl; + +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.EnchantmentCategory; +import net.minecraft.world.item.enchantment.Enchantments; +import org.auioc.mcmod.harmonicench.enchantment.HEEnchantments; +import org.auioc.mcmod.harmoniclib.enchantment.api.HLEnchantment; + +/** + * 唤潮 Tide TODO + *

+ * 提高水中投掷速度,击中目标会使其窒息。 + *

    + *
+ * + * @author WakelessSloth56 + * @author Libellule505 + * @since 2.1.0 + */ +public class TideEnchantment extends HLEnchantment { + + public TideEnchantment() { + super( + Enchantment.Rarity.RARE, + EnchantmentCategory.TRIDENT, + EquipmentSlot.MAINHAND, + 3, + (o) -> o != Enchantments.LOYALTY && o != Enchantments.CHANNELING + && o != HEEnchantments.ELECTRIFICATION.get() + ); + } + + @Override + public int getMinCost(int lvl) { + return (lvl * 7) + 5; + } + + @Override + public int getMaxCost(int lvl) { + return 50; + } + +} diff --git a/src/main/resources/assets/harmonicench/lang/en_us.json b/src/main/resources/assets/harmonicench/lang/en_us.json index 9b20970..68752c9 100644 --- a/src/main/resources/assets/harmonicench/lang/en_us.json +++ b/src/main/resources/assets/harmonicench/lang/en_us.json @@ -26,6 +26,9 @@ "enchantment.harmonicench.long": "Long", "enchantment.harmonicench.aim": "Aim", "enchantment.harmonicench.blunt": "Blunt", + "enchantment.harmonicench.tide": "Tide (WIP)", + "enchantment.harmonicench.harvest": "Harvest (WIP)", + "enchantment.harmonicench.observer": "Observer (WIP)", "enchantment.harmonicench.rapier.desc": "Increase your attack speed, but sweeping attack is no longer available.", "enchantment.harmonicench.handiness.desc": "Increase user's speed temporarily when shooting a target.", diff --git a/src/main/resources/assets/harmonicench/lang/zh_cn.json b/src/main/resources/assets/harmonicench/lang/zh_cn.json index 5ca4002..b41cd7d 100644 --- a/src/main/resources/assets/harmonicench/lang/zh_cn.json +++ b/src/main/resources/assets/harmonicench/lang/zh_cn.json @@ -26,6 +26,9 @@ "enchantment.harmonicench.long": "延展之刃", "enchantment.harmonicench.aim": "瞄准", "enchantment.harmonicench.blunt": "钝重", + "enchantment.harmonicench.tide": "唤潮(未实现)", + "enchantment.harmonicench.harvest": "收割(未实现)", + "enchantment.harmonicench.observer": "观测(未实现)", "enchantment.harmonicench.rapier.desc": "增加攻击速度,但无法再使出横扫攻击。", "enchantment.harmonicench.handiness.desc": "射出的箭命中实体后会短暂提高使用者移动速度。",