Skip to content
This repository has been archived by the owner on May 27, 2023. It is now read-only.

Sign Bug? #18

Open
einfachBlu opened this issue Dec 1, 2022 · 5 comments
Open

Sign Bug? #18

einfachBlu opened this issue Dec 1, 2022 · 5 comments

Comments

@einfachBlu
Copy link

I have a schematic created and loaded which contains Signs with Text on it.
The Signs on loading does not have a Text

Does Schematics contain the Text of the Signs? if yes -> They dont get loaded correctly (I have BlockHandler for Signs registered)

@LooFifteen
Copy link
Member

You need to set the block handler of the signs when they are placed by scaffolding. This project is currently stale so I will not be adding any features to make this task easier.

@einfachBlu
Copy link
Author

// Registering the SignHandler
MinecraftServer.getBlockManager().registerHandler(NamespaceID.from("minecraft:sign"), SignHandler::new);

// SignHandler Class
public final class SignHandler implements BlockHandler {

  @Override
  public @NotNull NamespaceID getNamespaceId() {
    return NamespaceID.from("minecraft", "sign");
  }

  public Collection<Tag<?>> getBlockEntityTags() {
    return Arrays.asList(
        Tag.Byte("GlowingText"),
        Tag.String("Color"),
        Tag.String("Text1"),
        Tag.String("Text2"),
        Tag.String("Text3"),
        Tag.String("Text4"));
  }
}

What do you mean with when they are placed by scaffolding?
I have registered the SignHandler already.

@LooFifteen
Copy link
Member

You need to set the block handler when the block is placed. Just registering it does not apply it to the sign.

@einfachBlu
Copy link
Author

Block block =
                    Block.OAK_SIGN
                        .withTag(
                            Tag.String("Text1"),
                            GsonComponentSerializer.gson().serialize(Component.text("Line 1")))
                        .withHandler(new SignHandler());

                // Option 1
                AbsoluteBlockBatch absoluteBlockBatch = new AbsoluteBlockBatch();
                absoluteBlockBatch.setBlock(world.getSpawnPos(), block);
                absoluteBlockBatch.apply(instance, () -> {});

                // Option 2
                instance.setBlock(world.getSpawnPos(), block);

But this works for example. Just the Schematic Class does not seem to load it correctly. Have you tested it in the past with Signs?

@einfachBlu
Copy link
Author

I can't find a way of how to assign Handler after they are placed by the BlockBatch you apply with the Schematics. There maybe need to be a PreSetter Parameter to change the Block before it gets applied to the BlockBatch

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants