Advertisement
Guest User

Untitled

a guest
Oct 13th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. package theishiopian.sandbox.handler;
  2.  
  3. import net.minecraft.entity.player.EntityPlayer;
  4. import net.minecraft.util.EnumParticleTypes;
  5. import net.minecraftforge.event.entity.living.LivingSpawnEvent;
  6. import net.minecraftforge.fml.common.eventhandler.Event.Result;
  7. import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
  8. import theishiopian.sandbox.world.ScarecrowTracking;
  9.  
  10. public class SpawnHandler
  11. {
  12.     @SubscribeEvent
  13.     public void spawnHandler(LivingSpawnEvent.CheckSpawn event)
  14.     {
  15.         if((!(event.getEntity() instanceof EntityPlayer))&&(!(event.getWorld().isRemote)))
  16.         {
  17.             if(ScarecrowTracking.get(event.getWorld()).inRange(event.getEntity()))event.setResult(Result.DENY);
  18.             event.getWorld().spawnParticle(EnumParticleTypes.SMOKE_NORMAL, true, event.getX(), event.getY(), event.getZ(), 0, 0, 0, new int[0]);
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement