Layer human?

hello, i want to create a human who is layer,
how can i modify the rotation of this?

plz thx

Uhh… Wat…?


a human with a rotation of 90°

To the right
To the left
Take it back now y’all
One hop this time, one hop this time
Right foot two stomps
Left foot two stomps
Slide to the left
Slide to the right
Criss cross, criss cross
Cha cha real smooth


the human be on the back,

like if it is in a bed

That is not something sponge can do.

You would need a client mod to change the rendering behavior of the player.

Aka, player pitch and roll rotation are not natively supported by the minecraft client, therefore they are not supported by sponge.

1 Like

So you’re asking if it’s possible to make a player lye down without having to be in a bed?

I’ve just tried a few tests with setRotation and it doesn’t seem to be possible. You could try fooling the client into thinking it’s in a bed but I don’t know if that would actually work.

You could try to find out how minecraft does it internally, looks like RenderPlayer#rotateCorpse is where it happens

oh, shit,
i try what i want with another way!
as a block in 3D

Wat… dafuq…?

1 Like

It wold be helpful to us if you explain what you’re trying to do, as in your end goal.
What does the plugin you’re making do?

It’s possible with Bukkit, I doubt you need a client mod.
It’s kinda hacky, though. As far as I know, the plugin places a bed block somewhere under the player.

I think that plugin uses packet manipulation, which SpongeAPI doesn’t allow now, and probably won’t allow in the future.

True, it uses packets. Is there actually no way at all to send packets with a Sponge server, irrespective of the API? O_o

You can, but that would mean adding a dependency on a particular implementation which defeats the point of an API.
You can use internal minecraft code and send packets yourself, you just need to compile (and in the case of MCP-based implementations, reobfuscate) your code against the impl.

1 Like

I got it working! the base idea is that you spawn a bed, place the Human in the bed and teleports it to where it schould be!
Exampel (uses NMS):

    public void preInit(GamePreInitializationEvent event) {
        CommandSpec spawn = CommandSpec.builder()
                .executor((src, args) -> {
                    if (src instanceof Player) {
                        spawnCorpse(((Player) src).getLocation());
                        return CommandResult.success();
                    return CommandResult.empty();
        Sponge.getCommandDispatcher().register(this, spawn, "spawn");

    public void spawnCorpse(Location<World> location) {
        Vector3d pos = location.getPosition().clone();
        Optional<Entity> optional = location.getExtent().createEntity(EntityTypes.HUMAN, pos);
        if (optional.isPresent()) {
            Human human = (Human) optional.get();
            location.getExtent().spawnEntity(human, Cause.of(this));
            BlockPos bedPos = new BlockPos(1, 1, 1);
            S0APacketUseBed packet = new S0APacketUseBed();
            setField("playerID", packet, ((EntityHuman) human).getEntityId());
            setField("bedPos", packet, bedPos);
            S23PacketBlockChange bed = new S23PacketBlockChange();
            setField("blockPosition", bed, bedPos);
            setField("blockState", bed, BlockTypes.BED.getDefaultState());
            ((EntityHuman) human).pushPackets(bed);
            ((EntityHuman) human).pushPackets(packet);
            human.setLocation(new Location<>(location.getExtent(), pos.add(0, 0.3, 0)));

    public void setField(String name, Object target, Object value) {
        try {
            Field field = target.getClass().getDeclaredField(name);
            field.set(target, value);
        } catch (IllegalAccessException | NoSuchFieldException ignored) {

i have somes errors when i want to import BlockPos, what i have to import?

and when i export my plugin, where do i have to put this depentie?