diff --git a/src/main/java/hellfirepvp/astralsorcery/common/enchantment/EnchantmentNightVision.java b/src/main/java/hellfirepvp/astralsorcery/common/enchantment/EnchantmentNightVision.java index 7d80c7ac5..663f2bc39 100644 --- a/src/main/java/hellfirepvp/astralsorcery/common/enchantment/EnchantmentNightVision.java +++ b/src/main/java/hellfirepvp/astralsorcery/common/enchantment/EnchantmentNightVision.java @@ -11,10 +11,14 @@ import net.minecraft.enchantment.EnchantmentType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.EquipmentSlotType; +import net.minecraft.item.Items; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.potion.EffectInstance; import net.minecraft.potion.Effects; import net.minecraftforge.fml.LogicalSide; +import hellfirepvp.astralsorcery.common.data.research.PlayerProgress; +import hellfirepvp.astralsorcery.common.data.research.ResearchHelper; /** * This class is part of the Astral Sorcery Mod @@ -32,10 +36,28 @@ public EnchantmentNightVision() { @Override public void tick(PlayerEntity player, LogicalSide side, int level) { if (side.isServer()) { - player.addPotionEffect(new EffectInstance(Effects.NIGHT_VISION, 300, level - 1, true, false)); + PlayerProgress prog = ResearchHelper.getProgress(player, LogicalSide.SERVER); + if (prog.doPerkAbilities()) { + EffectInstance effect = new EffectInstance(Effects.NIGHT_VISION, 300, level - 1, true, false); + effect.addCurativeItem(getCurativeMarkerItem()); + player.addPotionEffect(effect); + } else { + player.curePotionEffects(getCurativeMarkerItem()); + } } } + private static ItemStack getCurativeMarkerItem() { + ItemStack curativeItem = new ItemStack(Items.BARRIER, 1); + + CompoundNBT nbtMarker = new CompoundNBT(); + nbtMarker.putBoolean("astralNightVision", true); + + curativeItem.setTag(nbtMarker); + + return curativeItem; + } + @Override public boolean canApply(ItemStack stack) { return this.type.canEnchantItem(stack.getItem());