@Override public boolean update(boolean force, boolean applyPhysics) { Block block = getBlock(); return (block.getTypeId() == typeId || force) && block.setTypeIdAndData(typeId, getRawData(), applyPhysics); }
private void placeFallingBlock() { location.getBlock().setTypeIdAndData(material.getId(), getBlockData(), true); if (getBlockEntityCompoundTag() != null) { if (location.getBlock() instanceof GlowBlock) { GlowBlock block = (GlowBlock) location.getBlock(); BlockEntity blockEntity = block.getBlockEntity(); if (blockEntity != null) { blockEntity.loadNbt(getBlockEntityCompoundTag()); } } } if (material == Material.ANVIL) { ThreadLocalRandom random = ThreadLocalRandom.current(); world.playSound(location, Sound.BLOCK_ANVIL_FALL, 4, (1.0F + (random.nextFloat() - random.nextFloat()) * 0.2F) * 0.7F); } }
relativeBlock.setTypeIdAndData(0, (byte) 0, true); return;
@Override public boolean setTypeIdAndData(final int type, final byte data, final boolean applyPhysics) { return base.setTypeIdAndData(type, data, applyPhysics); }
/** * Sets the Block type and data at once * * @param block to set the type and data of * @param type to set to * @param data to set to * @param update - whether to perform physics afterwards */ @SuppressWarnings("deprecation") public static void setTypeAndRawData(org.bukkit.block.Block block, Material type, int data, boolean update) { block.setTypeIdAndData(type.getId(), (byte) data, update); }
/** * Sets the Block type and data at once * * @param block to set the type and data of * @param type to set to * @param data to set to * @param update - whether to perform physics afterwards */ @SuppressWarnings("deprecation") public static void setTypeAndData(org.bukkit.block.Block block, Material type, MaterialData data, boolean update) { block.setTypeIdAndData(type.getId(), data.getData(), update); }
block.setTypeIdAndData(31, (byte) 0, false); // tall grass return; case 1: block.setTypeIdAndData(31, (byte) 1, false); // tall grass return; case 2: block.setTypeIdAndData(31, (byte) 2, false); // tall grass return; case 3:
/** * Wipes a single translocation block from the world * * @param field * @param tb */ public boolean wipeTranslocationBlock(Field field, TranslocationBlock tb) { Block block = tb.getBlock(); tb = processBlock(tb); if (tb != null) { // wipe the block addBlock(field, block, true); block.setTypeIdAndData(0, (byte) 0, true); return true; } return false; }
/** * Clears a single translocation block from the world * * @param tb */ public void zeroOutBlock(TranslocationBlock tb) { final Block block = tb.getBlock().getWorld().getBlockAt(tb.getX(), tb.getY(), tb.getZ()); block.setTypeIdAndData(0, (byte) 0, true); }
@Override public void run() { if (id != -1 && id != 0 && subId != -1) { org.bukkit.material.Sign sign = (org.bukkit.material.Sign) location.getBlock().getState().getData(); location.getBlock().getRelative(sign.getAttachedFace()).setTypeIdAndData(id, (byte) subId, true); } } });
currentBlock.setTypeIdAndData(blockUpdate.typeId, blockUpdate.data, false);
block.setTypeIdAndData(0, (byte) 0, true);
block.setTypeIdAndData(gb.getTypeId(), gb.getData(), true); return; block.setTypeIdAndData(gb.getTypeId(), gb.getData(), true);
block.setTypeIdAndData(0, (byte) 0, true); bottom.setTypeIdAndData(0, (byte) 0, true); top.setTypeIdAndData(0, (byte) 0, true); } else { if (!Helper.isDoor(block)) { block.setTypeIdAndData(0, (byte) 0, true);
block.setTypeIdAndData(0, (byte) 0, false); continue; block.setTypeIdAndData(0, (byte) 0, false); continue; for (BlockEntry db : revert) { Block block = db.getLocation().getBlock(); block.setTypeIdAndData(db.getTypeId(), db.getData(), true);
block.setTypeIdAndData(tb.getTypeId(), tb.getData(), true); return true; block.setTypeIdAndData(tb.getTypeId(), tb.getData(), true);