Java 类net.minecraft.entity.player.EntityPlayerMP 实例源码

项目:GardenStuff    文件:ItemCandelillaSeeds.java   
@Override
public EnumActionResult onItemUse (EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    ItemStack stack = player.getHeldItem(hand);
    IBlockState state = worldIn.getBlockState(pos);

    if (facing != EnumFacing.UP)
        return EnumActionResult.FAIL;
    if (!player.canPlayerEdit(pos.offset(facing), facing, stack))
        return EnumActionResult.FAIL;
    if (!state.getBlock().canSustainPlant(state, worldIn, pos, EnumFacing.UP, this))
        return EnumActionResult.FAIL;
    if (!worldIn.isAirBlock(pos.up()))
        return EnumActionResult.FAIL;

    worldIn.setBlockState(pos.up(), ModBlocks.candelilla.getDefaultState());
    if (player instanceof EntityPlayerMP)
        CriteriaTriggers.PLACED_BLOCK.trigger((EntityPlayerMP)player, pos.up(), stack);

    stack.shrink(1);
    return EnumActionResult.SUCCESS;
}
项目:Mods    文件:CommandResetStat.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    try {

        EntityPlayerMP entityplayermp = args.length > 0 ? getPlayer(server, sender, args[0])
                : getCommandSenderAsPlayer(sender);
        entityplayermp.getCapability(TF2weapons.PLAYER_CAP, null).highestBossLevel.clear();
        Chunk chunk=entityplayermp.world.getChunkFromBlockCoords(entityplayermp.getPosition());
        int australium=0;
        for(int x=0;x<16;x++){
            for(int y=0;y<128;y++){
                for(int z=0;z<16;z++){
                    if(chunk.getBlockState(x, y, z).getBlock()==TF2weapons.blockAustraliumOre)
                        australium++;
                }
            }
        }
        notifyCommandListener(sender, this, "commands.resetbossstat.success",entityplayermp.getName());
    } catch (Exception e) {
        throw new WrongUsageException(getUsage(sender), new Object[0]);
    }
}
项目:CustomWorldGen    文件:PlayerList.java   
public void transferPlayerToDimension(EntityPlayerMP player, int dimensionIn, net.minecraft.world.Teleporter teleporter)
{
    int i = player.dimension;
    WorldServer worldserver = this.mcServer.worldServerForDimension(player.dimension);
    player.dimension = dimensionIn;
    WorldServer worldserver1 = this.mcServer.worldServerForDimension(player.dimension);
    player.connection.sendPacket(new SPacketRespawn(player.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), player.interactionManager.getGameType()));
    this.updatePermissionLevel(player);
    worldserver.removeEntityDangerously(player);
    player.isDead = false;
    this.transferEntityToWorld(player, i, worldserver, worldserver1, teleporter);
    this.preparePlayer(player, worldserver);
    player.connection.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
    player.interactionManager.setWorld(worldserver1);
    player.connection.sendPacket(new SPacketPlayerAbilities(player.capabilities));
    this.updateTimeAndWeatherForPlayer(player, worldserver1);
    this.syncPlayerInventory(player);

    for (PotionEffect potioneffect : player.getActivePotionEffects())
    {
        player.connection.sendPacket(new SPacketEntityEffect(player.getEntityId(), potioneffect));
    }
    net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, i, dimensionIn);
}
项目:Backmemed    文件:PlayerList.java   
public void sendMessageToAllTeamMembers(EntityPlayer player, ITextComponent message)
{
    Team team = player.getTeam();

    if (team != null)
    {
        for (String s : team.getMembershipCollection())
        {
            EntityPlayerMP entityplayermp = this.getPlayerByUsername(s);

            if (entityplayermp != null && entityplayermp != player)
            {
                entityplayermp.addChatMessage(message);
            }
        }
    }
}
项目:BaseClient    文件:ServerConfigurationManager.java   
public void sendMessageToTeamOrEvryPlayer(EntityPlayer player, IChatComponent message)
{
    Team team = player.getTeam();

    if (team == null)
    {
        this.sendChatMsg(message);
    }
    else
    {
        for (int i = 0; i < this.playerEntityList.size(); ++i)
        {
            EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(i);

            if (entityplayermp.getTeam() != team)
            {
                entityplayermp.addChatMessage(message);
            }
        }
    }
}
项目:refinedstorageaddons    文件:NetworkItemWirelessCraftingGrid.java   
@Override
public boolean onOpen(INetwork network, EntityPlayer player, EnumHand hand) {
    if (RSAddons.INSTANCE.config.wirelessCraftingGridUsesEnergy && stack.getItemDamage() != ItemWirelessCraftingGrid.TYPE_CREATIVE && stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored() <= RSAddons.INSTANCE.config.wirelessCraftingGridOpenUsage) {
        return false;
    }

    if (!network.getSecurityManager().hasPermission(Permission.MODIFY, player)) {
        WorldUtils.sendNoPermissionMessage(player);

        return false;
    }

    RSAddons.RSAPI.openWirelessGrid(player, hand, network.world().provider.getDimension(), WirelessCraftingGrid.ID);

    network.sendItemStorageToClient((EntityPlayerMP) player);

    drainEnergy(RSAddons.INSTANCE.config.wirelessCraftingGridOpenUsage);

    return true;
}
项目:BaseClient    文件:ServerConfigurationManager.java   
/**
 * params: srcPlayer,x,y,z,r,dimension. The packet is not sent to the srcPlayer, but all other players within the
 * search radius
 */
