Java Code Examples for net.minecraft.entity.player.EntityPlayer#getCommandSenderName()

The following examples show how to use net.minecraft.entity.player.EntityPlayer#getCommandSenderName() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
public void equipTick(World world, EntityPlayer player, Aspect aspect) {
    if(world.isRemote) return;

    FamiliarData data = new FamiliarData(player.getCommandSenderName(), aspect.getTag());

    IInventory baublesInv = BaublesApi.getBaubles(player);
    if(baublesInv.getStackInSlot(0) == null) {
        handleUnequip(world, player, aspect);
        return;
    }

    if(familiarControllers.get(player) == null || !playersWithFamiliar.contains(data)) {
        handleEquip(world, player, aspect);
    }

    familiarControllers.get(player).tick();
}
 
Example 2
@Override
public void tick(int ticksSoFar, World world, EntityPlayer parent, ItemStack itemStack) {
    int rangeInc = ((ItemFamiliar_Old) itemStack.getItem()).getAttackRangeIncrease(itemStack);

    List<EntityLivingBase> lastTargetters = getPotentialTargets(world, parent, rangeInc);
    if(lastTargetters.size() == 0) {
        FamiliarAIController_Old.cleanTargetterList(parent);
        return;
    }
    EntityLivingBase mob = lastTargetters.get(world.rand.nextInt(lastTargetters.size()));
    if(mob.isDead || mob instanceof EntityPlayer) {
        FamiliarAIController_Old.cleanTargetterList(parent);
        return;
    }

    mob.attackEntityFrom(DamageSource.magic, ((ItemFamiliar_Old) itemStack.getItem()).getAttackStrength(itemStack));

    world.playSoundEffect(mob.posX + 0.5, mob.posY + 0.5, mob.posZ + 0.5, "thaumcraft:zap", 0.8F, 1.0F);

    PacketFamiliarBolt bolt = new PacketFamiliarBolt(parent.getCommandSenderName(), (float) mob.posX, (float) mob.posY, (float) mob.posZ, 6, true);
    PacketHandler.INSTANCE.sendToAllAround(bolt, new NetworkRegistry.TargetPoint(mob.worldObj.provider.dimensionId, mob.posX, mob.posY, mob.posZ, 32));
    FamiliarAIController_Old.cleanTargetterList(parent);
}
 
Example 3
Source Project: qcraft-mod   File: QCraft.java    License: Apache License 2.0 6 votes vote down vote up
public static void verifyUnverifiedLuggage( EntityPlayer instigator, EntityPlayer player )
{
    String username = player.getCommandSenderName();
    if( s_unverifiedLuggage.containsKey( username ) )
    {
        Set<byte[]> luggageSet = s_unverifiedLuggage.remove( username );

        boolean teleported = false;
        Iterator<byte[]> it = luggageSet.iterator();
        while( it.hasNext() )
        {
            byte[] signedLuggageData = it.next();
            if( unpackLuggage( instigator, player, signedLuggageData, true, teleported, true ) )
            {
                teleported = true;
            }
        }
    }
}
 
Example 4
@SideOnly(Side.CLIENT)
public static void playerRenderEvent(EntityPlayer player, float partialTicks) {
    String ownerName = player.getCommandSenderName();
    if(!clientFamiliars.containsKey(ownerName)) return;

    ExFamiliarData data = clientFamiliars.get(ownerName);
    PartialEntityFamiliar fam = data.familiar;

    Aspect aspect = Aspect.getAspect(data.data.aspectTag);

    if(ENTITY_WISP == null) ENTITY_WISP = new EntityWisp(new FakeWorld());
    ENTITY_WISP.setType(aspect.getTag());
    ENTITY_WISP.ticksExisted = fam.dummyEntity.ticksExisted;
    GL11.glPushMatrix();
    if(fam.owner == null || fam.owner.get() == null) {
        fam.owner = new WeakReference<EntityPlayer>(player);
    }
    EntityPlayer current = Minecraft.getMinecraft().thePlayer;
    double diffX = fam.renderX - current.posX + player.posX;
    double diffY = fam.renderY - current.posY + player.posY + 0.5;
    double diffZ = fam.renderZ - current.posZ + player.posZ;

    String currentPl = current.getCommandSenderName();
    String otherPl = player.getCommandSenderName();

    if(!currentPl.equals(otherPl)) {
        diffY += 1.32;

        EntityLivingBase entity = Minecraft.getMinecraft().renderViewEntity;
        diffX -= ((entity.posX - entity.lastTickPosX) * partialTicks);
        diffY -= ((entity.posY - entity.lastTickPosY) * partialTicks);
        diffZ -= ((entity.posZ - entity.lastTickPosZ) * partialTicks);
    }

    ItemRenderFamiliar.renderEntityWispFor(fam.owner.get(), ENTITY_WISP, diffX, diffY, diffZ, 0, partialTicks);
    GL11.glPopMatrix();
}
 
