Advertisement
Guest User

TileEntityConveyor

a guest
Aug 12th, 2015
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. public class TileEntityConveyor extends TileEntity {
  2.  
  3.     public final float speed;
  4.  
  5.     public TileEntityConveyor(float speed) {
  6.         this.speed = speed;
  7.     }
  8.  
  9.     @Override
  10.     public void updateEntity() {
  11.         List<Entity> entities = worldObj.getEntitiesWithinAABB(Entity.class,
  12.                 AxisAlignedBB.getBoundingBox(xCoord, yCoord + 0.1, zCoord,
  13.                         xCoord + 1.0, yCoord + 1.0, zCoord + 1.0));
  14.  
  15.         int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
  16.        
  17.         for (Entity e : entities) {
  18.             if (meta == 2) {
  19.                 e.setVelocity(e.motionX, e.motionY, -speed);
  20.             }
  21.             if (meta == 3) {
  22.                 e.setVelocity(e.motionX, e.motionY, speed);
  23.             }
  24.             if (meta == 4) {
  25.                 e.setVelocity(-speed, e.motionY, e.motionZ);
  26.             }
  27.             if (meta == 5) {
  28.                 e.setVelocity(speed, e.motionY, e.motionZ);
  29.             }
  30.         }
  31.     }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement