本文整理汇总了Java中net.minecraft.tileentity.TileEntitySkull.getSkullType方法的典型用法代码示例。如果您正苦于以下问题:Java TileEntitySkull.getSkullType方法的具体用法?Java TileEntitySkull.getSkullType怎么用?Java TileEntitySkull.getSkullType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.tileentity.TileEntitySkull
的用法示例。
在下文中一共展示了TileEntitySkull.getSkullType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBlockDropped
import net.minecraft.tileentity.TileEntitySkull; //导入方法依赖的package包/类
@Override
public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
{
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
if ((metadata & 8) == 0)
{
ItemStack itemstack = new ItemStack(Item.skull.itemID, 1, this.getDamageValue(world, x, y, z));
TileEntitySkull tileentityskull = (TileEntitySkull)world.getBlockTileEntity(x, y, z);
if (tileentityskull == null)
{
return drops;
}
if (tileentityskull.getSkullType() == 3 && tileentityskull.getExtraType() != null && tileentityskull.getExtraType().length() > 0)
{
itemstack.setTagCompound(new NBTTagCompound());
itemstack.getTagCompound().setString("SkullOwner", tileentityskull.getExtraType());
}
drops.add(itemstack);
}
return drops;
}
示例2: getBlockDropped
import net.minecraft.tileentity.TileEntitySkull; //导入方法依赖的package包/类
@Override
public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) {
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
if ((metadata & 8) == 0) {
ItemStack itemstack = new ItemStack(Item.skull.itemID, 1, this.getDamageValue(world, x, y, z));
TileEntitySkull tileentityskull = (TileEntitySkull) world.getBlockTileEntity(x, y, z);
if (tileentityskull == null)
return drops;
if (tileentityskull.getSkullType() == 3 && tileentityskull.getExtraType() != null && tileentityskull.getExtraType().length() > 0) {
itemstack.setTagCompound(new NBTTagCompound());
itemstack.getTagCompound().setString("SkullOwner", tileentityskull.getExtraType());
}
drops.add(itemstack);
}
return drops;
}
示例3: breakBlock
import net.minecraft.tileentity.TileEntitySkull; //导入方法依赖的package包/类
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
if (!worldIn.isRemote)
{
if (!((Boolean)state.getValue(NODROP)).booleanValue())
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntitySkull)
{
TileEntitySkull tileentityskull = (TileEntitySkull)tileentity;
ItemStack itemstack = new ItemStack(Items.skull, 1, this.getDamageValue(worldIn, pos));
if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null)
{
itemstack.setTagCompound(new NBTTagCompound());
NBTTagCompound nbttagcompound = new NBTTagCompound();
NBTUtil.writeGameProfile(nbttagcompound, tileentityskull.getPlayerProfile());
itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound);
}
spawnAsEntity(worldIn, pos, itemstack);
}
}
super.breakBlock(worldIn, pos, state);
}
}
示例4: breakBlock
import net.minecraft.tileentity.TileEntitySkull; //导入方法依赖的package包/类
/**
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
*/
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
if (!worldIn.isRemote)
{
if (!((Boolean)state.getValue(NODROP)).booleanValue())
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntitySkull)
{
TileEntitySkull tileentityskull = (TileEntitySkull)tileentity;
ItemStack itemstack = this.getItem(worldIn, pos, state);
if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null)
{
itemstack.setTagCompound(new NBTTagCompound());
NBTTagCompound nbttagcompound = new NBTTagCompound();
NBTUtil.writeGameProfile(nbttagcompound, tileentityskull.getPlayerProfile());
itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound);
}
spawnAsEntity(worldIn, pos, itemstack);
}
}
super.breakBlock(worldIn, pos, state);
}
}
示例5: getDrops
import net.minecraft.tileentity.TileEntitySkull; //导入方法依赖的package包/类
public java.util.List<ItemStack> getDrops(IBlockAccess worldIn, BlockPos pos, IBlockState state, int fortune)
{
java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
{
if (!((Boolean)state.getValue(NODROP)).booleanValue())
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntitySkull)
{
TileEntitySkull tileentityskull = (TileEntitySkull)tileentity;
ItemStack itemstack = new ItemStack(Items.SKULL, 1, tileentityskull.getSkullType());
if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null)
{
itemstack.setTagCompound(new NBTTagCompound());
NBTTagCompound nbttagcompound = new NBTTagCompound();
NBTUtil.writeGameProfile(nbttagcompound, tileentityskull.getPlayerProfile());
itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound);
}
ret.add(itemstack);
}
}
}
return ret;
}
示例6: getGain
import net.minecraft.tileentity.TileEntitySkull; //导入方法依赖的package包/类
private int getGain(BlockPos pos, boolean[] types) {
IBlockState blockState = getWorld().getBlockState(pos);
if (blockState.getBlock().equals(Blocks.SKULL)) {
if (types[0]) return 0;
types[0] = true;
TileEntitySkull tes = (TileEntitySkull) world.getTileEntity(pos);
switch (tes.getSkullType()) {
case 0:
case 2:
case 4:
return 1; //Zombie, Skeleton and creeper
case 1:
case 3:
return 2; //Wither skull and player skull
case 5:
return 4; //Ender dragon
default:
return 0;
}
} else if (blockState.getBlock().equals(Blocks.TORCH)) {
if (types[1]) return 0;
types[1] = true;
return 1;
} else if (blockState.getBlock().equals(Blocks.FLOWER_POT)) {
if (blockState.getBlock().hasTileEntity(blockState)) {
TileEntityFlowerPot tefp = (TileEntityFlowerPot) world.getTileEntity(pos);
if (!tefp.getFlowerItemStack().isEmpty()) {
if (types[2]) return 0;
types[2] = true;
return 1;
}
}
//TODO: Change the way gems are stored on an altar. Use a ritual plate. Pick them up via the oredict, to increase mod support.
} else if (blockState.getBlock().equals(Blocks.DIAMOND_BLOCK)) {
return 325;
} else if (blockState.getBlock().equals(Blocks.EMERALD_BLOCK)) {
return 275;
} else if (blockState.getBlock().equals(ModBlocks.moldavite_block)) {
return 225;
} else if (blockState.getBlock().equals(ModBlocks.alexandrite_block)) {
return 225;
} else if (blockState.getBlock().equals(ModBlocks.nuummite_block)) {
return 225;
} else if (blockState.getBlock().equals(ModBlocks.garnet_block)) {
return 225;
} else if (blockState.getBlock().equals(ModBlocks.amethyst_block)) {
return 225;
} else if (blockState.getBlock().equals(ModBlocks.tourmaline_block)) {
return 225;
} else if (blockState.getBlock().equals(ModBlocks.tigers_eye_block)) {
return 225;
} else if (blockState.getBlock().equals(ModBlocks.malachite_block)) {
return 225;
} else if (blockState.getBlock().equals(ModBlocks.bloodstone_block)) {
return 225;
} else if (blockState.getBlock().equals(ModBlocks.jasper_block)) {
return 225;
} else if (blockState.getBlock().equals(Blocks.LAPIS_BLOCK)) {
return 225;
} else if (blockState.getBlock().equals(Blocks.QUARTZ_BLOCK)) {
return 225;
} else if (blockState.getBlock().equals(Blocks.REDSTONE_BLOCK)) {
return 200;
} else if (blockState.getBlock() instanceof BlockCandle) {
if (types[1]) return 0;
types[1] = true;
return 2;
// } else if (blockState.getBlock().equals(ModBlocks.ritual_candle)) {
// if (types[1]) return 0;
// types[1]=true;
// return 2;
}
return 0;
}
示例7: getMultiplier
import net.minecraft.tileentity.TileEntitySkull; //导入方法依赖的package包/类
private double getMultiplier(BlockPos pos, boolean[] typesMult) {
IBlockState blockState = getWorld().getBlockState(pos);
if (blockState.getBlock().equals(Blocks.SKULL)) {
if (typesMult[0]) return 0;
typesMult[0] = true;
TileEntitySkull tes = (TileEntitySkull) world.getTileEntity(pos);
switch (tes.getSkullType()) {
case 0:
return 0.05; //Skeleton
case 1:
case 3:
return 0.3; //Wither skull and player skull
case 5:
return 0.8; //Ender dragon
default:
return 0;
}
} else if (blockState.getBlock().equals(Blocks.DIAMOND_BLOCK)) {
return 125;
} else if (blockState.getBlock().equals(Blocks.EMERALD_BLOCK)) {
return 100;
} else if (blockState.getBlock().equals(ModBlocks.moldavite_block)) {
return 75;
} else if (blockState.getBlock().equals(ModBlocks.alexandrite_block)) {
return 75;
} else if (blockState.getBlock().equals(ModBlocks.nuummite_block)) {
return 75;
} else if (blockState.getBlock().equals(ModBlocks.garnet_block)) {
return 75;
} else if (blockState.getBlock().equals(ModBlocks.amethyst_block)) {
return 75;
} else if (blockState.getBlock().equals(ModBlocks.tourmaline_block)) {
return 75;
} else if (blockState.getBlock().equals(ModBlocks.tigers_eye_block)) {
return 75;
} else if (blockState.getBlock().equals(ModBlocks.malachite_block)) {
return 75;
} else if (blockState.getBlock().equals(ModBlocks.bloodstone_block)) {
return 75;
} else if (blockState.getBlock().equals(ModBlocks.jasper_block)) {
return 75;
} else if (blockState.getBlock().equals(Blocks.LAPIS_BLOCK)) {
return 75;
} else if (blockState.getBlock().equals(Blocks.QUARTZ_BLOCK)) {
return 75;
} else if (blockState.getBlock().equals(Blocks.REDSTONE_BLOCK)) {
return 50;
} else if (blockState.getBlock().equals(ModBlocks.goblet)) {
if (typesMult[1])
return 0;
typesMult[1] = true;
if (blockState.getValue(BlockGoblet.FULL)) {
return 0.6;
} else {
return 0.3;
}
// } else if (blockState.getBlock().equals(ModBlocks.candle_plate)) {
// if (typesMult[2]) return 0;
// typesMult[2]=true;
// return 0.5;
}
return 0;
}
示例8: checkWitherSpawn
import net.minecraft.tileentity.TileEntitySkull; //导入方法依赖的package包/类
public void checkWitherSpawn(World worldIn, BlockPos pos, TileEntitySkull te)
{
if (te.getSkullType() == 1 && pos.getY() >= 2 && worldIn.getDifficulty() != EnumDifficulty.PEACEFUL && !worldIn.isRemote)
{
BlockPattern blockpattern = this.getWitherPattern();
BlockPattern.PatternHelper blockpattern$patternhelper = blockpattern.match(worldIn, pos);
if (blockpattern$patternhelper != null)
{
for (int i = 0; i < 3; ++i)
{
BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, 0, 0);
worldIn.setBlockState(blockworldstate.getPos(), blockworldstate.getBlockState().withProperty(NODROP, Boolean.valueOf(true)), 2);
}
for (int j = 0; j < blockpattern.getPalmLength(); ++j)
{
for (int k = 0; k < blockpattern.getThumbLength(); ++k)
{
BlockWorldState blockworldstate1 = blockpattern$patternhelper.translateOffset(j, k, 0);
worldIn.setBlockState(blockworldstate1.getPos(), Blocks.air.getDefaultState(), 2);
}
}
BlockPos blockpos = blockpattern$patternhelper.translateOffset(1, 0, 0).getPos();
EntityWither entitywither = new EntityWither(worldIn);
BlockPos blockpos1 = blockpattern$patternhelper.translateOffset(1, 2, 0).getPos();
entitywither.setLocationAndAngles((double)blockpos1.getX() + 0.5D, (double)blockpos1.getY() + 0.55D, (double)blockpos1.getZ() + 0.5D, blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X ? 0.0F : 90.0F, 0.0F);
entitywither.renderYawOffset = blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X ? 0.0F : 90.0F;
entitywither.func_82206_m();
for (EntityPlayer entityplayer : worldIn.getEntitiesWithinAABB(EntityPlayer.class, entitywither.getEntityBoundingBox().expand(50.0D, 50.0D, 50.0D)))
{
entityplayer.triggerAchievement(AchievementList.spawnWither);
}
worldIn.spawnEntityInWorld(entitywither);
for (int l = 0; l < 120; ++l)
{
worldIn.spawnParticle(EnumParticleTypes.SNOWBALL, (double)blockpos.getX() + worldIn.rand.nextDouble(), (double)(blockpos.getY() - 2) + worldIn.rand.nextDouble() * 3.9D, (double)blockpos.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
}
for (int i1 = 0; i1 < blockpattern.getPalmLength(); ++i1)
{
for (int j1 = 0; j1 < blockpattern.getThumbLength(); ++j1)
{
BlockWorldState blockworldstate2 = blockpattern$patternhelper.translateOffset(i1, j1, 0);
worldIn.notifyNeighborsRespectDebug(blockworldstate2.getPos(), Blocks.air);
}
}
}
}
}
示例9: checkWitherSpawn
import net.minecraft.tileentity.TileEntitySkull; //导入方法依赖的package包/类
public void checkWitherSpawn(World worldIn, BlockPos pos, TileEntitySkull te)
{
if (te.getSkullType() == 1 && pos.getY() >= 2 && worldIn.getDifficulty() != EnumDifficulty.PEACEFUL && !worldIn.isRemote)
{
BlockPattern blockpattern = this.getWitherPattern();
BlockPattern.PatternHelper blockpattern$patternhelper = blockpattern.match(worldIn, pos);
if (blockpattern$patternhelper != null)
{
for (int i = 0; i < 3; ++i)
{
BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, 0, 0);
worldIn.setBlockState(blockworldstate.getPos(), blockworldstate.getBlockState().withProperty(NODROP, Boolean.valueOf(true)), 2);
}
for (int j = 0; j < blockpattern.getPalmLength(); ++j)
{
for (int k = 0; k < blockpattern.getThumbLength(); ++k)
{
BlockWorldState blockworldstate1 = blockpattern$patternhelper.translateOffset(j, k, 0);
worldIn.setBlockState(blockworldstate1.getPos(), Blocks.AIR.getDefaultState(), 2);
}
}
BlockPos blockpos = blockpattern$patternhelper.translateOffset(1, 0, 0).getPos();
EntityWither entitywither = new EntityWither(worldIn);
BlockPos blockpos1 = blockpattern$patternhelper.translateOffset(1, 2, 0).getPos();
entitywither.setLocationAndAngles((double)blockpos1.getX() + 0.5D, (double)blockpos1.getY() + 0.55D, (double)blockpos1.getZ() + 0.5D, blockpattern$patternhelper.getForwards().getAxis() == EnumFacing.Axis.X ? 0.0F : 90.0F, 0.0F);
entitywither.renderYawOffset = blockpattern$patternhelper.getForwards().getAxis() == EnumFacing.Axis.X ? 0.0F : 90.0F;
entitywither.ignite();
for (EntityPlayer entityplayer : worldIn.getEntitiesWithinAABB(EntityPlayer.class, entitywither.getEntityBoundingBox().expandXyz(50.0D)))
{
entityplayer.addStat(AchievementList.SPAWN_WITHER);
}
worldIn.spawnEntityInWorld(entitywither);
for (int l = 0; l < 120; ++l)
{
worldIn.spawnParticle(EnumParticleTypes.SNOWBALL, (double)blockpos.getX() + worldIn.rand.nextDouble(), (double)(blockpos.getY() - 2) + worldIn.rand.nextDouble() * 3.9D, (double)blockpos.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
}
for (int i1 = 0; i1 < blockpattern.getPalmLength(); ++i1)
{
for (int j1 = 0; j1 < blockpattern.getThumbLength(); ++j1)
{
BlockWorldState blockworldstate2 = blockpattern$patternhelper.translateOffset(i1, j1, 0);
worldIn.notifyNeighborsRespectDebug(blockworldstate2.getPos(), Blocks.AIR, false);
}
}
}
}
}
示例10: checkWitherSpawn
import net.minecraft.tileentity.TileEntitySkull; //导入方法依赖的package包/类
public void checkWitherSpawn(World worldIn, BlockPos pos, TileEntitySkull te)
{
if (te.getSkullType() == 1 && pos.getY() >= 2 && worldIn.getDifficulty() != EnumDifficulty.PEACEFUL && !worldIn.isRemote)
{
BlockPattern blockpattern = this.getWitherPattern();
BlockPattern.PatternHelper blockpattern$patternhelper = blockpattern.match(worldIn, pos);
if (blockpattern$patternhelper != null)
{
for (int i = 0; i < 3; ++i)
{
BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, 0, 0);
worldIn.setBlockState(blockworldstate.getPos(), blockworldstate.getBlockState().withProperty(NODROP, Boolean.valueOf(true)), 2);
}
for (int j = 0; j < blockpattern.getPalmLength(); ++j)
{
for (int k = 0; k < blockpattern.getThumbLength(); ++k)
{
BlockWorldState blockworldstate1 = blockpattern$patternhelper.translateOffset(j, k, 0);
worldIn.setBlockState(blockworldstate1.getPos(), Blocks.AIR.getDefaultState(), 2);
}
}
BlockPos blockpos = blockpattern$patternhelper.translateOffset(1, 0, 0).getPos();
EntityWither entitywither = new EntityWither(worldIn);
BlockPos blockpos1 = blockpattern$patternhelper.translateOffset(1, 2, 0).getPos();
entitywither.setLocationAndAngles((double)blockpos1.getX() + 0.5D, (double)blockpos1.getY() + 0.55D, (double)blockpos1.getZ() + 0.5D, blockpattern$patternhelper.getForwards().getAxis() == EnumFacing.Axis.X ? 0.0F : 90.0F, 0.0F);
entitywither.renderYawOffset = blockpattern$patternhelper.getForwards().getAxis() == EnumFacing.Axis.X ? 0.0F : 90.0F;
entitywither.ignite();
for (EntityPlayer entityplayer : worldIn.getEntitiesWithinAABB(EntityPlayer.class, entitywither.getEntityBoundingBox().expandXyz(50.0D)))
{
entityplayer.addStat(AchievementList.SPAWN_WITHER);
}
worldIn.spawnEntityInWorld(entitywither);
for (int l = 0; l < 120; ++l)
{
worldIn.spawnParticle(EnumParticleTypes.SNOWBALL, (double)blockpos.getX() + worldIn.rand.nextDouble(), (double)(blockpos.getY() - 2) + worldIn.rand.nextDouble() * 3.9D, (double)blockpos.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
}
for (int i1 = 0; i1 < blockpattern.getPalmLength(); ++i1)
{
for (int j1 = 0; j1 < blockpattern.getThumbLength(); ++j1)
{
BlockWorldState blockworldstate2 = blockpattern$patternhelper.translateOffset(i1, j1, 0);
worldIn.notifyNeighborsRespectDebug(blockworldstate2.getPos(), Blocks.AIR);
}
}
}
}
}