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

The following examples show how to use net.minecraft.entity.player.EntityPlayer#getEntityId() . 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 check out the related API usage on the sidebar.
Example 1
Source File: EngineeringSwitchArchivePacket.java    From Cyberware with MIT License 5 votes vote down vote up
public EngineeringSwitchArchivePacket(BlockPos pos, EntityPlayer player, boolean direction, boolean isComponent)
{
	this.dimensionId = player.worldObj.provider.getDimension();
	this.entityId = player.getEntityId();
	this.pos = pos;
	this.direction = direction;
	this.isComponent = isComponent;
}
 
Example 2
Source File: VSWorldEventListener.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Override
public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) {
    if (!worldObj.isRemote) {
        for (EntityPlayer entityplayermp : worldObj.playerEntities) {
            if (entityplayermp != null && entityplayermp.getEntityId() != breakerId) {
                Vector posVector = new Vector(pos.getX(), pos.getY(), pos.getZ());

                Optional<PhysicsObject> physicsObject = ValkyrienUtils
                    .getPhysicsObject(worldObj, pos);

                physicsObject.ifPresent(object -> object
                    .getShipTransformationManager()
                    .getCurrentTickTransform()
                    .transform(posVector,
                        TransformType.SUBSPACE_TO_GLOBAL));

                double d0 = posVector.X - entityplayermp.posX;
                double d1 = posVector.Y - entityplayermp.posY;
                double d2 = posVector.Z - entityplayermp.posZ;

                if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
                    ((EntityPlayerMP) entityplayermp).connection
                        .sendPacket(new SPacketBlockBreakAnim(breakerId, pos, progress));
                }
            }
        }
    }
}
 
Example 3
Source File: ArmourStandInteractMessage.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
public ArmourStandInteractMessage(int dimID, EntityArmourStand stand, EntityPlayer player) {
	this.dimID = dimID;
	standID = stand.getEntityId();
	playerID = player.getEntityId();
	MovingObjectPosition hit = Minecraft.getMinecraft().objectMouseOver;
	hitPos = Vec3.createVectorHelper(hit.hitVec.xCoord - stand.posX, hit.hitVec.yCoord - stand.posY, hit.hitVec.zCoord - stand.posZ);
}
 
Example 4
Source File: WRAddonCPH.java    From WirelessRedstone with MIT License 5 votes vote down vote up
private void throwTracker(WorldClient world, EntityPlayer player, int entityID, int throwerID, int freq) {
    Entity thrower = world.getEntityByID(throwerID);
    if (throwerID == player.getEntityId())
        thrower = player;

    if (thrower != null && thrower instanceof EntityLiving) {
        EntityWirelessTracker tracker = new EntityWirelessTracker(world, 0, (EntityLiving) thrower);
        tracker.setEntityId(entityID);
        world.addEntityToWorld(entityID, tracker);
        world.playSoundAtEntity(thrower, "random.bow", 0.5F, 0.4F / (world.rand.nextFloat() * 0.4F + 0.8F));
    }
}
 
Example 5
Source File: WRAddonCPH.java    From WirelessRedstone with MIT License 5 votes vote down vote up
private void throwREP(int entityID, int throwerID, WorldClient world, EntityPlayer player) {
    Entity thrower = world.getEntityByID(throwerID);
    if (throwerID == player.getEntityId())
        thrower = player;

    if (thrower != null && thrower instanceof EntityLivingBase) {
        EntityREP rep = new EntityREP(world, (EntityLivingBase) thrower);
        rep.setEntityId(entityID);
        world.addEntityToWorld(entityID, rep);
    }
}
 
Example 6
Source File: PacketTransformationInfo.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public Request(EntityPlayer player) {
    this.player = player.getEntityId();
}
 
Example 7
Source File: WRAddonCPH.java    From WirelessRedstone with MIT License 4 votes vote down vote up
private void processTrackerUpdate(PacketCustom packet, WorldClient world, EntityPlayer player) {
    int entityID = packet.readInt();
    int freq = packet.readUShort();
    boolean attached = packet.readBoolean();

    Entity e = world.getEntityByID(entityID);
    if (e != null && e.isDead)
        e = null;

    if (!(e instanceof EntityWirelessTracker)) {
        if (e != null)
            throw new IllegalStateException("EntityID mapped to non tracker");

        e = new EntityWirelessTracker(world, freq);
        e.setEntityId(entityID);
        world.addEntityToWorld(entityID, e);
    }
    EntityWirelessTracker tracker = (EntityWirelessTracker) e;

    if (attached) {
        int attachedEntityID = packet.readInt();

        Entity attachedEntity;
        if (attachedEntityID == player.getEntityId())
            attachedEntity = player;
        else
            attachedEntity = world.getEntityByID(attachedEntityID);

        if (attachedEntity == null) {
            return;
        }

        tracker.attached = true;
        tracker.attachedEntity = attachedEntity;
        tracker.attachedX = packet.readFloat();
        tracker.attachedY = packet.readFloat();
        tracker.attachedZ = packet.readFloat();
        tracker.attachedYaw = packet.readFloat();
    } else {
        tracker.attachedEntity = null;
        tracker.attached = false;

        tracker.posX = packet.readFloat();
        tracker.posY = packet.readFloat();
        tracker.posZ = packet.readFloat();
        tracker.motionX = packet.readFloat();
        tracker.motionY = packet.readFloat();
        tracker.motionZ = packet.readFloat();

        tracker.setPosition(tracker.posX, tracker.posY, tracker.posZ);
        tracker.setVelocity(tracker.motionX, tracker.motionY, tracker.motionZ);

        tracker.attachmentCounter = packet.readUShort();
        tracker.item = packet.readBoolean();
    }
}