public void sendToAllNearExcept(EntityPlayer p_148543_1_, double x, double y, double z, double radius, int dimension, Packet p_148543_11_)
{
    for (int i = 0; i < this.playerEntityList.size(); ++i)
    {
        EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(i);

        if (entityplayermp != p_148543_1_ && entityplayermp.dimension == dimension)
        {
            double d0 = x - entityplayermp.posX;
            double d1 = y - entityplayermp.posY;
            double d2 = z - entityplayermp.posZ;

            if (d0 * d0 + d1 * d1 + d2 * d2 < radius * radius)
            {
                entityplayermp.playerNetServerHandler.sendPacket(p_148543_11_);
            }
        }
    }
}
项目:CustomWorldGen    文件:PlayerChunkMap.java   
/**
 * Removes an EntityPlayerMP from the PlayerManager.
 */
public void removePlayer(EntityPlayerMP player)
{
    int i = (int)player.managedPosX >> 4;
    int j = (int)player.managedPosZ >> 4;

    for (int k = i - this.playerViewRadius; k <= i + this.playerViewRadius; ++k)
    {
        for (int l = j - this.playerViewRadius; l <= j + this.playerViewRadius; ++l)
        {
            PlayerChunkMapEntry playerchunkmapentry = this.getEntry(k, l);

            if (playerchunkmapentry != null)
            {
                playerchunkmapentry.removePlayer(player);
            }
        }
    }

    this.players.remove(player);
    this.markSortPending();
}
项目:BaseClient    文件:EntityAIFindEntityNearest.java   
/**
 * Returns whether an in-progress EntityAIBase should continue executing
 */
public boolean continueExecuting()
{
    EntityLivingBase entitylivingbase = this.field_179442_b.getAttackTarget();

    if (entitylivingbase == null)
    {
        return false;
    }
    else if (!entitylivingbase.isEntityAlive())
    {
        return false;
    }
    else
    {
        double d0 = this.func_179438_f();
        return this.field_179442_b.getDistanceSqToEntity(entitylivingbase) > d0 * d0 ? false : !(entitylivingbase instanceof EntityPlayerMP) || !((EntityPlayerMP)entitylivingbase).theItemInWorldManager.isCreative();
    }
}
项目:tp-plus    文件:CommandTPP.java   
public static void teleportToDimension(EntityPlayer player, int dimension, double x, double y, double z) {
    int oldDimension = player.getEntityWorld().provider.getDimension();
    EntityPlayerMP entityPlayerMP = (EntityPlayerMP) player;
    MinecraftServer server = player.getEntityWorld().getMinecraftServer();
    WorldServer worldServer = server.getWorld(dimension);
    player.addExperienceLevel(0);


    worldServer.getMinecraftServer().getPlayerList().transferPlayerToDimension(entityPlayerMP, dimension, new RfToolsTeleporter(worldServer, x, y, z));
    player.setPositionAndUpdate(x, y, z);
    if (oldDimension == 1) {
        // For some reason teleporting out of the end does weird things.
        player.setPositionAndUpdate(x, y, z);
        worldServer.spawnEntity(player);
        worldServer.updateEntityWithOptionalForce(player, false);
    }
}
项目:ExPetrum    文件:ExPHandlerServer.java   
@SubscribeEvent
public void onClientLogIn(net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent event)
{
    // Should be always true but mods can throw this event at any time...
    if (event.player instanceof EntityPlayerMP)
    {
        if (FMLCommonHandler.instance().getMinecraftServerInstance().isDedicatedServer())
        {
            SettingsManager.restoreAllClientData();
        }
        else
        {
            SettingsManager.sendSettingsToClient((EntityPlayerMP) event.player);
        }
    }
}
项目:Proyecto-DASI    文件:JSONWorldDataHelper.java   
/** Builds the basic achievement world data to be used as observation signals by the listener.
 * @param json a JSON object into which the achievement stats will be added.
 */
