Created
August 23, 2018 02:40
-
-
Save aikar/398a0cc15f9e6d2fd2b7c4cf4b809569 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static CraftBlockData fromData(IBlockData data) { | |
Class<? extends CraftBlockData> craft = MAP.get(data.getBlock().getClass()); | |
if (craft == null) { | |
craft = CraftBlockData.class; | |
} | |
CraftBlockData ret; | |
try { | |
ret = craft.getDeclaredConstructor(IBlockData.class).newInstance(data); | |
} catch (ReflectiveOperationException ex) { | |
throw new RuntimeException(ex); | |
} | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment