Java 类net.minecraft.network.PacketThreadUtil 实例源码

项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * Verifies that the server and client are synchronized with respect to the inventory/container opened by the player
 * and confirms if it is the case.
 */
public void handleConfirmTransaction(SPacketConfirmTransaction packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Container container = null;
    EntityPlayer entityplayer = this.gameController.player;

    if (packetIn.getWindowId() == 0)
    {
        container = entityplayer.inventoryContainer;
    }
    else if (packetIn.getWindowId() == entityplayer.openContainer.windowId)
    {
        container = entityplayer.openContainer;
    }

    if (container != null && !packetIn.wasAccepted())
    {
        this.sendPacket(new CPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true));
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Updates the specified entity's position by the specified relative moment and
 * absolute rotation. Note that subclassing of the packet allows for the
 * specification of a subset of this data (e.g. only rel. position, abs.
 * rotation or both).
 */
public void handleEntityMovement(S14PacketEntity packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = packetIn.getEntity(this.clientWorldController);

    if (entity != null) {
        entity.serverPosX += packetIn.func_149062_c();
        entity.serverPosY += packetIn.func_149061_d();
        entity.serverPosZ += packetIn.func_149064_e();
        double d0 = (double) entity.serverPosX / 32.0D;
        double d1 = (double) entity.serverPosY / 32.0D;
        double d2 = (double) entity.serverPosZ / 32.0D;
        float f = packetIn.func_149060_h() ? (float) (packetIn.func_149066_f() * 360) / 256.0F : entity.rotationYaw;
        float f1 = packetIn.func_149060_h() ? (float) (packetIn.func_149063_g() * 360) / 256.0F
                : entity.rotationPitch;
        entity.setPositionAndRotation2(d0, d1, d2, f, f1, 3, false);
        entity.onGround = packetIn.getOnGround();
    }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
public void handleCollectItem(S0DPacketCollectItem packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getCollectedItemEntityID());
    EntityLivingBase entitylivingbase = (EntityLivingBase)this.clientWorldController.getEntityByID(packetIn.getEntityID());

    if (entitylivingbase == null)
    {
        entitylivingbase = this.gameController.thePlayer;
    }

    if (entity != null)
    {
        if (entity instanceof EntityXPOrb)
        {
            this.clientWorldController.playSoundAtEntity(entity, "random.orb", 0.2F, ((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F);
        }
        else
        {
            this.clientWorldController.playSoundAtEntity(entity, "random.pop", 0.2F, ((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F);
        }

        this.gameController.effectRenderer.addEffect(new EntityPickupFX(this.clientWorldController, entity, entitylivingbase, 0.5F));
        this.clientWorldController.removeEntityFromWorld(packetIn.getCollectedItemEntityID());
    }
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * Removes or sets the ScoreObjective to be displayed at a particular scoreboard position (list, sidebar, below
 * name)
 */
public void handleDisplayObjective(SPacketDisplayObjective packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Scoreboard scoreboard = this.clientWorldController.getScoreboard();

    if (packetIn.getName().isEmpty())
    {
        scoreboard.setObjectiveInDisplaySlot(packetIn.getPosition(), (ScoreObjective)null);
    }
    else
    {
        ScoreObjective scoreobjective = scoreboard.getObjective(packetIn.getName());
        scoreboard.setObjectiveInDisplaySlot(packetIn.getPosition(), scoreobjective);
    }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
public void handleRespawn(S07PacketRespawn packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (packetIn.getDimensionID() != this.gameController.thePlayer.dimension)
    {
        this.doneLoadingTerrain = false;
        Scoreboard scoreboard = this.clientWorldController.getScoreboard();
        this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), packetIn.getWorldType()), packetIn.getDimensionID(), packetIn.getDifficulty(), this.gameController.mcProfiler);
        this.clientWorldController.setWorldScoreboard(scoreboard);
        this.gameController.loadWorld(this.clientWorldController);
        this.gameController.thePlayer.dimension = packetIn.getDimensionID();
        this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
    }

    this.gameController.setDimensionAndSpawnPlayer(packetIn.getDimensionID());
    this.gameController.playerController.setGameType(packetIn.getGameType());
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
/**
 * Verifies that the server and client are synchronized with respect to the inventory/container opened by the player
 * and confirms if it is the case.
 */
public void handleConfirmTransaction(S32PacketConfirmTransaction packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Container container = null;
    EntityPlayer entityplayer = this.gameController.thePlayer;

    if (packetIn.getWindowId() == 0)
    {
        container = entityplayer.inventoryContainer;
    }
    else if (packetIn.getWindowId() == entityplayer.openContainer.windowId)
    {
        container = entityplayer.openContainer;
    }

    if (container != null && !packetIn.func_148888_e())
    {
        this.addToSendQueue(new C0FPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true));
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Updates a specified sign with the specified text lines
 */
public void handleUpdateSign(S33PacketUpdateSign packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    boolean flag = false;

    if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) {
        TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());

        if (tileentity instanceof TileEntitySign) {
            TileEntitySign tileentitysign = (TileEntitySign) tileentity;

            if (tileentitysign.getIsEditable()) {
                System.arraycopy(packetIn.getLines(), 0, tileentitysign.signText, 0, 4);
                tileentitysign.markDirty();
            }

            flag = true;
        }
    }

    if (!flag && this.gameController.thePlayer != null) {
        this.gameController.thePlayer.addChatMessage(new ChatComponentText("Unable to locate sign at "
                + packetIn.getPos().getX() + ", " + packetIn.getPos().getY() + ", " + packetIn.getPos().getZ()));
    }
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
public void handleEntityAttach(SPacketEntityAttach packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
    Entity entity1 = this.clientWorldController.getEntityByID(packetIn.getVehicleEntityId());

    if (entity instanceof EntityLiving)
    {
        if (entity1 != null)
        {
            ((EntityLiving)entity).setLeashedToEntity(entity1, false);
        }
        else
        {
            ((EntityLiving)entity).clearLeashed(false, false);
        }
    }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
public void handleMapChunkBulk(S26PacketMapChunkBulk packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    for (int i = 0; i < packetIn.getChunkCount(); ++i)
    {
        int j = packetIn.getChunkX(i);
        int k = packetIn.getChunkZ(i);
        this.clientWorldController.doPreChunk(j, k, true);
        this.clientWorldController.invalidateBlockReceiveRegion(j << 4, 0, k << 4, (j << 4) + 15, 256, (k << 4) + 15);
        Chunk chunk = this.clientWorldController.getChunkFromChunkCoords(j, k);
        chunk.fillChunk(packetIn.getChunkBytes(i), packetIn.getChunkSize(i), true);
        this.clientWorldController.markBlockRangeForRenderUpdate(j << 4, 0, k << 4, (j << 4) + 15, 256, (k << 4) + 15);

        if (!(this.clientWorldController.provider instanceof WorldProviderSurface))
        {
            chunk.resetRelightChecks();
        }
    }
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * Updates the specified entity's position by the specified relative moment and absolute rotation. Note that
 * subclassing of the packet allows for the specification of a subset of this data (e.g. only rel. position, abs.
 * rotation or both).
 */
public void handleEntityMovement(SPacketEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = packetIn.getEntity(this.clientWorldController);

    if (entity != null)
    {
        entity.serverPosX += (long)packetIn.getX();
        entity.serverPosY += (long)packetIn.getY();
        entity.serverPosZ += (long)packetIn.getZ();
        double d0 = (double)entity.serverPosX / 4096.0D;
        double d1 = (double)entity.serverPosY / 4096.0D;
        double d2 = (double)entity.serverPosZ / 4096.0D;

        if (!entity.canPassengerSteer())
        {
            float f = packetIn.isRotating() ? (float)(packetIn.getYaw() * 360) / 256.0F : entity.rotationYaw;
            float f1 = packetIn.isRotating() ? (float)(packetIn.getPitch() * 360) / 256.0F : entity.rotationPitch;
            entity.setPositionAndRotationDirect(d0, d1, d2, f, f1, 3, false);
            entity.onGround = packetIn.getOnGround();
        }
    }
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
/**
 * Either updates the score with a specified value or removes the score for an objective
 */
public void handleUpdateScore(SPacketUpdateScore packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Scoreboard scoreboard = this.clientWorldController.getScoreboard();
    ScoreObjective scoreobjective = scoreboard.getObjective(packetIn.getObjectiveName());

    if (packetIn.getScoreAction() == SPacketUpdateScore.Action.CHANGE)
    {
        Score score = scoreboard.getOrCreateScore(packetIn.getPlayerName(), scoreobjective);
        score.setScorePoints(packetIn.getScoreValue());
    }
    else if (packetIn.getScoreAction() == SPacketUpdateScore.Action.REMOVE)
    {
        if (StringUtils.isNullOrEmpty(packetIn.getObjectiveName()))
        {
            scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), (ScoreObjective)null);
        }
        else if (scoreobjective != null)
        {
            scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), scoreobjective);
        }
    }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
/**
 * Either updates the score with a specified value or removes the score for an objective
 */
public void handleUpdateScore(S3CPacketUpdateScore packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Scoreboard scoreboard = this.clientWorldController.getScoreboard();
    ScoreObjective scoreobjective = scoreboard.getObjective(packetIn.getObjectiveName());

    if (packetIn.getScoreAction() == S3CPacketUpdateScore.Action.CHANGE)
    {
        Score score = scoreboard.getValueFromObjective(packetIn.getPlayerName(), scoreobjective);
        score.setScorePoints(packetIn.getScoreValue());
    }
    else if (packetIn.getScoreAction() == S3CPacketUpdateScore.Action.REMOVE)
    {
        if (StringUtils.isNullOrEmpty(packetIn.getObjectiveName()))
        {
            scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), (ScoreObjective)null);
        }
        else if (scoreobjective != null)
        {
            scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), scoreobjective);
        }
    }
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
public void handleEntityEffect(SPacketEntityEffect packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity instanceof EntityLivingBase)
    {
        Potion potion = Potion.getPotionById(packetIn.getEffectId() & 0xFF);

        if (potion != null)
        {
            PotionEffect potioneffect = new PotionEffect(potion, packetIn.getDuration(), packetIn.getAmplifier(), packetIn.getIsAmbient(), packetIn.doesShowParticles());
            potioneffect.setPotionDurationMax(packetIn.isMaxDuration());
            ((EntityLivingBase)entity).addPotionEffect(potioneffect);
        }
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
public void handleCollectItem(S0DPacketCollectItem packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getCollectedItemEntityID());
    EntityLivingBase entitylivingbase = (EntityLivingBase)this.clientWorldController.getEntityByID(packetIn.getEntityID());

    if (entitylivingbase == null)
    {
        entitylivingbase = this.gameController.thePlayer;
    }

    if (entity != null)
    {
        if (entity instanceof EntityXPOrb)
        {
            this.clientWorldController.playSoundAtEntity(entity, "random.orb", 0.2F, ((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F);
        }
        else
        {
            this.clientWorldController.playSoundAtEntity(entity, "random.pop", 0.2F, ((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F);
        }

        this.gameController.effectRenderer.addEffect(new EntityPickupFX(this.clientWorldController, entity, entitylivingbase, 0.5F));
        this.clientWorldController.removeEntityFromWorld(packetIn.getCollectedItemEntityID());
    }
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
 * beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.world.isBlockLoaded(packetIn.getPos()))
    {
        TileEntity tileentity = this.gameController.world.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();
        boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;

        if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign || i == 10 && tileentity instanceof TileEntityShulkerBox)
        {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }

        if (flag && this.gameController.currentScreen instanceof GuiCommandBlock)
        {
            ((GuiCommandBlock)this.gameController.currentScreen).updateGui();
        }
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Sets the velocity of the specified entity to the specified value
 */
public void handleEntityVelocity(S12PacketEntityVelocity packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID());

    if (Minecraft.getMinecraft().thePlayer == entity) {
        EventPlayerVelocity eventPlayerVelocity = new EventPlayerVelocity(100, 100);
        eventPlayerVelocity.call();
        if (eventPlayerVelocity.isCancelled()) {
            return;
        }
    } else if (entity != null) {
        entity.setVelocity((packetIn.getMotionX() * 100 / 100) / 8000.0D,
                (packetIn.getMotionY() * 100 / 100) / 8000.0D, (packetIn.getMotionZ() * 100 / 100) / 8000.0D);

    }
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
public void handleEntityAttach(SPacketEntityAttach packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
    Entity entity1 = this.clientWorldController.getEntityByID(packetIn.getVehicleEntityId());

    if (entity instanceof EntityLiving)
    {
        if (entity1 != null)
        {
            ((EntityLiving)entity).setLeashedToEntity(entity1, false);
        }
        else
        {
            ((EntityLiving)entity).clearLeashed(false, false);
        }
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Updates the NBTTagCompound metadata of instances of the following
 * entitytypes: Mob spawners, command blocks, beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) {
        TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();

        if (i == 1 && tileentity instanceof TileEntityMobSpawner
                || i == 2 && tileentity instanceof TileEntityCommandBlock
                || i == 3 && tileentity instanceof TileEntityBeacon
                || i == 4 && tileentity instanceof TileEntitySkull
                || i == 5 && tileentity instanceof TileEntityFlowerPot
                || i == 6 && tileentity instanceof TileEntityBanner) {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
 * beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos()))
    {
        TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();

        if (i == 1 && tileentity instanceof TileEntityMobSpawner || i == 2 && tileentity instanceof TileEntityCommandBlock || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner)
        {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }
    }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
/**
 * Handles the spawning of a painting object
 */
public void handleSpawnPainting(S10PacketSpawnPainting packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPainting entitypainting = new EntityPainting(this.clientWorldController, packetIn.getPosition(), packetIn.getFacing(), packetIn.getTitle());
    this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitypainting);
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
/**
 * Sets the velocity of the specified entity to the specified value
 */
public void handleEntityVelocity(S12PacketEntityVelocity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID());

    if (entity != null)
    {
        entity.setVelocity((double)packetIn.getMotionX() / 8000.0D, (double)packetIn.getMotionY() / 8000.0D, (double)packetIn.getMotionZ() / 8000.0D);
    }
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * Sets the progressbar of the opened window to the specified value
 */
public void handleWindowProperty(SPacketWindowProperty packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPlayer entityplayer = this.gameController.player;

    if (entityplayer.openContainer != null && entityplayer.openContainer.windowId == packetIn.getWindowId())
    {
        entityplayer.openContainer.updateProgressBar(packetIn.getProperty(), packetIn.getValue());
    }
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
/**
 * Received from the servers PlayerManager if between 1 and 64 blocks in a chunk are changed. If only one block
 * requires an update, the server sends S23PacketBlockChange and if 64 or more blocks are changed, the server sends
 * S21PacketChunkData
 */
public void handleMultiBlockChange(SPacketMultiBlockChange packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    for (SPacketMultiBlockChange.BlockUpdateData spacketmultiblockchange$blockupdatedata : packetIn.getChangedBlocks())
    {
        this.clientWorldController.invalidateRegionAndSetBlock(spacketmultiblockchange$blockupdatedata.getPos(), spacketmultiblockchange$blockupdatedata.getBlockState());
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Updates the worlds MapStorage with the specified MapData for the specified
 * map-identifier and invokes a MapItemRenderer for it
 */
public void handleMaps(S34PacketMaps packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    MapData mapdata = ItemMap.loadMapData(packetIn.getMapId(), this.gameController.theWorld);
    packetIn.setMapdataTo(mapdata);
    this.gameController.entityRenderer.getMapItemRenderer().updateMapTexture(mapdata);
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
/**
 * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
 * beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos()))
    {
        TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();
        boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;

        if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign)
        {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }
        else
        {
            if(tileentity == null)
            {
                LOGGER.error("Received invalid update packet for null tile entity at {} with data: {}", packetIn.getPos(), packetIn.getNbtCompound());
                return;
            }
            tileentity.onDataPacket(netManager, packetIn);
        }

        if (flag && this.gameController.currentScreen instanceof GuiCommandBlock)
        {
            ((GuiCommandBlock)this.gameController.currentScreen).updateGui();
        }
    }
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
public void handleEffect(SPacketEffect packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (packetIn.isSoundServerwide())
    {
        this.gameController.world.playBroadcastSound(packetIn.getSoundType(), packetIn.getSoundPos(), packetIn.getSoundData());
    }
    else
    {
        this.gameController.world.playEvent(packetIn.getSoundType(), packetIn.getSoundPos(), packetIn.getSoundData());
    }
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
public void handleEntityEquipment(SPacketEntityEquipment packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID());

    if (entity != null)
    {
        entity.setItemStackToSlot(packetIn.getEquipmentSlot(), packetIn.getItemStack());
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
@SuppressWarnings("incomplete-switch")
public void handlePlayerListItem(S38PacketPlayerListItem packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    for (S38PacketPlayerListItem.AddPlayerData s38packetplayerlistitem$addplayerdata : packetIn.func_179767_a()) {
        if (packetIn.func_179768_b() == S38PacketPlayerListItem.Action.REMOVE_PLAYER) {
            this.playerInfoMap.remove(s38packetplayerlistitem$addplayerdata.getProfile().getId());
        } else {
            NetworkPlayerInfo networkplayerinfo = (NetworkPlayerInfo) this.playerInfoMap
                    .get(s38packetplayerlistitem$addplayerdata.getProfile().getId());

            if (packetIn.func_179768_b() == S38PacketPlayerListItem.Action.ADD_PLAYER) {
                networkplayerinfo = new NetworkPlayerInfo(s38packetplayerlistitem$addplayerdata);
                this.playerInfoMap.put(networkplayerinfo.getGameProfile().getId(), networkplayerinfo);
            }

            if (networkplayerinfo != null) {
                switch (packetIn.func_179768_b()) {
                case ADD_PLAYER:
                    networkplayerinfo.setGameType(s38packetplayerlistitem$addplayerdata.getGameMode());
                    networkplayerinfo.setResponseTime(s38packetplayerlistitem$addplayerdata.getPing());
                    break;

                case UPDATE_GAME_MODE:
                    networkplayerinfo.setGameType(s38packetplayerlistitem$addplayerdata.getGameMode());
                    break;

                case UPDATE_LATENCY:
                    networkplayerinfo.setResponseTime(s38packetplayerlistitem$addplayerdata.getPing());
                    break;

                case UPDATE_DISPLAY_NAME:
                    networkplayerinfo.setDisplayName(s38packetplayerlistitem$addplayerdata.getDisplayName());
                }
            }
        }
    }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
/**
 * Renders a specified animation: Waking up a player, a living entity swinging its currently held item, being hurt
 * or receiving a critical hit by normal or magical means
 */
public void handleAnimation(S0BPacketAnimation packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID());

    if (entity != null)
    {
        if (packetIn.getAnimationType() == 0)
        {
            EntityLivingBase entitylivingbase = (EntityLivingBase)entity;
            entitylivingbase.swingItem();
        }
        else if (packetIn.getAnimationType() == 1)
        {
            entity.performHurtAnimation();
        }
        else if (packetIn.getAnimationType() == 2)
        {
            EntityPlayer entityplayer = (EntityPlayer)entity;
            entityplayer.wakeUpPlayer(false, false, false);
        }
        else if (packetIn.getAnimationType() == 4)
        {
            this.gameController.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT);
        }
        else if (packetIn.getAnimationType() == 5)
        {
            this.gameController.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT_MAGIC);
        }
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Handles the creation of a nearby player entity, sets the position and held
 * item
 */
public void handleSpawnPlayer(S0CPacketSpawnPlayer packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    double d0 = (double) packetIn.getX() / 32.0D;
    double d1 = (double) packetIn.getY() / 32.0D;
    double d2 = (double) packetIn.getZ() / 32.0D;
    float f = (float) (packetIn.getYaw() * 360) / 256.0F;
    float f1 = (float) (packetIn.getPitch() * 360) / 256.0F;
    EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(this.gameController.theWorld,
            this.getPlayerInfo(packetIn.getPlayer()).getGameProfile());
    entityotherplayermp.prevPosX = entityotherplayermp.lastTickPosX = (double) (entityotherplayermp.serverPosX = packetIn
            .getX());
    entityotherplayermp.prevPosY = entityotherplayermp.lastTickPosY = (double) (entityotherplayermp.serverPosY = packetIn
            .getY());
    entityotherplayermp.prevPosZ = entityotherplayermp.lastTickPosZ = (double) (entityotherplayermp.serverPosZ = packetIn
            .getZ());
    int i = packetIn.getCurrentItemID();

    if (i == 0) {
        entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = null;
    } else {
        entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = new ItemStack(
                Item.getItemById(i), 1, 0);
    }

    entityotherplayermp.setPositionAndRotation(d0, d1, d2, f, f1);
    this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entityotherplayermp);
    List<DataWatcher.WatchableObject> list = packetIn.func_148944_c();

    if (list != null) {
        entityotherplayermp.getDataWatcher().updateWatchedObjectsFromList(list);
    }
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
/**
 * Spawns an experience orb and sets its value (amount of XP)
 */
public void handleSpawnExperienceOrb(SPacketSpawnExperienceOrb packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    double d0 = packetIn.getX();
    double d1 = packetIn.getY();
    double d2 = packetIn.getZ();
    Entity entity = new EntityXPOrb(this.clientWorldController, d0, d1, d2, packetIn.getXPValue());
    EntityTracker.updateServerPosition(entity, d0, d1, d2);
    entity.rotationYaw = 0.0F;
    entity.rotationPitch = 0.0F;
    entity.setEntityId(packetIn.getEntityID());
    this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entity);
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Initiates a new explosion (sound, particles, drop spawn) for the affected
 * blocks indicated by the packet.
 */
public void handleExplosion(S27PacketExplosion packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Explosion explosion = new Explosion(this.gameController.theWorld, (Entity) null, packetIn.getX(),
            packetIn.getY(), packetIn.getZ(), packetIn.getStrength(), packetIn.getAffectedBlockPositions());
    explosion.doExplosionB(true);
    this.gameController.thePlayer.motionX += (double) packetIn.func_149149_c();
    this.gameController.thePlayer.motionY += (double) packetIn.func_149144_d();
    this.gameController.thePlayer.motionZ += (double) packetIn.func_149147_e();
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
public void handleUpdateHealth(SPacketUpdateHealth packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.player.setPlayerSPHealth(packetIn.getHealth());
    this.gameController.player.getFoodStats().setFoodLevel(packetIn.getFoodLevel());
    this.gameController.player.getFoodStats().setFoodSaturationLevel(packetIn.getSaturationLevel());
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
public void handlePlayerAbilities(S39PacketPlayerAbilities packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPlayer entityplayer = this.gameController.thePlayer;
    entityplayer.capabilities.isFlying = packetIn.isFlying();
    entityplayer.capabilities.isCreativeMode = packetIn.isCreativeMode();
    entityplayer.capabilities.disableDamage = packetIn.isInvulnerable();
    entityplayer.capabilities.allowFlying = packetIn.isAllowFlying();
    entityplayer.capabilities.setFlySpeed(packetIn.getFlySpeed());
    entityplayer.capabilities.setPlayerWalkSpeed(packetIn.getWalkSpeed());
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
public void handlePlayerAbilities(SPacketPlayerAbilities packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPlayer entityplayer = this.gameController.player;
    entityplayer.capabilities.isFlying = packetIn.isFlying();
    entityplayer.capabilities.isCreativeMode = packetIn.isCreativeMode();
    entityplayer.capabilities.disableDamage = packetIn.isInvulnerable();
    entityplayer.capabilities.allowFlying = packetIn.isAllowFlying();
    entityplayer.capabilities.setFlySpeed(packetIn.getFlySpeed());
    entityplayer.capabilities.setPlayerWalkSpeed(packetIn.getWalkSpeed());
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Sets the progressbar of the opened window to the specified value
 */
public void handleWindowProperty(S31PacketWindowProperty packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPlayer entityplayer = this.gameController.thePlayer;

    if (entityplayer.openContainer != null && entityplayer.openContainer.windowId == packetIn.getWindowId()) {
        entityplayer.openContainer.updateProgressBar(packetIn.getVarIndex(), packetIn.getVarValue());
    }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
/**
 * Sets the progressbar of the opened window to the specified value
 */
public void handleWindowProperty(S31PacketWindowProperty packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPlayer entityplayer = this.gameController.thePlayer;

    if (entityplayer.openContainer != null && entityplayer.openContainer.windowId == packetIn.getWindowId())
    {
        entityplayer.openContainer.updateProgressBar(packetIn.getVarIndex(), packetIn.getVarValue());
    }
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
/**
 * Updates which hotbar slot of the player is currently selected
 */
public void handleHeldItemChange(SPacketHeldItemChange packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (InventoryPlayer.isHotbar(packetIn.getHeldItemHotbarIndex()))
    {
        this.gameController.player.inventory.currentItem = packetIn.getHeldItemHotbarIndex();
    }
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
public void handleCamera(SPacketCamera packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = packetIn.getEntity(this.clientWorldController);

    if (entity != null)
    {
        this.gameController.setRenderViewEntity(entity);
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
public void handleEffect(S28PacketEffect packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (packetIn.isSoundServerwide())
    {
        this.gameController.theWorld.playBroadcastSound(packetIn.getSoundType(), packetIn.getSoundPos(), packetIn.getSoundData());
    }
    else
    {
        this.gameController.theWorld.playAuxSFX(packetIn.getSoundType(), packetIn.getSoundPos(), packetIn.getSoundData());
    }
}