#nms ๐๐
1 messages ยท Page 1 of 1 (latest)
one sec let me look up the CB collision code
yeah im doing that aswell
@Override
public void setCollidable(boolean collidable) {
getHandle().collides = collidable;
}```So now for the NMS
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);
yes but you are using packets so there should be no BukkitEntity
i created the husk using actual spawn mechanisms
ok then it really exists so set it to not collidable
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
did you set the husks invisible?
Also npcs spawning in the correct place and then teleporting points to your code moving them
wait
invisible when first spawned sounds like a lot of errors in your code
um your spawn packet doesn;t actually spawn the NPC
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
alr imma try yours
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
what do i use for teleportation?
it has a bukkit entity so you can just teleport that
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
no its never a packet entity as you spawn it
the npc i mean
yes, your npc is a full blown entity
wow
you spawned it so its no longer a packet entity
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