Skip to content

Commit

Permalink
improve tile entity logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Sep 14, 2017
1 parent 9fbe458 commit 7580317
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@
import org.bukkit.craftbukkit.v1_12_R1.block.CraftSkull;
import org.bukkit.material.MaterialData;

import java.lang.reflect.Field;
import java.util.UUID;

public class BlockHelper_v1_12_R1 implements BlockHelper {

public <T extends TileEntity> T getTE(CraftBlockEntityState<T> cbs) {
try {
return (T) cbs.getClass().getField("tileEntity").get(cbs);
Field f = CraftBlockEntityState.class.getField("tileEntity");
f.setAccessible(true);
return (T) f.get(cbs);
}
catch (IllegalAccessException e) {
e.printStackTrace();
Expand Down

0 comments on commit 7580317

Please sign in to comment.