本文整理汇总了Java中net.minecraft.server.Block类的典型用法代码示例。如果您正苦于以下问题:Java Block类的具体用法?Java Block怎么用?Java Block使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Block类属于net.minecraft.server包,在下文中一共展示了Block类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getMaterialFromStatistic
import net.minecraft.server.Block; //导入依赖的package包/类
public static Material getMaterialFromStatistic(net.minecraft.server.Statistic statistic) {
String statisticString = statistic.name;
String val = statisticString.substring(statisticString.lastIndexOf(".") + 1);
Item item = (Item) Item.REGISTRY.get(new MinecraftKey(val));
if (item != null) {
return Material.getMaterial(Item.getId(item));
}
Block block = (Block) Block.REGISTRY.get(new MinecraftKey(val));
if (block != null) {
return Material.getMaterial(Block.getId(block));
}
try {
return Material.getMaterial(Integer.parseInt(val));
} catch (NumberFormatException e) {
return null;
}
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:18,代码来源:CraftStatistic.java
示例2: AntiXray
import net.minecraft.server.Block; //导入依赖的package包/类
public AntiXray(SpigotWorldConfig config)
{
// Set all listed blocks as true to be obfuscated
for ( int id : ( config.engineMode == 1 ) ? config.hiddenBlocks : config.replaceBlocks )
{
obfuscateBlocks[id] = true;
}
// For every block
TByteSet blocks = new TByteHashSet();
for ( Integer i : config.hiddenBlocks )
{
Block block = Block.getById( i );
// Check it exists and is not a tile entity
if ( block != null && !block.isTileEntity() )
{
// Add it to the set of replacement blocks
blocks.add( (byte) (int) i );
}
}
// Bake it to a flat array of replacements
replacementOres = blocks.toArray();
}
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:24,代码来源:AntiXray.java
示例3: canMineBlock
import net.minecraft.server.Block; //导入依赖的package包/类
/**
* Test if the given tool is capable of "efficiently" mining the given block.
*
* Derived from CraftBlock.itemCausesDrops()
*/
public static boolean canMineBlock(MaterialData blockMaterial, org.bukkit.inventory.ItemStack tool) {
if(!blockMaterial.getItemType().isBlock()) {
throw new IllegalArgumentException("Material '" + blockMaterial + "' is not a block");
}
net.minecraft.server.Block nmsBlock = CraftMagicNumbers.getBlock(blockMaterial.getItemType());
net.minecraft.server.Item nmsTool = tool == null ? null : CraftMagicNumbers.getItem(tool.getType());
return nmsBlock != null && (nmsBlock.getBlockData().getMaterial().isAlwaysDestroyable() ||
(nmsTool != null && nmsTool.canDestroySpecialBlock(nmsBlock.getBlockData())));
}
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:17,代码来源:NMSHacks.java
示例4: getBlockStates
import net.minecraft.server.Block; //导入依赖的package包/类
public static Set<MaterialData> getBlockStates(Material material) {
ImmutableSet.Builder<MaterialData> materials = ImmutableSet.builder();
Block nmsBlock = CraftMagicNumbers.getBlock(material);
List<IBlockData> states = nmsBlock.s().a();
if(states != null) {
for(IBlockData state : states) {
int data = nmsBlock.toLegacyData(state);
materials.add(material.getNewData((byte) data));
}
}
return materials.build();
}
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:13,代码来源:NMSHacks.java
示例5: isEmpty
import net.minecraft.server.Block; //导入依赖的package包/类
public boolean isEmpty(int x, int y, int z) {
for (BlockState state : blocks) {
if (state.getX() == x && state.getY() == y && state.getZ() == z) {
return Block.getById(state.getTypeId()) == Blocks.AIR;
}
}
return world.getBlockAt(x, y, z).isEmpty();
}
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:10,代码来源:StructureGrowDelegate.java
示例6: getBlock
import net.minecraft.server.Block; //导入依赖的package包/类
public static Block getBlock(Material material) {
// TODO: Don't use ID
Block block = Block.getById(material.getId());
if (block == null) {
return Blocks.AIR;
}
return block;
}
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:11,代码来源:CraftMagicNumbers.java
示例7: isBurnable
import net.minecraft.server.Block; //导入依赖的package包/类
@Test
public void isBurnable() {
if (material.isBlock()) {
Block block = CraftMagicNumbers.getBlock(material);
assertThat(material.isBurnable(), is(fireValues.containsKey(block) && fireValues.get(block) > 0));
} else {
assertFalse(material.isBurnable());
}
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:10,代码来源:PerMaterialTest.java
示例8: hasTransparentBlockAdjacent
import net.minecraft.server.Block; //导入依赖的package包/类
private static boolean hasTransparentBlockAdjacent(World world, int x, int y, int z, int radius)
{
return !Block.l( world.getTypeId( x, y, z ) ) /* isSolidBlock */
|| ( radius > 0
&& ( hasTransparentBlockAdjacent( world, x + 1, y, z, radius - 1 )
|| hasTransparentBlockAdjacent( world, x - 1, y, z, radius - 1 )
|| hasTransparentBlockAdjacent( world, x, y + 1, z, radius - 1 )
|| hasTransparentBlockAdjacent( world, x, y - 1, z, radius - 1 )
|| hasTransparentBlockAdjacent( world, x, y, z + 1, radius - 1 )
|| hasTransparentBlockAdjacent( world, x, y, z - 1, radius - 1 ) ) );
}
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:12,代码来源:AntiXray.java
示例9: isSolid
import net.minecraft.server.Block; //导入依赖的package包/类
@Test
public void isSolid() {
if (material == Material.AIR) {
assertFalse(material.isSolid());
} else if (material.isBlock()) {
assertThat(material.isSolid(), is(Block.byId[material.getId()].material.isSolid()));
} else {
assertFalse(material.isSolid());
}
}
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:11,代码来源:PerMaterialTest.java
示例10: isTransparent
import net.minecraft.server.Block; //导入依赖的package包/类
@Test
public void isTransparent() {
if (material == Material.AIR) {
assertTrue(material.isTransparent());
} else if (material.isBlock()) {
assertThat(material.isTransparent(), is(not(Block.byId[material.getId()].material.blocksLight())));
} else {
assertFalse(material.isTransparent());
}
}
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:11,代码来源:PerMaterialTest.java
示例11: isFlammable
import net.minecraft.server.Block; //导入依赖的package包/类
@Test
public void isFlammable() {
if (material != Material.AIR && material.isBlock()) {
assertThat(material.isFlammable(), is(Block.byId[material.getId()].material.isBurnable()));
} else {
assertFalse(material.isFlammable());
}
}
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:9,代码来源:PerMaterialTest.java
示例12: isOccluding
import net.minecraft.server.Block; //导入依赖的package包/类
@Test
public void isOccluding() {
if (material.isBlock()) {
assertThat(material.isOccluding(), is(Block.l(material.getId())));
} else {
assertFalse(material.isOccluding());
}
}
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:9,代码来源:PerMaterialTest.java
示例13: hasGravity
import net.minecraft.server.Block; //导入依赖的package包/类
@Test
public void hasGravity() {
if (material.isBlock()) {
assertThat(material.hasGravity(), is(Block.byId[material.getId()] instanceof BlockSand));
} else {
assertFalse(material.hasGravity());
}
}
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:9,代码来源:PerMaterialTest.java
示例14: updateNearbyBlocks
import net.minecraft.server.Block; //导入依赖的package包/类
private void updateNearbyBlocks(World world, int x, int y, int z, int radius, boolean updateSelf)
{
// If the block in question is loaded
if ( world.isLoaded( x, y, z ) )
{
// Get block id
Block block = world.getType(x, y, z);
// See if it needs update
if ( updateSelf && obfuscateBlocks[Block.getId( block )] )
{
// Send the update
world.notify( x, y, z );
}
// Check other blocks for updates
if ( radius > 0 )
{
updateNearbyBlocks( world, x + 1, y, z, radius - 1, true );
updateNearbyBlocks( world, x - 1, y, z, radius - 1, true );
updateNearbyBlocks( world, x, y + 1, z, radius - 1, true );
updateNearbyBlocks( world, x, y - 1, z, radius - 1, true );
updateNearbyBlocks( world, x, y, z + 1, radius - 1, true );
updateNearbyBlocks( world, x, y, z - 1, radius - 1, true );
}
}
}
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:28,代码来源:AntiXray.java
示例15: isSolidBlock
import net.minecraft.server.Block; //导入依赖的package包/类
private static boolean isSolidBlock(Block block) {
// Mob spawners are treated as solid blocks as far as the
// game is concerned for lighting and other tasks but for
// rendering they can be seen through therefor we special
// case them so that the antixray doesn't show the fake
// blocks around them.
return block.r() && block != Blocks.MOB_SPAWNER;
}
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:9,代码来源:AntiXray.java
示例16: getBlock
import net.minecraft.server.Block; //导入依赖的package包/类
public static Block getBlock(Material material) {
if (material == null) {
return null;
}
// TODO: Don't use ID
Block block = Block.getById(material.getId());
if (block == null) {
return Blocks.AIR;
}
return block;
}
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:14,代码来源:CraftMagicNumbers.java
示例17: getTranslationKey
import net.minecraft.server.Block; //导入依赖的package包/类
private static String getTranslationKey(Block nmsBlock) {
return nmsBlock.a() + ".name";
}
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:NMSHacks.java
示例18: getBlockTranslationKey
import net.minecraft.server.Block; //导入依赖的package包/类
private static @Nullable String getBlockTranslationKey(Material material) {
Block nmsBlock = CraftMagicNumbers.getBlock(material);
return nmsBlock == null ? null : getTranslationKey(nmsBlock);
}
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:5,代码来源:NMSHacks.java
示例19: setTypeAndData
import net.minecraft.server.Block; //导入依赖的package包/类
public void setTypeAndData(int x, int y, int z, Block block, int data, int light) {
BlockState state = world.getBlockAt(x, y, z).getState();
state.setTypeId(Block.getId(block));
state.setRawData((byte) data);
list.add(state);
}
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:7,代码来源:BlockStateListPopulator.java
示例20: setTypeUpdate
import net.minecraft.server.Block; //导入依赖的package包/类
public void setTypeUpdate(int x, int y, int z, Block block) {
this.setType(x, y, z, block);
}
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:4,代码来源:BlockStateListPopulator.java
注:本文中的net.minecraft.server.Block类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论