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


Java S23PacketBlockChange类代码示例

本文整理汇总了Java中net.minecraft.network.play.server.S23PacketBlockChange的典型用法代码示例。如果您正苦于以下问题:Java S23PacketBlockChange类的具体用法?Java S23PacketBlockChange怎么用?Java S23PacketBlockChange使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: blockDestroy

import net.minecraft.network.play.server.S23PacketBlockChange; //导入依赖的package包/类
/**
 * ブロックを破壊します
 *
 * @param world       world
 * @param x           x座標
 * @param y           y座標
 * @param z           z座標
 * @param player      プレイヤー
 * @param centerBlock 中心のブロック
 * @param cX          中心のブロックのx座標
 * @param cY          中心のブロックのy座標
 * @param cZ          中心のブロックのz座標
 * @param toolStack   破壊に使用したツールのItemStack
 */
private void blockDestroy(World world, int x, int y, int z, EntityPlayerMP player, Block centerBlock, int cX, int cY, int cZ, ItemStack toolStack) {
	if (!world.isAirBlock(x, y, z)) {
		Block block = world.getBlock(x, y, z);
		int meta = world.getBlockMetadata(x, y, z);
		if (canDestroyBlock(toolStack, block, meta) && (centerBlock.getBlockHardness(world, cX, cY, cZ) - block.getBlockHardness(world, x, y, z)) <= 3F) {
			BreakEvent event = ForgeHooks.onBlockBreakEvent(world, player.theItemInWorldManager.getGameType(), player, x, y, z);
			if (!event.isCanceled()) {
				block.onBlockHarvested(world, x, y, z, meta, player);
				if (block.removedByPlayer(world, player, x, y, z, false)) {
					block.onBlockDestroyedByPlayer(world, x, y, z, meta);
					block.harvestBlock(world, player, x, y, z, meta);
				}
				if (!world.isRemote) {
					player.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));
				}
				
			}
		}
	}
}
 
开发者ID:Team-Antimatter-Mod,项目名称:AntiMatterMod,代码行数:35,代码来源:MiningHammer.java

示例2: send

import net.minecraft.network.play.server.S23PacketBlockChange; //导入依赖的package包/类
public void send(BlockPos center, EntityPlayerMP player, ForgeDirection face) {
    World world = MinecraftServer.getServer().worldServerForDimension(center.getDim());
    int x, y, z;
    Volume updateVolume = relativeCoords.translate(face);

    for (int i = updateVolume.getMinX(); i <= updateVolume.getMaxX(); i++) {
        for (int j = updateVolume.getMinY(); j <= updateVolume.getMaxY(); j++) {
            for (int k = updateVolume.getMinZ(); k <= updateVolume.getMaxZ(); k++) {
                x = center.getX() + i;
                y = center.getY() + j;
                z = center.getZ() + k;

                S23PacketBlockChange packet = new S23PacketBlockChange(x, y, z, world);
                FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().sendPacketToAllPlayers(packet);
            }
        }
    }
}
 
开发者ID:MyEssentials,项目名称:MyTown2,代码行数:19,代码来源:ClientBlockUpdate.java

示例3: sendBlockChange

import net.minecraft.network.play.server.S23PacketBlockChange; //导入依赖的package包/类
@Override
public void sendBlockChange(Location loc, int material, byte data) {
    if (getHandle().playerNetServerHandler == null) return;

    S23PacketBlockChange packet = new S23PacketBlockChange(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), ((CraftWorld) loc.getWorld()).getHandle());

    packet.field_148883_d = CraftMagicNumbers.getBlock(material);
    packet.field_148884_e = data;
    getHandle().playerNetServerHandler.sendPacket(packet);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:11,代码来源:CraftPlayer.java

示例4: processPlayerBlockPlacement

import net.minecraft.network.play.server.S23PacketBlockChange; //导入依赖的package包/类
/**
 * Processes block placement and block activation (anvil, furnace, etc.)
 */
