net.minecraft.world.World.scheduleUpdate()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中net.minecraft.world.World.scheduleUpdate()方法的一些代码示例,展示了World.scheduleUpdate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.scheduleUpdate()方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:scheduleUpdate

World.scheduleUpdate介绍

暂无

代码示例

代码示例来源:origin: Vazkii/Botania

@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
  if(shouldRemove(world, pos))
    world.scheduleUpdate(pos, this, tickRate(world));
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

private void addTick( final int x, final int y, final int z, final NextTickListEntry entry )
{
  this.world.scheduleUpdate( new BlockPos( x + this.x_offset, y + this.y_offset, z + this.z_offset ), entry.getBlock(), (int) entry.scheduledTime );
}

代码示例来源:origin: Vazkii/Botania

public void tickDispenser() {
  BlockPos bind = getBinding();
  if(bind != null) {
    TileEntity tile = world.getTileEntity(bind);
    if(tile instanceof TileEntityDispenser)
      world.scheduleUpdate(bind, tile.getBlockType(), tile.getBlockType().tickRate(world));
  }
}

代码示例来源:origin: Vazkii/Botania

public static void onInteract(EntityPlayer player, World world, BlockPos pos, EnumHand hand) {
  if(world.isRemote)
    return;
  List<TileRedStringInterceptor> remove = new ArrayList<>();
  boolean did = false;
  for(TileRedStringInterceptor inter : interceptors) {
    if(!inter.saneState()) {
      remove.add(inter);
      continue;
    }
    if(inter.world == world) {
      BlockPos coords = inter.getBinding();
      if(coords != null && coords.equals(pos)) {
        Block block = inter.getBlockType();
        world.setBlockState(inter.getPos(), world.getBlockState(inter.getPos()).withProperty(BotaniaStateProps.POWERED, true), 1 | 2);
        world.scheduleUpdate(inter.getPos(), block, block.tickRate(world));
        did = true;
      }
    }
  }
  interceptors.removeAll(remove);
  if(did) {
    player.swingArm(hand);
    world.playSound(null, pos, SoundEvents.BLOCK_DISPENSER_DISPENSE, SoundCategory.BLOCKS, 0.3F, 0.6F);
  }
}

代码示例来源:origin: Vazkii/Psi

@Override
public void onLoad() {
  if (time > 0) {
    world.scheduleUpdate(pos, blockType, time);
    time = -1;
  }
}

代码示例来源:origin: TheGreyGhost/MinecraftByExample

private void scheduleNextTick(World world, BlockPos pos, Block block, boolean reset)
{
 if (!togglingIsActive) return;
 if (reset || ticksTillOutputStateChange == 0) {
  ticksTillOutputStateChange = (outputState == true) ? onTicks : offTicks;
 }
 final int MAXIMUM_DELAY_UNTIL_NEXT_UPDATE = 20;  // always tick at least once every 20 ticks.
 lastTickDelay = Math.min(ticksTillOutputStateChange, MAXIMUM_DELAY_UNTIL_NEXT_UPDATE);
 if (lastTickDelay != 0) {  // should never happen, but be defensive...
  world.scheduleUpdate(pos, block, lastTickDelay);
 }
 return;
}

代码示例来源:origin: Vazkii/Botania

@Override
public void onUpdate() {
  super.onUpdate();
  if(supertile.getWorld().isRemote)
    return;
  if(ticksExisted % 200 == 0)
    sync();
  if(ticksExisted % 6 == 0 && redstoneSignal == 0) {
    int range = getRange();
    int x = supertile.getPos().getX() + supertile.getWorld().rand.nextInt(range * 2 + 1) - range;
    int z = supertile.getPos().getZ() + supertile.getWorld().rand.nextInt(range * 2 + 1) - range;
    for(int i = 4; i > -2; i--) {
      int y = supertile.getPos().getY() + i;
      BlockPos pos = new BlockPos(x, y, z);
      if(supertile.getWorld().isAirBlock(pos))
        continue;
      if(isPlant(pos) && mana > 5) {
        Block block = supertile.getWorld().getBlockState(pos).getBlock();
        mana -= 5;
        supertile.getWorld().scheduleUpdate(pos, block, 1);
        if(ConfigHandler.blockBreakParticles)
          supertile.getWorld().playEvent(2005, pos, 6 + supertile.getWorld().rand.nextInt(4));
        supertile.getWorld().playSound(null, x, y, z, ModSounds.agricarnation, SoundCategory.BLOCKS, 0.01F, 0.5F + (float) Math.random() * 0.5F);
        break;
      }
    }
  }
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public void scheduleUpdate(@Nonnull BlockPos pos, @Nonnull Block blockIn, int delay) {
 wrapped.scheduleUpdate(pos, blockIn, delay);
}

代码示例来源:origin: Vazkii/Botania

if(world.getBlockState(pos).getValue(BotaniaStateProps.LUMINIZER_VARIANT) == LuminizerVariant.DETECTOR) {
  world.setBlockState(pos, world.getBlockState(pos).withProperty(BotaniaStateProps.POWERED, true), 1 | 2);
  world.scheduleUpdate(pos, tile.getBlockType(), tile.getBlockType().tickRate(world));

代码示例来源:origin: Vazkii/Quark

@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
  if(shouldBePowered(worldIn, pos, state))
    worldIn.scheduleUpdate(pos, this, 1);
}

代码示例来源:origin: Vazkii/Quark

@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
  worldIn.scheduleUpdate(pos, this, tickRate(worldIn));
}

