Advertisement
RazzleberryFox

Chair Code

Oct 1st, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. [2:08:12 AM] Noppes: sure
  2. [2:08:24 AM] Noppes: first I have an entity you need
  3. [2:08:28 AM] *** Noppes sent EntityChairMount.java ***
  4. [2:09:09 AM] Noppes: register said entity
  5. [2:10:19 AM] Noppes: Next make a function in your block class like
  6. [2:10:20 AM] Noppes:
  7.  
  8.  
  9. public static boolean MountBlock(World world, int x, int y, int z, EntityPlayer player){
  10. if(world.isRemote)
  11. return true;
  12. List<Entity> list = world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1));
  13. for(Entity entity : list){
  14. if(entity instanceof EntityChairMount || entity instanceof EntityCustomNpc)
  15. return false;
  16. }
  17. EntityChairMount mount = new EntityChairMount(world);
  18. mount.setPosition(x + 0.5f, y, z + 0.5);
  19. player.mountEntity(mount);
  20. world.spawnEntityInWorld(mount);
  21. player.mountEntity(mount);
  22. return true;
  23. }
  24.  
  25.  
  26. [2:10:45 AM] Noppes: and than simply call it from blockactivated
  27. [2:10:46 AM] Noppes:
  28.  
  29.  
  30. @Override
  31. public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
  32. return MountBlock(world, x, y, z, player);
  33. }
  34.  
  35.  
  36. [2:11:04 AM] Noppes: and thats it
  37. [8:02:47 AM] Razz: thank you Noppy
  38. [8:14:33 AM] Noppes: np
  39. [8:27:58 AM] Noppes: oh from the function you will probably want to remove the || entity instanceof EntityCustomNpc
  40. [8:28:15 AM] Noppes: Im preventing players from sitting on chairs npcs sit on
  41. [8:57:33 AM] Razz: oh?
  42. [8:57:38 AM] Razz: hhahahahaha cool
  43. [8:59:01 AM] Noppes: yupyup
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement