本文整理汇总了Java中org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial方法的典型用法代码示例。如果您正苦于以下问题:Java CraftMagicNumbers.getMaterial方法的具体用法?Java CraftMagicNumbers.getMaterial怎么用?Java CraftMagicNumbers.getMaterial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.craftbukkit.util.CraftMagicNumbers
的用法示例。
在下文中一共展示了CraftMagicNumbers.getMaterial方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPlayerBucketEvent
import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
private static PlayerEvent getPlayerBucketEvent(boolean isFilling, EntityHuman who, int clickedX, int clickedY, int clickedZ, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
Player player = (who == null) ? null : (Player) who.getBukkitEntity();
CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item);
Material bucket = CraftMagicNumbers.getMaterial(itemstack.getItem());
CraftWorld craftWorld = (CraftWorld) player.getWorld();
CraftServer craftServer = (CraftServer) player.getServer();
Block blockClicked = craftWorld.getBlockAt(clickedX, clickedY, clickedZ);
BlockFace blockFace = CraftBlock.notchToBlockFace(clickedFace);
PlayerEvent event = null;
if (isFilling) {
event = new PlayerBucketFillEvent(player, blockClicked, blockFace, bucket, itemInHand);
((PlayerBucketFillEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
} else {
event = new PlayerBucketEmptyEvent(player, blockClicked, blockFace, bucket, itemInHand);
((PlayerBucketEmptyEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
}
craftServer.getPluginManager().callEvent(event);
return event;
}
示例2: getPlayerBucketEvent
import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
private static PlayerEvent getPlayerBucketEvent(boolean isFilling, EntityHuman who, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
Player player = (who == null) ? null : (Player) who.getBukkitEntity();
CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item);
Material bucket = CraftMagicNumbers.getMaterial(itemstack.getItem());
CraftWorld craftWorld = (CraftWorld) player.getWorld();
CraftServer craftServer = (CraftServer) player.getServer();
Block blockClicked = craftWorld.getBlockAt(clickedX, clickedY, clickedZ);
BlockFace blockFace = CraftBlock.notchToBlockFace(clickedFace);
PlayerEvent event = null;
if (isFilling) {
event = new PlayerBucketFillEvent(player, blockClicked, blockFace, bucket, itemInHand);
((PlayerBucketFillEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
} else {
event = new PlayerBucketEmptyEvent(player, blockClicked, blockFace, bucket, itemInHand);
((PlayerBucketEmptyEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
}
craftServer.getPluginManager().callEvent(event);
return event;
}
示例3: getPlaying
import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
@Override
public Material getPlaying() {
ItemStack record = jukebox.func_145856_a();
if (record == null) {
return Material.AIR;
}
return CraftMagicNumbers.getMaterial(record.getItem());
}
示例4: asBukkitCopy
import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
/**
* Copies the NMS stack to return as a strictly-Bukkit stack
*/
public static ItemStack asBukkitCopy(net.minecraft.server.ItemStack original) {
if (original == null) {
return new ItemStack(Material.AIR);
}
ItemStack stack = new ItemStack(CraftMagicNumbers.getMaterial(original.getItem()), original.count, (short) original.getData());
if (hasItemMeta(original)) {
stack.setItemMeta(getItemMeta(original));
}
return stack;
}
示例5: getPlaying
import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
@Override
public Material getPlaying() {
ItemStack record = jukebox.getRecord();
if (record == null) {
return Material.AIR;
}
return CraftMagicNumbers.getMaterial(record.getItem());
}
示例6: asNewCraftStack
import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
public static CraftItemStack asNewCraftStack(net.minecraft.item.Item item, int amount) {
return new CraftItemStack(CraftMagicNumbers.getMaterial(item), amount, (short) 0, null);
}
示例7: materialByKey
import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
public static @Nullable Material materialByKey(String key) {
final Item item = Item.REGISTRY.get(new MinecraftKey(key));
return item == null ? null : CraftMagicNumbers.getMaterial(item);
}
示例8: callEntityChangeBlockEvent
import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
public static EntityChangeBlockEvent callEntityChangeBlockEvent(Entity entity, int x, int y, int z, net.minecraft.server.Block type, int data) {
Block block = entity.world.getWorld().getBlockAt(x, y, z);
Material material = CraftMagicNumbers.getMaterial(type);
return callEntityChangeBlockEvent(entity.getBukkitEntity(), block, material, data);
}
示例9: asNewCraftStack
import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
public static CraftItemStack asNewCraftStack(Item item, int amount) {
return new CraftItemStack(CraftMagicNumbers.getMaterial(item), amount, (short) 0, null);
}
示例10: getItemMeta
import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
public static ItemMeta getItemMeta(net.minecraft.server.ItemStack item) {
if (!hasItemMeta(item)) {
return CraftItemFactory.instance().getItemMeta(getType(item));
}
switch (getType(item)) {
case WRITTEN_BOOK:
return new CraftMetaBookSigned(item.getTag());
case BOOK_AND_QUILL:
return new CraftMetaBook(item.getTag());
case SKULL_ITEM:
return new CraftMetaSkull(item.getTag());
case LEATHER_HELMET:
case LEATHER_CHESTPLATE:
case LEATHER_LEGGINGS:
case LEATHER_BOOTS:
return new CraftMetaLeatherArmor(item.getTag());
case POTION:
return new CraftMetaPotion(item.getTag());
case MAP:
return new CraftMetaMap(item.getTag());
case FIREWORK:
return new CraftMetaFirework(item.getTag());
case FIREWORK_CHARGE:
return new CraftMetaCharge(item.getTag());
case ENCHANTED_BOOK:
return new CraftMetaEnchantedBook(item.getTag());
case BANNER:
return new CraftMetaBanner(item.getTag());
case FURNACE:
case CHEST:
case TRAPPED_CHEST:
case JUKEBOX:
case DISPENSER:
case DROPPER:
case SIGN:
case MOB_SPAWNER:
case NOTE_BLOCK:
case PISTON_BASE:
case BREWING_STAND_ITEM:
case ENCHANTMENT_TABLE:
case COMMAND:
case BEACON:
case DAYLIGHT_DETECTOR:
case DAYLIGHT_DETECTOR_INVERTED:
case HOPPER:
case REDSTONE_COMPARATOR:
case FLOWER_POT_ITEM:
return new CraftMetaBlockState(item.getTag(), CraftMagicNumbers.getMaterial(item.getItem()));
default:
return new CraftMetaItem(item.getTag());
}
}