Java Code Examples for net.minecraft.init.Blocks.FLOWING_WATER

The following are Jave code examples for showing how to use FLOWING_WATER of the net.minecraft.init.Blocks class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: CustomWorldGen   File: BlockMagma.java   Source Code and License Vote up 6 votes
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    BlockPos blockpos = pos.up();
    IBlockState iblockstate = worldIn.getBlockState(blockpos);

    if (iblockstate.getBlock() == Blocks.WATER || iblockstate.getBlock() == Blocks.FLOWING_WATER)
    {
        worldIn.setBlockToAir(blockpos);
        worldIn.playSound((EntityPlayer)null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);

        if (worldIn instanceof WorldServer)
        {
            ((WorldServer)worldIn).spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.25D, (double)blockpos.getZ() + 0.5D, 8, 0.5D, 0.25D, 0.5D, 0.0D, new int[0]);
        }
    }
}
 
Example 2
Project: pnc-repressurized   File: HeatBehaviourLiquid.java   Source Code and License Vote up 5 votes
public Fluid getFluid() {
    Fluid fluid = FluidRegistry.lookupFluidForBlock(getBlockState().getBlock());
    if (fluid != null) return fluid;
    else if (getBlockState().getBlock() == Blocks.FLOWING_LAVA) return FluidRegistry.LAVA;
    else if (getBlockState().getBlock() == Blocks.FLOWING_WATER) return FluidRegistry.WATER;
    return null;
}
 
Example 3
Project: pnc-repressurized   File: HeatBehaviourLiquidTransition.java   Source Code and License Vote up 5 votes
protected void transformSourceBlock(Block turningBlockSource, Block turningBlockFlowing) {
    if (FluidUtils.isSourceBlock(getWorld(), getPos())) {
        getWorld().setBlockState(getPos(), turningBlockSource.getDefaultState());
    } else {
        Set<BlockPos> traversed = new HashSet<BlockPos>();
        Stack<BlockPos> pending = new Stack<BlockPos>();
        pending.push(getPos());
        traversed.add(getPos());
        while (!pending.isEmpty()) {
            BlockPos pos = pending.pop();
            for (EnumFacing d : EnumFacing.VALUES) {
                BlockPos newPos = pos.offset(d);
                Block checkingBlock = getWorld().getBlockState(newPos).getBlock();
                if ((checkingBlock == getBlockState().getBlock() || getBlockState().getBlock() == Blocks.FLOWING_WATER && checkingBlock == Blocks.WATER || getBlockState().getBlock() == Blocks.FLOWING_LAVA && checkingBlock == Blocks.LAVA) && traversed.add(newPos)) {
                    if (FluidUtils.isSourceBlock(getWorld(), newPos)) {
                        getWorld().setBlockState(newPos, turningBlockSource.getDefaultState());
                        onTransition(newPos);
                        return;
                    } else {
                        getWorld().setBlockState(newPos, turningBlockFlowing.getDefaultState());
                        onTransition(newPos);
                        pending.push(newPos);
                    }
                }
            }
        }
    }
}
 
Example 4
Project: Bewitchment   File: CropKelp.java   Source Code and License Vote up 5 votes
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
	BlockPos I = pos.add(-1, 0, -1);
	BlockPos F = pos.add(1, 1, 1);
	for (BlockPos blockPos : BlockPos.getAllInBox(I, F)) {
		Block block = worldIn.getBlockState(blockPos).getBlock();
		if (block != this && block != Blocks.WATER && block != Blocks.FLOWING_WATER) {
			checkAndDropBlock(worldIn, pos, state);
			break;
		}
	}
	if (!canBlockStay(worldIn, pos, state) || !canSustainBush(worldIn.getBlockState(pos.down()))) {
		checkAndDropBlock(worldIn, pos, state);
	}
}
 