public static void buildAchievementStats(JsonObject json, EntityPlayerMP player)
{
    StatFileWriter sfw = player.getStatFile();
    json.addProperty("DistanceTravelled", 
            sfw.readStat((StatBase)StatList.distanceWalkedStat) 
            + sfw.readStat((StatBase)StatList.distanceSwumStat) 
            + sfw.readStat((StatBase)StatList.distanceDoveStat) 
            + sfw.readStat((StatBase)StatList.distanceFallenStat) 
            ); // TODO: there are many other ways of moving!
    json.addProperty("TimeAlive", sfw.readStat((StatBase)StatList.timeSinceDeathStat));
    json.addProperty("MobsKilled", sfw.readStat((StatBase)StatList.mobKillsStat));
    json.addProperty("PlayersKilled", sfw.readStat((StatBase)StatList.playerKillsStat));
    json.addProperty("DamageTaken", sfw.readStat((StatBase)StatList.damageTakenStat));

    /* Other potential reinforcement signals that may be worth researching:
    json.addProperty("BlocksDestroyed", sfw.readStat((StatBase)StatList.objectBreakStats) - but objectBreakStats is an array of 32000 StatBase objects - indexed by block type.);
    json.addProperty("Blocked", ev.player.isMovementBlocked()) - but isMovementBlocker() is a protected method (can get round this with reflection)
    */
}
项目:Uranium    文件:CraftPlayer.java   
public void setExtraData(net.minecraft.nbt.NBTTagCompound nbttagcompound) {
    if (!nbttagcompound.hasKey("bukkit")) {
        nbttagcompound.setTag("bukkit", new net.minecraft.nbt.NBTTagCompound());
    }

    net.minecraft.nbt.NBTTagCompound data = nbttagcompound.getCompoundTag("bukkit");
    net.minecraft.entity.player.EntityPlayerMP handle = getHandle();
    data.setInteger("newExp", handle.newExp);
    data.setInteger("newTotalExp", handle.newTotalExp);
    data.setInteger("newLevel", handle.newLevel);
    data.setInteger("expToDrop", handle.expToDrop);
    data.setBoolean("keepLevel", handle.keepLevel);
    data.setLong("firstPlayed", getFirstPlayed());
    data.setLong("lastPlayed", System.currentTimeMillis());
    data.setString("lastKnownName", handle.getCommandSenderName());
}
项目:MeeCreeps    文件:PortalGunItem.java   
private void throwProjectile(EntityPlayer player, EnumHand hand, World world) {
    ItemStack heldItem = player.getHeldItem(hand);

    int charge = getCharge(heldItem);
    if (charge <= 0) {
        MeeCreepsMessages.INSTANCE.sendTo(new PacketShowBalloonToClient("message.meecreeps.gun_no_charge"), (EntityPlayerMP) player);
        return;
    }
    setCharge(heldItem, charge-1);

    List<TeleportDestination> destinations = getDestinations(heldItem);
    int current = getCurrentDestination(heldItem);
    if (current == -1) {
        MeeCreepsMessages.INSTANCE.sendTo(new PacketShowBalloonToClient("message.meecreeps.gun_no_destination"), (EntityPlayerMP) player);
    } else if (destinations.get(current) == null) {
        MeeCreepsMessages.INSTANCE.sendTo(new PacketShowBalloonToClient("message.meecreeps.gun_bad_destination"), (EntityPlayerMP) player);
    } else {
        EntityProjectile projectile = new EntityProjectile(world, player);
        projectile.setDestination(destinations.get(current));
        projectile.setPlayerId(player.getUniqueID());
        projectile.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
        world.spawnEntity(projectile);
    }
}
项目:BaseClient    文件:WorldServer.java   
/**
 * Spawns the desired particle and sends the necessary packets to the relevant connected players.
 */
