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

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

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

World.addBlockEvent介绍

暂无

代码示例

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

  1. public void handRotate() {
  2. if(!world.isRemote)
  3. world.addBlockEvent(getPos(), ModBlocks.animatedTorch, 0, (side + 1) % 4);
  4. }

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

  1. public void toggle() {
  2. if(!world.isRemote) {
  3. world.addBlockEvent(getPos(), ModBlocks.animatedTorch, 0, torchMode.modeSwitcher.rotate(this, side));
  4. nextRandomRotation = world.rand.nextInt(4);
  5. VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
  6. }
  7. }

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

  1. private void craftingFanciness() {
  2. if(soundTicks == 0) {
  3. world.playSound(null, pos, ModSounds.manaPoolCraft, SoundCategory.BLOCKS, 0.4F, 4F);
  4. soundTicks = 6;
  5. }
  6. world.addBlockEvent(getPos(), getBlockType(), CRAFT_EFFECT_EVENT, 0);
  7. }

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

  1. public void saveLastRecipe() {
  2. lastRecipe = new ArrayList<>();
  3. for(int i = 0; i < getSizeInventory(); i++) {
  4. ItemStack stack = itemHandler.getStackInSlot(i);
  5. if(stack.isEmpty())
  6. break;
  7. lastRecipe.add(stack.copy());
  8. }
  9. recipeKeepTicks = 400;
  10. world.addBlockEvent(getPos(), ModBlocks.altar, SET_KEEP_TICKS_EVENT, 400);
  11. }

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

  1. public void saveLastRecipe() {
  2. lastRecipe = new ArrayList<>();
  3. for(int i = 0; i < getSizeInventory(); i++) {
  4. ItemStack stack = itemHandler.getStackInSlot(i);
  5. if(stack.isEmpty())
  6. break;
  7. lastRecipe.add(stack.copy());
  8. }
  9. recipeKeepTicks = 400;
  10. world.addBlockEvent(getPos(), ModBlocks.runeAltar, SET_KEEP_TICKS_EVENT, 400);
  11. }

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

  1. private void updateActivePositions() {
  2. int newActivePositions = 0;
  3. for (int i = 0; i < ticksRemaining.length; i++) {
  4. if (ticksRemaining[i] > -1) {
  5. newActivePositions |= 1 << i;
  6. }
  7. }
  8. if (newActivePositions != activePositions) {
  9. getWorld().addBlockEvent(getPos(), supertile.getBlockType(), UPDATE_ACTIVE_EVENT, newActivePositions);
  10. }
  11. }

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

  1. @Override
  2. public void onUpdate() {
  3. super.onUpdate();
  4. if(getWorld().isRemote) {
  5. if(state != NONE && Math.random() > 0.6)
  6. Botania.proxy.wispFX(supertile.getPos().getX() + 0.55 + Math.random() * 0.2 - 0.1, supertile.getPos().getY() + 0.75 + Math.random() * 0.2 - 0.1, supertile.getPos().getZ() + 0.5, state == INCREASING ? 0.05F : 1F, 0.05F, state == INCREASING ? 1F : 0.05F, (float) Math.random() / 7, (float) -Math.random() / 50);
  7. } else {
  8. int mana = 0;
  9. for(EnumFacing dir : EnumFacing.HORIZONTALS) {
  10. BlockPos pos = supertile.getPos().offset(dir);
  11. if(getWorld().isBlockLoaded(pos)) {
  12. TileEntity tile = supertile.getWorld().getTileEntity(pos);
  13. if(tile instanceof IManaPool)
  14. mana += ((IManaPool) tile).getCurrentMana();
  15. }
  16. }
  17. int newState = mana > lastMana ? INCREASING : mana < lastMana ? DECREASING : NONE;
  18. if(newState != state)
  19. getWorld().addBlockEvent(getPos(), supertile.getBlockType(), SET_STATE_EVENT, newState);
  20. if(ticksExisted % 60 == 0)
  21. lastMana = mana;
  22. }
  23. }

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

  1. EntityItem outputItem = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, output);
  2. world.spawnEntity(outputItem);
  3. world.addBlockEvent(getPos(), ModBlocks.brewery, CRAFT_EFFECT_EVENT, recipe.getBrew().getColor(output));

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

  1. world.addBlockEvent(getPos(), getBlockType(), CHARGE_EFFECT_EVENT, outputting ? 1 : 0);

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

  1. world.addBlockEvent(getPos(), supertile.getBlockType(), RECIPE_COMPLETE_EVENT, positionAt);
  2. if(ConfigHandler.blockBreakParticles)
  3. supertile.getWorld().playEvent(2001, coords, Block.getStateId(recipe.getOutputState()));

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

  1. public void openInventory( final EntityPlayer player )
  2. {
  3. if( !player.isSpectator() )
  4. {
  5. this.setPlayerOpen( this.getPlayerOpen() + 1 );
  6. this.world.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing );
  7. this.world.notifyNeighborsOfStateChange( this.pos, this.getBlockType(), true );
  8. this.world.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType(), true );
  9. if( this.getPlayerOpen() == 1 )
  10. {
  11. this.getWorld()
  12. .playSound( player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_OPEN,
  13. SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
  14. this.markForUpdate();
  15. }
  16. }
  17. }

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

  1. @Override
  2. public void onUpdate() {
  3. super.onUpdate();
  4. if(!supertile.getWorld().isRemote && mana == 0) {
  5. List<EntityTNTPrimed> tnts = supertile.getWorld().getEntitiesWithinAABB(EntityTNTPrimed.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
  6. for(EntityTNTPrimed tnt : tnts) {
  7. if(tnt.getFuse() == 1 && !tnt.isDead && !supertile.getWorld().getBlockState(new BlockPos(tnt)).getMaterial().isLiquid()) {
  8. tnt.playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 0.2F, (1F + (supertile.getWorld().rand.nextFloat() - supertile.getWorld().rand.nextFloat()) * 0.2F) * 0.7F);
  9. tnt.setDead();
  10. mana += getMaxMana();
  11. sync();
  12. getWorld().addBlockEvent(getPos(), supertile.getBlockType(), EXPLODE_EFFECT_EVENT, tnt.getEntityId());
  13. break;
  14. }
  15. }
  16. }
  17. }

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

  1. public void closeInventory( final EntityPlayer player )
  2. {
  3. if( !player.isSpectator() )
  4. {
  5. this.setPlayerOpen( this.getPlayerOpen() - 1 );
  6. this.world.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing );
  7. this.world.notifyNeighborsOfStateChange( this.pos, this.getBlockType(), true );
  8. this.world.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType(), true );
  9. if( this.getPlayerOpen() < 0 )
  10. {
  11. this.setPlayerOpen( 0 );
  12. }
  13. if( this.getPlayerOpen() == 0 )
  14. {
  15. this.getWorld()
  16. .playSound( player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_CLOSE,
  17. SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
  18. this.markForUpdate();
  19. }
  20. }
  21. }

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

  1. @Override
  2. protected void execute(EntityPlayer player) {
  3. player.world.addBlockEvent(pos, Block.getBlockById(id), a, b);
  4. //TODO multi threading - scheduled tasks
  5. }

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

  1. mana = 0;
  2. world.addBlockEvent(getPos(), ModBlocks.enchanter, CRAFT_EFFECT_EVENT, 0);
  3. advanceStage();

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

  1. getWorld().addBlockEvent(getPos(), getWorld().getBlockState(getPos()).getBlock(), START_BURN_EVENT, item.getEntityId());
  2. sync();

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

  1. world.spawnEntity(outputItem);
  2. currentRecipe = null;
  3. world.addBlockEvent(getPos(), ModBlocks.runeAltar, SET_COOLDOWN_EVENT, 60);
  4. world.addBlockEvent(getPos(), ModBlocks.runeAltar, CRAFT_EFFECT_EVENT, 0);

代码示例来源:origin: blay09/CookingForBlockheads

  1. public void setForcedOpen(boolean isForcedOpen) {
  2. this.isForcedOpen = isForcedOpen;
  3. tileEntity.getWorld().addBlockEvent(tileEntity.getPos(), tileEntity.getBlockType(), 2, isForcedOpen ? 1 : 0);
  4. }

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

  1. world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
  2. world.addBlockEvent(getPos(), getBlockType(), CRAFT_EFFECT_EVENT, 0);

代码示例来源:origin: PenguinSquad/Harvest-Festival

  1. @Override
  2. public void closeInventory(EntityPlayer player) {
  3. players--;
  4. if (players < 0) {
  5. players = 0;
  6. }
  7. player.world.addBlockEvent(tile.getPos(), tile.getBlockType(), 1, players);
  8. tile.getWorld().playSound(null, tile.getPos().getX(), tile.getPos().getY(), tile.getPos().getZ(), HFSounds.FRIDGE, SoundCategory.BLOCKS, 2F, tile.getWorld().rand.nextFloat() * 0.1F + 0.9F);
  9. tile.saveAndRefresh(); //Update the client about this
  10. }

相关文章

World类方法