MineColonies

MineColonies

57M Downloads

[BUG] Colony naming Issue in townhall

vvezina opened this issue ยท 13 comments

commented

Is there an existing issue for this?

  • I have searched the existing issues

Are you using the latest MineColonies Verison?

  • I am running the latest alpha version of MineColonies for my Minecraft version.

Did you check on the Wiki? or ask on Discord?

  • I checked the MineColonies Wiki and made sure my issue is not covered there. Or I was sent from discord to open an issue here.

Minecraft Version

1.19

MineColonies Version

1.0.1149-ALPHA

Structurize Version

1.0.1149-ALPHA

Related Mods and their Versions

Minecolonies Official Colony Venture.

Current Behavior

If you deconstruct a townhall from a certain lvl to move it somewhere else, the Colony name will become (colony name (level of the townhall)) ex : New Haven 2. Renaming the colony to ex: "New Haven" Or another name doesn't fix this issue.

Expected Behavior

Colony name should not have the lvl of the townhall next to it.

Reproduction Steps

1 Deconstruct a townhall from a certain level.
2 Pick it up
3 Place it somewhere else.
4 colony name in town hall will be (colony name + level)

Logs

No logs

Anything else?

  • Add a thumbs-up to the bug report if you are also affected. This helps the bug report become more visible to the team and doesn't clutter the comments.
  • Add a comment if you have any insights or background information that isn't already part of the conversation.
commented


(Reposting image from discord)

commented

and this doesn't display with deconstruction?

commented

According to the logic in the code, the issue is reported wrong, this should show regardless of deconstruction, but I haven't loaded in to check myself

commented

After a little research on discord, it looks like it is only visual (the colony is still named "New Haven", but it shows like "New Haven 2")
But it can still be confusing

commented

Where does it display that?

commented

Inside the town hall next to the colony name, I checked in the code and it's because there is a level field in the XML right next to the name, so the AbstractWindowModuleBuilding populates those fields like in any other building, causing it show as "<Colony name> <level>"

commented

It in fact shows by default right when you place the townhall:
2023-01-08 17_35_15-Greenshot

commented

It seems that the logic in the AbstractWindowModuleBuilding is somehow affected and it lands in the else block:

        final MutableComponent component =
          building.getCustomName().isEmpty() ? new TranslatableComponent(getBuildingName()) : new TextComponent(building.getCustomName());
        if (switchView != null && switchView.getID().equals(GUI_LIST_BUTTON_SWITCH + PAGE_ACTIONS))
        {
            // Town hall does not need level in colony name
            title.setText(component);

            final Component levelComponent = new TranslatableComponent(CMC_GUI_TOWNHALL_BUILDING_LEVEL)
                                                    .append(": " + buildingView.getBuildingLevel());
            findPaneOfTypeByID(LEVEL_LABEL, Text.class).setText(levelComponent);
        }
        else if (title != null)
        {
            final MutableComponent componentWithLevel = component.append(" ").append(String.valueOf(buildingView.getBuildingLevel()));
            title.setText(componentWithLevel);
        }
commented

I'd assume that switchView has to go and instead check using building instanceof ITownHallView should be good enough, no?

commented

Old code, townhall was reworked since then

commented

Unless it's only changed in 1.19.2, this is what I pulled from version/main (inside my plantation branch, which is currently equal to main)

commented

I mean, the code that checks for townhall is old =D

commented

Yes