Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TileEntityConveyor extends TileEntity {
- public final float speed;
- public TileEntityConveyor(float speed) {
- this.speed = speed;
- }
- @Override
- public void updateEntity() {
- List<Entity> entities = worldObj.getEntitiesWithinAABB(Entity.class,
- AxisAlignedBB.getBoundingBox(xCoord, yCoord + 0.1, zCoord,
- xCoord + 1.0, yCoord + 1.0, zCoord + 1.0));
- int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
- for (Entity e : entities) {
- if (meta == 2) {
- e.setVelocity(e.motionX, e.motionY, -speed);
- }
- if (meta == 3) {
- e.setVelocity(e.motionX, e.motionY, speed);
- }
- if (meta == 4) {
- e.setVelocity(-speed, e.motionY, e.motionZ);
- }
- if (meta == 5) {
- e.setVelocity(speed, e.motionY, e.motionZ);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement