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

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

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

World.notifyBlockUpdate介绍

暂无

代码示例

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

  1. private void dropTorch( final World w, final BlockPos pos )
  2. {
  3. final IBlockState prev = w.getBlockState( pos );
  4. w.destroyBlock( pos, true );
  5. w.notifyBlockUpdate( pos, prev, w.getBlockState( pos ), 3 );
  6. }

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

  1. private void dropCrank( final World world, final BlockPos pos )
  2. {
  3. world.destroyBlock( pos, true ); // w.destroyBlock( x, y, z, true );
  4. world.notifyBlockUpdate( pos, this.getDefaultState(), world.getBlockState( pos ), 3 );
  5. }

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

  1. private void dropTorch( final World w, final BlockPos pos )
  2. {
  3. final IBlockState prev = w.getBlockState( pos );
  4. w.destroyBlock( pos, true );
  5. w.notifyBlockUpdate( pos, prev, w.getBlockState( pos ), 3 );
  6. }

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

  1. private void dropTorch( final World w, final BlockPos pos )
  2. {
  3. final IBlockState prev = w.getBlockState( pos );
  4. w.destroyBlock( pos, true );
  5. w.notifyBlockUpdate( pos, prev, w.getBlockState( pos ), 3 );
  6. }

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

  1. public void markForUpdate()
  2. {
  3. if( this.renderFragment > 0 )
  4. {
  5. this.renderFragment |= 1;
  6. }
  7. else
  8. {
  9. // TODO: Optimize Network Load
  10. if( this.world != null )
  11. {
  12. AELog.blockUpdate( this.pos, this );
  13. this.world.notifyBlockUpdate( this.pos, this.getBlockState(), this.getBlockState(), 3 );
  14. }
  15. }
  16. }

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

  1. @Nonnull
  2. @Override
  3. public EnumActionResult onItemUse(EntityPlayer p, World world, BlockPos pos, EnumHand hand, EnumFacing side, float xs, float ys, float zs) {
  4. TileEntity tile = world.getTileEntity(pos);
  5. if(tile != null && tile instanceof TileCraftCrate) {
  6. TileCraftCrate crate = (TileCraftCrate) tile;
  7. crate.pattern = p.getHeldItem(hand).getItemDamage();
  8. world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 8);
  9. return EnumActionResult.SUCCESS;
  10. }
  11. return EnumActionResult.PASS;
  12. }

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

  1. @Override
  2. public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, World world, @Nonnull BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull IBlockState newState) {
  3. boolean placed = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState);
  4. if(placed) {
  5. String type = getType(stack);
  6. TileEntity te = world.getTileEntity(pos);
  7. if(te instanceof TileSpecialFlower) {
  8. TileSpecialFlower tile = (TileSpecialFlower) te;
  9. tile.setSubTile(type);
  10. tile.onBlockAdded(world, pos, newState);
  11. tile.onBlockPlacedBy(world, pos, newState, player, stack);
  12. if(!world.isRemote)
  13. world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 8);
  14. }
  15. }
  16. return placed;
  17. }

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

  1. void swap(TilePlatform tile, boolean empty) {
  2. tile.camoState = empty ? null : camoState;
  3. world.notifyBlockUpdate(tile.getPos(), world.getBlockState(tile.getPos()), world.getBlockState(tile.getPos()), 8);
  4. }

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

  1. @Override
  2. public void moveTile( final TileEntity te, final World w, final BlockPos newPosition )
  3. {
  4. te.setWorld( w );
  5. te.setPos( newPosition );
  6. final Chunk c = w.getChunkFromBlockCoords( newPosition );
  7. c.addTileEntity( newPosition, te );
  8. if( c.isLoaded() )
  9. {
  10. final IBlockState state = w.getBlockState( newPosition );
  11. w.addTileEntity( te );
  12. w.notifyBlockUpdate( newPosition, state, state, 1 );
  13. }
  14. }
  15. }

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

  1. @Nonnull
  2. @Override
  3. public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float xv, float yv, float zv) {
  4. TileEntity tile = world.getTileEntity(pos);
  5. if(tile != null && (tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP) || tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null))
  6. && !CorporeaHelper.doesBlockHaveSpark(world, pos)) {
  7. ItemStack stack = player.getHeldItem(hand);
  8. stack.shrink(1);
  9. if(!world.isRemote) {
  10. EntityCorporeaSpark spark = new EntityCorporeaSpark(world);
  11. if(stack.getItemDamage() == 1)
  12. spark.setMaster(true);
  13. spark.setPosition(pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5);
  14. world.spawnEntity(spark);
  15. world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 0);
  16. }
  17. return EnumActionResult.SUCCESS;
  18. }
  19. return EnumActionResult.PASS;
  20. }

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

  1. @Override
  2. public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
  3. TileEntity tile = world.getTileEntity(pos);
  4. if(world.isRemote)
  5. return true;
  6. ItemStack currentStack = player.getHeldItem(hand);
  7. if(!currentStack.isEmpty()
  8. && Block.getBlockFromItem(currentStack.getItem()) != null
  9. && tile instanceof TileCamo) {
  10. TileCamo camo = (TileCamo) tile;
  11. IBlockState changeState = Block.getBlockFromItem(currentStack.getItem()).getStateForPlacement(world, pos, side, hitX, hitY, hitZ, currentStack.getItemDamage(), player);
  12. if(isValidBlock(changeState) && !(changeState.getBlock() instanceof BlockCamo) && changeState.getMaterial() != Material.AIR) {
  13. camo.camoState = changeState;
  14. world.notifyBlockUpdate(pos, state, state, 8);
  15. return true;
  16. }
  17. }
  18. return false;
  19. }

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

  1. @Override
  2. public void onBlockPlacedBy(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull EntityLivingBase player,
  3. @Nonnull ItemStack stack) {
  4. setPaintSource(state, world, pos, PaintUtil.getSourceBlock(stack));
  5. if (!world.isRemote) {
  6. world.notifyBlockUpdate(pos, state, state, 3);
  7. }
  8. }

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

  1. @Override
  2. public void onBlockPlacedBy(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull EntityLivingBase player,
  3. @Nonnull ItemStack stack) {
  4. setPaintSource(state, world, pos, PaintUtil.getSourceBlock(stack));
  5. if (!world.isRemote) {
  6. world.notifyBlockUpdate(pos, state, state, 3);
  7. }
  8. }

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

  1. @Override
  2. public void onBlockPlacedBy(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull EntityLivingBase player,
  3. @Nonnull ItemStack stack) {
  4. setPaintSource(state, world, pos, PaintUtil.getSourceBlock(stack));
  5. if (!world.isRemote) {
  6. world.notifyBlockUpdate(pos, state, state, 3);
  7. }
  8. }

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

  1. @Override
  2. public void onBlockPlacedBy(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull EntityLivingBase placer,
  3. @Nonnull ItemStack stack) {
  4. setPaintSource(state, world, pos, PaintUtil.getSourceBlock(stack));
  5. if (!world.isRemote) {
  6. world.notifyBlockUpdate(pos, state, state, 3);
  7. }
  8. }

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

  1. this.world.notifyBlockUpdate( pos, this.world.getBlockState( pos ), this.world.getBlockState( pos ), z );

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

  1. @Override
  2. public IMessage onMessage(PacketOCConduitSignalColor message, MessageContext ctx) {
  3. IOCConduit con = message.getConduit(ctx);
  4. if (con != null) {
  5. con.setSignalColor(message.dir, message.col);
  6. IBlockState bs = message.getWorld(ctx).getBlockState(message.getPos());
  7. message.getWorld(ctx).notifyBlockUpdate(message.getPos(), bs, bs, 3);
  8. }
  9. return null;
  10. }

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

  1. private void doConduitsDirty() {
  2. IBlockState bs = world.getBlockState(pos);
  3. world.notifyBlockUpdate(pos, bs, bs, 3);
  4. world.neighborChanged(pos, getBlockType(), pos);
  5. markDirty();
  6. forceUpdatePlayers();
  7. conduitsDirty = false;
  8. }

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

  1. @SuppressWarnings("null") // gah, Eclipse thinks a final field can go null from one side of the comma to the next
  2. @Override
  3. public IMessage doSetLabel(@Nullable String label) {
  4. ta.setLabel(label);
  5. if (te != null) { // TODO what's this? overkill?
  6. IBlockState bs = te.getWorld().getBlockState(te.getPos());
  7. te.getWorld().notifyBlockUpdate(te.getPos(), bs, bs, 3);
  8. te.getWorld().markChunkDirty(te.getPos(), te);
  9. }
  10. return null;
  11. }

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

  1. world.setTileEntity( d, nte );
  2. world.notifyBlockUpdate( d, prev, state, 3 );

相关文章

World类方法