本文整理汇总了Java中net.minecraft.block.state.IBlockState.cycleProperty方法的典型用法代码示例。如果您正苦于以下问题:Java IBlockState.cycleProperty方法的具体用法?Java IBlockState.cycleProperty怎么用?Java IBlockState.cycleProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.state.IBlockState
的用法示例。
在下文中一共展示了IBlockState.cycleProperty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBlockActivated
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (this.blockMaterial == Material.IRON)
{
return false; //Allow items to interact with the door
}
else
{
BlockPos blockpos = state.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down();
IBlockState iblockstate = pos.equals(blockpos) ? state : worldIn.getBlockState(blockpos);
if (iblockstate.getBlock() != this)
{
return false;
}
else
{
state = iblockstate.cycleProperty(OPEN);
worldIn.setBlockState(blockpos, state, 10);
worldIn.markBlockRangeForRenderUpdate(blockpos, pos);
worldIn.playEvent(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? this.getOpenSound() : this.getCloseSound(), pos, 0);
return true;
}
}
}
示例2: onBlockActivated
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (this.blockMaterial == Material.iron)
{
return true;
}
else
{
BlockPos blockpos = state.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down();
IBlockState iblockstate = pos.equals(blockpos) ? state : worldIn.getBlockState(blockpos);
if (iblockstate.getBlock() != this)
{
return false;
}
else
{
state = iblockstate.cycleProperty(OPEN);
worldIn.setBlockState(blockpos, state, 2);
worldIn.markBlockRangeForRenderUpdate(blockpos, pos);
worldIn.playAuxSFXAtEntity(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0);
return true;
}
}
}
示例3: onBlockActivated
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (worldIn.isRemote)
{
return true;
}
else
{
state = state.cycleProperty(POWERED);
worldIn.setBlockState(pos, state, 3);
worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, ((Boolean)state.getValue(POWERED)).booleanValue() ? 0.6F : 0.5F);
worldIn.notifyNeighborsOfStateChange(pos, this);
EnumFacing enumfacing = ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing();
worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing.getOpposite()), this);
return true;
}
}
示例4: onBlockActivated
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (!playerIn.capabilities.allowEdit)
{
return false;
}
else
{
state = state.cycleProperty(MODE);
float f = state.getValue(MODE) == BlockRedstoneComparator.Mode.SUBTRACT ? 0.55F : 0.5F;
worldIn.playSound(playerIn, pos, SoundEvents.BLOCK_COMPARATOR_CLICK, SoundCategory.BLOCKS, 0.3F, f);
worldIn.setBlockState(pos, state, 2);
this.onStateChange(worldIn, pos, state);
return true;
}
}
示例5: onBlockActivated
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY)
{
if (!playerIn.capabilities.allowEdit)
{
return false;
}
else
{
state = state.cycleProperty(MODE);
float f = state.getValue(MODE) == BlockRedstoneComparator.Mode.SUBTRACT ? 0.55F : 0.5F;
worldIn.playSound(playerIn, pos, SoundEvents.BLOCK_COMPARATOR_CLICK, SoundCategory.BLOCKS, 0.3F, f);
worldIn.setBlockState(pos, state, 2);
this.onStateChange(worldIn, pos, state);
return true;
}
}
示例6: onBlockActivated
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
BlockPos blockpos = state.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down();
IBlockState iblockstate = pos.equals(blockpos) ? state : worldIn.getBlockState(blockpos);
if (iblockstate.getBlock() != this) {
return false;
}
IBlockState checkstate = iblockstate.cycleProperty(OPEN);
worldIn.setBlockState(blockpos, checkstate, 10);
worldIn.markBlockRangeForRenderUpdate(blockpos, pos);
worldIn.playEvent(playerIn, checkstate.getValue(OPEN) ? 1012 : 1006, pos, 0);
return true;
}
示例7: onBlockActivated
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (!playerIn.capabilities.allowEdit)
{
return false;
}
else
{
state = state.cycleProperty(MODE);
worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, state.getValue(MODE) == BlockRedstoneComparator.Mode.SUBTRACT ? 0.55F : 0.5F);
worldIn.setBlockState(pos, state, 2);
this.onStateChange(worldIn, pos, state);
return true;
}
}
示例8: onBlockActivated
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (this.blockMaterial == Material.iron)
{
return true;
}
else
{
state = state.cycleProperty(OPEN);
worldIn.setBlockState(pos, state, 2);
worldIn.playAuxSFXAtEntity(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0);
return true;
}
}
示例9: onBlockActivated
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY)
{
if (this.blockMaterial == Material.IRON)
{
return false;
}
else
{
state = state.cycleProperty(OPEN);
worldIn.setBlockState(pos, state, 2);
this.playSound(playerIn, worldIn, pos, ((Boolean)state.getValue(OPEN)).booleanValue());
return true;
}
}
示例10: onBlockActivated
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
EnumFacing side, float hitX, float hitY, float hitZ) {
if (worldIn.isRemote) {
return true;
} else {
state = state.cycleProperty(POWERED);
worldIn.setBlockState(pos, state, 3);
worldIn.playSoundEffect((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D,
"random.click", 0.3F, ((Boolean) state.getValue(POWERED)).booleanValue() ? 0.6F : 0.5F);
worldIn.notifyNeighborsOfStateChange(pos, this);
EnumFacing enumfacing = ((BlockLever.EnumOrientation) state.getValue(FACING)).getFacing();
worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing.getOpposite()), this);
return true;
}
}