Example 5
Project: Bewitchment   File: FrostbiteBrew.java   Source Code and License Vote up 5 votes
@Override
public void safeImpact(BlockPos pos, @Nullable EnumFacing side, World world, int amplifier) {
	int box = 1 + (int) ((float) amplifier / 2F);

	BlockPos posI = pos.add(box, box, box);
	BlockPos posF = pos.add(-box, -box, -box);

	Iterable<BlockPos> spots = BlockPos.getAllInBox(posI, posF);
	for (BlockPos spot : spots) {
		IBlockState state = world.getBlockState(spot);
		boolean place = amplifier > 2 || world.rand.nextBoolean();
		if (place && state.getBlock() == Blocks.WATER && world.isAirBlock(spot.up())) {
			world.setBlockState(spot, Blocks.ICE.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.ICE) {
			world.setBlockState(spot, Blocks.PACKED_ICE.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.SNOW_LAYER) {
			world.setBlockState(spot, Blocks.SNOW.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.SNOW) {
			world.setBlockState(spot, Blocks.PACKED_ICE.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.FROSTED_ICE) {
			world.setBlockState(spot, Blocks.ICE.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.LAVA) {
			world.setBlockState(spot, Blocks.OBSIDIAN.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.FLOWING_LAVA) {
			world.setBlockState(spot, Blocks.OBSIDIAN.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.FLOWING_WATER) {
			world.setBlockState(spot, Blocks.ICE.getDefaultState(), 3);
		}
	}
}
 
Example 6
Project: Backmemed   File: World.java   Source Code and License Vote up 5 votes
/**
 * Checks to see if a given block is both water and cold enough to freeze.
 */
public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj)
{
    Biome biome = this.getBiome(pos);
    float f = biome.getFloatTemperature(pos);

    if (f >= 0.15F)
    {
        return false;
    }
    else
    {
        if (pos.getY() >= 0 && pos.getY() < 256 && this.getLightFor(EnumSkyBlock.BLOCK, pos) < 10)
        {
            IBlockState iblockstate = this.getBlockState(pos);
            Block block = iblockstate.getBlock();

            if ((block == Blocks.WATER || block == Blocks.FLOWING_WATER) && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0)
            {
                if (!noWaterAdj)
                {
                    return true;
                }

                boolean flag = this.isWater(pos.west()) && this.isWater(pos.east()) && this.isWater(pos.north()) && this.isWater(pos.south());

                if (!flag)
                {
                    return true;
                }
            }
        }

        return false;
    }
}
 
Example 7
Project: Backmemed   File: BlockLiquid.java   Source Code and License Vote up 5 votes
public static BlockDynamicLiquid getFlowingBlock(Material materialIn)
{
    if (materialIn == Material.WATER)
    {
        return Blocks.FLOWING_WATER;
    }
    else if (materialIn == Material.LAVA)
    {
        return Blocks.FLOWING_LAVA;
    }
    else
    {
        throw new IllegalArgumentException("Invalid material");
    }
}
 
Example 8
Project: CustomWorldGen   File: PathNavigateGround.java   Source Code and License Vote up 5 votes
/**
 * Gets the safe pathing Y position for the entity depending on if it can path swim or not
 */
private int getPathablePosY()
{
    if (this.theEntity.isInWater() && this.getCanSwim())
    {
        int i = (int)this.theEntity.getEntityBoundingBox().minY;
        Block block = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.theEntity.posX), i, MathHelper.floor_double(this.theEntity.posZ))).getBlock();
        int j = 0;

        while (block == Blocks.FLOWING_WATER || block == Blocks.WATER)
        {
            ++i;
            block = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.theEntity.posX), i, MathHelper.floor_double(this.theEntity.posZ))).getBlock();
            ++j;

            if (j > 16)
            {
                return (int)this.theEntity.getEntityBoundingBox().minY;
            }
        }

        return i;
    }
    else
    {
        return (int)(this.theEntity.getEntityBoundingBox().minY + 0.5D);
    }
}
 
Example 9
Project: CustomWorldGen   File: World.java   Source Code and License Vote up 5 votes
public boolean canBlockFreezeBody(BlockPos pos, boolean noWaterAdj)
{
    Biome biome = this.getBiome(pos);
    float f = biome.getFloatTemperature(pos);

    if (f > 0.15F)
    {
        return false;
    }
    else
    {
        if (pos.getY() >= 0 && pos.getY() < 256 && this.getLightFor(EnumSkyBlock.BLOCK, pos) < 10)
        {
            IBlockState iblockstate = this.getBlockState(pos);
            Block block = iblockstate.getBlock();

            if ((block == Blocks.WATER || block == Blocks.FLOWING_WATER) && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0)
            {
                if (!noWaterAdj)
                {
                    return true;
                }

                boolean flag = this.isWater(pos.west()) && this.isWater(pos.east()) && this.isWater(pos.north()) && this.isWater(pos.south());

                if (!flag)
                {
                    return true;
                }
            }
        }

        return false;
    }
}
 
Example 10
Project: CustomWorldGen   File: BlockLiquid.java   Source Code and License Vote up 5 votes
public static BlockDynamicLiquid getFlowingBlock(Material materialIn)
{
    if (materialIn == Material.WATER)
    {
        return Blocks.FLOWING_WATER;
    }
    else if (materialIn == Material.LAVA)
    {
        return Blocks.FLOWING_LAVA;
    }
    else
    {
        throw new IllegalArgumentException("Invalid material");
    }
}
 
Example 11
Project: Backmemed   File: ItemBucket.java   Source Code and License Vote up 4 votes
public boolean tryPlaceContainedLiquid(@Nullable EntityPlayer player, World worldIn, BlockPos posIn)
{
    if (this.containedBlock == Blocks.AIR)
    {
        return false;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(posIn);
        Material material = iblockstate.getMaterial();
        boolean flag = !material.isSolid();
        boolean flag1 = iblockstate.getBlock().isReplaceable(worldIn, posIn);

        if (!worldIn.isAirBlock(posIn) && !flag && !flag1)
        {
            return false;
        }
        else
        {
            if (worldIn.provider.doesWaterVaporize() && this.containedBlock == Blocks.FLOWING_WATER)
            {
                int l = posIn.getX();
                int i = posIn.getY();
                int j = posIn.getZ();
                worldIn.playSound(player, posIn, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);

                for (int k = 0; k < 8; ++k)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double)l + Math.random(), (double)i + Math.random(), (double)j + Math.random(), 0.0D, 0.0D, 0.0D, new int[0]);
                }
            }
            else
            {
                if (!worldIn.isRemote && (flag || flag1) && !material.isLiquid())
                {
                    worldIn.destroyBlock(posIn, true);
                }

                SoundEvent soundevent = this.containedBlock == Blocks.FLOWING_LAVA ? SoundEvents.ITEM_BUCKET_EMPTY_LAVA : SoundEvents.ITEM_BUCKET_EMPTY;
                worldIn.playSound(player, posIn, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F);
                worldIn.setBlockState(posIn, this.containedBlock.getDefaultState(), 11);
            }

            return true;
        }
    }
}
 
Example 12
Project: ExPetrum   File: BlockFreshWater.java   Source Code and License Vote up 4 votes
@Override
public boolean isAssociatedBlock(Block other)
{
	return super.isAssociatedBlock(other) || other == Blocks.WATER || other == Blocks.FLOWING_WATER;
}
 
Example 13
Project: Backmemed   File: DebugRendererWater.java   Source Code and License Vote up 4 votes
public void render(float p_190060_1_, long p_190060_2_)
{
    this.player = this.minecraft.player;
    this.xo = this.player.lastTickPosX + (this.player.posX - this.player.lastTickPosX) * (double)p_190060_1_;
    this.yo = this.player.lastTickPosY + (this.player.posY - this.player.lastTickPosY) * (double)p_190060_1_;
    this.zo = this.player.lastTickPosZ + (this.player.posZ - this.player.lastTickPosZ) * (double)p_190060_1_;
    BlockPos blockpos = this.minecraft.player.getPosition();
    World world = this.minecraft.player.world;
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    GlStateManager.color(0.0F, 1.0F, 0.0F, 0.75F);
    GlStateManager.disableTexture2D();
    GlStateManager.glLineWidth(6.0F);

    for (BlockPos blockpos1 : BlockPos.getAllInBox(blockpos.add(-10, -10, -10), blockpos.add(10, 10, 10)))
    {
        IBlockState iblockstate = world.getBlockState(blockpos1);

        if (iblockstate.getBlock() == Blocks.WATER || iblockstate.getBlock() == Blocks.FLOWING_WATER)
        {
            double d0 = (double)BlockLiquid.func_190972_g(iblockstate, world, blockpos1);
            RenderGlobal.renderFilledBox((new AxisAlignedBB((double)((float)blockpos1.getX() + 0.01F), (double)((float)blockpos1.getY() + 0.01F), (double)((float)blockpos1.getZ() + 0.01F), (double)((float)blockpos1.getX() + 0.99F), d0, (double)((float)blockpos1.getZ() + 0.99F))).offset(-this.xo, -this.yo, -this.zo), 1.0F, 1.0F, 1.0F, 0.2F);
        }
    }

    for (BlockPos blockpos2 : BlockPos.getAllInBox(blockpos.add(-10, -10, -10), blockpos.add(10, 10, 10)))
    {
        IBlockState iblockstate1 = world.getBlockState(blockpos2);

        if (iblockstate1.getBlock() == Blocks.WATER || iblockstate1.getBlock() == Blocks.FLOWING_WATER)
        {
            Integer integer = (Integer)iblockstate1.getValue(BlockLiquid.LEVEL);
            double d1 = integer.intValue() > 7 ? 0.9D : 1.0D - 0.11D * (double)integer.intValue();
            String s = iblockstate1.getBlock() == Blocks.FLOWING_WATER ? "f" : "s";
            DebugRenderer.renderDebugText(s + " " + integer, (double)blockpos2.getX() + 0.5D, (double)blockpos2.getY() + d1, (double)blockpos2.getZ() + 0.5D, p_190060_1_, -16777216);
        }
    }

    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example 14
Project: Backmemed   File: GuiCreateFlatWorld.java   Source Code and License Vote up 4 votes
protected void drawSlot(int entryID, int insideLeft, int yPos, int insideSlotHeight, int mouseXIn, int mouseYIn)
{
    FlatLayerInfo flatlayerinfo = (FlatLayerInfo)GuiCreateFlatWorld.this.theFlatGeneratorInfo.getFlatLayers().get(GuiCreateFlatWorld.this.theFlatGeneratorInfo.getFlatLayers().size() - entryID - 1);
    IBlockState iblockstate = flatlayerinfo.getLayerMaterial();
    Block block = iblockstate.getBlock();
    Item item = Item.getItemFromBlock(block);

    if (item == Items.field_190931_a)
    {
        if (block != Blocks.WATER && block != Blocks.FLOWING_WATER)
        {
            if (block == Blocks.LAVA || block == Blocks.FLOWING_LAVA)
            {
                item = Items.LAVA_BUCKET;
            }
        }
        else
        {
            item = Items.WATER_BUCKET;
        }
    }

    ItemStack itemstack = new ItemStack(item, 1, item.getHasSubtypes() ? block.getMetaFromState(iblockstate) : 0);
    String s = item.getItemStackDisplayName(itemstack);
    this.drawItem(insideLeft, yPos, itemstack);
    GuiCreateFlatWorld.this.fontRendererObj.drawString(s, insideLeft + 18 + 5, yPos + 3, 16777215);
    String s1;

    if (entryID == 0)
    {
        s1 = I18n.format("createWorld.customize.flat.layer.top", new Object[] {Integer.valueOf(flatlayerinfo.getLayerCount())});
    }
    else if (entryID == GuiCreateFlatWorld.this.theFlatGeneratorInfo.getFlatLayers().size() - 1)
    {
        s1 = I18n.format("createWorld.customize.flat.layer.bottom", new Object[] {Integer.valueOf(flatlayerinfo.getLayerCount())});
    }
    else
    {
        s1 = I18n.format("createWorld.customize.flat.layer", new Object[] {Integer.valueOf(flatlayerinfo.getLayerCount())});
    }

    GuiCreateFlatWorld.this.fontRendererObj.drawString(s1, insideLeft + 2 + 213 - GuiCreateFlatWorld.this.fontRendererObj.getStringWidth(s1), yPos + 3, 16777215);
}
 
Example 15
Project: Backmemed   File: WalkNodeProcessor.java   Source Code and License Vote up 4 votes
public PathPoint getStart()
{
    int i;

    if (this.getCanSwim() && this.entity.isInWater())
    {
        i = (int)this.entity.getEntityBoundingBox().minY;
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor(this.entity.posX), i, MathHelper.floor(this.entity.posZ));

        for (Block block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock(); block == Blocks.FLOWING_WATER || block == Blocks.WATER; block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock())
        {
            ++i;
            blockpos$mutableblockpos.setPos(MathHelper.floor(this.entity.posX), i, MathHelper.floor(this.entity.posZ));
        }
    }
    else if (this.entity.onGround)
    {
        i = MathHelper.floor(this.entity.getEntityBoundingBox().minY + 0.5D);
    }
    else
    {
        BlockPos blockpos;

        for (blockpos = new BlockPos(this.entity); (this.blockaccess.getBlockState(blockpos).getMaterial() == Material.AIR || this.blockaccess.getBlockState(blockpos).getBlock().isPassable(this.blockaccess, blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down())
        {
            ;
        }

        i = blockpos.up().getY();
    }

    BlockPos blockpos2 = new BlockPos(this.entity);
    PathNodeType pathnodetype1 = this.getPathNodeType(this.entity, blockpos2.getX(), i, blockpos2.getZ());

    if (this.entity.getPathPriority(pathnodetype1) < 0.0F)
    {
        Set<BlockPos> set = Sets.<BlockPos>newHashSet();
        set.add(new BlockPos(this.entity.getEntityBoundingBox().minX, (double)i, this.entity.getEntityBoundingBox().minZ));
        set.add(new BlockPos(this.entity.getEntityBoundingBox().minX, (double)i, this.entity.getEntityBoundingBox().maxZ));
        set.add(new BlockPos(this.entity.getEntityBoundingBox().maxX, (double)i, this.entity.getEntityBoundingBox().minZ));
        set.add(new BlockPos(this.entity.getEntityBoundingBox().maxX, (double)i, this.entity.getEntityBoundingBox().maxZ));

        for (BlockPos blockpos1 : set)
        {
            PathNodeType pathnodetype = this.getPathNodeType(this.entity, blockpos1);

            if (this.entity.getPathPriority(pathnodetype) >= 0.0F)
            {
                return this.openPoint(blockpos1.getX(), blockpos1.getY(), blockpos1.getZ());
            }
        }
    }

    return this.openPoint(blockpos2.getX(), i, blockpos2.getZ());
}
 
Example 16
Project: CustomWorldGen   File: WalkNodeProcessor.java   Source Code and License Vote up 4 votes
public PathPoint getStart()
{
    int i;

    if (this.getCanSwim() && this.entity.isInWater())
    {
        i = (int)this.entity.getEntityBoundingBox().minY;
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor_double(this.entity.posX), i, MathHelper.floor_double(this.entity.posZ));

        for (Block block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock(); block == Blocks.FLOWING_WATER || block == Blocks.WATER; block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock())
        {
            ++i;
            blockpos$mutableblockpos.setPos(MathHelper.floor_double(this.entity.posX), i, MathHelper.floor_double(this.entity.posZ));
        }
    }
    else if (this.entity.onGround)
    {
        i = MathHelper.floor_double(this.entity.getEntityBoundingBox().minY + 0.5D);
    }
    else
    {
        BlockPos blockpos;

        for (blockpos = new BlockPos(this.entity); (this.blockaccess.getBlockState(blockpos).getMaterial() == Material.AIR || this.blockaccess.getBlockState(blockpos).getBlock().isPassable(this.blockaccess, blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down())
        {
            ;
        }

        i = blockpos.up().getY();
    }

    BlockPos blockpos2 = new BlockPos(this.entity);
    PathNodeType pathnodetype1 = this.getPathNodeType(this.entity, blockpos2.getX(), i, blockpos2.getZ());

    if (this.entity.getPathPriority(pathnodetype1) < 0.0F)
    {
        Set<BlockPos> set = Sets.<BlockPos>newHashSet();
        set.add(new BlockPos(this.entity.getEntityBoundingBox().minX, (double)i, this.entity.getEntityBoundingBox().minZ));
        set.add(new BlockPos(this.entity.getEntityBoundingBox().minX, (double)i, this.entity.getEntityBoundingBox().maxZ));
        set.add(new BlockPos(this.entity.getEntityBoundingBox().maxX, (double)i, this.entity.getEntityBoundingBox().minZ));
        set.add(new BlockPos(this.entity.getEntityBoundingBox().maxX, (double)i, this.entity.getEntityBoundingBox().maxZ));

        for (BlockPos blockpos1 : set)
        {
            PathNodeType pathnodetype = this.getPathNodeType(this.entity, blockpos1);

            if (this.entity.getPathPriority(pathnodetype) >= 0.0F)
            {
                return this.openPoint(blockpos1.getX(), blockpos1.getY(), blockpos1.getZ());
            }
        }
    }

    return this.openPoint(blockpos2.getX(), i, blockpos2.getZ());
}
 
Example 17
Project: CustomWorldGen   File: MapGenRavine.java   Source Code and License Vote up 4 votes
protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ)
{
    net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock();
    return block== Blocks.FLOWING_WATER || block == Blocks.WATER;
}
 
Example 18
Project: CustomWorldGen   File: ItemBucket.java   Source Code and License Vote up 4 votes
public boolean tryPlaceContainedLiquid(@Nullable EntityPlayer player, World worldIn, BlockPos posIn)
{
    if (this.containedBlock == Blocks.AIR)
    {
        return false;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(posIn);
        Material material = iblockstate.getMaterial();
        boolean flag = !material.isSolid();
        boolean flag1 = iblockstate.getBlock().isReplaceable(worldIn, posIn);

        if (!worldIn.isAirBlock(posIn) && !flag && !flag1)
        {
            return false;
        }
        else
        {
            if (worldIn.provider.doesWaterVaporize() && this.containedBlock == Blocks.FLOWING_WATER)
            {
                int l = posIn.getX();
                int i = posIn.getY();
                int j = posIn.getZ();
                worldIn.playSound(player, posIn, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);

                for (int k = 0; k < 8; ++k)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double)l + Math.random(), (double)i + Math.random(), (double)j + Math.random(), 0.0D, 0.0D, 0.0D, new int[0]);
                }
            }
            else
            {
                if (!worldIn.isRemote && (flag || flag1) && !material.isLiquid())
                {
                    worldIn.destroyBlock(posIn, true);
                }

                SoundEvent soundevent = this.containedBlock == Blocks.FLOWING_LAVA ? SoundEvents.ITEM_BUCKET_EMPTY_LAVA : SoundEvents.ITEM_BUCKET_EMPTY;
                worldIn.playSound(player, posIn, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F);
                worldIn.setBlockState(posIn, this.containedBlock.getDefaultState(), 11);
            }

            return true;
        }
    }
}
 
Example 19
Project: CustomWorldGen   File: DebugRendererWater.java   Source Code and License Vote up 4 votes
public void render(float p_190060_1_, long p_190060_2_)
{
    this.player = this.minecraft.thePlayer;
    this.xo = this.player.lastTickPosX + (this.player.posX - this.player.lastTickPosX) * (double)p_190060_1_;
    this.yo = this.player.lastTickPosY + (this.player.posY - this.player.lastTickPosY) * (double)p_190060_1_;
    this.zo = this.player.lastTickPosZ + (this.player.posZ - this.player.lastTickPosZ) * (double)p_190060_1_;
    BlockPos blockpos = this.minecraft.thePlayer.getPosition();
    World world = this.minecraft.thePlayer.worldObj;
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    GlStateManager.color(0.0F, 1.0F, 0.0F, 0.75F);
    GlStateManager.disableTexture2D();
    GlStateManager.glLineWidth(6.0F);

    for (BlockPos blockpos1 : BlockPos.PooledMutableBlockPos.getAllInBox(blockpos.add(-10, -10, -10), blockpos.add(10, 10, 10)))
    {
        IBlockState iblockstate = world.getBlockState(blockpos1);

        if (iblockstate.getBlock() == Blocks.WATER || iblockstate.getBlock() == Blocks.FLOWING_WATER)
        {
            double d0 = (double)EntityBoat.getLiquidHeight(iblockstate, world, blockpos1);
            RenderGlobal.renderFilledBox((new AxisAlignedBB((double)((float)blockpos1.getX() + 0.01F), (double)((float)blockpos1.getY() + 0.01F), (double)((float)blockpos1.getZ() + 0.01F), (double)((float)blockpos1.getX() + 0.99F), d0, (double)((float)blockpos1.getZ() + 0.99F))).offset(-this.xo, -this.yo, -this.zo), 1.0F, 1.0F, 1.0F, 0.2F);
        }
    }

    for (BlockPos blockpos2 : BlockPos.PooledMutableBlockPos.getAllInBox(blockpos.add(-10, -10, -10), blockpos.add(10, 10, 10)))
    {
        IBlockState iblockstate1 = world.getBlockState(blockpos2);

        if (iblockstate1.getBlock() == Blocks.WATER || iblockstate1.getBlock() == Blocks.FLOWING_WATER)
        {
            Integer integer = (Integer)iblockstate1.getValue(BlockLiquid.LEVEL);
            double d1 = integer.intValue() > 7 ? 0.9D : 1.0D - 0.11D * (double)integer.intValue();
            String s = iblockstate1.getBlock() == Blocks.FLOWING_WATER ? "f" : "s";
            DebugRenderer.renderDebugText(s + " " + integer, (double)blockpos2.getX() + 0.5D, (double)blockpos2.getY() + d1, (double)blockpos2.getZ() + 0.5D, p_190060_1_, -16777216);
        }
    }

    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example 20
Project: CustomWorldGen   File: BlockModelShapes.java   Source Code and License Vote up 4 votes
public TextureAtlasSprite getTexture(IBlockState state)
{
    Block block = state.getBlock();
    IBakedModel ibakedmodel = this.getModelForState(state);

    if (ibakedmodel == null || ibakedmodel == this.modelManager.getMissingModel())
    {
        if (block == Blocks.WALL_SIGN || block == Blocks.STANDING_SIGN || block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST || block == Blocks.STANDING_BANNER || block == Blocks.WALL_BANNER)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/planks_oak");
        }

        if (block == Blocks.ENDER_CHEST)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/obsidian");
        }

        if (block == Blocks.FLOWING_LAVA || block == Blocks.LAVA)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/lava_still");
        }

        if (block == Blocks.FLOWING_WATER || block == Blocks.WATER)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/water_still");
        }

        if (block == Blocks.SKULL)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/soul_sand");
        }

        if (block == Blocks.BARRIER)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:items/barrier");
        }
    }

    if (ibakedmodel == null)
    {
        ibakedmodel = this.modelManager.getMissingModel();
    }

    return ibakedmodel.getParticleTexture();
}