Examples of PlayerData

  • org.cspoker.ai.opponentmodels.weka.PlayerData
    Class that tracks player statistics when playing games. @author guy

  • Examples of com.flansmod.common.PlayerData

                    team.sortPlayers();
                    data.writeInt(team.members.size());
                    for(int j = 0; j < team.members.size(); j++)
                    {
                      String username = team.members.get(j);
                      PlayerData playerData = PlayerHandler.getPlayerData(username, Side.SERVER);
                      writeUTF(data, username);
                      if(playerData == null)
                      {
                        data.writeInt(0);
                        data.writeInt(0);
                        data.writeInt(0);
                        writeUTF(data, "");
                      }
                      else
                      {
                        data.writeInt(playerData.score);
                        data.writeInt(playerData.zombieScore);
                        data.writeInt(playerData.kills);
                        data.writeInt(playerData.deaths);
                        writeUTF(data, playerData.playerClass.shortName);
                      }
                    }
                  }
                }
            }
            else
            {
              data.writeBoolean(false);
              ArrayList<String> playerNames = new ArrayList<String>();
              for(int i = 0; i < TeamsManager.getInstance().currentRound.teams.length; i++)
                {
                  Team team = TeamsManager.getInstance().currentRound.teams[i];
                  if(team == null || team.members == null)
                  {
                    continue;
                  }
                  playerNames.addAll(team.members);
                }
             
              Collections.sort(playerNames, new Team.ComparatorScore());
                data.writeInt(playerNames.size());
                for(int j = 0; j < playerNames.size(); j++)
                {
                  String username = playerNames.get(j);
                  PlayerData playerData = PlayerHandler.getPlayerData(username, Side.SERVER);
                  writeUTF(data, username);
                  if(playerData == null)
                  {
                    data.writeInt(0);
                    data.writeInt(0);
    View Full Code Here

    Examples of com.flansmod.common.PlayerData

      public void renderOffHandGun(RenderPlayerEvent.Specials.Post event)
      {
        RenderPlayer renderer = event.renderer;
        EntityPlayer player = event.entityPlayer;
        float dt = event.partialRenderTick;
        PlayerData data = PlayerHandler.getPlayerData(player, Side.CLIENT);
       
        ItemStack gunStack = null;
       
        //Check current stack is a one handed gun
        if(player instanceof EntityOtherPlayerMP)
    View Full Code Here

    Examples of com.flansmod.common.PlayerData

         
      //Handle player hiding / name tag removal for teams
      @SubscribeEvent
      public void renderLiving(RenderPlayerEvent.Pre event)
      {
        PlayerData data = PlayerHandler.getPlayerData(event.entityPlayer, Side.CLIENT);
       
        //Render debug boxes for player snapshots
        if(FlansMod.DEBUG && data != null)
        {
          if(data.snapshots[0] != null)
    View Full Code Here

    Examples of com.flansmod.common.PlayerData

        if(entity instanceof EntityPlayer && ((EntityPlayer)entity).inventory.getCurrentItem() == itemstack)
        {     
          //Get useful objects
          Minecraft mc = Minecraft.getMinecraft();
          EntityPlayer player = (EntityPlayer)entity;
          PlayerData data = PlayerHandler.getPlayerData(player, Side.CLIENT);
         
          //Play idle sounds
          if (soundDelay <= 0 && type.idleSound != null)
          {
            PacketPlaySound.sendSoundPacket(entity.posX, entity.posY, entity.posZ, FlansMod.soundRange, entity.dimension, type.idleSound, false);
            soundDelay = type.idleSoundLength;
          }
         
          //This code is not for deployables
          if (type.deployable)
            return;
         
         
          GameSettings gameSettings = FMLClientHandler.instance().getClient().gameSettings;
          //If in a GUI
          if(FMLClientHandler.instance().getClient().currentScreen != null)
          {
            if(FlansModClient.currentScope != null)
            {
              FlansModClient.currentScope = null;
              gameSettings.mouseSensitivity = FlansModClient.originalMouseSensitivity;
              gameSettings.thirdPersonView = FlansModClient.originalThirdPerson;
              gameSettings.fovSetting = FlansModClient.originalFOV;
           
          }
          //Do not shoot ammo bags, flags or dropped gun items
          else if(mc.objectMouseOver != null && (mc.objectMouseOver.entityHit instanceof EntityFlagpole || mc.objectMouseOver.entityHit instanceof EntityFlag || mc.objectMouseOver.entityHit instanceof EntityGunItem || (mc.objectMouseOver.entityHit instanceof EntityGrenade && ((EntityGrenade)mc.objectMouseOver.entityHit).type.isDeployableBag)))
          {
           
          }
          //Else do shoot code
          else
          {
            //Get whether mice are held
            lastRightMouseHeld = rightMouseHeld;
            lastLeftMouseHeld = leftMouseHeld;
            rightMouseHeld = Mouse.isButtonDown(1);
            leftMouseHeld = Mouse.isButtonDown(0);
           
           
            boolean offHandFull = false;
           
            //----------------------------- Off hand item ---------------------------------------------------------------------
            if(type.oneHanded)
            {
              if(data.offHandGunSlot == player.inventory.currentItem + 1)
                data.offHandGunSlot = 0;
              //Cycle selection
              int dWheel = Mouse.getDWheel();
              if(Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode()) && dWheel != 0)
              {
                data.cycleOffHandItem(player, dWheel);
              }
             
              if(data.offHandGunSlot != 0)
              {
                offHandFull = true;
    View Full Code Here

    Examples of com.flansmod.common.PlayerData

     
      /** Client side shoot method for animations and delayers
       * @return whether to consume the gun item  */
      public boolean clientSideShoot(EntityPlayer player, ItemStack stack, GunType gunType, boolean left)
      {
        PlayerData data = PlayerHandler.getPlayerData(player);
        if(FlansModClient.shootTime(left) <= 0)
        {
          boolean hasAmmo = false;
          for(int i = 0; i < gunType.numAmmoItemsInGun; i++)
          {
    View Full Code Here

    Examples of com.flansmod.common.PlayerData

      public void onUpdateServer(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
      {
        if(entity instanceof EntityPlayerMP)
        {
          EntityPlayerMP player = (EntityPlayerMP)entity;
          PlayerData data = PlayerHandler.getPlayerData(player);
          if(data == null)
            return;
         
          if(player.inventory.getCurrentItem() != itemstack)
          {
    View Full Code Here

    Examples of com.flansmod.common.PlayerData

        else onUpdateServer(itemstack, world, pEnt, i, flag);
       
        if(pEnt instanceof EntityPlayer)
        {
          EntityPlayer player = (EntityPlayer)pEnt;
          PlayerData data = PlayerHandler.getPlayerData(player);
          if(data == null)
            return;
          //if(data.lastMeleePositions == null || data.lastMeleePositions.length != type.meleeDamagePoints.size())
          //{
          //  data.lastMeleePositions = new Vector3f[type.meleeDamagePoints.size()];
          //  for(int j = 0; j < type.meleeDamagePoints.size(); j++)
          //    data.lastMeleePositions[j] = new Vector3f(player.posX, player.posY, player.posZ);
          //}
          //Melee weapon
          if(data.meleeLength > 0 && type.meleePath.size() > 0 && player.inventory.getCurrentItem() == itemstack)
          {
            for(int k = 0; k < type.meleeDamagePoints.size(); k++)
            {
              Vector3f meleeDamagePoint = type.meleeDamagePoints.get(k);
              //Do a raytrace from the prev pos to the current pos and attack anything in the way
              Vector3f nextPos = type.meleePath.get((data.meleeProgress + 1) % type.meleePath.size());
              Vector3f nextAngles = type.meleePathAngles.get((data.meleeProgress + 1) % type.meleePathAngles.size());
              RotatedAxes nextAxes = new RotatedAxes().rotateGlobalRoll(-nextAngles.x).rotateGlobalPitch(-nextAngles.z).rotateGlobalYaw(-nextAngles.y);
             
              Vector3f nextPosInGunCoords = nextAxes.findLocalVectorGlobally(meleeDamagePoint);
              Vector3f.add(nextPos, nextPosInGunCoords, nextPosInGunCoords);
              Vector3f.add(new Vector3f(0F, 0F, 0F), nextPosInGunCoords, nextPosInGunCoords);
              Vector3f nextPosInPlayerCoords = new RotatedAxes(player.rotationYaw + 90F, player.rotationPitch, 0F).findLocalVectorGlobally(nextPosInGunCoords);
             
             
              if(!FlansMod.proxy.isThePlayer(player))
                nextPosInPlayerCoords.y += 1.6F;
             
              Vector3f nextPosInWorldCoords = new Vector3f(player.posX + nextPosInPlayerCoords.x, player.posY + nextPosInPlayerCoords.y, player.posZ + nextPosInPlayerCoords.z);
             
              Vector3f dPos = data.lastMeleePositions[k] == null ? new Vector3f() : Vector3f.sub(nextPosInWorldCoords, data.lastMeleePositions[k], null);
             
              if(player.worldObj.isRemote && FlansMod.DEBUG)
                player.worldObj.spawnEntityInWorld(new EntityDebugVector(player.worldObj, data.lastMeleePositions[k], dPos, 200, 1F, 0F, 0F));
             
              //Do the raytrace
              {
                //Create a list for all bullet hits
                ArrayList<BulletHit> hits = new ArrayList<BulletHit>();
                       
                //Iterate over all entities
                for(int j = 0; j < world.loadedEntityList.size(); j++)
                {
                  Object obj = world.loadedEntityList.get(j);
                  //Get players
                  if(obj instanceof EntityPlayer)
                  {
                    EntityPlayer otherPlayer = (EntityPlayer)obj;
                    PlayerData otherData = PlayerHandler.getPlayerData(otherPlayer);
                    boolean shouldDoNormalHitDetect = false;
                    if(otherPlayer == player)
                      continue;
                    if(otherData != null)
                    {
    View Full Code Here

    Examples of com.flansmod.common.PlayerData

        return new EntityDamageSourceGun(type.shortName, attacker, attacker, type, false);
      }
     
      public void onMouseHeld(ItemStack stack, World world, EntityPlayerMP player, boolean left, boolean isShooting)
      {
        PlayerData data = PlayerHandler.getPlayerData(player);
        if(data != null && data.shootClickDelay == 0)
        {
          //Drivers can't shoot
          if(player.ridingEntity instanceof EntitySeat && ((EntitySeat)player.ridingEntity).seatInfo.id == 0)
            return;
    View Full Code Here

    Examples of com.flansmod.common.PlayerData

       
      public ItemStack tryToShoot(ItemStack gunStack, GunType gunType, World world, EntityPlayerMP entityplayer, boolean left)
      {
        if(type.deployable)
          return gunStack;
        PlayerData data = PlayerHandler.getPlayerData(entityplayer);
        //Shoot delay ticker is at (or below) 0. Try and shoot the next bullet
        if((left && data.shootTimeLeft <= 0) || (!left && data.shootTimeRight <= 0))
        {
          //Go through the bullet stacks in the gun and see if any of them are not null
          int bulletID = 0;
    View Full Code Here

    Examples of com.flansmod.common.PlayerData

            animations.doMelee(type.meleeTime);
          }
          //Do custom melee hit detection
          if(entityLiving instanceof EntityPlayer)
          {
            PlayerData data = PlayerHandler.getPlayerData((EntityPlayer)entityLiving);
            data.doMelee((EntityPlayer)entityLiving, type.meleeTime, type);
          }
        }
        return type.secondaryFunction != EnumSecondaryFunction.MELEE;
      }
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. All rights reserved.
    All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.