java类net.minecraft.entity.player.EntityPlayerMP的实例源码

ItemCandelillaSeeds.java 文件源码 项目:GardenStuff 阅读 14 收藏 0 点赞 0 评论 0
@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;
}
CommandResetStat.java 文件源码 项目:Mods 阅读 28 收藏 0 点赞 0 评论 0
@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]);
    }
}
PlayerList.java 文件源码 项目:CustomWorldGen 阅读 27 收藏 0 点赞 0 评论 0
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);
}
PlayerList.java 文件源码 项目:Backmemed 阅读 18 收藏 0 点赞 0 评论 0
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);
            }
        }
    }
}
ServerConfigurationManager.java 文件源码 项目:BaseClient 阅读 19 收藏 0 点赞 0 评论 0
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);
            }
        }
    }
}
NetworkItemWirelessCraftingGrid.java 文件源码 项目:refinedstorageaddons 阅读 16 收藏 0 点赞 0 评论 0
@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;
}
ServerConfigurationManager.java 文件源码 项目:BaseClient 阅读 17 收藏 0 点赞 0 评论 0
/**
 * 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_);
            }
        }
    }
}
PlayerChunkMap.java 文件源码 项目:CustomWorldGen 阅读 18 收藏 0 点赞 0 评论 0
/**
 * 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();
}
EntityAIFindEntityNearest.java 文件源码 项目:BaseClient 阅读 27 收藏 0 点赞 0 评论 0
/**
 * 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();
    }
}
CommandTPP.java 文件源码 项目:tp-plus 阅读 15 收藏 0 点赞 0 评论 0
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);
    }
}
ExPHandlerServer.java 文件源码 项目:ExPetrum 阅读 28 收藏 0 点赞 0 评论 0
@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);
        }
    }
}
JSONWorldDataHelper.java 文件源码 项目:Proyecto-DASI 阅读 18 收藏 0 点赞 0 评论 0
/** 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)
    */
}
CraftPlayer.java 文件源码 项目:Uranium 阅读 22 收藏 0 点赞 0 评论 0
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());
}
PortalGunItem.java 文件源码 项目:MeeCreeps 阅读 14 收藏 0 点赞 0 评论 0
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);
    }
}
WorldServer.java 文件源码 项目:BaseClient 阅读 19 收藏 0 点赞 0 评论 0
/**
 * 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);
        }
    }
}
ServerConfigurationManager.java 文件源码 项目:BaseClient 阅读 21 收藏 0 点赞 0 评论 0
/**
 * 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();
    }
}
MessageClientUpdate.java 文件源码 项目:FirstAid 阅读 14 收藏 0 点赞 0 评论 0
@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;
}
PlayerList.java 文件源码 项目:Backmemed 阅读 30 收藏 0 点赞 0 评论 0
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());
}
S38PacketPlayerListItem.java 文件源码 项目:DecompiledMinecraft 阅读 52 收藏 0 点赞 0 评论 0
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()));
    }
}
CmdReload.java 文件源码 项目:World-Border 阅读 16 收藏 0 点赞 0 评论 0
@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.");
}
MessageUpdatePitchYaw.java 文件源码 项目:MineCamera 阅读 15 收藏 0 点赞 0 评论 0
@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;
}
EntityElderGuardian.java 文件源码 项目:Backmemed 阅读 25 收藏 0 点赞 0 评论 0
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);
    }
}
ItemNetworkPicker.java 文件源码 项目:refinedstorageaddons 阅读 15 收藏 0 点赞 0 评论 0
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);
    }
}
ServerConfigurationManager.java 文件源码 项目:BaseClient 阅读 24 收藏 0 点赞 0 评论 0
/**
 * 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));
    }
}
PlayerList.java 文件源码 项目:CustomWorldGen 阅读 23 收藏 0 点赞 0 评论 0
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;
}
CommandGetGlobalVariable.java 文件源码 项目:pnc-repressurized 阅读 18 收藏 0 点赞 0 评论 0
@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);
    }
}
EntityHandler.java 文件源码 项目:CraftingParadiseMod 阅读 25 收藏 0 点赞 0 评论 0
@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);
            }
        }
    }
}
JSONWorldDataHelper.java 文件源码 项目:Proyecto-DASI 阅读 14 收藏 0 点赞 0 评论 0
/** 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());
}
ExPPlayer.java 文件源码 项目:ExPetrum 阅读 16 收藏 0 点赞 0 评论 0
public static ExPPlayer createDefaultWithOwner(final EntityPlayer owner)
{
    final ExPPlayer defaultImpl = createDefault();
    defaultImpl.owner = owner;
    defaultImpl.isRemote = !(owner instanceof EntityPlayerMP);
    return defaultImpl;
}
WorldServer.java 文件源码 项目:Backmemed 阅读 18 收藏 0 点赞 0 评论 0
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);
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号