#nms ๐Ÿ˜‹๐Ÿ˜‹

1 messages ยท Page 1 of 1 (latest)

hybrid shuttle
#

ok so

#

alright uhh

austere knot
#

one sec let me look up the CB collision code

hybrid shuttle
#

yeah im doing that aswell

austere knot
#
    @Override
    public void setCollidable(boolean collidable) {
        getHandle().collides = collidable;
    }```So now for the NMS
hybrid shuttle
#

using 1.19 :D

#

the ServerLevel thingy has something related to collisio

#

CollisionGetter

#

or i could just

#

this.getbukkitentity.setcollidable(false)

#

((LivingEntity)this.getBukkitEntity()).setCollidable(false);

austere knot
#

yes but you are using packets so there should be no BukkitEntity

hybrid shuttle
#

the husk is still a BukkitEntity

#

the NPC isnt

austere knot
#

not if you created it using packets

#

If you actually spawned it, then yes

hybrid shuttle
#

i created the husk using actual spawn mechanisms

austere knot
#

ok then it really exists so set it to not collidable

hybrid shuttle
#

well now the npc cant collide with the husk

#

ok done

#

hold up lemme launch mc

#

ok uhh

#

nothing changed

#

ive noticed that the npcs spawn in the proper coordinates

#

and then get teleported somewhere else

#

and the husks are invisible

austere knot
#

did you set the husks invisible?

hybrid shuttle
#

nope

#

rejoining makes them appear

austere knot
#

Also npcs spawning in the correct place and then teleporting points to your code moving them

hybrid shuttle
#

wait

austere knot
#

invisible when first spawned sounds like a lot of errors in your code

hybrid shuttle
#

top one is npc code

#

bottom is custom zombie class

austere knot
#

um your spawn packet doesn;t actually spawn the NPC

hybrid shuttle
#

its appearing tho

#

on the tab and on the screen

#

could you elaborate why

austere knot
#

You likely also need to call addToWorld on the npc

#

nmsWorld.addNewPlayer(npc)

hybrid shuttle
#

doesnt do anything

#

its the same

austere knot
#

it also look like your pitch/yaw is also reversed

#
        this.setXRot(pitch);```
#

this is what I use instead of yrou send join packets

#
    private static void showAll(Npc npc) {

        ClientboundPlayerInfoPacket playerInfoAdd = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, npc);
        ClientboundAddPlayerPacket playerSpawn = new ClientboundAddPlayerPacket(npc);
        ClientboundRotateHeadPacket headRotation = new ClientboundRotateHeadPacket(npc, (byte) Math.floor(npc.getYHeadRot() * 256f / 360f));
        ClientboundPlayerInfoPacket playerInfoRemove = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, npc);
        
        // For Entities (packet based) require this packet for skins.
        //ClientboundSetEntityDataPacket entityData = new ClientboundSetEntityDataPacket(npc.getId(), npc.getEntityData(), true);

        for (Player player : Bukkit.getOnlinePlayers()) {
            ServerGamePacketListenerImpl connection = ((ServerPlayer) NMSUtils.getServerPlayer(player)).connection;
            connection.send(playerInfoAdd);        // Inform client this Entity exists.
            connection.send(playerSpawn);    // Spawn this entity on the client.
            //connection.send(entityData);    // EntityData (Packet based Entity) to show skins.
            connection.send(headRotation);
            connection.send(playerInfoRemove);    // Remove from servers tab list
        }
    }```
#

that last one for removing player info may mess with skins. I've not tested that fully

#

it removesd them from the Tab but skins are also pulled from there

hybrid shuttle
#

alr imma try yours

austere knot
#

I can;t see you updating the ServerPlayer location after its spawned. You just send calculated update packets

#

if the Zombie moves you can simply teleport the ServerPlayer to the same location. The client will extrapolate movement

hybrid shuttle
#

what do i use for teleportation?

austere knot
#

it has a bukkit entity so you can just teleport that

hybrid shuttle
#
public void move(double x, double y, double z){
        ServerPlayer npc = instance;
        Bukkit.getOnlinePlayers().forEach(player -> {
            ServerGamePacketListenerImpl packetSender = ((CraftPlayer) player).getHandle().connection;
            packetSender.send(new ClientboundMoveEntityPacket.Pos(npc.getId(), (short) (x * 4096), (short) (y * 4096), (short) (z * 4096), true));
        });
    }```
#

oh

#

its still a packet entity tho

austere knot
#

no its never a packet entity as you spawn it

hybrid shuttle
#

the npc i mean

austere knot
#

yes, your npc is a full blown entity

hybrid shuttle
#

wow

austere knot
#

you spawned it so its no longer a packet entity

hybrid shuttle
#

nope it just does not move anymore

#

but it spawns and stays at the correct coordinates

#

so the move method probably may be the problem

#
public void move(Entity entity){
//        Bukkit.getOnlinePlayers().forEach(player -> {
//            ServerGamePacketListenerImpl packetSender = ((CraftPlayer) player).getHandle().connection;
//            packetSender.send(new ClientboundMoveEntityPacket.Pos(this.instance.getId(), (short) (x * 4096), (short) (y * 4096), (short) (z * 4096), true));
//        });
        this.instance.getBukkitEntity().teleport(entity);
    }```
#

npc.move(this.getBukkitEntity());

#

this is in the tick method

#

this is teh husk

#

hold up lemme try coords

#

yep they do not work