public void MagicChest(BlockBreakEvent event){ Location loc = event.getBlock().getLocation(); World world = loc.getWorld(); event.setCancelled(true); Block block = event.getBlock(); block.setType(Material.CHEST); DirectionalContainer chestData = (DirectionalContainer) block.getState().getData(); BlockFace directionInfo = new LuckyBlocksInvokeMethodClass().getCardinalDirection(event.getPlayer()); chestData.setFacingDirection(directionInfo); //Next Line makes use of a Deprecated Method block.setData(chestData.getData(),true); Chest chest = (Chest) block.getState(); world.playEffect(loc,Effect.ENDER_SIGNAL,50); int RandomSelection = (int) (Math.random()*100); if (RandomSelection < 50) { ItemStack goldenApples = new ItemStack(Material.GOLDEN_APPLE); goldenApples.setAmount(5); chest.getInventory().addItem(goldenApples); } else if (RandomSelection >= 50) isUnluckyChestActivated = 1; }
@Deprecated public DirectionalContainer(int type) { }
public DirectionalContainer() { // TODO }
public DirectionalContainer(Material type) { }
@Deprecated public DirectionalContainer(int type, byte data) { }
@Deprecated public DirectionalContainer(Material type, byte data) { }
public DirectionalContainer clone() { return null; }