本文整理汇总了Java中net.minecraft.block.state.IBlockState.getCollisionBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:Java IBlockState.getCollisionBoundingBox方法的具体用法?Java IBlockState.getCollisionBoundingBox怎么用?Java IBlockState.getCollisionBoundingBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.state.IBlockState
的用法示例。
在下文中一共展示了IBlockState.getCollisionBoundingBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tryPlace
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
private boolean tryPlace(EntityPlayer player, ItemStack stack, World worldIn, BlockPos pos, int subtype)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
if (iblockstate.getBlock() == this.singleSlab)
{
int subtype1 = singleSlabCS.getSubtype(iblockstate);
if (subtype1 == subtype)
{
IBlockState stateDouble = this.makeState(subtype1);
AxisAlignedBB axisalignedbb = stateDouble == null ? Block.NULL_AABB : stateDouble.getCollisionBoundingBox(worldIn, pos);
if (stateDouble != null && axisalignedbb != Block.NULL_AABB && worldIn.checkNoEntityCollision(axisalignedbb.offset(pos)) && worldIn.setBlockState(pos, stateDouble, 11))
{
SoundType soundtype = stateDouble.getBlock().getSoundType(stateDouble, worldIn, pos, player);
worldIn.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
stack.shrink(1);
}
return true;
}
}
return false;
}
示例2: tryPlace
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
private boolean tryPlace(EntityPlayer player, ItemStack stack, World worldIn, BlockPos pos, Object itemSlabType)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
if (iblockstate.getBlock() == this.singleSlab)
{
Comparable<?> comparable = iblockstate.getValue(this.singleSlab.getVariantProperty());
if (comparable == itemSlabType)
{
IBlockState iblockstate1 = this.makeState(this.singleSlab.getVariantProperty(), comparable);
AxisAlignedBB axisalignedbb = iblockstate1.getCollisionBoundingBox(worldIn, pos);
if (axisalignedbb != Block.NULL_AABB && worldIn.checkNoEntityCollision(axisalignedbb.offset(pos)) && worldIn.setBlockState(pos, iblockstate1, 11))
{
SoundType soundtype = this.doubleSlab.getSoundType();
worldIn.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
stack.func_190918_g(1);
}
return true;
}
}
return false;
}
示例3: tryPlace
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
private boolean tryPlace(EntityPlayer player, ItemStack stack, World worldIn, BlockPos pos, Object itemSlabType)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
if (iblockstate.getBlock() == this.singleSlab)
{
Comparable<?> comparable = iblockstate.getValue(this.singleSlab.getVariantProperty());
if (comparable == itemSlabType)
{
IBlockState iblockstate1 = this.makeState(this.singleSlab.getVariantProperty(), comparable);
AxisAlignedBB axisalignedbb = iblockstate1.getCollisionBoundingBox(worldIn, pos);
if (axisalignedbb != Block.NULL_AABB && worldIn.checkNoEntityCollision(axisalignedbb.offset(pos)) && worldIn.setBlockState(pos, iblockstate1, 11))
{
SoundType soundtype = this.doubleSlab.getSoundType(iblockstate1, worldIn, pos, player);
worldIn.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
--stack.stackSize;
}
return true;
}
}
return false;
}
示例4: isValid
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public boolean isValid(World world, long pos) {
if (pos == -1L) {
return false;
}
BlockPos p = BlockPos.fromLong(pos);
IBlockState state = world.getBlockState(p);
Block block = state.getBlock();
if (Config.getBlocksBlocking().contains(block.getRegistryName())) {
// Special case for doors
if (block instanceof BlockDoor) {
return state.getValue(BlockDoor.OPEN);
}
if (block instanceof BlockTrapDoor) {
return state.getValue(BlockTrapDoor.OPEN);
}
return false;
}
if (Config.getBlocksNonBlocking().contains(block.getRegistryName())) {
return true;
}
if (block.isAir(state, world, p)) {
return true;
} else {
AxisAlignedBB box = state.getCollisionBoundingBox(world, p);
if (box == null) {
return true;
}
return !block.isOpaqueCube(state);
}
}
示例5: onItemUse
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
ItemStack itemstack = player.getHeldItem(hand);
if (!itemstack.isEmpty() && player.canPlayerEdit(pos.offset(facing), facing, itemstack))
{
int subtype = getMetadata(itemstack);
IBlockState currentState = worldIn.getBlockState(pos);
if (currentState.getBlock() == singleSlab)
{
int subtype1 = this.singleSlabCS.getSubtype(currentState);
net.minecraft.block.BlockSlab.EnumBlockHalf half = currentState.getValue(net.minecraft.block.BlockSlab.HALF);
if ((facing == EnumFacing.UP && half == net.minecraft.block.BlockSlab.EnumBlockHalf.BOTTOM || facing == EnumFacing.DOWN && half == net.minecraft.block.BlockSlab.EnumBlockHalf.TOP)
&& subtype1 == subtype)
{
IBlockState stateDouble = this.makeState(subtype1);
AxisAlignedBB axisalignedbb = stateDouble == null ? Block.NULL_AABB : stateDouble.getCollisionBoundingBox(worldIn, pos);
if (stateDouble != null && axisalignedbb != Block.NULL_AABB && worldIn.checkNoEntityCollision(axisalignedbb.offset(pos)) && worldIn.setBlockState(pos, stateDouble, 11))
{
SoundType soundtype = stateDouble.getBlock().getSoundType(stateDouble, worldIn, pos, player);
worldIn.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
itemstack.shrink(1);
}
return EnumActionResult.SUCCESS;
}
}
return this.tryPlace(player, itemstack, worldIn, pos.offset(facing), subtype) ? EnumActionResult.SUCCESS : super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ);
} else
{
return EnumActionResult.FAIL;
}
}
示例6: func_190876_a
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
private void func_190876_a(double p_190876_1_, double p_190876_3_, double p_190876_5_, double p_190876_7_, float p_190876_9_, int p_190876_10_)
{
BlockPos blockpos = new BlockPos(p_190876_1_, p_190876_7_, p_190876_3_);
boolean flag = false;
double d0 = 0.0D;
while (true)
{
if (!EntityEvoker.this.world.isBlockNormalCube(blockpos, true) && EntityEvoker.this.world.isBlockNormalCube(blockpos.down(), true))
{
if (!EntityEvoker.this.world.isAirBlock(blockpos))
{
IBlockState iblockstate = EntityEvoker.this.world.getBlockState(blockpos);
AxisAlignedBB axisalignedbb = iblockstate.getCollisionBoundingBox(EntityEvoker.this.world, blockpos);
if (axisalignedbb != null)
{
d0 = axisalignedbb.maxY;
}
}
flag = true;
break;
}
blockpos = blockpos.down();
if (blockpos.getY() < MathHelper.floor(p_190876_5_) - 1)
{
break;
}
}
if (flag)
{
EntityEvokerFangs entityevokerfangs = new EntityEvokerFangs(EntityEvoker.this.world, p_190876_1_, (double)blockpos.getY() + d0, p_190876_3_, p_190876_9_, p_190876_10_, EntityEvoker.this);
EntityEvoker.this.world.spawnEntityInWorld(entityevokerfangs);
}
}
示例7: onItemUse
import net.minecraft.block.state.IBlockState; //导入方法依赖的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)
{
ItemStack itemstack = stack.getHeldItem(pos);
if (!itemstack.func_190926_b() && stack.canPlayerEdit(worldIn.offset(hand), hand, itemstack))
{
Comparable<?> comparable = this.singleSlab.getTypeForItem(itemstack);
IBlockState iblockstate = playerIn.getBlockState(worldIn);
if (iblockstate.getBlock() == this.singleSlab)
{
IProperty<?> iproperty = this.singleSlab.getVariantProperty();
Comparable<?> comparable1 = iblockstate.getValue(iproperty);
BlockSlab.EnumBlockHalf blockslab$enumblockhalf = (BlockSlab.EnumBlockHalf)iblockstate.getValue(BlockSlab.HALF);
if ((hand == EnumFacing.UP && blockslab$enumblockhalf == BlockSlab.EnumBlockHalf.BOTTOM || hand == EnumFacing.DOWN && blockslab$enumblockhalf == BlockSlab.EnumBlockHalf.TOP) && comparable1 == comparable)
{
IBlockState iblockstate1 = this.makeState(iproperty, comparable1);
AxisAlignedBB axisalignedbb = iblockstate1.getCollisionBoundingBox(playerIn, worldIn);
if (axisalignedbb != Block.NULL_AABB && playerIn.checkNoEntityCollision(axisalignedbb.offset(worldIn)) && playerIn.setBlockState(worldIn, iblockstate1, 11))
{
SoundType soundtype = this.doubleSlab.getSoundType();
playerIn.playSound(stack, worldIn, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
itemstack.func_190918_g(1);
}
return EnumActionResult.SUCCESS;
}
}
return this.tryPlace(stack, itemstack, playerIn, worldIn.offset(hand), comparable) ? EnumActionResult.SUCCESS : super.onItemUse(stack, playerIn, worldIn, pos, hand, facing, hitX, hitY);
}
else
{
return EnumActionResult.FAIL;
}
}
示例8: addCollisionBoxToList
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
@Deprecated
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_)
{
// TODO: Client hook
// FIXME: This hook could be better with a decent event system
AxisAlignedBB blockBox = state.getCollisionBoundingBox(worldIn, pos);
for(Module aMod: Hacks.hackList)
{
blockBox = aMod.onAddCollisionBox(this, pos, blockBox);
}
addCollisionBoxToList(pos, entityBox, collidingBoxes, blockBox);
// End: Client
// addCollisionBoxToList(pos, entityBox, collidingBoxes, state.getCollisionBoundingBox(worldIn, pos));
}
示例9: onUpdate
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
@Override
public void onUpdate()
{
IBlockState stuck = world.getBlockState(this.stuckPos);
if(stuck.getCollisionBoundingBox(world, stuckPos) == Block.NULL_AABB)
{
this.inTerrain = false;
}
if(!inTerrain)
{
super.onUpdate();
}
}
示例10: onItemUse
import net.minecraft.block.state.IBlockState; //导入方法依赖的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)
{
if (stack.stackSize != 0 && playerIn.canPlayerEdit(pos.offset(facing), facing, stack))
{
Comparable<?> comparable = this.singleSlab.getTypeForItem(stack);
IBlockState iblockstate = worldIn.getBlockState(pos);
if (iblockstate.getBlock() == this.singleSlab)
{
IProperty<?> iproperty = this.singleSlab.getVariantProperty();
Comparable<?> comparable1 = iblockstate.getValue(iproperty);
BlockSlab.EnumBlockHalf blockslab$enumblockhalf = (BlockSlab.EnumBlockHalf)iblockstate.getValue(BlockSlab.HALF);
if ((facing == EnumFacing.UP && blockslab$enumblockhalf == BlockSlab.EnumBlockHalf.BOTTOM || facing == EnumFacing.DOWN && blockslab$enumblockhalf == BlockSlab.EnumBlockHalf.TOP) && comparable1 == comparable)
{
IBlockState iblockstate1 = this.makeState(iproperty, comparable1);
AxisAlignedBB axisalignedbb = iblockstate1.getCollisionBoundingBox(worldIn, pos);
if (axisalignedbb != Block.NULL_AABB && worldIn.checkNoEntityCollision(axisalignedbb.offset(pos)) && worldIn.setBlockState(pos, iblockstate1, 11))
{
SoundType soundtype = this.doubleSlab.getSoundType(iblockstate1, worldIn, pos,playerIn);
worldIn.playSound(playerIn, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
--stack.stackSize;
}
return EnumActionResult.SUCCESS;
}
}
return this.tryPlace(playerIn, stack, worldIn, pos.offset(facing), comparable) ? EnumActionResult.SUCCESS : super.onItemUse(stack, playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
}
else
{
return EnumActionResult.FAIL;
}
}
示例11: getCollisionBoundingBox
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
@Nullable
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
IBlockState camo = getCamoState(worldIn, pos);
return camo != null ? camo.getCollisionBoundingBox(worldIn, pos) : super.getCollisionBoundingBox(blockState, worldIn, pos);
}
示例12: onItemUse
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
ItemStack itemstack = player.getHeldItem(hand);
if (!itemstack.isEmpty() && player.canPlayerEdit(pos, facing, itemstack))
{
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
BlockPos blockpos = pos;
if ((facing != EnumFacing.UP || block != this.block) && !block.isReplaceable(worldIn, pos))
{
blockpos = pos.offset(facing);
iblockstate = worldIn.getBlockState(blockpos);
block = iblockstate.getBlock();
}
if (block == this.block)
{
int i = iblockstate.getValue(BlockSnow.LAYERS);
if (i < 8)
{
IBlockState iblockstate1 = iblockstate.withProperty(BlockSnow.LAYERS, i + 1);
AxisAlignedBB axisalignedbb = iblockstate1.getCollisionBoundingBox(worldIn, blockpos);
if (axisalignedbb != Block.NULL_AABB && worldIn.checkNoEntityCollision(axisalignedbb.offset(blockpos)) && worldIn.setBlockState(blockpos, iblockstate1, 10))
{
SoundType soundtype = this.block.getSoundType(iblockstate1, worldIn, pos, player);
worldIn.playSound(player, blockpos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
if (player instanceof EntityPlayerMP)
{
CriteriaTriggers.PLACED_BLOCK.trigger((EntityPlayerMP)player, pos, itemstack);
}
itemstack.shrink(1);
return EnumActionResult.SUCCESS;
}
}
}
return super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ);
}
else
{
return EnumActionResult.FAIL;
}
}
示例13: onItemUse
import net.minecraft.block.state.IBlockState; //导入方法依赖的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)
{
ItemStack itemstack = stack.getHeldItem(pos);
if (!itemstack.func_190926_b() && stack.canPlayerEdit(worldIn, hand, itemstack))
{
IBlockState iblockstate = playerIn.getBlockState(worldIn);
Block block = iblockstate.getBlock();
BlockPos blockpos = worldIn;
if ((hand != EnumFacing.UP || block != this.block) && !block.isReplaceable(playerIn, worldIn))
{
blockpos = worldIn.offset(hand);
iblockstate = playerIn.getBlockState(blockpos);
block = iblockstate.getBlock();
}
if (block == this.block)
{
int i = ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue();
if (i < 8)
{
IBlockState iblockstate1 = iblockstate.withProperty(BlockSnow.LAYERS, Integer.valueOf(i + 1));
AxisAlignedBB axisalignedbb = iblockstate1.getCollisionBoundingBox(playerIn, blockpos);
if (axisalignedbb != Block.NULL_AABB && playerIn.checkNoEntityCollision(axisalignedbb.offset(blockpos)) && playerIn.setBlockState(blockpos, iblockstate1, 10))
{
SoundType soundtype = this.block.getSoundType();
playerIn.playSound(stack, blockpos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
itemstack.func_190918_g(1);
return EnumActionResult.SUCCESS;
}
}
}
return super.onItemUse(stack, playerIn, worldIn, pos, hand, facing, hitX, hitY);
}
else
{
return EnumActionResult.FAIL;
}
}
示例14: didBlockChange
import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
protected boolean didBlockChange(World worldIn, BlockPos pos, IBlockState oldState, IBlockState newState)
{
AxisAlignedBB axisalignedbb = oldState.getCollisionBoundingBox(worldIn, pos);
AxisAlignedBB axisalignedbb1 = newState.getCollisionBoundingBox(worldIn, pos);
return axisalignedbb != axisalignedbb1 && (axisalignedbb == null || !axisalignedbb.equals(axisalignedbb1));
}
示例15: onItemUse
import net.minecraft.block.state.IBlockState; //导入方法依赖的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)
{
if (stack.stackSize != 0 && playerIn.canPlayerEdit(pos, facing, stack))
{
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
BlockPos blockpos = pos;
if ((facing != EnumFacing.UP || block != this.block) && !block.isReplaceable(worldIn, pos))
{
blockpos = pos.offset(facing);
iblockstate = worldIn.getBlockState(blockpos);
block = iblockstate.getBlock();
}
if (block == this.block)
{
int i = ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue();
if (i <= 7)
{
IBlockState iblockstate1 = iblockstate.withProperty(BlockSnow.LAYERS, Integer.valueOf(i + 1));
AxisAlignedBB axisalignedbb = iblockstate1.getCollisionBoundingBox(worldIn, blockpos);
if (axisalignedbb != Block.NULL_AABB && worldIn.checkNoEntityCollision(axisalignedbb.offset(blockpos)) && worldIn.setBlockState(blockpos, iblockstate1, 10))
{
SoundType soundtype = this.block.getSoundType(iblockstate1, worldIn, blockpos, playerIn);
worldIn.playSound(playerIn, blockpos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
--stack.stackSize;
return EnumActionResult.SUCCESS;
}
}
}
return super.onItemUse(stack, playerIn, worldIn, blockpos, hand, facing, hitX, hitY, hitZ);
}
else
{
return EnumActionResult.FAIL;
}
}