當前位置: 首頁>>代碼示例>>Java>>正文


Java BlockState.getMaterialData方法代碼示例

本文整理匯總了Java中org.bukkit.block.BlockState.getMaterialData方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockState.getMaterialData方法的具體用法?Java BlockState.getMaterialData怎麽用?Java BlockState.getMaterialData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.block.BlockState的用法示例。


在下文中一共展示了BlockState.getMaterialData方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: canRenew

import org.bukkit.block.BlockState; //導入方法依賴的package包/類
public boolean canRenew(BlockState original, BlockState current) {
    // Original block must be in the region and match the renewable filter
    if(!region.contains(original)) return false;
    BlockQuery originalQuery = new BlockQuery(original);
    if(!renewableBlocks.query(originalQuery).isAllowed()) return false;

    MaterialData originalMaterial = original.getMaterialData();
    MaterialData currentMaterial = current.getMaterialData();

    // If current material matches the original, block is already renewed
    if(originalMaterial.equals(currentMaterial)) return false;

    // If the original and current blocks are both shuffleable, block is already renewed
    if(shuffleableBlocks.query(originalQuery).isAllowed() && shuffleableBlocks.query(new BlockQuery(current)).isAllowed()) {
        return false;
    }

    // Otherwise, block is eligible to be renewed
    return true;
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:21,代碼來源:RenewableDefinition.java

示例2: isNew

import org.bukkit.block.BlockState; //導入方法依賴的package包/類
boolean isNew(BlockState currentState) {
    // If original block does not match renewable rule, block is new
    BlockVector pos = BlockUtils.position(currentState);
    if(!isOriginalRenewable(pos)) return true;

    // If original and current material are both shuffleable, block is new
    MaterialData currentMaterial = currentState.getMaterialData();
    if(isOriginalShuffleable(pos) && definition.shuffleableBlocks.query(new BlockQuery(currentState)).isAllowed()) return true;

    // If current material matches original, block is new
    if(currentMaterial.equals(snapshot().getOriginalMaterial(pos))) return true;

    // Otherwise, block is not new (can be renewed)
    return false;
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:16,代碼來源:Renewable.java

示例3: sampleShuffledMaterial

import org.bukkit.block.BlockState; //導入方法依賴的package包/類
MaterialData sampleShuffledMaterial(BlockVector pos) {
    Random random = match.getRandom();
    int range = SHUFFLE_SAMPLE_RANGE;
    int diameter = range * 2 + 1;
    for(int i = 0; i < SHUFFLE_SAMPLE_ITERATIONS; i++) {
        BlockState block = snapshot().getOriginalBlock(pos.getBlockX() + random.nextInt(diameter) - range,
                                                       pos.getBlockY() + random.nextInt(diameter) - range,
                                                       pos.getBlockZ() + random.nextInt(diameter) - range);
        if(definition.shuffleableBlocks.query(new BlockQuery(block)).isAllowed()) return block.getMaterialData();
    }
    return null;
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:13,代碼來源:Renewable.java

示例4: BlockInfo

import org.bukkit.block.BlockState; //導入方法依賴的package包/類
public BlockInfo(BlockState block, @Nullable ParticipantState owner) {
    this(block.getMaterialData(), owner);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:4,代碼來源:BlockInfo.java

示例5: format

import org.bukkit.block.BlockState; //導入方法依賴的package包/類
public static String format(BlockState state) {
    return "BlockState{pos=(" + state.getX() + ", " + state.getY() + ", " + state.getZ() +
           ") material=" + state.getMaterialData() + "}";
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:5,代碼來源:BlockStateUtils.java


注:本文中的org.bukkit.block.BlockState.getMaterialData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。