本文整理汇总了Java中net.minecraft.block.state.IBlockState.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java IBlockState.getValue方法的具体用法?Java IBlockState.getValue怎么用?Java IBlockState.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.state.IBlockState
的用法示例。
在下文中一共展示了IBlockState.getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMetaFromState
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
@SuppressWarnings("incomplete-switch")
/**
* Convert the BlockState into the correct metadata value
*/
public int getMetaFromState(IBlockState state)
{
int i = 0;
i = i | ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4;
switch ((BlockLog.EnumAxis)state.getValue(LOG_AXIS))
{
case X:
i |= 4;
break;
case Z:
i |= 8;
break;
case NONE:
i |= 12;
}
return i;
}
示例2: setBlockBoundsBasedOnState
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
{
if (this.isDouble())
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
else
{
IBlockState iblockstate = worldIn.getBlockState(pos);
if (iblockstate.getBlock() == this)
{
if (iblockstate.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP)
{
this.setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
}
else
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
}
}
}
}
示例3: canPlaceBlockOnSide
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack)
{
BlockPos blockpos = pos;
IProperty iproperty = this.singleSlab.getVariantProperty();
Object object = this.singleSlab.getVariant(stack);
IBlockState iblockstate = worldIn.getBlockState(pos);
if (iblockstate.getBlock() == this.singleSlab)
{
boolean flag = iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP;
if ((side == EnumFacing.UP && !flag || side == EnumFacing.DOWN && flag) && object == iblockstate.getValue(iproperty))
{
return true;
}
}
pos = pos.offset(side);
IBlockState iblockstate1 = worldIn.getBlockState(pos);
return iblockstate1.getBlock() == this.singleSlab && object == iblockstate1.getValue(iproperty) ? true : super.canPlaceBlockOnSide(worldIn, blockpos, side, player, stack);
}
示例4: rotateBlock
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
{
IBlockState state = world.getBlockState(pos);
for (IProperty prop : state.getProperties().keySet())
{
if (prop.getName().equals("variant") && prop.getValueClass() == EnumType.class)
{
EnumType current = (EnumType)state.getValue(prop);
EnumType next = current == EnumType.LINES_X ? EnumType.LINES_Y :
current == EnumType.LINES_Y ? EnumType.LINES_Z :
current == EnumType.LINES_Z ? EnumType.LINES_X : current;
if (next == current)
return false;
world.setBlockState(pos, state.withProperty(prop, next));
return true;
}
}
return false;
}
示例5: onNeighborBlockChange
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
/**
* Called when a neighboring block changes.
*/
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
BlockPos blockpos = pos.offset(enumfacing.getOpposite());
IBlockState iblockstate = worldIn.getBlockState(blockpos);
if (iblockstate.getBlock() != Blocks.piston && iblockstate.getBlock() != Blocks.sticky_piston)
{
worldIn.setBlockToAir(pos);
}
else
{
iblockstate.getBlock().onNeighborBlockChange(worldIn, blockpos, iblockstate, neighborBlock);
}
}
示例6: getMapColor
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
/**
* Get the MapColor for this Block and the given BlockState
*/
public MapColor getMapColor(IBlockState state)
{
switch ((BlockHugeMushroom.EnumType)state.getValue(VARIANT))
{
case ALL_STEM:
return MapColor.clothColor;
case ALL_INSIDE:
return MapColor.sandColor;
case STEM:
return MapColor.sandColor;
default:
return super.getMapColor(state);
}
}
示例7: getRenderColor
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public int getRenderColor(IBlockState state)
{
if (state.getBlock() != this)
{
return super.getRenderColor(state);
}
else
{
BlockPlanks.EnumType blockplanks$enumtype = (BlockPlanks.EnumType)state.getValue(VARIANT);
return blockplanks$enumtype == BlockPlanks.EnumType.SPRUCE ? ColorizerFoliage.getFoliageColorPine() : (blockplanks$enumtype == BlockPlanks.EnumType.BIRCH ? ColorizerFoliage.getFoliageColorBirch() : super.getRenderColor(state));
}
}
示例8: getMetaFromState
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
/**
* Convert the BlockState into the correct metadata value
*/
public int getMetaFromState(IBlockState state)
{
int i = 0;
i = i | ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata();
if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP)
{
i |= 8;
}
return i;
}
示例9: getActualState
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
/**
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
* metadata, such as fence connections.
*/
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
{
IBlockState iblockstate = worldIn.getBlockState(pos.down());
if (iblockstate.getBlock() == this)
{
state = state.withProperty(VARIANT, iblockstate.getValue(VARIANT));
}
}
return state;
}
示例10: isSameRailWithPower
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
protected boolean isSameRailWithPower(World worldIn, BlockPos pos, boolean p_176567_3_, int distance, BlockRailBase.EnumRailDirection p_176567_5_)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
if (iblockstate.getBlock() != this)
{
return false;
}
else
{
BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)iblockstate.getValue(SHAPE);
return p_176567_5_ != BlockRailBase.EnumRailDirection.EAST_WEST || blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.NORTH_SOUTH && blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.ASCENDING_NORTH && blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.ASCENDING_SOUTH ? (p_176567_5_ != BlockRailBase.EnumRailDirection.NORTH_SOUTH || blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.EAST_WEST && blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.ASCENDING_EAST && blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.ASCENDING_WEST ? (((Boolean)iblockstate.getValue(POWERED)).booleanValue() ? (worldIn.isBlockPowered(pos) ? true : this.findPoweredRailSignal(worldIn, pos, iblockstate, p_176567_3_, distance + 1)) : false) : false) : false;
}
}
示例11: update
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
@Override
public void update() {
this.energyStorage.tick();
IBlockState cur = world.getBlockState(pos);
EnumFacing facing = cur.getValue(BlockBattery.FACING);
IEnergyStorage target = RFTransport.getStorage(world, pos.offset(facing), facing.getOpposite());
if (target.canReceive()) {
int toPush = Math.min(energyStorage.getEnergyStored(), target.getMaxEnergyStored());
int received = target.receiveEnergy(toPush, false);
if (received>0) energyStorage.extractEnergy(received, false);
energyStorage.receiveEnergy(energyStorage.getMaxEnergyStored(), false);
}
}
示例12: canBlockStay
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
if (pos.getY() >= 0 && pos.getY() < 256)
{
IBlockState iblockstate = worldIn.getBlockState(pos.down());
return iblockstate.getBlock() == Blocks.MYCELIUM ? true : (iblockstate.getBlock() == Blocks.DIRT && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canSustainBush(iblockstate));
}
else
{
return false;
}
}
示例13: canBlockStay
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
{
return worldIn.getBlockState(pos.down()).getBlock() == this;
}
else
{
IBlockState iblockstate = worldIn.getBlockState(pos.up());
return iblockstate.getBlock() == this && super.canBlockStay(worldIn, pos, iblockstate);
}
}
示例14: canConnectRedstone
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
@Override
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
if (side == state.getValue(FACING) || side == state.getValue(FACING).getOpposite())
return false;
return true;
}
示例15: getUnpoweredState
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
protected IBlockState getUnpoweredState(IBlockState poweredState)
{
Integer integer = (Integer)poweredState.getValue(DELAY);
Boolean obool = (Boolean)poweredState.getValue(LOCKED);
EnumFacing enumfacing = (EnumFacing)poweredState.getValue(FACING);
return Blocks.unpowered_repeater.getDefaultState().withProperty(FACING, enumfacing).withProperty(DELAY, integer).withProperty(LOCKED, obool);
}