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

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

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

World.scheduleUpdate介绍

暂无

代码示例

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

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

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

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

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

  1. public void tickDispenser() {
  2. BlockPos bind = getBinding();
  3. if(bind != null) {
  4. TileEntity tile = world.getTileEntity(bind);
  5. if(tile instanceof TileEntityDispenser)
  6. world.scheduleUpdate(bind, tile.getBlockType(), tile.getBlockType().tickRate(world));
  7. }
  8. }

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

  1. public static void onInteract(EntityPlayer player, World world, BlockPos pos, EnumHand hand) {
  2. if(world.isRemote)
  3. return;
  4. List<TileRedStringInterceptor> remove = new ArrayList<>();
  5. boolean did = false;
  6. for(TileRedStringInterceptor inter : interceptors) {
  7. if(!inter.saneState()) {
  8. remove.add(inter);
  9. continue;
  10. }
  11. if(inter.world == world) {
  12. BlockPos coords = inter.getBinding();
  13. if(coords != null && coords.equals(pos)) {
  14. Block block = inter.getBlockType();
  15. world.setBlockState(inter.getPos(), world.getBlockState(inter.getPos()).withProperty(BotaniaStateProps.POWERED, true), 1 | 2);
  16. world.scheduleUpdate(inter.getPos(), block, block.tickRate(world));
  17. did = true;
  18. }
  19. }
  20. }
  21. interceptors.removeAll(remove);
  22. if(did) {
  23. player.swingArm(hand);
  24. world.playSound(null, pos, SoundEvents.BLOCK_DISPENSER_DISPENSE, SoundCategory.BLOCKS, 0.3F, 0.6F);
  25. }
  26. }

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

  1. @Override
  2. public void onLoad() {
  3. if (time > 0) {
  4. world.scheduleUpdate(pos, blockType, time);
  5. time = -1;
  6. }
  7. }

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

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

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

  1. @Override
  2. public void onUpdate() {
  3. super.onUpdate();
  4. if(supertile.getWorld().isRemote)
  5. return;
  6. if(ticksExisted % 200 == 0)
  7. sync();
  8. if(ticksExisted % 6 == 0 && redstoneSignal == 0) {
  9. int range = getRange();
  10. int x = supertile.getPos().getX() + supertile.getWorld().rand.nextInt(range * 2 + 1) - range;
  11. int z = supertile.getPos().getZ() + supertile.getWorld().rand.nextInt(range * 2 + 1) - range;
  12. for(int i = 4; i > -2; i--) {
  13. int y = supertile.getPos().getY() + i;
  14. BlockPos pos = new BlockPos(x, y, z);
  15. if(supertile.getWorld().isAirBlock(pos))
  16. continue;
  17. if(isPlant(pos) && mana > 5) {
  18. Block block = supertile.getWorld().getBlockState(pos).getBlock();
  19. mana -= 5;
  20. supertile.getWorld().scheduleUpdate(pos, block, 1);
  21. if(ConfigHandler.blockBreakParticles)
  22. supertile.getWorld().playEvent(2005, pos, 6 + supertile.getWorld().rand.nextInt(4));
  23. supertile.getWorld().playSound(null, x, y, z, ModSounds.agricarnation, SoundCategory.BLOCKS, 0.01F, 0.5F + (float) Math.random() * 0.5F);
  24. break;
  25. }
  26. }
  27. }
  28. }

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

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

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

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

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

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

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

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

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

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

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

  1. @Override
  2. public void interceptRequestLast(Object request, int count, ICorporeaSpark spark, ICorporeaSpark source, List<ItemStack> stacks, List<InvWithLocation> inventories, boolean doit) {
  3. List<ItemStack> filter = getFilter();
  4. for(ItemStack stack : filter)
  5. if(requestMatches(request, stack)) {
  6. int missing = count;
  7. for(ItemStack stack_ : stacks)
  8. missing -= stack_.getCount();
  9. if(missing > 0 && !world.getBlockState(getPos()).getValue(BotaniaStateProps.POWERED)) {
  10. world.setBlockState(getPos(), world.getBlockState(getPos()).withProperty(BotaniaStateProps.POWERED, true), 1 | 2);
  11. world.scheduleUpdate(getPos(), getBlockType(), 2);
  12. TileEntity requestor = source.getSparkInventory().world.getTileEntity(source.getSparkInventory().pos);
  13. for(EnumFacing dir : EnumFacing.HORIZONTALS) {
  14. TileEntity tile = world.getTileEntity(pos.offset(dir));
  15. if(tile != null && tile instanceof TileCorporeaRetainer)
  16. ((TileCorporeaRetainer) tile).setPendingRequest(requestor.getPos(), request, count);
  17. }
  18. return;
  19. }
  20. }
  21. }

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

  1. @Override
  2. public void onBlockAdded(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
  3. super.onBlockAdded(world, pos, state);
  4. world.notifyBlockUpdate(pos, state, state, 3);
  5. if (respectsGravity) {
  6. world.scheduleUpdate(pos, this, tickRate(world));
  7. }
  8. }

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

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

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

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

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

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

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

  1. @Override
  2. public void scheduleUpdate(BlockPos pos, Block block, int delay) {
  3. if (part.getPartPos().equals(pos)) {
  4. part.scheduleTick(delay);
  5. } else {
  6. getActualWorld().scheduleUpdate(pos, block, delay);
  7. }
  8. }

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

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

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

  1. @Override
  2. public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) {
  3. if(super.rotateBlock(world, pos, axis)) {
  4. IBlockState state = world.getBlockState(pos);
  5. state = state.withProperty(POWERED, false);
  6. world.setBlockState(pos, state);
  7. if(shouldBePowered(world, pos, state))
  8. world.scheduleUpdate(pos, this, 1);
  9. return true;
  10. }
  11. return false;
  12. }

相关文章

World类方法