本文整理汇总了Java中net.minecraft.block.BlockJukebox类的典型用法代码示例。如果您正苦于以下问题:Java BlockJukebox类的具体用法?Java BlockJukebox怎么用?Java BlockJukebox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BlockJukebox类属于net.minecraft.block包,在下文中一共展示了BlockJukebox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemUse
import net.minecraft.block.BlockJukebox; //导入依赖的package包/类
/**
* Called when a Block is right-clicked with this Item
*/
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
if (iblockstate.getBlock() == Blocks.jukebox && !((Boolean)iblockstate.getValue(BlockJukebox.HAS_RECORD)).booleanValue())
{
if (worldIn.isRemote)
{
return true;
}
else
{
((BlockJukebox)Blocks.jukebox).insertRecord(worldIn, pos, iblockstate, stack);
worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1005, pos, Item.getIdFromItem(this));
--stack.stackSize;
playerIn.triggerAchievement(StatList.field_181740_X);
return true;
}
}
else
{
return false;
}
}
示例2: onItemUse
import net.minecraft.block.BlockJukebox; //导入依赖的package包/类
/**
* Called when a Block is right-clicked with this Item
*/
public EnumActionResult onItemUse(EntityPlayer stack, World playerIn, BlockPos worldIn, EnumHand pos, EnumFacing hand, float facing, float hitX, float hitY)
{
IBlockState iblockstate = playerIn.getBlockState(worldIn);
if (iblockstate.getBlock() == Blocks.JUKEBOX && !((Boolean)iblockstate.getValue(BlockJukebox.HAS_RECORD)).booleanValue())
{
if (!playerIn.isRemote)
{
ItemStack itemstack = stack.getHeldItem(pos);
((BlockJukebox)Blocks.JUKEBOX).insertRecord(playerIn, worldIn, iblockstate, itemstack);
playerIn.playEvent((EntityPlayer)null, 1010, worldIn, Item.getIdFromItem(this));
itemstack.func_190918_g(1);
stack.addStat(StatList.RECORD_PLAYED);
}
return EnumActionResult.SUCCESS;
}
else
{
return EnumActionResult.PASS;
}
}
示例3: onItemUse
import net.minecraft.block.BlockJukebox; //导入依赖的package包/类
/**
* Called when a Block is right-clicked with this Item
*/
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
if (iblockstate.getBlock() == Blocks.JUKEBOX && !((Boolean)iblockstate.getValue(BlockJukebox.HAS_RECORD)).booleanValue())
{
if (!worldIn.isRemote)
{
((BlockJukebox)Blocks.JUKEBOX).insertRecord(worldIn, pos, iblockstate, stack);
worldIn.playEvent((EntityPlayer)null, 1010, pos, Item.getIdFromItem(this));
--stack.stackSize;
playerIn.addStat(StatList.RECORD_PLAYED);
}
return EnumActionResult.SUCCESS;
}
else
{
return EnumActionResult.PASS;
}
}
示例4: onItemUse
import net.minecraft.block.BlockJukebox; //导入依赖的package包/类
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10)
{
//TODO: world.getBlock()
if (world.getBlock(x, y, z) == Blocks.jukebox && world.getBlockMetadata(x, y, z) == 0)
{
if (world.isRemote)
return true;
else
{
//TODO: .insertRecord()
((BlockJukebox)Blocks.jukebox).func_149926_b(world, x, y, z, itemStack);
//TODO: Item.getIdFromItem()
world.playAuxSFXAtEntity((EntityPlayer)null, 1005, x, y, z, Item.getIdFromItem(this));
--itemStack.stackSize;
return true;
}
}
else
return false;
}
示例5: onItemUse
import net.minecraft.block.BlockJukebox; //导入依赖的package包/类
/**
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS
*/
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (par3World.getBlock(par4, par5, par6) == Blocks.jukebox && par3World.getBlockMetadata(par4, par5, par6) == 0)
{
if (par3World.isClient)
{
return true;
}
else
{
((BlockJukebox)Blocks.jukebox).func_149926_b(par3World, par4, par5, par6, par1ItemStack);
par3World.playAuxSFXAtEntity((EntityPlayer)null, 1005, par4, par5, par6, Item.getIdFromItem(this));
--par1ItemStack.stackSize;
return true;
}
}
else
{
return false;
}
}
示例6: onItemUse
import net.minecraft.block.BlockJukebox; //导入依赖的package包/类
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
{
if (p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_) == Blocks.jukebox && p_77648_3_.getBlockMetadata(p_77648_4_, p_77648_5_, p_77648_6_) == 0)
{
if (p_77648_3_.isRemote)
{
return true;
}
else
{
((BlockJukebox)Blocks.jukebox).func_149926_b(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, p_77648_1_);
p_77648_3_.playAuxSFXAtEntity((EntityPlayer)null, 1005, p_77648_4_, p_77648_5_, p_77648_6_, Item.getIdFromItem(this));
--p_77648_1_.stackSize;
return true;
}
}
else
{
return false;
}
}
示例7: onDrawBlockHighlight
import net.minecraft.block.BlockJukebox; //导入依赖的package包/类
@SubscribeEvent
public void onDrawBlockHighlight(DrawBlockHighlightEvent event) {
int x = event.target.blockX;
int y = event.target.blockY;
int z = event.target.blockZ;
World world = event.player.worldObj;
if (world != null) {
Block block = world.getBlock(x, y, z);
if (block == Blocks.jukebox) {
TileEntity te = world.getTileEntity(x, y, z);
if (te instanceof BlockJukebox.TileEntityJukebox) {
//BlockJukebox.TileEntityJukebox jb = (BlockJukebox.TileEntityJukebox) te;
Physis.logger.info("test");
}
}
}
}
示例8: onItemUse
import net.minecraft.block.BlockJukebox; //导入依赖的package包/类
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10)
{
if (world.getBlock(x, y, z) == Blocks.jukebox && world.getBlockMetadata(x, y, z) == 0)
{
if (world.isRemote)
return true;
else
{
((BlockJukebox)Blocks.jukebox).func_149926_b(world, x, y, z, itemStack);
world.playAuxSFXAtEntity((EntityPlayer)null, 1005, x, y, z, Item.getIdFromItem(this));
--itemStack.stackSize;
return true;
}
}
else
return false;
}
示例9: onItemUse
import net.minecraft.block.BlockJukebox; //导入依赖的package包/类
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player,
World world, int x, int y, int z,
int par7, float par8, float par9, float par10) {
if (world.getBlock(x, y, z) == Blocks.jukebox && world.getBlockMetadata(x, y, z) == 0) {
if (world.isRemote) {
return true;
} else {
//TODO: .insertRecord()
((BlockJukebox) Blocks.jukebox).func_149926_b(world, x, y, z, stack);
world.playAuxSFXAtEntity(null, 1005, x, y, z, Item.getIdFromItem(this));
--stack.stackSize;
return true;
}
} else {
return false;
}
}
示例10: onItemUse
import net.minecraft.block.BlockJukebox; //导入依赖的package包/类
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
if (iblockstate.getBlock() == Blocks.JUKEBOX && !((Boolean)iblockstate.getValue(BlockJukebox.HAS_RECORD)).booleanValue())
{
if (!worldIn.isRemote)
{
ItemStack itemstack = player.getHeldItem(hand);
((BlockJukebox)Blocks.JUKEBOX).insertRecord(worldIn, pos, iblockstate, itemstack);
worldIn.playEvent((EntityPlayer)null, 1010, pos, Item.getIdFromItem(this));
itemstack.shrink(1);
player.addStat(StatList.RECORD_PLAYED);
}
return EnumActionResult.SUCCESS;
}
else
{
return EnumActionResult.PASS;
}
}
示例11: onItemUse
import net.minecraft.block.BlockJukebox; //导入依赖的package包/类
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (par3World.getBlockId(par4, par5, par6) == Block.jukebox.blockID && par3World.getBlockMetadata(par4, par5, par6) == 0 && !mod_Rediscovered.Calm4MusicDisk)
{
if (par3World.isRemote)
{
return true;
}
else
{
((BlockJukeBox)Block.jukebox).insertRecord(par3World, par4, par5, par6, par1ItemStack);
// par3World.playAuxSFXAtEntity((EntityPlayer)null, 1005, par4, par5, par6, this.itemID);
// par3World.playSoundAtEntity(par2EntityPlayer, mod_Rediscovered.modid + ":calm", 2.0F, 1.0F);
--par1ItemStack.stackSize;
return true;
}
}
else
{
return false;
}
}
示例12: onItemUse
import net.minecraft.block.BlockJukebox; //导入依赖的package包/类
/**
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS
*/
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (par3World.getBlockId(par4, par5, par6) == Block.jukebox.blockID && par3World.getBlockMetadata(par4, par5, par6) == 0)
{
if (par3World.isRemote)
{
return true;
}
else
{
((BlockJukeBox)Block.jukebox).insertRecord(par3World, par4, par5, par6, par1ItemStack);
par3World.playAuxSFXAtEntity((EntityPlayer)null, 1005, par4, par5, par6, this.itemID);
--par1ItemStack.stackSize;
return true;
}
}
else
{
return false;
}
}
示例13: onItemUse
import net.minecraft.block.BlockJukebox; //导入依赖的package包/类
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
IBlockState iblockstate = world.getBlockState(pos);
if (iblockstate.getBlock() == Blocks.JUKEBOX && !((Boolean)iblockstate.getValue(BlockJukebox.HAS_RECORD)).booleanValue()) {
if (!world.isRemote) {
((BlockJukebox)Blocks.JUKEBOX).insertRecord(world, pos, iblockstate, player.getActiveItemStack());
world.playEvent((EntityPlayer)null, 1010, pos, Item.getIdFromItem(this));
player.getActiveItemStack().setCount(player.getActiveItemStack().getCount()-1);
player.addStat(StatList.RECORD_PLAYED);
}
return EnumActionResult.SUCCESS;
}
else
return EnumActionResult.PASS;
}
示例14: func_77648_a
import net.minecraft.block.BlockJukebox; //导入依赖的package包/类
public boolean func_77648_a(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
if(p_77648_3_.func_72798_a(p_77648_4_, p_77648_5_, p_77648_6_) == Block.field_72032_aY.field_71990_ca && p_77648_3_.func_72805_g(p_77648_4_, p_77648_5_, p_77648_6_) == 0) {
if(p_77648_3_.field_72995_K) {
return true;
} else {
((BlockJukeBox)Block.field_72032_aY).func_85106_a(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, p_77648_1_);
p_77648_3_.func_72889_a((EntityPlayer)null, 1005, p_77648_4_, p_77648_5_, p_77648_6_, this.field_77779_bT);
--p_77648_1_.field_77994_a;
return true;
}
} else {
return false;
}
}
示例15: canHack
import net.minecraft.block.BlockJukebox; //导入依赖的package包/类
@Override
public boolean canHack(IBlockAccess world, BlockPos pos, EntityPlayer player) {
return world.getBlockState(pos).getValue(BlockJukebox.HAS_RECORD);
}