代码示例来源:origin: Vazkii/Botania

if(!world.isRemote) {
  world.setBlockState(getPos(), world.getBlockState(getPos()).withProperty(BotaniaStateProps.POWERED, true), 1);
  world.scheduleUpdate(pos, getBlockType(), getBlockType().tickRate(world));

代码示例来源:origin: Vazkii/Botania

@Override
public void interceptRequestLast(Object request, int count, ICorporeaSpark spark, ICorporeaSpark source, List<ItemStack> stacks, List<InvWithLocation> inventories, boolean doit) {
  List<ItemStack> filter = getFilter();
  for(ItemStack stack : filter)
    if(requestMatches(request, stack)) {
      int missing = count;
      for(ItemStack stack_ : stacks)
        missing -= stack_.getCount();
      if(missing > 0 && !world.getBlockState(getPos()).getValue(BotaniaStateProps.POWERED)) {
        world.setBlockState(getPos(), world.getBlockState(getPos()).withProperty(BotaniaStateProps.POWERED, true), 1 | 2);
        world.scheduleUpdate(getPos(), getBlockType(), 2);
        TileEntity requestor = source.getSparkInventory().world.getTileEntity(source.getSparkInventory().pos);
        for(EnumFacing dir : EnumFacing.HORIZONTALS) {
          TileEntity tile = world.getTileEntity(pos.offset(dir));
          if(tile != null && tile instanceof TileCorporeaRetainer)
            ((TileCorporeaRetainer) tile).setPendingRequest(requestor.getPos(), request, count);
        }
        return;
      }
    }
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public void onBlockAdded(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
 super.onBlockAdded(world, pos, state);
 world.notifyBlockUpdate(pos, state, state, 3);
 if (respectsGravity) {
  world.scheduleUpdate(pos, this, tickRate(world));
 }
}

代码示例来源:origin: GregTechCE/GregTech

@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
  super.onBlockAdded(worldIn, pos, state);
  worldIn.scheduleUpdate(pos, state.getBlock(), 5);
}

代码示例来源:origin: GregTechCE/GregTech

@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
  if (state.getValue(STONE_TYPE).falling)
    worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));
}

代码示例来源:origin: ForestryMC/ForestryMC

private void activatePile(IBlockState state, World world, BlockPos pos, boolean scheduleUpdate) {
  world.setBlockState(pos, state.withProperty(IS_ACTIVE, true), 2);
  if (scheduleUpdate) {
    world.scheduleUpdate(pos, this, (this.tickRate(world) + world.rand.nextInt(RANDOM_TICK)) / 4);
  }
}

代码示例来源:origin: amadornes/MCMultiPart

@Override
public void scheduleUpdate(BlockPos pos, Block block, int delay) {
  if (part.getPartPos().equals(pos)) {
    part.scheduleTick(delay);
  } else {
    getActualWorld().scheduleUpdate(pos, block, delay);
  }
}

代码示例来源:origin: ForestryMC/ForestryMC

private static boolean tryTickColumn(World world, int x, int z, int maxY, int minY) {
  for (int y = maxY; y >= minY; --y) {
    Block block = world.getBlockState(new BlockPos(x, y, z)).getBlock();
    if (block.getTickRandomly() && (block instanceof IGrowable || block instanceof IPlantable)) {
      world.scheduleUpdate(new BlockPos(x, y, z), block, 5);
      return true;
    }
  }
  return false;
}

代码示例来源:origin: Vazkii/Quark

@Override
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) {
  if(super.rotateBlock(world, pos, axis)) {
    IBlockState state = world.getBlockState(pos);
    state = state.withProperty(POWERED, false);
    world.setBlockState(pos, state);
    if(shouldBePowered(world, pos, state))
      world.scheduleUpdate(pos, this, 1);
    return true;
  }
  return false;
}

相关文章

微信公众号

最新文章

更多

World类方法