Scaffolding icon indicating copy to clipboard operation
Scaffolding copied to clipboard

Sign Bug?

Open einfachBlu opened this issue 3 years ago • 5 comments

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)

einfachBlu avatar Dec 01 '22 20:12 einfachBlu

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.

LooFifteen avatar Dec 01 '22 20:12 LooFifteen

// 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.

einfachBlu avatar Dec 01 '22 21:12 einfachBlu

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

LooFifteen avatar Dec 01 '22 21:12 LooFifteen

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 avatar Dec 01 '22 22:12 einfachBlu

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

einfachBlu avatar Dec 01 '22 22:12 einfachBlu