当前位置: 首页>>代码示例>>Java>>正文


Java Blocks.FLOWING_WATER属性代码示例

本文整理汇总了Java中net.minecraft.init.Blocks.FLOWING_WATER属性的典型用法代码示例。如果您正苦于以下问题:Java Blocks.FLOWING_WATER属性的具体用法?Java Blocks.FLOWING_WATER怎么用?Java Blocks.FLOWING_WATER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.minecraft.init.Blocks的用法示例。


在下文中一共展示了Blocks.FLOWING_WATER属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateTick

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]);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:16,代码来源:BlockMagma.java

示例2: getFluid

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;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:7,代码来源:HeatBehaviourLiquid.java

示例3: transformSourceBlock

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);
                    }
                }
            }
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:28,代码来源:HeatBehaviourLiquidTransition.java

示例4: neighborChanged

@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);
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:15,代码来源:CropKelp.java

示例5: safeImpact

@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);
		}
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:30,代码来源:FrostbiteBrew.java

示例6: canBlockFreeze

/**
 * 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;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:38,代码来源:World.java

示例7: getFlowingBlock

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");
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:15,代码来源:BlockLiquid.java

示例8: getPathablePosY

/**
 * 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);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:30,代码来源:PathNavigateGround.java

示例9: canBlockFreezeBody

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;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:35,代码来源:World.java

示例10: tryPlaceContainedLiquid

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;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:47,代码来源:ItemBucket.java

示例11: isAssociatedBlock

@Override
public boolean isAssociatedBlock(Block other)
{
	return super.isAssociatedBlock(other) || other == Blocks.WATER || other == Blocks.FLOWING_WATER;
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:5,代码来源:BlockFreshWater.java

示例12: render

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();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:41,代码来源:DebugRendererWater.java

示例13: drawSlot

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);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:43,代码来源:GuiCreateFlatWorld.java

示例14: getStart

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());
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:55,代码来源:WalkNodeProcessor.java

示例15: getStart

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());
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:55,代码来源:WalkNodeProcessor.java


注:本文中的net.minecraft.init.Blocks.FLOWING_WATER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。