Skip to content

Commit

Permalink
feat(ench): register 3 new enchantments
Browse files Browse the repository at this point in the history
tide, harvest, observer

[skip ci]
  • Loading branch information
WakelessSloth56 committed Feb 21, 2024
1 parent 9078f18 commit 93b8bd9
Show file tree
Hide file tree
Showing 8 changed files with 218 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -83,5 +86,8 @@ private static <T extends Enchantment> DeferredHolder<Enchantment, T> register(S
public static final DeferredHolder<Enchantment, LongEnchantment> LONG = register("long", LongEnchantment::new);
public static final DeferredHolder<Enchantment, AimEnchantment> AIM = register("aim", AimEnchantment::new);
public static final DeferredHolder<Enchantment, BluntEnchantment> BLUNT = register("blunt", BluntEnchantment::new);
public static final DeferredHolder<Enchantment, TideEnchantment> TIDE = register("tide", TideEnchantment::new);
public static final DeferredHolder<Enchantment, HarvestEnchantment> HARVEST = register("harvest", HarvestEnchantment::new);
public static final DeferredHolder<Enchantment, ObserverEnchantment> OBSERVER = register("observer", ObserverEnchantment::new);

}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/

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;

/**
* <b>收割 Harvest</b> TODO
* <p>
* 提高收割作物(以及生物)的速度。
* <ul>
* </ul>
*
* @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);
}

}
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/

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;

/**
* <b>观测 Observer</b> TODO
* <p>
* 在晴朗的夜晚,了解天象。
* <ul>
* </ul>
*
* @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;
}

}
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/

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;

/**
* <b>唤潮 Tide</b> TODO
* <p>
* 提高水中投掷速度,击中目标会使其窒息。
* <ul>
* </ul>
*
* @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;
}

}
3 changes: 3 additions & 0 deletions src/main/resources/assets/harmonicench/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/assets/harmonicench/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "射出的箭命中实体后会短暂提高使用者移动速度。",
Expand Down

0 comments on commit 93b8bd9

Please sign in to comment.