Advertisement
TheInstitutions

Entity Spawning From Item

Jul 16th, 2012
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. package net.minecraft.src;
  2.  
  3. import java.util.Random;
  4.  
  5. public class SpiderManequin extends Item
  6. {
  7. public SpiderManequin(int i)
  8. {
  9. super(i);
  10. maxStackSize = 1;
  11. setMaxDamage(200);
  12. }
  13. private World worldObj;
  14.  
  15. public boolean onItemUse (ItemStack itemstack, EntityPlayer entityplayer, World world, int i ,int j, int k, int l){
  16. if(!world.isRemote)
  17. {
  18. ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Dirt Slime Summonned!");
  19. EntityLiving entityliving = (EntityLiving)EntityList.createEntityByName("Dirt Slime", entityplayer.worldObj);
  20.  
  21. entityliving.setLocationAndAngles(i, j + 1, k, 0F, 0F);
  22. entityplayer.worldObj.spawnEntityInWorld(entityliving);
  23. entityplayer.swingItem();
  24. }
  25.  
  26. return true;
  27.  
  28.  
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement