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


Java World.scheduleUpdate方法代码示例

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


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

示例1: onNeighborBlockChange

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    boolean flag = worldIn.isBlockPowered(pos) || worldIn.isBlockPowered(pos.up());
    boolean flag1 = ((Boolean)state.getValue(TRIGGERED)).booleanValue();

    if (flag && !flag1)
    {
        worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));
        worldIn.setBlockState(pos, state.withProperty(TRIGGERED, Boolean.valueOf(true)), 4);
    }
    else if (!flag && flag1)
    {
        worldIn.setBlockState(pos, state.withProperty(TRIGGERED, Boolean.valueOf(false)), 4);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:BlockDispenser.java

示例2: neighborChanged

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
 * change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
 * block, etc.
 */
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos p_189540_5_)
{
    boolean flag = worldIn.isBlockPowered(pos) || worldIn.isBlockPowered(pos.up());
    boolean flag1 = ((Boolean)state.getValue(TRIGGERED)).booleanValue();

    if (flag && !flag1)
    {
        worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));
        worldIn.setBlockState(pos, state.withProperty(TRIGGERED, Boolean.valueOf(true)), 4);
    }
    else if (!flag && flag1)
    {
        worldIn.setBlockState(pos, state.withProperty(TRIGGERED, Boolean.valueOf(false)), 4);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:BlockDispenser.java

示例3: neighborChanged

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
 * change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
 * block, etc.
 */
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
{
    if (!this.canSurviveAt(worldIn, pos))
    {
        worldIn.scheduleUpdate(pos, this, 1);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:BlockChorusPlant.java

示例4: onNeighborBlockChange

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    if (!worldIn.isRemote)
    {
        if (this.isOn && !worldIn.isBlockPowered(pos))
        {
            worldIn.scheduleUpdate(pos, this, 4);
        }
        else if (!this.isOn && worldIn.isBlockPowered(pos))
        {
            worldIn.setBlockState(pos, Blocks.lit_redstone_lamp.getDefaultState(), 2);
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:18,代码来源:BlockRedstoneLight.java

示例5: freezeNearby

import net.minecraft.world.World; //导入方法依赖的package包/类
public static void freezeNearby(EntityLivingBase living, World worldIn, BlockPos pos, int level)
{
    if (living.onGround)
    {
        float f = (float)Math.min(16, 2 + level);
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(0, 0, 0);

        for (BlockPos.MutableBlockPos blockpos$mutableblockpos1 : BlockPos.getAllInBoxMutable(pos.add((double)(-f), -1.0D, (double)(-f)), pos.add((double)f, -1.0D, (double)f)))
        {
            if (blockpos$mutableblockpos1.distanceSqToCenter(living.posX, living.posY, living.posZ) <= (double)(f * f))
            {
                blockpos$mutableblockpos.setPos(blockpos$mutableblockpos1.getX(), blockpos$mutableblockpos1.getY() + 1, blockpos$mutableblockpos1.getZ());
                IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos);

                if (iblockstate.getMaterial() == Material.AIR)
                {
                    IBlockState iblockstate1 = worldIn.getBlockState(blockpos$mutableblockpos1);

                    if (iblockstate1.getMaterial() == Material.WATER && ((Integer)iblockstate1.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.canBlockBePlaced(Blocks.FROSTED_ICE, blockpos$mutableblockpos1, false, EnumFacing.DOWN, (Entity)null, (ItemStack)null))
                    {
                        worldIn.setBlockState(blockpos$mutableblockpos1, Blocks.FROSTED_ICE.getDefaultState());
                        worldIn.scheduleUpdate(blockpos$mutableblockpos1.toImmutable(), Blocks.FROSTED_ICE, MathHelper.getRandomIntegerInRange(living.getRNG(), 60, 120));
                    }
                }
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:29,代码来源:EnchantmentFrostWalker.java

示例6: checkForArrows

import net.minecraft.world.World; //导入方法依赖的package包/类
private void checkForArrows(World worldIn, BlockPos pos, IBlockState state)
{
    this.updateBlockBounds(state);
    List <? extends Entity > list = worldIn.<Entity>getEntitiesWithinAABB(EntityArrow.class, new AxisAlignedBB((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ));
    boolean flag = !list.isEmpty();
    boolean flag1 = ((Boolean)state.getValue(POWERED)).booleanValue();

    if (flag && !flag1)
    {
        worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(true)));
        this.notifyNeighbors(worldIn, pos, (EnumFacing)state.getValue(FACING));
        worldIn.markBlockRangeForRenderUpdate(pos, pos);
        worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, 0.6F);
    }

    if (!flag && flag1)
    {
        worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(false)));
        this.notifyNeighbors(worldIn, pos, (EnumFacing)state.getValue(FACING));
        worldIn.markBlockRangeForRenderUpdate(pos, pos);
        worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, 0.5F);
    }

    if (flag)
    {
        worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:29,代码来源:BlockButton.java

示例7: slightlyMelt

import net.minecraft.world.World; //导入方法依赖的package包/类
protected void slightlyMelt(World p_185681_1_, BlockPos p_185681_2_, IBlockState p_185681_3_, Random p_185681_4_, boolean p_185681_5_)
{
    int i = ((Integer)p_185681_3_.getValue(AGE)).intValue();

    if (i < 3)
    {
        p_185681_1_.setBlockState(p_185681_2_, p_185681_3_.withProperty(AGE, Integer.valueOf(i + 1)), 2);
        p_185681_1_.scheduleUpdate(p_185681_2_, this, MathHelper.getInt(p_185681_4_, 20, 40));
    }
    else
    {
        this.turnIntoWater(p_185681_1_, p_185681_2_);

        if (p_185681_5_)
        {
            for (EnumFacing enumfacing : EnumFacing.values())
            {
                BlockPos blockpos = p_185681_2_.offset(enumfacing);
                IBlockState iblockstate = p_185681_1_.getBlockState(blockpos);

                if (iblockstate.getBlock() == this)
                {
                    this.slightlyMelt(p_185681_1_, blockpos, iblockstate, p_185681_4_, false);
                }
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:29,代码来源:BlockFrostedIce.java

示例8: updatePoweredState

import net.minecraft.world.World; //导入方法依赖的package包/类
private void updatePoweredState(World worldIn, BlockPos pos, IBlockState state)
{
    boolean flag = ((Boolean)state.getValue(POWERED)).booleanValue();
    boolean flag1 = false;
    List<EntityMinecart> list = this.<EntityMinecart>findMinecarts(worldIn, pos, EntityMinecart.class, new Predicate[0]);

    if (!list.isEmpty())
    {
        flag1 = true;
    }

    if (flag1 && !flag)
    {
        worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(true)), 3);
        worldIn.notifyNeighborsOfStateChange(pos, this);
        worldIn.notifyNeighborsOfStateChange(pos.down(), this);
        worldIn.markBlockRangeForRenderUpdate(pos, pos);
    }

    if (!flag1 && flag)
    {
        worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(false)), 3);
        worldIn.notifyNeighborsOfStateChange(pos, this);
        worldIn.notifyNeighborsOfStateChange(pos.down(), this);
        worldIn.markBlockRangeForRenderUpdate(pos, pos);
    }

    if (flag1)
    {
        worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));
    }

    worldIn.updateComparatorOutputLevel(pos, this);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:35,代码来源:BlockRailDetector.java

示例9: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    boolean flag = this.shouldBeOff(worldIn, pos, state);
    List<BlockRedstoneTorch.Toggle> list = (List)toggles.get(worldIn);

    while (list != null && !list.isEmpty() && worldIn.getTotalWorldTime() - ((BlockRedstoneTorch.Toggle)list.get(0)).time > 60L)
    {
        list.remove(0);
    }

    if (this.isOn)
    {
        if (flag)
        {
            worldIn.setBlockState(pos, Blocks.UNLIT_REDSTONE_TORCH.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3);

            if (this.isBurnedOut(worldIn, pos, true))
            {
                worldIn.playSound((EntityPlayer)null, pos, SoundEvents.BLOCK_REDSTONE_TORCH_BURNOUT, SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);

                for (int i = 0; i < 5; ++i)
                {
                    double d0 = (double)pos.getX() + rand.nextDouble() * 0.6D + 0.2D;
                    double d1 = (double)pos.getY() + rand.nextDouble() * 0.6D + 0.2D;
                    double d2 = (double)pos.getZ() + rand.nextDouble() * 0.6D + 0.2D;
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
                }

                worldIn.scheduleUpdate(pos, worldIn.getBlockState(pos).getBlock(), 160);
            }
        }
    }
    else if (!flag && !this.isBurnedOut(worldIn, pos, false))
    {
        worldIn.setBlockState(pos, Blocks.REDSTONE_TORCH.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:38,代码来源:BlockRedstoneTorch.java

示例10: updateState

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Updates the pressure plate when stepped on
 */
protected void updateState(World worldIn, BlockPos pos, IBlockState state, int oldRedstoneStrength)
{
    int i = this.computeRedstoneStrength(worldIn, pos);
    boolean flag = oldRedstoneStrength > 0;
    boolean flag1 = i > 0;

    if (oldRedstoneStrength != i)
    {
        state = this.setRedstoneStrength(state, i);
        worldIn.setBlockState(pos, state, 2);
        this.updateNeighbors(worldIn, pos);
        worldIn.markBlockRangeForRenderUpdate(pos, pos);
    }

    if (!flag1 && flag)
    {
        worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, 0.5F);
    }
    else if (flag1 && !flag)
    {
        worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, 0.6F);
    }

    if (flag1)
    {
        worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:32,代码来源:BlockBasePressurePlate.java

示例11: neighborChanged

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
 * change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
 * block, etc.
 */
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos p_189540_5_)
{
    if (!this.canSurviveAt(worldIn, pos))
    {
        worldIn.scheduleUpdate(pos, this, 1);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:BlockChorusPlant.java

示例12: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand){
	world.scheduleUpdate(pos, this, FundamentalChemistry.RELAY_TICKS); //schedule next update
	
	TileVersatileGenerator ent = (TileVersatileGenerator)world.getTileEntity(pos);
	ent.tick();
}
 
开发者ID:ImagicTheCat,项目名称:FundamentalChemistry,代码行数:8,代码来源:BlockVersatileGenerator.java

示例13: onBlockAdded

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
	world.scheduleUpdate(pos, this, FundamentalChemistry.RELAY_TICKS);
}
 
开发者ID:ImagicTheCat,项目名称:FundamentalChemistry,代码行数:5,代码来源:BlockItemBreaker.java

示例14: onBlockAdded

import net.minecraft.world.World; //导入方法依赖的package包/类
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
    worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:5,代码来源:BlockFalling.java

示例15: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!worldIn.isRemote)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityCommandBlock)
        {
            TileEntityCommandBlock tileentitycommandblock = (TileEntityCommandBlock)tileentity;
            CommandBlockBaseLogic commandblockbaselogic = tileentitycommandblock.getCommandBlockLogic();
            boolean flag = !StringUtils.isNullOrEmpty(commandblockbaselogic.getCommand());
            TileEntityCommandBlock.Mode tileentitycommandblock$mode = tileentitycommandblock.getMode();
            boolean flag1 = !tileentitycommandblock.isConditional() || this.isNextToSuccessfulCommandBlock(worldIn, pos, state);
            boolean flag2 = tileentitycommandblock.isConditionMet();
            boolean flag3 = false;

            if (tileentitycommandblock$mode != TileEntityCommandBlock.Mode.SEQUENCE && flag2 && flag)
            {
                commandblockbaselogic.trigger(worldIn);
                flag3 = true;
            }

            if (tileentitycommandblock.isPowered() || tileentitycommandblock.isAuto())
            {
                if (tileentitycommandblock$mode == TileEntityCommandBlock.Mode.SEQUENCE && flag1 && flag)
                {
                    commandblockbaselogic.trigger(worldIn);
                    flag3 = true;
                }

                if (tileentitycommandblock$mode == TileEntityCommandBlock.Mode.AUTO)
                {
                    worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));

                    if (flag1)
                    {
                        this.propagateUpdate(worldIn, pos);
                    }
                }
            }

            if (!flag3)
            {
                commandblockbaselogic.setSuccessCount(0);
            }

            tileentitycommandblock.setConditionMet(flag1);
            worldIn.updateComparatorOutputLevel(pos, this);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:52,代码来源:BlockCommandBlock.java


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