public void spawnParticle(EnumParticleTypes particleType, boolean longDistance, double xCoord, double yCoord, double zCoord, int numberOfParticles, double xOffset, double yOffset, double zOffset, double particleSpeed, int... p_180505_18_)
{
    Packet packet = new S2APacketParticles(particleType, longDistance, (float)xCoord, (float)yCoord, (float)zCoord, (float)xOffset, (float)yOffset, (float)zOffset, (float)particleSpeed, numberOfParticles, p_180505_18_);

    for (int i = 0; i < this.playerEntities.size(); ++i)
    {
        EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntities.get(i);
        BlockPos blockpos = entityplayermp.getPosition();
        double d0 = blockpos.distanceSq(xCoord, yCoord, zCoord);

        if (d0 <= 256.0D || longDistance && d0 <= 65536.0D)
        {
            entityplayermp.playerNetServerHandler.sendPacket(packet);
        }
    }
}
项目:BaseClient    文件:ServerConfigurationManager.java   
/**
 * also stores the NBTTags if this is an intergratedPlayerList
 */
protected void writePlayerData(EntityPlayerMP playerIn)
{
    this.playerNBTManagerObj.writePlayerData(playerIn);
    StatisticsFile statisticsfile = (StatisticsFile)this.playerStatFiles.get(playerIn.getUniqueID());

    if (statisticsfile != null)
    {
        statisticsfile.saveStatFile();
    }
}
项目:FirstAid    文件:MessageClientUpdate.java   
@Override
public IMessage onMessage(MessageClientUpdate message, MessageContext ctx) {
    EntityPlayerMP player = ctx.getServerHandler().player;
    if (message.type == Type.TUTORIAL_COMPLETE) {
        PlayerDataManager.tutorialDone.add(player.getName());
        Objects.requireNonNull(player.getServer()).addScheduledTask(() -> PlayerDataManager.getDamageModel(player).hasTutorial = true);
    } else if (message.type == Type.REQUEST_REFRESH) {
        FirstAid.NETWORKING.sendTo(new MessageResync(PlayerDataManager.getDamageModel(player)), player);
    }
    return null;
}
项目:Backmemed    文件:PlayerList.java   
private void setPlayerGameTypeBasedOnOther(EntityPlayerMP target, EntityPlayerMP source, World worldIn)
{
    if (source != null)
    {
        target.interactionManager.setGameType(source.interactionManager.getGameType());
    }
    else if (this.gameType != null)
    {
        target.interactionManager.setGameType(this.gameType);
    }

    target.interactionManager.initializeGameType(worldIn.getWorldInfo().getGameType());
}
项目:DecompiledMinecraft    文件:S38PacketPlayerListItem.java   
public S38PacketPlayerListItem(S38PacketPlayerListItem.Action actionIn, EntityPlayerMP... players)
{
    this.action = actionIn;

    for (EntityPlayerMP entityplayermp : players)
    {
        this.players.add(new S38PacketPlayerListItem.AddPlayerData(entityplayermp.getGameProfile(), entityplayermp.ping, entityplayermp.theItemInWorldManager.getGameType(), entityplayermp.getTabListDisplayName()));
    }
}
项目:World-Border    文件:CmdReload.java   
@Override
public void execute(ICommandSender sender, EntityPlayerMP player, List<String> params, String worldName)
{
    if (player != null)
        Log.info("Reloading config file at the command of player \"" + player.getDisplayName() + "\".");

    Config.load(true);

    if (player != null)
        Util.chat(sender, "WorldBorder configuration reloaded.");
}
项目:MineCamera    文件:MessageUpdatePitchYaw.java   
@Override
public IMessage onMessage(MessageUpdatePitchYaw message, MessageContext ctx) {
    if (ctx.side == Side.SERVER) {
        EntityPlayerMP player = ctx.getServerHandler().playerEntity;
        Entity entity =player.getEntityWorld()
                .getEntityByID(player.getEntityData().getInteger("renderViewCamera"));
        // entity.setDelay(message.delay);
        if (player != null && entity != null&&entity instanceof EntityTripod) {
            entity.rotationYaw = message.rotationYaw;
            entity.rotationPitch = message.rotationPitch;
        }
    }
    return null;
}
项目:Backmemed    文件:EntityElderGuardian.java   
protected void updateAITasks()
{
    super.updateAITasks();
    int i = 1200;

    if ((this.ticksExisted + this.getEntityId()) % 1200 == 0)
    {
        Potion potion = MobEffects.MINING_FATIGUE;
        List<EntityPlayerMP> list = this.world.<EntityPlayerMP>getPlayers(EntityPlayerMP.class, new Predicate<EntityPlayerMP>()
        {
            public boolean apply(@Nullable EntityPlayerMP p_apply_1_)
            {
                return EntityElderGuardian.this.getDistanceSqToEntity(p_apply_1_) < 2500.0D && p_apply_1_.interactionManager.survivalOrAdventure();
            }
        });
        int j = 2;
        int k = 6000;
        int l = 1200;

        for (EntityPlayerMP entityplayermp : list)
        {
            if (!entityplayermp.isPotionActive(potion) || entityplayermp.getActivePotionEffect(potion).getAmplifier() < 2 || entityplayermp.getActivePotionEffect(potion).getDuration() < 1200)
            {
                entityplayermp.connection.sendPacket(new SPacketChangeGameState(10, 0.0F));
                entityplayermp.addPotionEffect(new PotionEffect(potion, 6000, 2));
            }
        }
    }

    if (!this.hasHome())
    {
        this.setHomePosAndDistance(new BlockPos(this), 16);
    }
}
项目:refinedstorageaddons    文件:ItemNetworkPicker.java   
public void doPick(INetwork network, EntityPlayerMP player, ItemStack stack) {
    if (RSAddons.INSTANCE.config.networkPickerUsesEnergy && stack.getItemDamage() != ItemNetworkPicker.TYPE_CREATIVE && stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored() <= RSAddons.INSTANCE.config.networkPickerUsage) {
        return;
    }

    if (!network.getSecurityManager().hasPermission(Permission.MODIFY, player)) {
        WorldUtils.sendNoPermissionMessage(player);

        return;
    }

    RayTraceResult target = player.world.rayTraceBlocks(RenderUtils.getStart(player), RenderUtils.getEnd(player));

    if (target != null) {
        IBlockState state = player.world.getBlockState(target.getBlockPos());

        ItemStack toExtract = state.getBlock().getPickBlock(state, target, player.world, target.getBlockPos(), player);

        if (!toExtract.isEmpty()) {
            ItemStack result = network.extractItem(toExtract, toExtract.getMaxStackSize(), false);

            if (result != null) {
                if (!player.inventory.addItemStackToInventory(result)) {
                    network.insertItem(result, result.getCount(), false);
                }
            }
        }
    }

    if (RSAddons.INSTANCE.config.networkPickerUsesEnergy && stack.getItemDamage() != ItemNetworkPicker.TYPE_CREATIVE) {
        stack.getCapability(CapabilityEnergy.ENERGY, null).extractEnergy(RSAddons.INSTANCE.config.networkPickerUsage, false);
    }
}
项目:BaseClient    文件:ServerConfigurationManager.java   
/**
 * Saves all of the players' current states.
 */
