Skip to content

Commit

Permalink
build 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WeAthFolD committed Oct 25, 2015
1 parent 98b5063 commit c2e5789
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/cn/liutils/util/mc/WorldUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,13 @@ public static List<Entity> getEntities(World world, AxisAlignedBB box, IEntitySe
return world.getEntitiesWithinAABBExcludingEntity(null, box, filter);
}

/**
* Get the tile entity at the given position and check if it is the specified type.
* Return the tile entity if is of the type, null otherwise.
*/
public static <T extends TileEntity> T getTileEntity(World world, int x, int y, int z, Class<T> type) {
TileEntity te = world.getTileEntity(x, y, z);
return type.isInstance(te) ? (T) te : null;
}

}

0 comments on commit c2e5789

Please sign in to comment.