package landmaster.plustic.traits;

import java.util.*;

import net.minecraft.entity.*;
import net.minecraft.init.*;
import net.minecraft.potion.*;
import net.minecraft.util.*;
import net.minecraftforge.common.*;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.fml.common.eventhandler.*;
import slimeknights.tconstruct.library.traits.*;

public class Ghastly extends AbstractTrait {
	public static final Ghastly ghastly = new Ghastly();
	
	public Ghastly() {
		super("ghastly", 0xFFFFFF);
		MinecraftForge.EVENT_BUS.register(this);
	}
	
	@SubscribeEvent(priority = EventPriority.LOWEST)
	public void defend(LivingHurtEvent event) {
		if (event.getEntityLiving().isSneaking() && event.getSource() instanceof EntityDamageSource) {
			Optional.ofNullable(event.getSource().getTrueSource()).ifPresent(attacker -> {
				if (attacker instanceof EntityLivingBase) {
					((EntityLivingBase)attacker).addPotionEffect(
							new PotionEffect(MobEffects.SLOWNESS, 100, 2));
				}
			});
		}
	}
}

@@ -356,16 +356,64 @@
 raits.*;
+%0Aimport slimeknights.tconstruct.library.utils.*;
 %0A%0Apublic
@@ -742,17 +742,21 @@
 eaking()
- 
+%0A%09%09%09%09
 && event
@@ -797,16 +797,192 @@
 geSource
+%0A%09%09%09%09&& Arrays.stream(EnumHand.values())%0A%09%09%09%09.map(event.getEntityLiving()::getHeldItem)%0A%09%09%09%09.map(TagUtil::getTagSafe)%0A%09%09%09%09.anyMatch(nbt -%3E TinkerUtil.hasTrait(nbt, identifier))
 ) %7B%0A%09%09%09O

Make Ghastly trait correct