TouhouLittleMaid icon indicating copy to clipboard operation
TouhouLittleMaid copied to clipboard

[Bug] Multi-Blocks Altar visualizer in Patchouli doesn't recognize modified structure nbt

Open EverettSummer opened this issue 1 year ago • 2 comments

Minecraft Version

  • [ ] 1.12.2 (End of support)
  • [ ] 1.16.5
  • [X] 1.18.2
  • [ ] 1.19.2
  • [ ] 1.20/1.20.1

What happened?

I want to make a datapack that provides compatibility for Terrafirmacraft (aka TFC), since the oak log in TFC has a different block id, I updated four nbt files in data/touhou_little_maid/structures folder, I used the Minecraft Development plugin of IntelliJ IDEA to update these nbt files like this: image

I have tested the datapack and the Multi-Blocks Alter can be formed using the TFC oak log by right-clicking with Gohei,

But the issue is the visualizer of the Patchouli book still claim I'm using the wrong block for the Altar. image

After searching the code, I noticed that the visualizer may use a hardcode block ID to match the blocks, the code is here:

src/main/java/com/github/tartaricacid/touhoulittlemaid/compat/patchouli/MultiblockRegistry.java

    public static void init() {
        PatchouliAPI.IPatchouliAPI api = PatchouliAPI.get();
        IStateMatcher oakLogMatcher = api.predicateMatcher(Blocks.OAK_LOG.defaultBlockState(), state -> state.is(Blocks.OAK_LOG) && state.getValue(RotatedPillarBlock.AXIS) == Direction.Axis.Y);
        IStateMatcher redWoolMatcher = api.predicateMatcher(Blocks.RED_WOOL.defaultBlockState(), state -> state.is(Blocks.RED_WOOL));
        api.registerMultiblock(ID, api.makeMultiblock(TEMPLATE, 'O', oakLogMatcher, 'R', redWoolMatcher, ' ', api.anyMatcher()));
    }

I hope I can help to draft a PR, but I am not familiar with MC development and don't know how to read block id from the nbt data.

Relevant log output

No response

Contact Details

No response

EverettSummer avatar Sep 19 '23 15:09 EverettSummer

There is another issue after modified the NBT data, the Alter cannot place items due to the hardcoded block id in this code src/main/java/com/github/tartaricacid/touhoulittlemaid/block/multiblock/MultiBlockAltar.java L:65

            if (te instanceof TileEntityAltar) {
                boolean isRender = currentPos.equals(currentCenterPos);
                boolean canPlaceItem = blockInfo.pos.getY() == 2 && blockInfo.state.is(Blocks.OAK_LOG);
                ((TileEntityAltar) te).setForgeData(blockInfo.state, isRender,
                        canPlaceItem, direction, posList, canPlaceItemPosList);
            }

EverettSummer avatar Sep 19 '23 17:09 EverettSummer

I'll look back and see how to modify it

TartaricAcid avatar Sep 23 '23 13:09 TartaricAcid

I have now changed it to block tag. In theory, all logs should be correctly identified.

TartaricAcid avatar Mar 10 '24 16:03 TartaricAcid