Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Add Slippery hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldorion committed Jun 23, 2022
1 parent 1d19ae6 commit eaa286f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions ENCHANTMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
- Unvanishable: Each time, the entity item life reaches 0 tick, 5 more minutes will be added for each level. Remove 1 level/5 minutes
- Wrong block (Armor): Randomly teleport you in a square of 2 * *level* blocks
- Slippery rope: 20%/level of chance to fail shouting with the bow
- Slippery hook: 15%/level of chance to get nothing when fishing
- Hylian Shield: The shield works as normal, but it does not take damage values
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CurseForge: [https://www.curseforge.com/minecraft/mc-mods/enchanter](https://www
* Sleepless Night: You can't sleep! You're too busy to sleep anyway.
* Wrong block (Armor): Randomly teleport you in a square of 2 * *level* blocks
* Slippery rope: 20%/level of chance to fail shouting with the bow
* Slippery hook: 15%/level of chance to get nothing when fishing

### Protections:
* Falling Block Protection (Helmet): 0.5 heart/level
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/goldorion/enchanter/ModEnchantments.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class ModEnchantments {
public static final RegistryObject<Enchantment> SLEEPLESS_NIGHT = register("sleepless_night", new GenericEnchantment(new EnchantmentBuilder(Rarity.VERY_RARE, EnchantmentCategory.ARMOR, ARMORS).setMinCost(25).setMaxCost(50).setTreasure().setCurse()));
public static final RegistryObject<Enchantment> WRONG_BLOCK = register("wrong_block", new GenericEnchantment(new EnchantmentBuilder(Rarity.RARE, EnchantmentCategory.ARMOR, ARMORS).setMaxLevel(5).setTreasure().setTreasure().setCurse()));
public static final RegistryObject<Enchantment> SLIPPERY_ROPE = register("slippery_rope", new GenericEnchantment(new EnchantmentBuilder(Rarity.RARE, EnchantmentCategory.BOW, HANDS).setMaxLevel(4).setMinCost(20).setMaxCost(50).setTreasure().setCurse()));
public static final RegistryObject<Enchantment> SLIPPERY_HOOK = register("slippery_hook", new GenericEnchantment(new EnchantmentBuilder(Rarity.RARE, EnchantmentCategory.FISHING_ROD, HANDS).setMaxLevel(4).setMinCost(20).setMaxCost(50).setTreasure().setCurse()));
//Misc
public static final RegistryObject<Enchantment> MAGMA_WALKER = register("magma_walker", new MagmaWalker(Rarity.RARE, EquipmentSlot.FEET));
public static final RegistryObject<Enchantment> UNVANISHABLE = register("unvanishable", new GenericEnchantment(new EnchantmentBuilder(Enchantment.Rarity.VERY_RARE, EnchantmentCategory.VANISHABLE, ALL).setMaxLevel(3).setTreasure()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraftforge.common.ToolActions;
import net.minecraftforge.event.entity.living.ShieldBlockEvent;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
import net.minecraftforge.event.entity.player.ItemFishedEvent;
import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
Expand All @@ -38,6 +39,16 @@ public static void arrownockEvent(ArrowNockEvent event) {
}
}

@SubscribeEvent
public static void itemFished(ItemFishedEvent event) {
if (Utils.hasEnchantment(event.getPlayer().getItemInHand(event.getPlayer().getUsedItemHand()), ModEnchantments.SLIPPERY_HOOK.get())) {
if (!event.getPlayer().getLevel().isClientSide() &&
Math.random() * 100 > (15 * EnchantmentHelper.getTagEnchantmentLevel(ModEnchantments.SLIPPERY_HOOK.get(), event.getPlayer().getUseItem()))) {
event.setCanceled(true);
}
}
}

@SubscribeEvent
public static void shieldBlocksDamage(ShieldBlockEvent event) {
if (Utils.hasEnchantment(event.getEntityLiving().getUseItem(), ModEnchantments.HYLIAN_SHIELD.get()))
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/enchanter/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"enchantment.enchanter.unvanishable": "Unvanishable",
"enchantment.enchanter.wrong_block": "Wrong Block",
"enchantment.enchanter.slippery_rope": "Slippery Rope",
"enchantment.enchanter.slippery_hook": "Slippery Hook",
"enchantment.enchanter.hylian_shield": "Hylian Shield"
}
1 change: 1 addition & 0 deletions src/main/resources/assets/enchanter/lang/fr_ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"enchantment.enchanter.unvanishable": "Persistance",
"enchantment.enchanter.wrong_block": "Mauvais bloc",
"enchantment.enchanter.slippery_rope": "Corde glissante",
"enchantment.enchanter.slippery_hook": "Hameçon glissant",
"enchantment.enchanter.hylian_shield": "Bouclier Hylien"
}
1 change: 1 addition & 0 deletions src/main/resources/assets/enchanter/lang/fr_fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"enchantment.enchanter.unvanishable": "Persistance",
"enchantment.enchanter.wrong_block": "Mauvais bloc",
"enchantment.enchanter.slippery_rope": "Corde glissante",
"enchantment.enchanter.slippery_hook": "Hameçon glissant",
"enchantment.enchanter.hylian_shield": "Bouclier Hylien"
}

0 comments on commit eaa286f

Please sign in to comment.