public void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer());
    WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
    ItemStack itemstack = this.playerEntity.inventory.getCurrentItem();
    boolean flag = false;
    BlockPos blockpos = packetIn.getPosition();
    EnumFacing enumfacing = EnumFacing.getFront(packetIn.getPlacedBlockDirection());
    this.playerEntity.markPlayerActive();

    if (packetIn.getPlacedBlockDirection() == 255)
    {
        if (itemstack == null)
        {
            return;
        }

        this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack);
    }
    else if (blockpos.getY() < this.serverController.getBuildLimit() - 1 || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit())
    {
        if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < 64.0D && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos))
        {
            this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ());
        }

        flag = true;
    }
    else
    {
        ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("build.tooHigh", new Object[] {Integer.valueOf(this.serverController.getBuildLimit())});
        chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
        this.playerEntity.playerNetServerHandler.sendPacket(new S02PacketChat(chatcomponenttranslation));
        flag = true;
    }

    if (flag)
    {
        this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos));
        this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos.offset(enumfacing)));
    }

    itemstack = this.playerEntity.inventory.getCurrentItem();

    if (itemstack != null && itemstack.stackSize == 0)
    {
        this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = null;
        itemstack = null;
    }

    if (itemstack == null || itemstack.getMaxItemUseDuration() == 0)
    {
        this.playerEntity.isChangingQuantityOnly = true;
        this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = ItemStack.copyItemStack(this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem]);
        Slot slot = this.playerEntity.openContainer.getSlotFromInventory(this.playerEntity.inventory, this.playerEntity.inventory.currentItem);
        this.playerEntity.openContainer.detectAndSendChanges();
        this.playerEntity.isChangingQuantityOnly = false;

        if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack()))
        {
            this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem()));
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:68,代码来源:NetHandlerPlayServer.java

示例5: onUpdate

import net.minecraft.network.play.server.S23PacketBlockChange; //导入依赖的package包/类
public void onUpdate()
{
    if (this.numBlocksToUpdate != 0)
    {
        if (this.numBlocksToUpdate == 1)
        {
            int i = (this.locationOfBlockChange[0] >> 12 & 15) + this.chunkCoords.chunkXPos * 16;
            int j = this.locationOfBlockChange[0] & 255;
            int k = (this.locationOfBlockChange[0] >> 8 & 15) + this.chunkCoords.chunkZPos * 16;
            BlockPos blockpos = new BlockPos(i, j, k);
            this.sendToAllPlayersWatchingChunk(new S23PacketBlockChange(PlayerManager.this.theWorldServer, blockpos));

            if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity())
            {
                this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos));
            }
        }
        else if (this.numBlocksToUpdate == 64)
        {
            int i1 = this.chunkCoords.chunkXPos * 16;
            int k1 = this.chunkCoords.chunkZPos * 16;
            this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), false, this.flagsYAreasToUpdate));

            for (int i2 = 0; i2 < 16; ++i2)
            {
                if ((this.flagsYAreasToUpdate & 1 << i2) != 0)
                {
                    int k2 = i2 << 4;
                    List<TileEntity> list = PlayerManager.this.theWorldServer.getTileEntitiesIn(i1, k2, k1, i1 + 16, k2 + 16, k1 + 16);

                    for (int l = 0; l < list.size(); ++l)
                    {
                        this.sendTileToAllPlayersWatchingChunk((TileEntity)list.get(l));
                    }
                }
            }
        }
        else
        {
            this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos)));

            for (int j1 = 0; j1 < this.numBlocksToUpdate; ++j1)
            {
                int l1 = (this.locationOfBlockChange[j1] >> 12 & 15) + this.chunkCoords.chunkXPos * 16;
                int j2 = this.locationOfBlockChange[j1] & 255;
                int l2 = (this.locationOfBlockChange[j1] >> 8 & 15) + this.chunkCoords.chunkZPos * 16;
                BlockPos blockpos1 = new BlockPos(l1, j2, l2);

                if (PlayerManager.this.theWorldServer.getBlockState(blockpos1).getBlock().hasTileEntity())
                {
                    this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos1));
                }
            }
        }

        this.numBlocksToUpdate = 0;
        this.flagsYAreasToUpdate = 0;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:60,代码来源:PlayerManager.java

