本文整理匯總了Java中org.bukkit.block.BlockState.setRawData方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockState.setRawData方法的具體用法?Java BlockState.setRawData怎麽用?Java BlockState.setRawData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.block.BlockState
的用法示例。
在下文中一共展示了BlockState.setRawData方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleBlockSpreadEvent
import org.bukkit.block.BlockState; //導入方法依賴的package包/類
public static void handleBlockSpreadEvent(Block block, Block source, net.minecraft.block.Block type, int data) {
BlockState state = block.getState();
state.setTypeId(net.minecraft.block.Block.getIdFromBlock(type));
state.setRawData((byte) data);
BlockSpreadEvent event = new BlockSpreadEvent(block, source, state);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
state.update(true);
}
}
示例2: getState
import org.bukkit.block.BlockState; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public BlockState getState(BlockVector pos) {
int offset = this.offset(pos);
BlockState state = pos.toLocation(this.world).getBlock().getState();
state.setTypeId(this.blockIds[offset]);
state.setRawData(this.blockData[offset]);
return state;
}
示例3: onBlockFromTo
import org.bukkit.block.BlockState; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@EventWrapper
public void onBlockFromTo(BlockFromToEvent event) {
if(event.getToBlock().getType() != event.getBlock().getType()) {
BlockState oldState = event.getToBlock().getState();
BlockState newState = event.getToBlock().getState();
newState.setType(event.getBlock().getType());
newState.setRawData(event.getBlock().getData());
// Check for lava ownership
this.callEvent(event, oldState, newState, blockResolver.getOwner(event.getBlock()));
}
}
示例4: cloneWithMaterial
import org.bukkit.block.BlockState; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public static BlockState cloneWithMaterial(Block block, Material material, byte data) {
BlockState state = block.getState();
state.setType(material);
state.setRawData(data);
return state;
}
示例5: next
import org.bukkit.block.BlockState; //導入方法依賴的package包/類
@Override
public BlockState next() {
Block block = BlockUtils.blockAt(world, iter.key());
if(block == null) return null;
BlockState state = block.getState();
state.setTypeId(decodeTypeId(iter.value()));
state.setRawData(decodeMetadata(iter.value()));
return state;
}
示例6: setTypeAndData
import org.bukkit.block.BlockState; //導入方法依賴的package包/類
public void setTypeAndData(int x, int y, int z, net.minecraft.block.Block block, int data, int light) {
BlockState state = world.getBlockAt(x, y, z).getState();
state.setTypeId(net.minecraft.block.Block.getIdFromBlock(block));
state.setRawData((byte) data);
list.add(state);
}
示例7: toAir
import org.bukkit.block.BlockState; //導入方法依賴的package包/類
public static BlockState toAir(Block block) {
BlockState newState = block.getState(); // this creates a new copy of the state
newState.setType(Material.AIR);
newState.setRawData((byte) 0);
return newState;
}