本文整理匯總了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;
}
示例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;
}
示例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;
}
示例4: BlockInfo
import org.bukkit.block.BlockState; //導入方法依賴的package包/類
public BlockInfo(BlockState block, @Nullable ParticipantState owner) {
this(block.getMaterialData(), owner);
}
示例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() + "}";
}