public void saveAllPlayerData()
{
    for (int i = 0; i < this.playerEntityList.size(); ++i)
    {
        this.writePlayerData((EntityPlayerMP)this.playerEntityList.get(i));
    }
}
项目:CustomWorldGen    文件:PlayerList.java   
public List<EntityPlayerMP> getPlayersMatchingAddress(String address)
{
    List<EntityPlayerMP> list = Lists.<EntityPlayerMP>newArrayList();

    for (EntityPlayerMP entityplayermp : this.playerEntityList)
    {
        if (entityplayermp.getPlayerIP().equals(address))
        {
            list.add(entityplayermp);
        }
    }

    return list;
}
项目:pnc-repressurized    文件:CommandGetGlobalVariable.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    if (sender instanceof EntityPlayerMP) {
        if (args.length != 1) throw new WrongUsageException("command.deliverAmazon.args");
        String varName = args[0].startsWith("#") ? args[0].substring(1) : args[0];
        BlockPos pos = GlobalVariableManager.getInstance().getPos(varName);
        ItemStack stack = GlobalVariableManager.getInstance().getItem(varName);
        NetworkHandler.sendTo(new PacketCommandGetGlobalVariableOutput(varName, pos, stack), (EntityPlayerMP) sender);
    }
}
项目:CraftingParadiseMod    文件:EntityHandler.java   
@SubscribeEvent()
public void onJoinWorld(EntityJoinWorldEvent event)
{
    Entity entity = event.getEntity();
    if(entity instanceof EntityPlayer)
    {
        if(event.getWorld() != null)
        {
            if(!event.getWorld().isRemote) //Server-side
            {
                CraftingParadiseSaveData.get(event.getWorld());
                PlanetModule core = ActivePlanet.coreModule;
                PlanetModule mantle = ActivePlanet.mantleModule;
                PlanetModule crust = ActivePlanet.crustModule;
                PlanetModule land = ActivePlanet.landscapeModule;
                PlanetModule worldType = ActivePlanet.worldModule;
                PlanetModule atmos = ActivePlanet.atmosphereModule;

                int coreID = core == null ? -1 : core.moduleId;
                int mantleID = mantle == null ? -1 : mantle.moduleId;
                int crustID = crust == null ? -1 : crust.moduleId;
                int landID = land == null ? -1 : land.moduleId;
                int worldTypeID = worldType == null ? -1 : worldType.moduleId;
                int atmosID = atmos == null ? -1 : atmos.moduleId;

                PacketHandler.INSTANCE.sendTo(new MessageClientPlanetChange(coreID, mantleID, crustID, landID, worldTypeID, atmosID), (EntityPlayerMP) entity);
            }
        }
    }
}
项目:Proyecto-DASI    文件:JSONWorldDataHelper.java   
/** Builds the basic life world data to be used as observation signals by the listener.
 * @param json a JSON object into which the life stats will be added.
 */
