Package net.minecraft.entity.player

Examples of net.minecraft.entity.player.EntityPlayerMP


    }

    @Override
    public void onTeleport(EntityPlayerMP player)
    {
        final EntityPlayerMP playerBase = PlayerUtil.getPlayerBaseServerFromPlayer(player, false);

        if (playerBase != null)
        {
            GCPlayerStats stats = GCPlayerStats.get(player);
View Full Code Here


    }

    @Override
    public void handleServerSide(EntityPlayer player)
    {
        EntityPlayerMP playerBase = PlayerUtil.getPlayerBaseServerFromPlayer(player, false);

        switch (this.type)
        {
        case S_UPDATE_ADVANCED_GUI:
            TileEntity tile = player.worldObj.getTileEntity((Integer) this.data.get(1), (Integer) this.data.get(2), (Integer) this.data.get(3));
View Full Code Here

        {
            world.setBlockToAir(x0, y0, z0);

            if (!world.isRemote && entity instanceof EntityPlayerMP)
            {
                EntityPlayerMP player = (EntityPlayerMP) entity;
                player.addChatMessage(new ChatComponentText(EnumColor.RED + GCCoreUtil.translate("gui.warning.noroom")));
                ItemStack itemstack = new ItemStack(this, 1, 0);
                EntityItem entityitem = player.dropPlayerItemWithRandomChoice(itemstack, false);
                entityitem.delayBeforeCanPickup = 0;
                entityitem.func_145797_a(player.getCommandSenderName());
            }

            return;
        }
View Full Code Here

                return getPlayerForUsernameVanilla(server, username);
            }
            else
            {
                Iterator iterator = server.getConfigurationManager().playerEntityList.iterator();
                EntityPlayerMP entityplayermp;

                do
                {
                    if (!iterator.hasNext())
                    {
                        return null;
                    }

                    entityplayermp = (EntityPlayerMP) iterator.next();
                }
                while (!entityplayermp.getCommandSenderName().equalsIgnoreCase(username));

                return entityplayermp;
            }
        }
View Full Code Here

    {
        if (this.player instanceof EntityPlayerMP)
        {
            for (int var12 = 0; var12 < this.player.worldObj.playerEntities.size(); ++var12)
            {
                final EntityPlayerMP var13 = (EntityPlayerMP) this.player.worldObj.playerEntities.get(var12);

                if (var13.dimension == this.player.worldObj.provider.dimensionId)
                {
                    final double var14 = this.x - var13.posX;
                    final double var16 = this.y - var13.posY;
View Full Code Here

   
   
    @Override
    public void handleCommand(String command, String playername, String[] args, WCommandSender listener)
    {
        EntityPlayerMP player = (EntityPlayerMP)listener.wrapped;
        handleCommand(getWorld(player), player, args);
    }
View Full Code Here

        //Not launch controlled
        if (this.riddenByEntity != null && !this.worldObj.isRemote)
        {
            if (this.riddenByEntity instanceof EntityPlayerMP)
            {
                EntityPlayerMP player = (EntityPlayerMP) this.riddenByEntity;

                this.onTeleport(player);
                GCPlayerStats stats = GCPlayerStats.get(player);
                WorldUtil.toCelestialSelection(player, stats, this.getRocketTier());
View Full Code Here

        // collisionFlag, !collisionFlag);
    }

    public static void teleportEntity(EntityPlayer entityPlayer, MovingObjectPosition hitMOP) {
        if (hitMOP != null && entityPlayer instanceof EntityPlayerMP) {
            EntityPlayerMP player = (EntityPlayerMP) entityPlayer;
            if (player.playerNetServerHandler.netManager.isChannelOpen()) {
                switch (hitMOP.typeOfHit) {
                    case ENTITY:
                        player.setPositionAndUpdate(hitMOP.hitVec.xCoord, hitMOP.hitVec.yCoord, hitMOP.hitVec.zCoord);
                        break;
                    case BLOCK:
                        double hitx = hitMOP.hitVec.xCoord;
                        double hity = hitMOP.hitVec.yCoord;
                        double hitz = hitMOP.hitVec.zCoord;
                        switch (hitMOP.sideHit) {
                            case 0: // Bottom
                                hity -= 2;
                                break;
                            case 1: // Top
                                // hity += 1;
                                break;
                            case 2: // East
                                hitz -= 0.5;
                                break;
                            case 3: // West
                                hitz += 0.5;
                                break;
                            case 4: // North
                                hitx -= 0.5;
                                break;
                            case 5: // South
                                hitx += 0.5;
                                break;
                        }
                        player.setPositionAndUpdate(hitx, hity, hitz);
                        break;
                    default:
                        break;

                }
View Full Code Here

                icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.addtolist").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GRAY)));
                icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.removefromlist").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GRAY)));
            }
            else if(args[0].equalsIgnoreCase("demorph"))
            {
                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)
                {
                    if(EntityHelper.demorphPlayer(player))
                    {
                        func_152373_a(icommandsender, this, "morph.command.forcingDemorph", player.getCommandSenderName());
                    }
                    else
                    {
                        icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.notInMorph", player.getCommandSenderName()));
                    }
                }
                else if(args.length > 2 && args[2].equalsIgnoreCase("true"))
                {
                    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);

                            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())
View Full Code Here

    {
        if(!event.entityLiving.worldObj.isRemote)
        {
            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
                        {
                            living = info.nextState.entInstance;
                        }
                    }
                }

                if(EntityHelper.morphPlayer(player, living, true) && !(event.entityLiving instanceof EntityPlayerMP) && !(event.entityLiving instanceof IBossDisplayData))
                {
                    living.setDead();
                }
            }
            if(Morph.classToKillForFlight != null && Morph.classToKillForFlight.isInstance(event.entityLiving)|| Morph.classToKillForFlight == null &&  event.entityLiving instanceof EntityWither)
            {
                if(event.source.getEntity() instanceof EntityPlayerMP)
                {
                    EntityPlayerMP player = (EntityPlayerMP)event.source.getEntity();

                    boolean firstKill = !Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player).getBoolean("hasKilledWither");
                    Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player).setBoolean("hasKilledWither", true);
                    if(Morph.config.getInt("disableEarlyGameFlight") == 2 && firstKill)
                    {
View Full Code Here

TOP

Related Classes of net.minecraft.entity.player.EntityPlayerMP

Copyright © 2018 www.massapicom. 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.