Guest User

Untitled

a guest
Jun 21st, 2015
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1. public class MonsterPlacerDataLoyalist extends Item {
  2.  
  3.     public MonsterPlacerDataLoyalist() {
  4.         this.setHasSubtypes(false);
  5.         this.setCreativeTab(CreativeTabs.tabMisc);
  6.         this.setUnlocalizedName("itemDataSwordmanSpawn");
  7.     }
  8.    
  9.     public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
  10.         return stack;
  11.     }
  12.    
  13.     public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int sideHit, float hitX, float hitY, float hitZ)
  14.     {
  15.         if (!world.isRemote) {
  16.             /*
  17.             Unknown error happened before, so this code was left behind.
  18.             EntityDataLoyalist loyalist = new EntityDataLoyalist(world);
  19.             loyalist.setLocationAndAngles(x, y, z, 0, 0);
  20.             world.spawnEntityInWorld(loyalist);
  21.             return true;
  22.             */
  23.            
  24.             EntityZombie zombie = new EntityZombie(world);
  25.             zombie.setLocationAndAngles(x, y+2, z, 0, 0);
  26.             world.spawnEntityInWorld(zombie);
  27.            
  28.             EntityDataSwordman swordman = new EntityDataSwordman(world);
  29.             swordman.setLocationAndAngles(x, y+2, z, 0, 0);
  30.             swordman.setVelocity(0, 2, 0);
  31.             world.spawnEntityInWorld(swordman);
  32.            
  33.            
  34.             EntitySkeleton skeleton = new EntitySkeleton(world);
  35.             skeleton.setLocationAndAngles(x, y, z, 0, 0);
  36.             world.spawnEntityInWorld(skeleton);
  37.             return true;
  38.         }
  39.         return false;
  40.     }
  41.    
  42. }
Advertisement
Add Comment
Please, Sign In to add comment