Examples of MorphInfo


Examples of morph.common.morph.MorphInfo

    return true;
  }
 
  public static boolean demorphPlayer(EntityPlayerMP player)
  {
    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.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

    public void playerTick(TickEvent.PlayerTickEvent event)
    {
        if(event.phase == TickEvent.Phase.END && event.side.isServer())
        {
            EntityPlayer player = event.player;
            MorphInfo info = getPlayerMorphInfo(player);
            if(info != null)
            {
                float prog = info.morphProgress > 10 ? (((float)info.morphProgress) / 60F) : 0.0F;
                if(prog > 1.0F)
                {
View Full Code Here

Examples of morph.common.morph.MorphInfo

        {
            Iterator<Entry<String, MorphInfo>> ite = playerMorphInfo.entrySet().iterator();
            while(ite.hasNext())
            {
                Entry<String, MorphInfo> e = ite.next();
                MorphInfo info = e.getValue();

                EntityPlayer player = FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().func_152612_a(info.playerName);

                if(info.getMorphing())
                {
                    info.morphProgress++;
                    if(info.morphProgress > 80)
                    {
                        info.morphProgress = 80;
                        info.setMorphing(false);

                        if(player != null)
                        {
                            player.setSize(info.nextState.entInstance.width, info.nextState.entInstance.height);
                            player.setPosition(player.posX, player.posY, player.posZ);
View Full Code Here

Examples of morph.common.morph.MorphInfo

    public void onSetupFog(EntityViewRenderEvent.FogDensity 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)
                        {
                            GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP);
                            if(player.isInWater())
                            {
                                event.density = 0.025F;

                                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)
                                    {
                                        event.density += 0.05F * MathHelper.clamp_float((float)info.morphProgress / 80F, 0.0F, 1.0F);
                                    }
                                    else if(!alsoHasSwim)
                                    {
                                        event.density += 0.05F * MathHelper.clamp_float((80F - (float)info.morphProgress) / 80F, 0.0F, 1.0F);
                                    }
                                }
                            }
                            else
                            {
                                event.density = 0.075F;

                                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)
                                    {
                                        event.density -= 0.073F * MathHelper.clamp_float((float)info.morphProgress / 80F, 0.0F, 1.0F);
                                    }
View Full Code Here

Examples of morph.common.morph.MorphInfo

        if(event.entity instanceof EntityPlayer && event.name.equalsIgnoreCase("damage.hit"))
        {
            EntityPlayer player = (EntityPlayer)event.entity;
            if(FMLCommonHandler.instance().getEffectiveSide().isServer() && Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player) != null)
            {
                MorphInfo info = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player);
                event.name = EntityHelper.getHurtSound(info.nextState.entInstance.getClass(), info.nextState.entInstance);
            }
            else if(FMLCommonHandler.instance().getEffectiveSide().isClient() && Morph.proxy.tickHandlerClient.playerMorphInfo.containsKey(player.getCommandSenderName()))
            {
                MorphInfo info = Morph.proxy.tickHandlerClient.playerMorphInfo.get(player.getCommandSenderName());
                event.name = EntityHelper.getHurtSound(info.nextState.entInstance.getClass(), info.nextState.entInstance);
            }
        }
    }
View Full Code Here

Examples of morph.common.morph.MorphInfo

    public void onLivingHurt(LivingHurtEvent event)
    {
        if(event.source.getEntity() instanceof EntityPlayerMP && !(event.source instanceof EntityDamageSourceIndirect))
        {
            EntityPlayer player = (EntityPlayer)event.source.getEntity();
            MorphInfo info = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player);

            if(info != null && player.getCurrentEquippedItem() == null)
            {
                for(Ability ab : info.morphAbilities)
                {
View Full Code Here

Examples of morph.common.morph.MorphInfo

        {
            if(Morph.config.getInt("loseMorphsOnDeath") >= 1 && event.entityLiving instanceof EntityPlayerMP)
            {
                EntityPlayerMP player = (EntityPlayerMP)event.entityLiving;

                MorphInfo info = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player);

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

                if(Morph.config.getInt("loseMorphsOnDeath") == 1)
                {
                    Morph.proxy.tickHandlerServer.removeAllPlayerMorphsExcludingCurrentMorph(player);
                }
                else if(info != null && info.nextState != state)
                {
                    ArrayList<MorphState> states = Morph.proxy.tickHandlerServer.getPlayerMorphs(player.worldObj, player);
                    states.remove(info.nextState);
                }

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

                if(info != null && state != null)
                {
                    MorphInfo info2 = new MorphInfo(player.getCommandSenderName(), info.nextState, state);
                    info2.setMorphing(true);
                    info2.healthOffset = info.healthOffset;

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

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

                    player.worldObj.playSoundAtEntity(player, "morph:morph", 1.0F, 1.0F);
                }
            }
            if(event.source.getEntity() instanceof EntityPlayerMP && event.entityLiving != event.source.getEntity())
            {
                EntityPlayerMP player = (EntityPlayerMP)event.source.getEntity();

                EntityLivingBase living = event.entityLiving;

                if(event.entityLiving instanceof EntityPlayerMP)
                {
                    EntityPlayerMP player1 = (EntityPlayerMP)event.entityLiving;

                    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

        }

        NBTTagCompound tag1 = tag.getCompoundTag("morphData");
        if(tag1.hasKey("playerName"))
        {
            MorphInfo info = new MorphInfo();
            info.readNBT(tag1);
            if(!info.nextState.playerName.equals(info.nextState.playerMorph))
            {
                Morph.proxy.tickHandlerServer.setPlayerMorphInfo(event.player, info);
                MorphHandler.addOrGetMorphState(list, info.nextState);

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

        MorphHandler.updatePlayerOfMorphStates((EntityPlayerMP)event.player, null, true);
        for(Entry<String, MorphInfo> e : Morph.proxy.tickHandlerServer.playerMorphInfo.entrySet())
        {
            if(e.getKey().equalsIgnoreCase(event.player.getCommandSenderName()))
            {
                continue;
            }
            PacketHandler.sendToPlayer(Morph.channels, e.getValue().getMorphInfoAsPacket(), event.player);
        }

        MorphInfo info = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(event.player);

        if(info != null)
        {
            event.player.setSize(info.nextState.entInstance.width, info.nextState.entInstance.height);
            event.player.setPosition(event.player.posX, event.player.posY, event.player.posZ);
View Full Code Here

Examples of morph.common.morph.MorphInfo

    }

    @SubscribeEvent
    public void onPlayerLogout(PlayerEvent.PlayerLoggedOutEvent event)
    {
        MorphInfo info = Morph.proxy.tickHandlerServer.playerMorphInfo.get(event.player.getCommandSenderName());
        if(info != null)
        {
            if(info.morphProgress < 80)
            {
                info.morphProgress = 80;
                double nextMaxHealth = MathHelper.clamp_double(info.nextState.entInstance.getEntityAttribute(SharedMonsterAttributes.maxHealth).getBaseValue(), 1D, 20D) + info.healthOffset;

                if(nextMaxHealth < 1D)
                {
                    nextMaxHealth = 1D;
                }

                if(nextMaxHealth != event.player.getEntityAttribute(SharedMonsterAttributes.maxHealth).getBaseValue())
                {
                    event.player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(nextMaxHealth);
                }
            }

            NBTTagCompound tag1 = new NBTTagCompound();
            info.writeNBT(tag1);
            Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(event.player).setTag("morphData", tag1);
        }

        ArrayList<MorphState> states = Morph.proxy.tickHandlerServer.playerMorphs.get(event.player.getCommandSenderName());
        if(states != null)
View Full Code Here

Examples of morph.common.morph.MorphInfo

    }

    @SubscribeEvent
    public void onPlayerChangedDimension(PlayerEvent.PlayerChangedDimensionEvent event)
    {
        MorphInfo info = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(event.player);

        if(info != null)
        {
            event.player.setSize(info.nextState.entInstance.width, info.nextState.entInstance.height);
            event.player.setPosition(event.player.posX, event.player.posY, event.player.posZ);
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.