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

✨ Add buildIgnoreProperties setting #3697

Merged
merged 1 commit into from
Oct 31, 2022

Conversation

ZacSharp
Copy link
Collaborator

Specifying property names per block might also be desired, should I change it to be per block?

Fixes #3696
Fixes #3610 (probably the same as #3696)
Closes #2854

@leijurv leijurv merged commit 3a945c8 into cabaletta:master Oct 31, 2022
@zndrmn
Copy link

zndrmn commented Oct 31, 2022

Is there a way I can use this on the 1.9.0 / 1.19.2 version? or do I just have to wait

@ZacSharp
Copy link
Collaborator Author

ZacSharp commented Oct 31, 2022

@zndrmn if you are not afraid of writing code yourself you can download the sourcecode from the 1.19.1 branch (it's named 1.19.1 but is for 1.19.2), copy the changes from this pr and build your own Baritone version from the result. This pr is pretty simple so you don't need to know how Baritone or Minecraft works (but it won't hurt either).
If that doesn't sound like something you'd do then you'll indeed have to wait, possibly for a long time, or you get someone else to do it for you.

@zndrmn
Copy link

zndrmn commented Oct 31, 2022

I think I got it working? I changed BuilderProcess a little because it wasn't compiling and now it compiles, I just don't know how I should be using the command, just an fyi I basically have no idea how to code

    private boolean sameBlockstate(BlockState first, BlockState second) {
        if (first.getBlock() != second.getBlock()) {
            return false;
        }
        boolean ignoreDirection = Baritone.settings().buildIgnoreDirection.value;
        List<String> ignoredProps = Baritone.settings().buildIgnoreProperties.value;
        if (!ignoreDirection && ignoredProps.isEmpty()) {
            return first.equals(second); // early return if no properties are being ignored
        }
        ImmutableMap<Property<?>, Comparable<?>> map1 = (ImmutableMap<Property<?>, Comparable<?>>) first.getProperties();
        ImmutableMap<Property<?>, Comparable<?>> map2 = (ImmutableMap<Property<?>, Comparable<?>>) second.getProperties();
        for (Property<?> prop : map1.keySet()) {
            if (map1.get(prop) != map2.get(prop)
                    && !(ignoreDirection && orientationProps.contains(prop))
                    && !ignoredProps.contains(prop.getName())) {
                return false;
            }
        }
        return true;
    }

@ZacSharp
Copy link
Collaborator Author

ZacSharp commented Nov 1, 2022

To use it you set buildIgnoreProperties to the names of the properties you want to ignore. For your case that's #set buildIgnoreProperties distance, for crop age it's #set buildIgnoreProperties age, for both it's #set buildIgnoreProperties distance,age and if you want anything else, just add it with a comma.
If the game crashes with a ClassCastException you probably have to exchange getProperties for getValues.

@zndrmn
Copy link

zndrmn commented Nov 2, 2022

I've got it to work but a lot of the time it gets confused and I have to keep typing in resume, idk if this is just an issue with my build or what but yeah

@rycbar0 rycbar0 mentioned this pull request Nov 5, 2022
10 tasks
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.

Baritone can't place leaves properly because of distance Build command glitching IgnoreCropAge Setting
3 participants