当前位置: 首页>>代码示例>>Java>>正文


Java CraftMagicNumbers.getBlock方法代码示例

本文整理汇总了Java中org.bukkit.craftbukkit.util.CraftMagicNumbers.getBlock方法的典型用法代码示例。如果您正苦于以下问题:Java CraftMagicNumbers.getBlock方法的具体用法?Java CraftMagicNumbers.getBlock怎么用?Java CraftMagicNumbers.getBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.craftbukkit.util.CraftMagicNumbers的用法示例。


在下文中一共展示了CraftMagicNumbers.getBlock方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendBlockChange

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
@Override
public void sendBlockChange(Location loc, int material, byte data) {
    if (getHandle().playerNetServerHandler == null) return;

    S23PacketBlockChange packet = new S23PacketBlockChange(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), ((CraftWorld) loc.getWorld()).getHandle());

    packet.field_148883_d = CraftMagicNumbers.getBlock(material);
    packet.field_148884_e = data;
    getHandle().playerNetServerHandler.sendPacket(packet);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:11,代码来源:CraftPlayer.java

示例2: canMineBlock

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的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

示例3: getBlockStates

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的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

示例4: isBurnable

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的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

示例5: sendBlockChange

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
@Override
public void sendBlockChange(Location loc, int material, byte data) {
    if (getHandle().playerConnection == null) return;

    PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), ((CraftWorld) loc.getWorld()).getHandle());

    packet.block = CraftMagicNumbers.getBlock(material);
    packet.data = data;
    getHandle().playerConnection.sendPacket(packet);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:11,代码来源:CraftPlayer.java

示例6: getNMSBlock

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
public net.minecraft.block.Block getNMSBlock() {
    return CraftMagicNumbers.getBlock(this); // TODO: UPDATE THIS
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:4,代码来源:CraftBlock.java

示例7: getBlockTranslationKey

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的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

示例8: getNMSBlock

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
private net.minecraft.block.Block getNMSBlock() {
    return CraftMagicNumbers.getBlock(this); // TODO: UPDATE THIS
}
 
开发者ID:CyberdyneCC,项目名称:ThermosRebased,代码行数:4,代码来源:CraftBlock.java

示例9: getNMSBlock

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
private net.minecraft.server.Block getNMSBlock() {
    return CraftMagicNumbers.getBlock(this); // TODO: UPDATE THIS
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:4,代码来源:CraftBlock.java

示例10: getNMSBlock

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
private static net.minecraft.server.Block getNMSBlock(int type) {
    return CraftMagicNumbers.getBlock(type);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:4,代码来源:CraftBlock.java


注:本文中的org.bukkit.craftbukkit.util.CraftMagicNumbers.getBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。