private void dropTargetBlock(Block targetBlock) { if (targetBlock.getType().equals(Material.BED_BLOCK)) { Block bedHead; Block bedFeet; Bed bedBlock = (Bed) targetBlock.getState().getData(); if (!bedBlock.isHeadOfBed()) { bedFeet = targetBlock; bedHead = Utils.getBedNeighbor(bedFeet); } else { bedHead = targetBlock; bedFeet = Utils.getBedNeighbor(bedHead); } if (!BedwarsRel.getInstance().getCurrentVersion().startsWith("v1_12")) { bedFeet.setType(Material.AIR); } else { bedHead.setType(Material.AIR); } } else { targetBlock.setType(Material.AIR); } }
/** * Only the bottom half of doors and the feet of a bed is logged! * * @param blockState the blockstate to adjust * * @return the adjusted blockstate */ public static BlockState adjustBlockForDoubleBlocks(BlockState blockState) { if (blockState.getType() == Material.WOODEN_DOOR || blockState.getType() == Material.IRON_DOOR_BLOCK) { if (blockState.getRawData() == 8 || blockState.getRawData() == 9) { if (blockState.getRawData() == 9) { blockState = blockState.getBlock().getRelative(BlockFace.DOWN).getState(); blockState.setRawData((byte)(blockState.getRawData() + 8)); return blockState; } return blockState.getBlock().getRelative(BlockFace.DOWN).getState(); } else { if (blockState.getBlock().getRelative(BlockFace.UP).getState().getRawData() == 9) { blockState.setRawData((byte)(blockState.getRawData() + 8)); } } } else if (blockState.getData() instanceof Bed) { Bed bed = (Bed)blockState.getData(); if (bed.isHeadOfBed()) { return blockState.getBlock().getRelative(bed.getFacing().getOppositeFace()).getState(); } } return blockState; }
private Block getRealFace(Block block) { if (((Bed) block.getState().getData()).isHeadOfBed()) block = block.getRelative(((Bed) block.getState().getData()).getFacing().getOppositeFace()); return block; }
public Bed() { }
public Bed(BlockFace direction) { }
@Deprecated public Bed(int type) { }
public Bed(Material type) { }
@Deprecated public Bed(int type, byte data) { }
@Deprecated public Bed(Material type, byte data) { }
public Bed clone() { return null; }