Skip to content

1.21.5 #4692

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

Open
wants to merge 9 commits into
base: 1.21.4
Choose a base branch
from
Open

1.21.5 #4692

wants to merge 9 commits into from

Conversation

rfresh2
Copy link
Contributor

@rfresh2 rfresh2 commented Mar 30, 2025

  • Fabric
  • Forge
  • NeoForge
  • Goal Beacon Renderer (actually has been broken since at least 1.20.4)
  • Testing (unable to test litematica as it has not been ported yet)

@ZacSharp ZacSharp mentioned this pull request Apr 4, 2025
@ZacSharp
Copy link
Collaborator

Also need to bump the end of the version range in SETUP.md under "Command Line".

@rfresh2
Copy link
Contributor Author

rfresh2 commented Apr 16, 2025

goal beacon renderer has actually been broken since at least 1.20.4

so i dont think ill resolve that in this pr, problem for another day

@rfresh2 rfresh2 marked this pull request as ready for review April 16, 2025 06:03
ClickEvent clickEvent = style.getClickEvent();
if (clickEvent == null) {
return;
}
if (!(clickEvent instanceof ClickEvent.RunCommand(String command))) return;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursed, but kinda nice?
Didn't know we can pattern match now. (only knew about o instanceof C o_)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite sure this breaks if a book for example contains a click event running a command (as you are cancelling the original code away)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, this cancels any commands, even if Baritone doesn't handle them.

Now I do wonder though: Didn't the previous injection do the same thing?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No because the injection point was different, the new injection point is also wrong I think. The code was previous only called when the command sending failed I think.

Copy link
Collaborator

@ZacSharp ZacSharp Apr 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, fell for a little gotcha (tried to use /say hi in a click event) and the command generator I used was broken, but I managed to confirm that Baritone does correctly handle clickable text in 1.19.4 and does not allow running vanilla commands in 1.21.5.

Minecraft (<=1.21.4) used to display an error message when running a chat command without a leading slash, so my guess is that the previous injection point was exactly that error message, meaning it would only run for Baritone commands (or from anything else using anything but "/" as its prefix).
Problem with that behavior is that Minecraft (>=1.21.5) allows commands without prefix in click events now.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah the ordinal was set to 1, meaning only the highlighted one was targetted. They changed this behaviour already in the past (in 1.19 versions) so I could imagine the Mixin silently broke without anyone noticing. (For the exact behaviour changes, see https://github.com/ViaVersion/ViaFabricPlus/blob/main/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/run_command_action/MixinScreen.java#L46)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's what I think should make this work. Not usable as is because it needs an additional import statement.

Suggested change
if (!(clickEvent instanceof ClickEvent.RunCommand(String command))) return;
if (!(clickEvent instanceof ClickEvent.RunCommand(String command))) return;
if (!command.startsWith(FORCE_COMMAND_PREFIX)) {
return;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't ordinal zero-based and the two calls in the screenshot the only candidates, so the second one is targeted?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another logger usage above which is not part of the screenshot

Copy link
Collaborator

@ZacSharp ZacSharp Apr 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That one (and the fourth one below Nope, only the first one) has the wrong signature.

Copy link
Collaborator

@ZacSharp ZacSharp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't pretend I thoroughly tested this or understand the new rendering system, but the rest looks good.

@@ -52,23 +79,8 @@ static void glColor(Color color, float alpha) {
}

static BufferBuilder startLines(Color color, float alpha, float lineWidth, boolean ignoreDepth) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignoreDepth here is now completely ignored

if (settings.renderGoalIgnoreDepth.value) {
RenderSystem.disableDepthTest();

}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this (and the one below) behind as a reminder?

Comment on lines +61 to +67
return nbt.getCompound("Regions")
.map(CompoundTag::values)
.map(r -> r.stream()
.filter(v -> v instanceof CompoundTag)
.map(CompoundTag.class::cast)
.toArray(CompoundTag[]::new)
).orElse(new CompoundTag[0]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it also fixes an NPE with malformed schematics. Should this be backported?

Comment on lines +112 to +113
for (String key : properties.keySet()) {
Property<?> property = block.getStateDefinition().getProperty(key);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object -> String replacement also backportable?

@ZacSharp
Copy link
Collaborator

There is a bug report for this (see #4697 (comment)), though I'm not yet sure whether that bug is actually introduced here.

@ZacSharp
Copy link
Collaborator

The bug also exists on previous versions.

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

Successfully merging this pull request may close these issues.

3 participants