示例6: tryHarvestBlock

import net.minecraft.network.play.server.S23PacketBlockChange; //导入依赖的package包/类
/**
 * Attempts to harvest a block
 */
public boolean tryHarvestBlock(BlockPos pos)
{
    if (this.gameType.isCreative() && this.thisPlayerMP.getHeldItem() != null && this.thisPlayerMP.getHeldItem().getItem() instanceof ItemSword)
    {
        return false;
    }
    else
    {
        IBlockState iblockstate = this.theWorld.getBlockState(pos);
        TileEntity tileentity = this.theWorld.getTileEntity(pos);

        if (this.gameType.isAdventure())
        {
            if (this.gameType == WorldSettings.GameType.SPECTATOR)
            {
                return false;
            }

            if (!this.thisPlayerMP.isAllowEdit())
            {
                ItemStack itemstack = this.thisPlayerMP.getCurrentEquippedItem();

                if (itemstack == null)
                {
                    return false;
                }

                if (!itemstack.canDestroy(iblockstate.getBlock()))
                {
                    return false;
                }
            }
        }

        this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, pos, Block.getStateId(iblockstate));
        boolean flag1 = this.removeBlock(pos);

        if (this.isCreative())
        {
            this.thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(this.theWorld, pos));
        }
        else
        {
            ItemStack itemstack1 = this.thisPlayerMP.getCurrentEquippedItem();
            boolean flag = this.thisPlayerMP.canHarvestBlock(iblockstate.getBlock());

            if (itemstack1 != null)
            {
                itemstack1.onBlockDestroyed(this.theWorld, iblockstate.getBlock(), pos, this.thisPlayerMP);

                if (itemstack1.stackSize == 0)
                {
                    this.thisPlayerMP.destroyCurrentEquippedItem();
                }
            }

            if (flag1 && flag)
            {
                iblockstate.getBlock().harvestBlock(this.theWorld, this.thisPlayerMP, pos, iblockstate, tileentity);
            }
        }

        return flag1;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:69,代码来源:ItemInWorldManager.java

示例7: handleBlockChange

import net.minecraft.network.play.server.S23PacketBlockChange; //导入依赖的package包/类
/**
 * Updates the block and metadata and generates a blockupdate (and notify the clients)
 */
