mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 03:25:18 +00:00
30 lines
923 B
Java
30 lines
923 B
Java
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", acceptableRemoteVersions = "*")
|
|
@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);
|
|
}
|
|
}
|
|
}
|
|
} |