CraftTweaker

CraftTweaker

151M Downloads

Add way to get entity from player

Xavion3 opened this issue ยท 5 comments

commented

Currently there is no way to get the entity for a player, this is required in order to get their coordinates which is required for some things such as use of the ability to determine brightness when crafted which needs coordinates.

This could potentially also allow the ability to teleport a player on crafting an item, which might be useful? Could let you create things like an item the player can craft, that can be shapelessly crafted by itself to teleport the player back to the location it was crafted as a possible use case.

commented

IPlayer already has

/**
     * Retrieves the x position of this entity.
     *
     * @return entity x position
     */
    @ZenGetter("x")
    double getX();
    
    /**
     * Retrieves the y position of this entity.
     *
     * @return entity y position
     */
    @ZenGetter("y")
    double getY();
    
    /**
     * Retrieves the z position of this entity.
     *
     * @return entity z position
     */
    @ZenGetter("z")
    double getZ();

What more do you need?

commented

Looks like that was added to IPlayer about two hours after I originally posted this, so I wasn't aware they existed at the time. Though one of the mentioned theoretical applications of being able to teleport a player would still require the ability to set them which would need being able to get the entity I believe.

commented

Well IEntity is actually never used from the looks of it, no implementations, so it wouldn't work anyway, also this will 100% cause an issue with auto crafters

commented

Then that is a seperate issue with an unimplemented API, but valid.

Auto crafters being temperamental is already a problem when you try to do some things, just special crafting tables I've had be unreliable when trying some things with functions. I just file it under stuff to put a warning on and leave it to a player to screw themselves up if they don't read it, not really sure how much more you can do when you want to do something dependent on the player crafting.