Polymer

Polymer

763k Downloads

I am having issues making a compass item that tracks a location, I have set the lodestone nbt but it will not track the location.

fooeyround opened this issue ยท 8 comments

commented

Do you have a discord?

also I am basically making a lodestone compass that instead of tracking a loadstone tracks another position. in this case a player. but the location seems to be not used by the client, and the nbt data is there, do you know why this may happen? also the item the item is imitating is the compass item...

commented

Thank you for the quick reply!

commented
  1. https://pb4.eu/discord

  2. Could you sent your code? Likely you don't have required nbt data on the item

commented

is a basic example of the way I am using the tags, is there a special method to set it and not be remapped?

commented

I found that all the tags I set to the stack are prefixed under Polymer is there a way to set the vanilla item's tags

commented

and my code..

commented

I am on 1.19.3.. and

    NbtCompound compound = stack.getOrCreateNbt();







    BlockPos blockPos = user.getBlockPos();

        PlayerEntity trackedPlayer = getPlayerFromString(world,compound.getString("tracked_player"));

        if (stack.getCount() > 1 || compound.getInt("uses") == 0 || trackedPlayer == null) {
            return TypedActionResult.fail(stack);
        }```
commented

or a better part is this.. as that does not need to be remapped
`

private void writeNbt(RegistryKey<World> worldKey, BlockPos pos, NbtCompound nbt) {
    nbt.put("LodestonePos", NbtHelper.fromBlockPos(pos));
    DataResult<NbtElement> dataResult = World.CODEC.encodeStart(NbtOps.INSTANCE, worldKey);
    Objects.requireNonNull(PlayerTracking.LOGGER);
    dataResult.resultOrPartial(PlayerTracking.LOGGER::error).ifPresent((nbtElement) -> nbt.put("LodestoneDimension", nbtElement));
    nbt.putBoolean("PlayerTracked", true);
}

`

this is called right under that..

commented

if the dimension and location get set under the normal tags, then that would solve the issue, I hope there is a way to do so..