made the infused blade also have a special effect: slowness!

This commit is contained in:
Ellpeck 2018-11-13 19:15:24 +01:00
parent 21c33fc856
commit f7c817a5c9
3 changed files with 12 additions and 2 deletions

View file

@ -90,7 +90,7 @@ public final class NaturesAura {
Compat.postInit(); Compat.postInit();
proxy.postInit(event); proxy.postInit(event);
if (ModConfig.general.removeDragonBreathContainerItem) { if (ModConfig.enabledFeatures.removeDragonBreathContainerItem) {
Items.DRAGON_BREATH.setContainerItem(null); Items.DRAGON_BREATH.setContainerItem(null);
} }
} }

View file

@ -5,9 +5,12 @@ import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.IModelProvider;
import de.ellpeck.naturesaura.reg.ModRegistry; import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword; import net.minecraft.item.ItemSword;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
@ -49,6 +52,13 @@ public class ItemSwordNA extends ItemSword implements IModItem, IModelProvider {
} }
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
if (this == ModItems.INFUSED_SWORD)
target.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 60, 2));
return super.hitEntity(stack, target, attacker);
}
@Nullable @Nullable
@Override @Override
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) { public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {

View file

@ -33,7 +33,7 @@
"recipe": "naturesaura:infused_hoe" "recipe": "naturesaura:infused_hoe"
}, { }, {
"type": "crafting", "type": "crafting",
"text": "The $(item)Botanist's Blade$(), while not having an inherent special feature, will still prove useful in slaying enemies of any sort.", "text": "The $(item)Botanist's Blade$() is a good way of dealing with monsters: It will cause any mob you hit to be $(thing)slowed down$() for a couple of seconds, making them an easier target.",
"recipe": "naturesaura:infused_sword" "recipe": "naturesaura:infused_sword"
} }
] ]