public void handleBlockChange(S23PacketBlockChange packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.clientWorldController.invalidateRegionAndSetBlock(packetIn.getBlockPosition(), packetIn.getBlockState());
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:9,代码来源:NetHandlerPlayClient.java

示例8: handleBlockChange

import net.minecraft.network.play.server.S23PacketBlockChange; //导入依赖的package包/类
/**
 * Updates the block and metadata and generates a blockupdate (and notify the
 * clients)
 */
public void handleBlockChange(S23PacketBlockChange packetIn) {
	PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
	this.clientWorldController.invalidateRegionAndSetBlock(packetIn.getBlockPosition(), packetIn.getBlockState());
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:9,代码来源:NetHandlerPlayClient.java

示例9: attack

import net.minecraft.network.play.server.S23PacketBlockChange; //导入依赖的package包/类
@SubscribeEvent
public void attack(final PlayerInteractEvent event) {
    if (event.action != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) {
        return;
    }
    final EntityPlayer player = event.entityPlayer;
    if (event.world == null || event.world.isRemote) {
        return;
    }
    if (player == null || !(player instanceof EntityPlayerMP)) {
        return;
    }
    final ItemStack heldItem = player.getHeldItem();
    if (heldItem == null || heldItem.getItem() != this) {
        return;
    }
    if (heldItem.getItemDamage() == 32767) {
        heldItem.stackSize = 0;
        return;
    }
    final int i = player.inventory.currentItem;
    if (i >= 9 || i < 0) {
        return;
    }
    event.setCanceled(true);
    final ItemStack item = heldItem.copy();
    heldItem.setItemDamage(32767);
    player.inventory.setInventorySlotContents(i, (ItemStack)null);
    final int x = event.x;
    final int y = event.y;
    final int z = event.z;
    final int side = event.face;
    try {
        final PlayerInteractEvent e = ForgeEventFactory.onPlayerInteract(player, PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, x, y, z, side, player.worldObj);
        final boolean result = !e.isCanceled() && event.useBlock != Event.Result.DENY;
        if (result) {
            final Block block = event.world.getBlock(x, y, z);
            block.onBlockClicked(event.world, x, y, z, player);
        }
    }
    catch (Exception err) {
        for (int j = 0; j < player.inventory.getSizeInventory(); ++j) {
            final ItemStack stackInSlot = player.inventory.getStackInSlot(i);
            if (stackInSlot != null) {
                if (stackInSlot.getItem() == this) {
                    if (stackInSlot.getItemDamage() == 32767) {
                        player.inventory.setInventorySlotContents(j, (ItemStack)null);
                    }
                }
            }
        }
        if (player.inventory.getStackInSlot(i) == null) {
            player.inventory.setInventorySlotContents(i, item);
        }
        else if (!player.inventory.addItemStackToInventory(item)) {
            player.dropPlayerItemWithRandomChoice(item, false);
        }
        throw Throwables.propagate((Throwable)err);
    }
    ((EntityPlayerMP)player).playerNetServerHandler.sendPacket((Packet)new S23PacketBlockChange(x, y, z, event.world));
    final ItemStack newItem = player.inventory.getStackInSlot(i);
    player.inventory.setInventorySlotContents(i, item);
    if (newItem != null && !player.inventory.addItemStackToInventory(newItem.copy())) {
        player.dropPlayerItemWithRandomChoice(newItem.copy(), false);
    }
    ((EntityPlayerMP)player).mcServer.getConfigurationManager().syncPlayerInventory((EntityPlayerMP)player);
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:68,代码来源:ItemGlove.java

示例10: onBlockBreakEvent

import net.minecraft.network.play.server.S23PacketBlockChange; //导入依赖的package包/类
public static BlockEvent.BreakEvent onBlockBreakEvent(World world, GameType gameType, EntityPlayerMP entityPlayer, int x, int y, int z)
{
    // Logic from tryHarvestBlock for pre-canceling the event
    boolean preCancelEvent = false;
    if (gameType.func_82752_c() && !entityPlayer.func_82246_f(x, y, z))
    {
        preCancelEvent = true;
    }
    else if (gameType.func_77145_d() && entityPlayer.func_70694_bm() != null && entityPlayer.func_70694_bm().func_77973_b() instanceof ItemSword)
    {
        preCancelEvent = true;
    }

    // Tell client the block is gone immediately then process events
    if (world.func_147438_o(x, y, z) == null)
    {
        S23PacketBlockChange packet = new S23PacketBlockChange(x, y, z, world);
        packet.field_148883_d = Blocks.field_150350_a;
        packet.field_148884_e = 0;
        entityPlayer.field_71135_a.func_147359_a(packet);
    }

    // Post the block break event
    Block block = world.func_147439_a(x, y, z);
    int blockMetadata = world.func_72805_g(x, y, z);
    BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(x, y, z, world, block, blockMetadata, entityPlayer);
    event.setCanceled(preCancelEvent);
    MinecraftForge.EVENT_BUS.post(event);

    // Handle if the event is canceled
    if (event.isCanceled())
    {
        // Let the client know the block still exists
        entityPlayer.field_71135_a.func_147359_a(new S23PacketBlockChange(x, y, z, world));

        // Update any tile entity data for this block
        TileEntity tileentity = world.func_147438_o(x, y, z);
        if (tileentity != null)
        {
            Packet pkt = tileentity.func_145844_m();
            if (pkt != null)
            {
                entityPlayer.field_71135_a.func_147359_a(pkt);
            }
        }
    }
    return event;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:49,代码来源:ForgeHooks.java

示例11: breaking

import net.minecraft.network.play.server.S23PacketBlockChange; //导入依赖的package包/类
private void breaking(ItemStack stack, BlockPos pos, EntityPlayerMP playermp) {

		World world = playermp.worldObj;
		IBlockState state = world.getBlockState(pos);
		Block block = state.getBlock();

		if (!world.isRemote) {
			if (!world.isAirBlock(pos)) {
				block.onBlockHarvested(world, pos, state, playermp);
				if (block.removedByPlayer(world, pos, playermp, true)) {
					block.onBlockDestroyedByPlayer(world, pos, state);
					if (!playermp.capabilities.isCreativeMode) {
						block.harvestBlock(world, playermp, pos, state, world.getTileEntity(pos));
						block.dropXpOnBlockBreak(world, pos, block.getExpDrop(world, pos, 0));
						stack.damageItem(1, playermp);
					}
				}
				playermp.playerNetServerHandler.sendPacket(new S23PacketBlockChange(world, pos));
			}
		}

		if (block instanceof BlockRedstoneOre || block instanceof BlockOre || blocks.contains(block)) {
			if (playermp.worldObj.getBlockState(pos.up()).getBlock() instanceof BlockRedstoneOre || playermp.worldObj.getBlockState(pos.up()).getBlock() instanceof BlockOre || blocks.contains(playermp.worldObj.getBlockState(pos.up()).getBlock())) {
				this.breaking(stack, pos.up(), playermp);
			}
			if (playermp.worldObj.getBlockState(pos.down()).getBlock() instanceof BlockRedstoneOre || playermp.worldObj.getBlockState(pos.down()).getBlock() instanceof BlockOre || blocks.contains(playermp.worldObj.getBlockState(pos.down()).getBlock())) {
				this.breaking(stack, pos.down(), playermp);
			}
			if (playermp.worldObj.getBlockState(pos.north()).getBlock() instanceof BlockRedstoneOre || playermp.worldObj.getBlockState(pos.north()).getBlock() instanceof BlockOre || blocks.contains(playermp.worldObj.getBlockState(pos.north()).getBlock())) {
				this.breaking(stack, pos.north(), playermp);
			}
			if (playermp.worldObj.getBlockState(pos.south()).getBlock() instanceof BlockRedstoneOre || playermp.worldObj.getBlockState(pos.south()).getBlock() instanceof BlockOre || blocks.contains(playermp.worldObj.getBlockState(pos.south()).getBlock())) {
				this.breaking(stack, pos.south(), playermp);
			}
			if (playermp.worldObj.getBlockState(pos.west()).getBlock() instanceof BlockRedstoneOre || playermp.worldObj.getBlockState(pos.west()).getBlock() instanceof BlockOre || blocks.contains(playermp.worldObj.getBlockState(pos.west()).getBlock())) {
				this.breaking(stack, pos.west(), playermp);
			}
			if (playermp.worldObj.getBlockState(pos.east()).getBlock() instanceof BlockRedstoneOre || playermp.worldObj.getBlockState(pos.east()).getBlock() instanceof BlockOre || blocks.contains(playermp.worldObj.getBlockState(pos.east()).getBlock())) {
				this.breaking(stack, pos.east(), playermp);
			}
		}
	}
 
开发者ID:HyCraftHD,项目名称:TeambattleMod,代码行数:43,代码来源:ItemTeambattlePickAxe.java

示例12: onBlockBreakEvent

import net.minecraft.network.play.server.S23PacketBlockChange; //导入依赖的package包/类
public static BlockEvent.BreakEvent onBlockBreakEvent(World world, GameType gameType, EntityPlayerMP entityPlayer, int x, int y, int z)
{
    // Logic from tryHarvestBlock for pre-canceling the event
    boolean preCancelEvent = false;
    if (gameType.isAdventure() && !entityPlayer.isCurrentToolAdventureModeExempt(x, y, z))
    {
        preCancelEvent = true;
    }
    else if (gameType.isCreative() && entityPlayer.getHeldItem() != null && entityPlayer.getHeldItem().getItem() instanceof ItemSword)
    {
        preCancelEvent = true;
    }

    // Tell client the block is gone immediately then process events
    if (world.getTileEntity(x, y, z) == null)
    {
        S23PacketBlockChange packet = new S23PacketBlockChange(x, y, z, world);
        packet.field_148883_d = Blocks.air;
        packet.field_148884_e = 0;
        entityPlayer.playerNetServerHandler.sendPacket(packet);
    }

    // Post the block break event
    Block block = world.getBlock(x, y, z);
    int blockMetadata = world.getBlockMetadata(x, y, z);
    BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(x, y, z, world, block, blockMetadata, entityPlayer);
    event.setCanceled(preCancelEvent);
    MinecraftForge.EVENT_BUS.post(event);

    // Handle if the event is canceled
    if (event.isCanceled())
    {
        // Let the client know the block still exists
        entityPlayer.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));

        // Update any tile entity data for this block
        TileEntity tileentity = world.getTileEntity(x, y, z);
        if (tileentity != null)
        {
            Packet pkt = tileentity.getDescriptionPacket();
            if (pkt != null)
            {
                entityPlayer.playerNetServerHandler.sendPacket(pkt);
            }
        }
    }
    return event;
}
 
开发者ID:alexandrage,项目名称:CauldronGit,代码行数:49,代码来源:ForgeHooks.java

示例13: harvestBlock

import net.minecraft.network.play.server.S23PacketBlockChange; //导入依赖的package包/类
protected boolean harvestBlock(World world, int x, int y, int z, EntityPlayer player) {
	if (world.isAirBlock(x, y, z)) {
		return false;
	}
	EntityPlayerMP playerMP = null;
	if (player instanceof EntityPlayerMP) {
		playerMP = (EntityPlayerMP) player;
	}
	Block block = world.getBlock(x, y, z);
	int meta = world.getBlockMetadata(x, y, z);
	if (!(toolClasses.contains(block.getHarvestTool(meta)) || canHarvestBlock(block, player.getCurrentEquippedItem()))) {
		return false;
	}
	if (!ForgeHooks.canHarvestBlock(block, player, meta)) {
		return false;
	}
	BreakEvent event = null;
	if (playerMP != null) {
		event = ForgeHooks.onBlockBreakEvent(world, playerMP.theItemInWorldManager.getGameType(), playerMP, x, y, z);
		if (event.isCanceled()) {
			return false;
		}
	}
	if (player.capabilities.isCreativeMode) {
		if (!world.isRemote) {
			block.onBlockHarvested(world, x, y, z, meta, player);
		} else {
			world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) | (meta << 12));
		}
		if (block.removedByPlayer(world, player, x, y, z, false)) {
			block.onBlockDestroyedByPlayer(world, x, y, z, meta);
		}
		if (!world.isRemote) {
			playerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));
		} else {
			Minecraft.getMinecraft().getNetHandler()
					.addToSendQueue(new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit));
		}
		return true;
	}
	world.playAuxSFXAtEntity(player, 2001, x, y, z, Block.getIdFromBlock(block) | (meta << 12));
	if (!world.isRemote) {
		block.onBlockHarvested(world, x, y, z, meta, player);
		if (block.removedByPlayer(world, player, x, y, z, true)) {
			block.onBlockDestroyedByPlayer(world, x, y, z, meta);
			block.harvestBlock(world, player, x, y, z, meta);
			if (event != null) {
				block.dropXpOnBlockBreak(world, x, y, z, event.getExpToDrop());
			}
		}
		playerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));
	} else {
		if (block.removedByPlayer(world, player, x, y, z, true)) {
			block.onBlockDestroyedByPlayer(world, x, y, z, meta);
		}
		Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit));
	}
	return true;
}
 
开发者ID:MHuanterAxe,项目名称:MHuanterMod,代码行数:60,代码来源:ItemToolMM.java

示例14: NeptuneBlockChangePacket

import net.minecraft.network.play.server.S23PacketBlockChange; //导入依赖的package包/类
public NeptuneBlockChangePacket(S23PacketBlockChange handle) {
    super(handle);
}
 
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:4,代码来源:NeptuneBlockChangePacket.java

示例15: getHandle

import net.minecraft.network.play.server.S23PacketBlockChange; //导入依赖的package包/类
@Override
public S23PacketBlockChange getHandle() {
    return (S23PacketBlockChange) super.getHandle();
}
 
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:5,代码来源:NeptuneBlockChangePacket.java


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