Added LivingKnockBackEvent event to allow better control over knock back effects. (#4503)

This commit is contained in:
Melonslise authored and LexManos committed 2017-12-16 18:03:45 -08:00
1 parent 441ece67bd
commit bbf1bef7d3
4 files changed
+161 -18

No files matched your search

@@ -0,0 +1,30 @@
package net.minecraftforge.debug;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraftforge.event.entity.living.LivingKnockBackEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@Mod(modid = "kbhtest", name = "Knock Back Hook Test", version = "1.0")
@Mod.EventBusSubscriber
public class KnockBackHookTest
{
private static final boolean ENABLED = false;
@SubscribeEvent
public static void onKnockBack(LivingKnockBackEvent event)
{
if(ENABLED)
{
if(event.getEntityLiving() instanceof EntitySheep)
{
event.setStrength(0.2F);
}
else if(event.getEntityLiving() instanceof EntityCow)
{
event.setCanceled(true);
}
}
}
}