本文整理汇总了Java中net.minecraft.server.TileEntitySkull.getGameProfile方法的典型用法代码示例。如果您正苦于以下问题:Java TileEntitySkull.getGameProfile方法的具体用法?Java TileEntitySkull.getGameProfile怎么用?Java TileEntitySkull.getGameProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.server.TileEntitySkull
的用法示例。
在下文中一共展示了TileEntitySkull.getGameProfile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDrops
import net.minecraft.server.TileEntitySkull; //导入方法依赖的package包/类
public Collection<ItemStack> getDrops() {
List<ItemStack> drops = new ArrayList<ItemStack>();
net.minecraft.server.Block block = this.getNMSBlock();
if (block != Blocks.AIR) {
byte data = getData();
// based on nms.Block.dropNaturally
int count = block.getDropCount(0, chunk.getHandle().world.random);
for (int i = 0; i < count; ++i) {
Item item = block.getDropType(data, chunk.getHandle().world.random, 0);
if (item != null) {
// Skulls are special, their data is based on the tile entity
if (Blocks.SKULL == block) {
net.minecraft.server.ItemStack nmsStack = new net.minecraft.server.ItemStack(item, 1, block.getDropData(chunk.getHandle().world, x, y, z));
TileEntitySkull tileentityskull = (TileEntitySkull) chunk.getHandle().world.getTileEntity(x, y, z);
if (tileentityskull.getSkullType() == 3 && tileentityskull.getGameProfile() != null) {
nmsStack.setTag(new NBTTagCompound());
NBTTagCompound nbttagcompound = new NBTTagCompound();
GameProfileSerializer.serialize(nbttagcompound, tileentityskull.getGameProfile());
nmsStack.getTag().set("SkullOwner", nbttagcompound);
}
drops.add(CraftItemStack.asBukkitCopy(nmsStack));
// We don't want to drop cocoa blocks, we want to drop cocoa beans.
} else if (Blocks.COCOA == block) {
int dropAmount = (BlockCocoa.c(data) >= 2 ? 3 : 1);
for (int j = 0; j < dropAmount; ++j) {
drops.add(new ItemStack(Material.INK_SACK, 1, (short) 3));
}
} else {
drops.add(new ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), 1, (short) block.getDropData(data)));
}
}
}
}
return drops;
}
示例2: CraftSkull
import net.minecraft.server.TileEntitySkull; //导入方法依赖的package包/类
public CraftSkull(final Block block) {
super(block);
CraftWorld world = (CraftWorld) block.getWorld();
skull = (TileEntitySkull) world.getTileEntityAt(getX(), getY(), getZ());
profile = skull.getGameProfile();
skullType = getSkullType(skull.getSkullType());
rotation = (byte) skull.getRotation();
}
示例3: isSkullCached
import net.minecraft.server.TileEntitySkull; //导入方法依赖的package包/类
/**
* Test if a {@link Skull} has a cached skin. If this returns false, the skull will
* likely try to fetch its skin the next time it is loaded.
*/
public static boolean isSkullCached(Skull skull) {
TileEntitySkull nmsSkull = (TileEntitySkull) ((CraftWorld) skull.getWorld()).getTileEntityAt(skull.getX(), skull.getY(), skull.getZ());
return nmsSkull.getGameProfile() == null ||
nmsSkull.getGameProfile().getProperties().containsKey("textures");
}