本文整理汇总了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);
}
示例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())));
}
示例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();
}
示例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());
}
}
示例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);
}
示例6: getNMSBlock
import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
public net.minecraft.block.Block getNMSBlock() {
return CraftMagicNumbers.getBlock(this); // TODO: UPDATE THIS
}
示例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);
}
示例8: getNMSBlock
import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
private net.minecraft.block.Block getNMSBlock() {
return CraftMagicNumbers.getBlock(this); // TODO: UPDATE THIS
}
示例9: getNMSBlock
import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
private net.minecraft.server.Block getNMSBlock() {
return CraftMagicNumbers.getBlock(this); // TODO: UPDATE THIS
}
示例10: getNMSBlock
import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
private static net.minecraft.server.Block getNMSBlock(int type) {
return CraftMagicNumbers.getBlock(type);
}