Example 5
public void handleEquip(World world, EntityPlayer player, Aspect aspect) {
    if(world.isRemote) return;

    String playerName = player.getCommandSenderName();
    FamiliarData data = new FamiliarData(playerName, aspect.getTag());

    if(!addClientQueue.contains(data)) addClientQueue.add(data);
    if(!playersWithFamiliar.contains(data)) playersWithFamiliar.add(data);
    markDirty();

    if(!familiarControllers.containsKey(player)) {
        FamiliarController controller = new FamiliarController(player);
        familiarControllers.put(player, controller);
    }
}
 
Example 6
public void handleUnequip(World world, EntityPlayer player, Aspect aspect) {
    if(world.isRemote) return;

    String playerName = player.getCommandSenderName();
    FamiliarData data = new FamiliarData(playerName, aspect.getTag());

    if(!removeClientQueue.contains(data)) removeClientQueue.add(data);
    if(playersWithFamiliar.contains(data)) playersWithFamiliar.remove(data);
    markDirty();

    familiarControllers.remove(player);
}
 
Example 7
public boolean setOwner(EntityPlayer player) {
    World world = getWorldObj();
    if(!world.isRemote && isValidOwner(player)) {
        this.player = player.getCommandSenderName();

        markForUpdate();

        return true;
    }
    return false;
}
 
Example 8
Source Project: qcraft-mod   File: QCraft.java    License: Apache License 2.0 5 votes vote down vote up
public static void addUnverifiedLuggage( EntityPlayer player, byte[] luggage )
{
    String username = player.getCommandSenderName();
    if( !s_unverifiedLuggage.containsKey( username ) )
    {
        s_unverifiedLuggage.put( username, new HashSet<byte[]>() );
    }

    Set<byte[]> luggageSet = s_unverifiedLuggage.get( username );
    if( !luggageSet.contains( luggage ) )
    {
        luggageSet.add( luggage );
    }
}
 
Example 9
Source Project: qcraft-mod   File: QCraft.java    License: Apache License 2.0 5 votes vote down vote up
public static void clearUnverifiedLuggage( EntityPlayer player )
{
    String username = player.getCommandSenderName();
    if( s_unverifiedLuggage.containsKey( username ) )
    {
        s_unverifiedLuggage.remove( username );
    }
}
 
Example 10
Source Project: Et-Futurum   File: SetPlayerModelMessage.java    License: The Unlicense 4 votes vote down vote up
public SetPlayerModelMessage(EntityPlayer player, boolean isAlex) {
	playerName = player.getCommandSenderName();
	this.isAlex = isAlex;
}
 
Example 11
Source Project: WirelessRedstone   File: WirelessPart.java    License: MIT License 4 votes vote down vote up
public void setupPlacement(EntityPlayer player, int side) {
    setSide(side ^ 1);
    setRotation(Rotation.getSidedRotation(player, side) ^ 2);
    owner = player.getCommandSenderName();
}
 
Example 12
public EntityDrone(World world, EntityPlayer player){
    this(world);
    playerUUID = player.getGameProfile().getId().toString();
    playerName = player.getCommandSenderName();
}
 
Example 13
Source Project: OpenPeripheral-Addons   File: TileEntityPIM.java    License: MIT License 4 votes vote down vote up
@Override
public String getInventoryName() {
	EntityPlayer player = getPlayer();
	return player != null? player.getCommandSenderName() : "pim";
}
 
Example 14
Source Project: Artifacts   File: TileEntityDisplayPedestal.java    License: MIT License 4 votes vote down vote up
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
	boolean sendNamePacket = false;
	
	if(entityplayer.worldObj.isRemote) {
		return false;
	}
	
	if( (ownerName == null || ownerName.equals("")) && (ownerUUID == null || ownerUUID.equals(new UUID(0, 0))) ) {
		ownerName = entityplayer.getCommandSenderName();
		ownerUUID = entityplayer.getUniqueID();
		this.markDirty();
		sendNamePacket = true;
	}
	
	if(ownerName.equals(entityplayer.getCommandSenderName()) && (ownerName == null || !ownerUUID.equals(entityplayer.getUniqueID()))) {
		ownerUUID = entityplayer.getUniqueID();
		this.markDirty();
	}
	
	if((ownerName == null || !ownerName.equals(entityplayer.getCommandSenderName())) && ownerUUID.equals(entityplayer.getUniqueID())) {
		ownerName = entityplayer.getCommandSenderName();
		this.markDirty();
		sendNamePacket = true;
	}
	
	if(sendNamePacket) {
		PacketBuffer out = new PacketBuffer(Unpooled.buffer());
		out.writeInt(PacketHandlerClient.PEDESTAL);
		out.writeInt(xCoord);
		out.writeInt(yCoord);
		out.writeInt(zCoord);
		out.writeInt(ownerName.length());
		for(int i = 0; i < ownerName.length(); i++) {
			out.writeChar(ownerName.charAt(i));
		}
		SToCMessage namePacket = new SToCMessage(out);
		DragonArtifacts.artifactNetworkWrapper.sendToAll(namePacket);
	}
	
	if(!(ownerName.equals(entityplayer.getCommandSenderName()) && ownerUUID.equals(entityplayer.getUniqueID()))) {
		return false;
	}
	
	return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;
}