Advertisement
Guest User

Untitled

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