public static void buildLifeStats(JsonObject json, EntityPlayerMP player)
{
    json.addProperty("Life", player.getHealth());
    json.addProperty("Score", player.getScore());    // Might always be the same as XP?
    json.addProperty("Food", player.getFoodStats().getFoodLevel());
    json.addProperty("XP", player.experienceTotal);
    json.addProperty("IsAlive", !player.isDead);
    json.addProperty("Air", player.getAir());
    json.addProperty("Name", player.getName());
}
项目:ExPetrum    文件:ExPPlayer.java   
public static ExPPlayer createDefaultWithOwner(final EntityPlayer owner)
{
    final ExPPlayer defaultImpl = createDefault();
    defaultImpl.owner = owner;
    defaultImpl.isRemote = !(owner instanceof EntityPlayerMP);
    return defaultImpl;
}
项目:Backmemed    文件:WorldServer.java   
private void sendPacketWithinDistance(EntityPlayerMP player, boolean longDistance, double x, double y, double z, Packet<?> packetIn)
{
    BlockPos blockpos = player.getPosition();
    double d0 = blockpos.distanceSq(x, y, z);

    if (d0 <= 1024.0D || longDistance && d0 <= 262144.0D)
    {
        player.connection.sendPacket(packetIn);
    }
}
项目:Proyecto-DASI    文件:ObservationFromFullStatsImplementation.java   
@Override
void buildJson(JsonObject json, EntityPlayerMP player, ObservationRequestMessage message, MessageContext ctx)
{
    JSONWorldDataHelper.buildAchievementStats(json, player);
    JSONWorldDataHelper.buildLifeStats(json, player);
    JSONWorldDataHelper.buildPositionStats(json, player);
    JSONWorldDataHelper.buildEnvironmentStats(json, player);
}
项目:VillagerInventory    文件:ModConfiguration.java   
@SubscribeEvent
public static void onPlayerLoggedIn(PlayerLoggedInEvent event)
{
    if (!event.player.world.isRemote)
    {
        VillagerInventoryMod.NETWORK.sendTo(new ConfigSyncMessage(), (EntityPlayerMP)event.player);
    }
}
项目:pnc-repressurized    文件:ItemAmadronTablet.java   
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
    if (handIn != EnumHand.MAIN_HAND) return ActionResult.newResult(EnumActionResult.PASS, playerIn.getHeldItem(handIn));
    if (!worldIn.isRemote) {
        NetworkHandler.sendTo(new PacketSyncAmadronOffers(AmadronOfferManager.getInstance().getAllOffers()), (EntityPlayerMP) playerIn);
        playerIn.openGui(PneumaticCraftRepressurized.instance, EnumGuiId.AMADRON.ordinal(), playerIn.world, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ);
    }
    return ActionResult.newResult(EnumActionResult.SUCCESS, playerIn.getHeldItemMainhand());
}
项目:pnc-repressurized    文件:TubeModule.java   
public boolean onActivated(EntityPlayer player) {
    if (!player.world.isRemote && upgraded && getGuiId() != null) {
        NetworkHandler.sendTo(new PacketOpenTubeModuleGui(getGuiId().ordinal(), pressureTube.pos()), (EntityPlayerMP) player);
        return true;
    }
    return false;
}
项目:minecraft-quiverbow    文件:NetHelper.java   
public static void sendKickbackMessage(Entity user, byte strength)
{
    if (user instanceof EntityPlayerMP)
    {
        IMessage msg = new KickbackMessage(strength);
        PacketHandler.net.sendTo(msg, (EntityPlayerMP) user);
    }
}
项目:pnc-repressurized    文件:TileEntityProgrammableController.java   
@Override
public EntityPlayerMP getFakePlayer() {
    if (fakePlayer == null) initializeFakePlayer();
    if (droneItems != null) {
        for (int i = 0; i < droneItems.getSlots(); i++) {
            fakePlayer.inventory.setInventorySlotContents(i, droneItems.getStackInSlot(i).copy());
        }
        droneItems = null;
    }
    return fakePlayer;
}
项目:BaseClient    文件:EntityTrackerEntry.java   
/**
 * Remove a tracked player from our list and tell the tracked player to destroy us from their world.
 */
public void removeTrackedPlayerSymmetric(EntityPlayerMP playerMP)
{
    if (this.trackingPlayers.contains(playerMP))
    {
        this.trackingPlayers.remove(playerMP);
        playerMP.removeEntity(this.trackedEntity);
    }
}
项目:Scripty    文件:ScriptyBlock.java   
public void parse() {
    if (isParsing() || owner == null) {
        System.out.println("not parsing because no owner/already parsing");
        return;
    }
    setParsing(true);
    ListenableFuture<Object> future = owner.getServer().addScheduledTask(() -> {
        try {
            String content = getContent();
            ScriptLanguage language = getLanguage();
            if (language.getEngine() == null) {
                System.out.println("WARNING: " + language + " has no engine associated.");
            } else {
                language.getEngine().eval(content);
            }
        } catch (ScriptException e) {
            throw new RuntimeException(e);
        }
    });
    Futures.addCallback(future, new FutureCallback<Object>() {
        @Override
        public void onSuccess(@Nullable Object result) {
            setParsing(false);
            if (owner != null) {
                ScriptyNetworkHandler.sendContentMessage((EntityPlayerMP) owner, pos, content, language, parsing);
            }
        }

        @Override
        public void onFailure(Throwable t) {
            setParsing(false);
            if (owner != null) {
                ScriptyNetworkHandler.sendContentMessage((EntityPlayerMP) owner, pos, content, language, parsing);
            }
        }
    });
}
项目:BaseClient    文件:EntityTracker.java   
public void removePlayerFromTrackers(EntityPlayerMP p_72787_1_)
{
    for (EntityTrackerEntry entitytrackerentry : this.trackedEntities)
    {
        entitytrackerentry.removeTrackedPlayerSymmetric(p_72787_1_);
    }
}
项目:Minecoprocessors    文件:MessageProcessorAction.java   
@Override
public IMessage onMessage(final MessageProcessorAction message, MessageContext ctx) {
  if (message.action == null) {
    return null;
  }
  final EntityPlayerMP payer = ctx.getServerHandler().player;
  payer.getServerWorld().addScheduledTask(new Worker(payer, message));
  return null;
}