Advertisement
Guest User

Untitled

a guest
Jul 9th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. public class MyClass {
  2. private final <T extends TileEntity> Class<T> tileEntityClass;
  3.  
  4. public <T extends TileEntity> MyClass(Class<T> tileEntityClass) {
  5. this.tileEntityClass = tileEntityClass;
  6. }
  7.  
  8. // My function got creating a new instance of the TileEntity.
  9. public <T extends TileEntity> T getTileEntity() {
  10. return tileEntityClass.newInstance();
  11. } catch(Exception e) {
  12. e.printStackTrace();
  13. }
  14.  
  15. return null;
  16. }
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement