Examples of MorphInfo


Examples of morph.common.morph.MorphInfo

    {
        EntityPlayer player1 = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(playerName);
        if(player1 != null)
        {
            player1.ignoreFrustumCheck = true;
            MorphInfo info = Morph.proxy.tickHandlerClient.playerMorphInfo.get(playerName);
            if(info != null)
            {
                player1.setSize(info.nextState.entInstance.width, info.nextState.entInstance.height);
                player1.setPosition(player1.posX, player1.posY, player1.posZ);
                player1.eyeHeight = player1.getDefaultEyeHeight();
View Full Code Here

Examples of morph.common.morph.MorphInfo

    }

    @Override
    public void execute(Side side, EntityPlayer player)
    {
        MorphInfo info = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player);

        if(!(info != null && info.getMorphing()) || input == 2)
        {
            MorphState state = MorphHandler.getMorphState((EntityPlayerMP)player, identifier);

            if(state != null)
            {
                switch(input)
                {
                    case 0:
                    {
                        //select
                        MorphState old = info != null ? info.nextState : Morph.proxy.tickHandlerServer.getSelfState(player.worldObj, player);

                        MorphInfo info2 = new MorphInfo(player.getCommandSenderName(), old, state);
                        info2.setMorphing(true);
                        info2.healthOffset = player.getEntityAttribute(SharedMonsterAttributes.maxHealth).getBaseValue() - 20D;
                        info2.preMorphHealth = player.getHealth();

                        MorphInfo info3 = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player);
                        if(info3 != null)
                        {
                            info2.morphAbilities = info3.morphAbilities;
                            info2.healthOffset = info3.healthOffset;
View Full Code Here

Examples of morph.common.morph.MorphInfo

                  player.addExhaustion(0.002F);
                }
               
        if(player.worldObj.isRemote && player.isInWater() && slowdownInWater)
                {
                  MorphInfo info = Morph.proxy.tickHandlerClient.playerMorphInfo.get(player.getCommandSenderName());
             
              if(info != null)
              {
                boolean swim = false;
                for(Ability ability : info.morphAbilities)
View Full Code Here

Examples of morph.common.morph.MorphInfo

                }
            }
            if(event.target instanceof EntityPlayer)
            {
                EntityPlayer player = (EntityPlayer)event.target;
                MorphInfo info = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player);

                if(info != null)
                {
                    for(Ability ab : info.morphAbilities)
                    {
                        if(ab instanceof AbilityFear)
                        {
                            AbilityFear abFear = (AbilityFear)ab;
                            for(Class clz : abFear.classList)
                            {
                                if(clz.isInstance(event.entityLiving))
                                {
                                    event.entityLiving.setRevengeTarget(null);
                                    if(event.entityLiving instanceof EntityLiving)
                                    {
                                        ((EntityLiving)event.entityLiving).setAttackTarget(null);
                                    }
                                }
                            }
                            break;
                        }
                    }

                    if(Morph.config.getInt("hostileAbilityMode") > 0 && hostile)
                    {
                        if(!info.getMorphing() && info.morphProgress >= 80)
                        {
                            boolean playerHostile = false;
                            for(Ability ab : info.morphAbilities)
                            {
                                if(ab.getType().equalsIgnoreCase("hostile"))
View Full Code Here

Examples of morph.common.morph.MorphInfo

    public void onSetupFog(EntityViewRenderEvent.FogColors event)
    {
        EntityPlayer player = Minecraft.getMinecraft().thePlayer;
        if(player != null && Morph.proxy.tickHandlerClient.playerMorphInfo.get(player.getCommandSenderName()) != null)
        {
            MorphInfo info = Morph.proxy.tickHandlerClient.playerMorphInfo.get(player.getCommandSenderName());
            if(!info.getMorphing() && info.morphProgress >= 80 || info.getMorphing() && info.morphProgress <= 80)
            {
                for(Ability ab: info.morphAbilities)
                {
                    if(ab.getType().equalsIgnoreCase("swim"))
                    {
                        AbilitySwim abilitySwim = (AbilitySwim)ab;
                        if(!abilitySwim.canSurviveOutOfWater)
                        {
                            if(player.isInWater())
                            {
                                float multi = 7.5F;

                                boolean hasSwim = false;
                                ArrayList<Ability> mobAbilities = AbilityHandler.getEntityAbilities(info.nextState.entInstance.getClass());
                                for(Ability ab1 : mobAbilities)
                                {
                                    if(ab1.getType().equalsIgnoreCase("swim"))
                                    {
                                        hasSwim = true;
                                        break;
                                    }
                                }

                                boolean alsoHasSwim = false;
                                mobAbilities = AbilityHandler.getEntityAbilities(info.prevState.entInstance.getClass());
                                for(Ability ab1 : mobAbilities)
                                {
                                    if(ab1.getType().equalsIgnoreCase("swim"))
                                    {
                                        alsoHasSwim = true;
                                        break;
                                    }
                                }

                                if(info.getMorphing())
                                {
                                    if(!hasSwim)
                                    {
                                        multi -= 6.5F * MathHelper.clamp_float((float)info.morphProgress / 80F, 0.0F, 1.0F);
                                    }
View Full Code Here

Examples of morph.common.morph.MorphInfo

                        FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().readPlayerDataFromFile(player1);
                        if(Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).hasKey("morphData"))
                        {
                            MorphState state = Morph.proxy.tickHandlerServer.getSelfState(DimensionManager.getWorld(0), player1);

                            MorphInfo info = new MorphInfo(args[1], state, state);
                            info.morphProgress = 80;
                            info.healthOffset = Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).getDouble("healthOffset");

                            Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).removeTag("morphData");

                            PacketHandler.sendToAll(Morph.channels, info.getMorphInfoAsPacket());

                            Morph.proxy.tickHandlerServer.setPlayerMorphInfo(player1, null);

                            func_152373_a(icommandsender, this, "morph.command.forcingDemorph", args[1]);

                            //Workaround to force save.
                            FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList.add(player1);
                            FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().saveAllPlayerData();
                            FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList.remove(player1);
                        }
                        else
                        {
                            icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.noMorphData", args[1]));
                        }
                    }
                    catch(Exception e)
                    {
                        icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.cannotReadMorphData", args[1]));
                    }
                }
                else
                {
                    icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.notOnline", args[1]));
                }
            }
            else if(args[0].equalsIgnoreCase("clear"))
            {
                EntityPlayer player;
                if(args.length > 1)
                {
                    player = PlayerSelector.matchOnePlayer(icommandsender, args[1]);
                }
                else
                {
                    player = getCommandSenderAsPlayer(icommandsender);
                }
                if (player == null)
                {
                    player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(args[1]);
                }
                if(player != null)
                {
                    MorphInfo info = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player);

                    MorphState state1;

                    MorphState state2 = Morph.proxy.tickHandlerServer.getSelfState(player.worldObj, player);

                    if(info != null)
                    {
                        state1 = info.nextState;
                        MorphInfo info2 = new MorphInfo(player.getCommandSenderName(), state1, state2);
                        info2.setMorphing(true);
                        info2.healthOffset = info.healthOffset;
                        info2.preMorphHealth = player.getHealth();

                        Morph.proxy.tickHandlerServer.setPlayerMorphInfo(player, info2);

                        PacketHandler.sendToAll(Morph.channels, info2.getMorphInfoAsPacket());

                        player.worldObj.playSoundAtEntity(player, "morph:morph", 1.0F, 1.0F);
                    }
                    Morph.proxy.tickHandlerServer.removeAllPlayerMorphsExcludingCurrentMorph(player);

                    MorphHandler.updatePlayerOfMorphStates((EntityPlayerMP)player, null, true);

                    func_152373_a(icommandsender, this, "morph.command.clearingMorphs", args[1]);
                }
                else
                {
                    try
                    {
                        EntityPlayerMP player1 = new EntityPlayerMP(FMLCommonHandler.instance().getMinecraftServerInstance(), DimensionManager.getWorld(0), EntityHelperBase.getSimpleGameProfileFromName(args[1]), new ItemInWorldManager(DimensionManager.getWorld(0)));
                        FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().readPlayerDataFromFile(player1);

                        if(Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).hasKey("morphData"))
                        {
                            MorphState state = Morph.proxy.tickHandlerServer.getSelfState(DimensionManager.getWorld(0), player1);

                            MorphInfo info = new MorphInfo(args[1], state, state);
                            info.morphProgress = 80;
                            info.healthOffset = Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).getDouble("healthOffset");

                            Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).removeTag("morphData");

                            PacketHandler.sendToAll(Morph.channels, info.getMorphInfoAsPacket());

                            Morph.proxy.tickHandlerServer.setPlayerMorphInfo(player1, null);
                        }
                        Morph.proxy.tickHandlerServer.removeAllPlayerMorphsExcludingCurrentMorph(player1);
                        if(Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).hasKey("morphStatesCount"))
                        {
                            Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).removeTag("morphStatesCount");
                        }
                        func_152373_a(icommandsender, this, "morph.command.clearingMorphs", args[1]);

                        FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList.add(player1);
                        FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().saveAllPlayerData();
                        FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList.remove(player1);
                    }
                    catch(Exception e)
                    {
                        icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.failToClear", args[1]));
                    }
                }
            }
            else if(args[0].equalsIgnoreCase("morphtarget"))
            {
                EntityPlayerMP player;
                if(args.length > 1)
                {
                    player = PlayerSelector.matchOnePlayer(icommandsender, args[1]);
                }
                else
                {
                    player = getCommandSenderAsPlayer(icommandsender);
                }
                if (player == null)
                {
                    player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(args[1]);
                }
                if(player != null)
                {
                    MovingObjectPosition mop = EntityHelper.getEntityLook(player, 4D, false, 1.0F);
                    if(mop != null && mop.entityHit != null && mop.entityHit instanceof EntityLivingBase)
                    {
                        EntityLivingBase living = (EntityLivingBase)mop.entityHit;

                        if(living instanceof EntityPlayerMP)
                        {
                            EntityPlayerMP player1 = (EntityPlayerMP)living;

                            MorphInfo info = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player1);
                            if(info != null)
                            {
                                if(info.getMorphing())
                                {
                                    living = info.prevState.entInstance;
                                }
                                else
                                {
View Full Code Here

Examples of morph.common.morph.MorphInfo

    }
  }
 
  public static float morphProgress(String playerName, boolean isClient)
  {
    MorphInfo info;
    if(isClient)
    {
      info = Morph.proxy.tickHandlerClient.playerMorphInfo.get(playerName);
    }
    else
View Full Code Here

Examples of morph.common.morph.MorphInfo

    return 1.0F;
  }
 
  public static EntityLivingBase getPrevMorphEntity(String playerName, boolean isClient)
  {
    MorphInfo info;
    if(isClient)
    {
      info = Morph.proxy.tickHandlerClient.playerMorphInfo.get(playerName);
    }
    else
View Full Code Here

Examples of morph.common.morph.MorphInfo

    return null;
  }
 
  public static EntityLivingBase getMorphEntity(String playerName, boolean isClient)
  {
    MorphInfo info;
    if(isClient)
    {
      info = Morph.proxy.tickHandlerClient.playerMorphInfo.get(playerName);
    }
    else
View Full Code Here

Examples of morph.common.morph.MorphInfo

      return false;
    }

        //TODO throw a morph acquired event
   
    MorphInfo info = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player);
   
//        EntityGiantZombie zomb = new EntityGiantZombie(living.worldObj);
//        zomb.setLocationAndAngles(event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, event.entityLiving.rotationYaw, event.entityLiving.rotationPitch);
//        event.entityLiving.worldObj.spawnEntityInWorld(zomb);
   
    if(!(living.writeToNBTOptional(new NBTTagCompound()) && !(living instanceof EntityPlayer) || living instanceof EntityPlayer))
    {
      return false;
    }
   
    if(info == null)
    {
      info = new MorphInfo(player.getCommandSenderName(), null, Morph.proxy.tickHandlerServer.getSelfState(player.worldObj, player));
    }
    else if(info.getMorphing() || info.nextState.entInstance == living)
    {
      return false;
    }
   
    byte isPlayer = (byte)((info.nextState.entInstance instanceof EntityPlayer && living instanceof EntityPlayer) ? 3 : info.nextState.entInstance instanceof EntityPlayer ? 1 : living instanceof EntityPlayer ? 2 : 0);
   
    if(!(info.nextState.entInstance instanceof EntityPlayer) && !info.nextState.entInstance.writeToNBTOptional(new NBTTagCompound()))
    {
      return false;
    }
   
    String username1 = (isPlayer == 1 || isPlayer == 3) ? ((EntityPlayer)info.nextState.entInstance).getCommandSenderName() : "";
    String username2 = (isPlayer == 2 || isPlayer == 3) ? ((EntityPlayer)living).getCommandSenderName() : "";
   
    NBTTagCompound prevTag = new NBTTagCompound();
    NBTTagCompound nextTag = new NBTTagCompound();

    info.nextState.entInstance.writeToNBTOptional(prevTag);
    living.writeToNBTOptional(nextTag);
   
    MorphState prevState = new MorphState(player.worldObj, player.getCommandSenderName(), username1, prevTag, false);
    MorphState nextState = new MorphState(player.worldObj, player.getCommandSenderName(), username2, nextTag, false);

        if(Morph.proxy.tickHandlerServer.hasMorphState(player, nextState) || !forced && MinecraftForge.EVENT_BUS.post(new MorphAcquiredEvent(player, nextState.entInstance)))
    {
      return false;
    }
   
    prevState = MorphHandler.addOrGetMorphState(Morph.proxy.tickHandlerServer.getPlayerMorphs(player.worldObj, player), prevState);
    nextState = MorphHandler.addOrGetMorphState(Morph.proxy.tickHandlerServer.getPlayerMorphs(player.worldObj, player), nextState);
   
    if(nextState.identifier.equalsIgnoreCase(info.nextState.identifier))
    {
      return false;
    }
   
    if(Morph.config.getInt("instaMorph") == 1 || forced)
    {
            //TODO make a general function to morph the player
      MorphInfo info2 = new MorphInfo(player.getCommandSenderName(), prevState, nextState);
      info2.setMorphing(true);
            info2.healthOffset = player.getEntityAttribute(SharedMonsterAttributes.maxHealth).getBaseValue() - 20D;
            info2.preMorphHealth = player.getHealth();

      MorphInfo info3 = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player);
      if(info3 != null)
      {
        info2.morphAbilities = info3.morphAbilities;
                info2.healthOffset = info3.healthOffset;
      }
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.