else axis = state.getSelectedBoundingBox(world, pos);
@Override public @Nonnull AxisAlignedBB getSelectedBoundingBox(@Nonnull World worldIn, @Nonnull BlockPos pos1) { return state.getSelectedBoundingBox(worldIn, pos1); }
private static void addBlockToRenderList(World world, BlockPos pos) { AxisAlignedBB box = world.getBlockState(pos).getSelectedBoundingBox(world, pos).grow(0.02); box = box.offset(-playerX, -playerY, -playerZ); renderList.add(box); }
public default AxisAlignedBB getSelectedBoundingBox(IPartInfo part) { return part.getState().getSelectedBoundingBox(part.getPartWorld(), part.getPartPos()); }
RegionCache world = new RegionCache(origin, 20, Minecraft.getMinecraft().world); for (BlockPos pos : getCandidates()) { AxisAlignedBB bb = state.getSelectedBoundingBox(Minecraft.getMinecraft().world, pos); drawCulledBox(bb, world, pos);
@Override @SideOnly(Side.CLIENT) public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World world, BlockPos pos) { TileMimic tileMimic = (TileMimic) world.getTileEntity(pos); if (tileMimic != null && !tileMimic.getStackInSlot(0).isEmpty()) { Block mimicBlock = Block.getBlockFromItem(tileMimic.getStackInSlot(0).getItem()); if (mimicBlock == Blocks.AIR) { return FULL_BLOCK_AABB; } IBlockState mimicState = tileMimic.getReplacedState(); if (mimicBlock != this) { return mimicState.getSelectedBoundingBox(world, pos); } } return FULL_BLOCK_AABB; }
/** * Convenience method for renderVisualization */ @SideOnly(Side.CLIENT) public final void drawCubeOutline(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) { GlStateManager.pushMatrix(); GlStateManager.disableDepth(); GlStateManager.disableCull(); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.shadeModel(GL11.GL_SMOOTH); GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.color(1, 1, 1, 1); GlStateManager.disableTexture2D(); GlStateManager.enableColorMaterial(); int color = Color.HSBtoRGB(ClientTickHandler.getTicks() % 200 / 200F, 0.6F, 1F); Color colorRGB = new Color(color); GL11.glLineWidth(1f); GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 255); RenderUtils.renderBlockOutline(state.getSelectedBoundingBox(world, pos)); GlStateManager.disableBlend(); GlStateManager.enableDepth(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); GlStateManager.disableColorMaterial(); GlStateManager.enableDepth(); GlStateManager.popMatrix(); }
private boolean tryPlace(EntityPlayer player, ItemStack stack, World world, BlockPos pos) { IBlockState state = world.getBlockState(pos); if (state.getBlock() == this.singleSlab) { AxisAlignedBB collisionBounds = state.getSelectedBoundingBox(world, pos); if (collisionBounds != Block.NULL_AABB && world.checkNoEntityCollision(collisionBounds.offset(pos)) && world.setBlockState(pos, state, 11)) { SoundType soundtype = this.doubleSlab.getSoundType(); world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F); stack.shrink(1);; } return true; } return false; } }
public void drawSelectionBoxOriginal(EntityPlayer player, RayTraceResult movingObjectPositionIn, int execute, float partialTicks) { if (execute == 0 && movingObjectPositionIn.typeOfHit == RayTraceResult.Type.BLOCK) { GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.glLineWidth(2.0F); GlStateManager.disableTexture2D(); GlStateManager.depthMask(false); BlockPos blockpos = movingObjectPositionIn.getBlockPos(); IBlockState iblockstate = player.world.getBlockState(blockpos); if (iblockstate.getMaterial() != Material.AIR && player.world.getWorldBorder().contains(blockpos)) { double d0 = 0;// player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks; double d1 = 0;//player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks; double d2 = 0;//player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks; RenderGlobal.drawSelectionBoundingBox(iblockstate.getSelectedBoundingBox(player.world, blockpos).expand(0.0020000000949949026D, 0.0020000000949949026D, 0.0020000000949949026D).offset(-d0, -d1, -d2), 0.0F, 0.0F, 0.0F, 0.4F); } GlStateManager.depthMask(true); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); } }
public void drawSelectionBoxOriginal(EntityPlayer player, RayTraceResult movingObjectPositionIn, int execute, float partialTicks) { if (execute == 0 && movingObjectPositionIn.typeOfHit == RayTraceResult.Type.BLOCK) { GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.glLineWidth(2.0F); GlStateManager.disableTexture2D(); GlStateManager.depthMask(false); BlockPos blockpos = movingObjectPositionIn.getBlockPos(); IBlockState iblockstate = this.world.getBlockState(blockpos); if (iblockstate.getMaterial() != Material.AIR && this.world.getWorldBorder().contains(blockpos)) { double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks; double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks; double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks; drawSelectionBoundingBox(iblockstate.getSelectedBoundingBox(this.world, blockpos).grow(0.0020000000949949026D).offset(-d0, -d1, -d2), 0.0F, 0.0F, 0.0F, 0.4F); } GlStateManager.depthMask(true); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); } }
@Override public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); if (stack.getCount() != 0 && player.canPlayerEdit(pos.offset(facing), facing, stack)) { IBlockState state = world.getBlockState(pos); if (state.getBlock() == this.singleSlab) { AncientSlabBlock.EnumBlockHalf half = state.getValue(BlockSlab.HALF); if ((facing == EnumFacing.UP && half == BlockSlab.EnumBlockHalf.BOTTOM || facing == EnumFacing.DOWN && half == BlockSlab.EnumBlockHalf.TOP)) { AxisAlignedBB collisionBox = state.getSelectedBoundingBox(world, pos); IBlockState doubleSlabState = this.doubleSlab.getDefaultState(); if (collisionBox != Block.NULL_AABB && world.checkNoEntityCollision(collisionBox.offset(pos)) && world.setBlockState(pos, doubleSlabState, 11)) { SoundType sound = this.doubleSlab.getSoundType(); world.playSound(player, pos, sound.getPlaceSound(), SoundCategory.BLOCKS, (sound.getVolume() + 1.0F) / 2.0F, sound.getPitch() * 0.8F); stack.shrink(1); } return EnumActionResult.SUCCESS; } } return this.tryPlace(player, stack, world, pos.offset(facing)) ? EnumActionResult.SUCCESS : super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ); } else { return EnumActionResult.FAIL; } }
AxisAlignedBB toDraw; if (state.getBlock().equals(Blocks.AIR)) { toDraw = Blocks.DIRT.getDefaultState().getSelectedBoundingBox(player.world, pos); } else { toDraw = state.getSelectedBoundingBox(player.world, pos);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED)); AxisAlignedBB aabb = world.getBlockState(pos).getSelectedBoundingBox(world, pos); double ix = aabb.minX; double iy = aabb.minY;
double d4 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) event.getPartialTicks(); double d5 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) event.getPartialTicks(); AxisAlignedBB box = blockState.getSelectedBoundingBox(world, pos).grow(0.002D).offset(-d3, -d4, -d5); RenderGlobal.drawSelectionBoundingBox(box, 0.0F, 0.0F, 0.0F, 0.4F);