mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 11:05:40 +00:00
Added LivingKnockBackEvent event to allow better control over knock back effects. (#4503)
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user