本文整理汇总了Java中net.minecraft.block.state.IBlockState.isSideSolid方法的典型用法代码示例。如果您正苦于以下问题:Java IBlockState.isSideSolid方法的具体用法?Java IBlockState.isSideSolid怎么用?Java IBlockState.isSideSolid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.state.IBlockState
的用法示例。
在下文中一共展示了IBlockState.isSideSolid方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onNeighborBlockUpdate
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
@Override
public void onNeighborBlockUpdate() {
super.onNeighborBlockUpdate();
EnumFacing oldSideConnected = sideConnected;
sideConnected = EnumFacing.DOWN;
for (EnumFacing d : EnumFacing.VALUES) {
BlockPos neighborPos = getPos().offset(d);
IBlockState state = getWorld().getBlockState(neighborPos);
if (state.isSideSolid(getWorld(), neighborPos, d.getOpposite())) {
sideConnected = d;
break;
}
}
if (sideConnected != oldSideConnected) {
sendDescriptionPacket();
}
}
示例2: canPlaceOn
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
private boolean canPlaceOn (World world, BlockPos pos) {
IBlockState state = world.getBlockState(pos);
if (state.isSideSolid(world, pos, EnumFacing.UP))
return true;
return state.getBlock().canPlaceTorchOnTop(state, world, pos);
}
示例3: isNeighborHardConnection
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
private boolean isNeighborHardConnection (IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing facing) {
if (state.getMaterial().isOpaque() && state.isFullCube())
return true;
if (state.isSideSolid(world, pos, facing.getOpposite()))
return true;
if (facing == EnumFacing.DOWN) {
Block block = state.getBlock();
if (block instanceof BlockFence || block instanceof net.minecraft.block.BlockFence)
return true;
}
return false;
}
示例4: onValidSurface
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
/**
* checks to make sure painting can be placed there
*/
public boolean onValidSurface()
{
if (!this.worldObj.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty())
{
return false;
}
else
{
int i = Math.max(1, this.getWidthPixels() / 16);
int j = Math.max(1, this.getHeightPixels() / 16);
BlockPos blockpos = this.hangingPosition.offset(this.facingDirection.getOpposite());
EnumFacing enumfacing = this.facingDirection.rotateYCCW();
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int k = 0; k < i; ++k)
{
for (int l = 0; l < j; ++l)
{
int i1 = (i - 1) / -2;
int j1 = (j - 1) / -2;
blockpos$mutableblockpos.setPos(blockpos).move(enumfacing, k + i1).move(EnumFacing.UP, l + j1);
IBlockState iblockstate = this.worldObj.getBlockState(blockpos$mutableblockpos);
if (iblockstate.isSideSolid(this.worldObj, blockpos$mutableblockpos, this.facingDirection))
continue;
if (!iblockstate.getMaterial().isSolid() && !BlockRedstoneDiode.isDiode(iblockstate))
{
return false;
}
}
}
return this.worldObj.getEntitiesInAABBexcluding(this, this.getEntityBoundingBox(), IS_HANGING_ENTITY).isEmpty();
}
}
示例5: canPlaceTorchOnTop
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
/**
* Determines if a torch can be placed on the top surface of this block.
* Useful for creating your own block that torches can be on, such as fences.
*
* @param state The current state
* @param world The current world
* @param pos Block position in world
* @return True to allow the torch to be placed
*/
public boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPos pos)
{
if (state.isSideSolid(world, pos, EnumFacing.UP))
{
return true;
}
else
{
return this instanceof BlockFence || this == net.minecraft.init.Blocks.GLASS || this == net.minecraft.init.Blocks.COBBLESTONE_WALL || this == net.minecraft.init.Blocks.STAINED_GLASS;
}
}
示例6: canSustainPlant
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
/**
* Determines if this block can support the passed in plant, allowing it to be planted and grow.
* Some examples:
* Reeds check if its a reed, or if its sand/dirt/grass and adjacent to water
* Cacti checks if its a cacti, or if its sand
* Nether types check for soul sand
* Crops check for tilled soil
* Caves check if it's a solid surface
* Plains check if its grass or dirt
* Water check if its still water
*
* @param state The Current state
* @param world The current world
* @param pos Block position in world
* @param direction The direction relative to the given position the plant wants to be, typically its UP
* @param plantable The plant that wants to check
* @return True to allow the plant to be planted/stay.
*/
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable)
{
IBlockState plant = plantable.getPlant(world, pos.offset(direction));
net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));
if (plant.getBlock() == net.minecraft.init.Blocks.CACTUS)
{
return this == net.minecraft.init.Blocks.CACTUS || this == net.minecraft.init.Blocks.SAND;
}
if (plant.getBlock() == net.minecraft.init.Blocks.REEDS && this == net.minecraft.init.Blocks.REEDS)
{
return true;
}
if (plantable instanceof BlockBush && ((BlockBush)plantable).canSustainBush(state))
{
return true;
}
switch (plantType)
{
case Desert: return this == net.minecraft.init.Blocks.SAND || this == net.minecraft.init.Blocks.HARDENED_CLAY || this == net.minecraft.init.Blocks.STAINED_HARDENED_CLAY;
case Nether: return this == net.minecraft.init.Blocks.SOUL_SAND;
case Crop: return this == net.minecraft.init.Blocks.FARMLAND;
case Cave: return state.isSideSolid(world, pos, EnumFacing.UP);
case Plains: return this == net.minecraft.init.Blocks.GRASS || this == net.minecraft.init.Blocks.DIRT || this == net.minecraft.init.Blocks.FARMLAND;
case Water: return state.getMaterial() == Material.WATER && state.getValue(BlockLiquid.LEVEL) == 0;
case Beach:
boolean isBeach = this == net.minecraft.init.Blocks.GRASS || this == net.minecraft.init.Blocks.DIRT || this == net.minecraft.init.Blocks.SAND;
boolean hasWater = (world.getBlockState(pos.east()).getMaterial() == Material.WATER ||
world.getBlockState(pos.west()).getMaterial() == Material.WATER ||
world.getBlockState(pos.north()).getMaterial() == Material.WATER ||
world.getBlockState(pos.south()).getMaterial() == Material.WATER);
return isBeach && hasWater;
}
return false;
}
示例7: canPlaceOn
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
private boolean canPlaceOn(World worldIn, BlockPos pos)
{
IBlockState state = worldIn.getBlockState(pos);
if (state.isSideSolid(worldIn, pos, EnumFacing.UP))
{
return true;
}
else
{
return state.getBlock().canPlaceTorchOnTop(state, worldIn, pos);
}
}
示例8: isSideSolid
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
@Override
public boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side) {
// ensure levers etc. can be attached to the block even though it can possibly emit redstone
IBlockState camo = getCamoState(world, pos);
return camo == null ? super.isSideSolid(base_state, world, pos, side) : camo.isSideSolid(world, pos, side);
}
示例9: isOnGround
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
private boolean isOnGround(Entity entity) {
BlockPos down = entity.getPosition().down();
IBlockState state = world.getBlockState(down);
return state.isSideSolid(world, down, EnumFacing.UP);
}
示例10: canPaneConnectTo
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir)
{
BlockPos off = pos.offset(dir);
IBlockState state = world.getBlockState(off);
return canPaneConnectToBlock(state.getBlock()) || state.isSideSolid(world, off, dir.getOpposite());
}