Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial port of #10656 #10661

Open
wants to merge 1 commit into
base: version/1.21
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public WindowDecorationController(final BlockPos b)
registerButton(BUTTON_REPAIR, this::repairClicked);
registerButton(BUTTON_CANCEL, this::cancelClicked);

findPaneOfTypeByID(LABEL_NAME, Text.class).setText(Component.literal(controller.getBlueprintPath()));
findPaneOfTypeByID(LABEL_NAME, Text.class).setText(Component.literal(controller.getBlueprintPath()
.replace(".blueprint", "").replace("\\", "/").replace("/", "\n")));

final IColonyView view = IColonyManager.getInstance().getClosestColonyView(world, controller.getBlockPos());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.util.Tuple;
import net.minecraft.core.BlockPos;
import org.codehaus.plexus.util.StringUtils;
import org.jetbrains.annotations.NotNull;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -225,12 +226,21 @@ public void loadAdditional(final CompoundTag compound, @NotNull final HolderLook
// TODO: remove this later (data break introduced in 1.20.4) because of blueprint data
this.rotationMirror = RotationMirror.of(Rotation.values()[compound.getInt(TAG_ROTATION)], compound.getBoolean(TAG_MIRROR) ? Mirror.FRONT_BACK : Mirror.NONE);
}
if(compound.contains(TAG_PATH))

// inexplicably IBlueprintDataProviderBE does not load the pack/path even though it saved them
this.packName = compound.getCompound(TAG_BLUEPRINTDATA).getString(TAG_PACK);
this.schematicPath = compound.getCompound(TAG_BLUEPRINTDATA).getString(TAG_PATH);

// the rest of this is backwards compat code that can be removed at some point (maybe even now)
if(compound.contains(TAG_PATH) && StringUtils.isEmpty(this.schematicName))
{
this.schematicPath = compound.getString(TAG_PATH);
}

if(compound.contains(TAG_NAME))
if(compound.contains(TAG_PACK) && StringUtils.isEmpty(this.packName))
{
this.packName = compound.getString(TAG_PACK);
}
if(compound.contains(TAG_NAME) && StringUtils.isEmpty(this.schematicName))
{
this.schematicName = compound.getString(TAG_NAME);
if (this.schematicPath == null || this.schematicPath.isEmpty())
Expand All @@ -240,7 +250,7 @@ public void loadAdditional(final CompoundTag compound, @NotNull final HolderLook
this.schematicName = "";
}
}
this.packName = compound.getString(TAG_PACK);
// end of backwards compat code

if (!this.schematicPath.endsWith(".blueprint"))
{
Expand All @@ -254,9 +264,6 @@ public void saveAdditional(final CompoundTag compound, @NotNull final HolderLook
super.saveAdditional(compound, provider);
writeSchematicDataToNBT(compound);
compound.putByte(TAG_ROTATION_MIRROR, (byte) this.rotationMirror.ordinal());
compound.putString(TAG_NAME, schematicName == null ? "" : schematicName);
compound.putString(TAG_PATH, schematicPath == null ? "" : schematicPath);
compound.putString(TAG_PACK, (packName == null || packName.isEmpty()) ? "" : packName);
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<image source="minecolonies:textures/gui/citizen/colonist_paper.png" size="100% 100%"/>

<text id="name" size="150 11" pos="15 10" color="black" textalign="TOP_MIDDLE"/>
<text id="name" size="150 60" pos="15 10" color="black" textalign="TOP_MIDDLE"/>

<button id="cancel" size="14 15" pos="400 0"
source="minecolonies:textures/gui/button_x.png" color="black"/>

<button id="repair" size="86 17" pos="50 50"
<button id="repair" size="86 17" pos="50 70"
source="minecolonies:textures/gui/builderhut/builder_button_medium.png"
label="$(com.minecolonies.coremod.gui.workerhuts.repair)" color="black"/>
<button id="build" size="86 17" pos="50 70"
<button id="build" size="86 17" pos="50 90"
source="minecolonies:textures/gui/builderhut/builder_button_medium.png"
label="$(com.minecolonies.coremod.gui.workerhuts.upgrade)" color="black"/>
</window>