Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void commonCrate(Location loc, Block block, Player p) {
- int x = r.nextInt(2);
- int z = r.nextInt(2);
- Location locBlock = loc.add(x, 0, z);
- int y = p.getWorld().getHighestBlockYAt(locBlock.getBlockX(), locBlock.getBlockZ());
- locBlock.setY(y);
- block.setType(Material.CHEST);
- Chest chest = (Chest) block.getState();
- try {
- Field inventoryField = chest.getClass().getDeclaredField("chest");
- inventoryField.setAccessible(true);
- TileEntityChest teChest = ((TileEntityChest) inventoryField.get(chest));
- teChest.a(ChatColor.DARK_GREEN + ChatColor.BOLD.toString() + "Realistic_crate");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement