示例#1
0
 // Spigot start
 // Helper method for scheduleTicks. If the hopper at x0, y0, z0 is pointed
 // at this tile entity, then make it active.
 private void scheduleTick(int x0, int y0, int z0) {
   TileEntity tileEntity = world.getTileEntity(x0, y0, z0);
   if (tileEntity instanceof TileEntityHopper && tileEntity.world != null) {
     // i is the metadeta assoiated with the direction the hopper faces.
     int i = BlockHopper.b(tileEntity.p());
     // Facing class provides arrays for direction offset.
     if (tileEntity.x + Facing.b[i] == x
         && tileEntity.y + Facing.c[i] == y
         && tileEntity.z + Facing.d[i] == z) {
       ((TileEntityHopper) tileEntity).makeTick();
     }
   }
 }
示例#2
0
 // Called from update when the contents have changed, so hoppers need updates.
 // Check all 6 faces.
 public void scheduleTicks() {
   if (world != null && world.spigotConfig.altHopperTicking) {
     // Check the top
     scheduleTick(x, y + 1, z);
     // Check the sides
     for (int i = 2; i < 6; i++) {
       scheduleTick(x + Facing.b[i], y, z + Facing.d[i]);
     }
     // Check the bottom.
     TileEntity tileEntity = world.getTileEntity(x, y - 1, z);
     if (tileEntity instanceof TileEntityHopper && tileEntity.world != null) {
       ((TileEntityHopper) tileEntity).makeTick();
     }
   }
 }