8000 Implement blocks filter & refactor regions by Pablete1234 · Pull Request #1076 · PGMDev/PGM · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Implement blocks filter & refactor regions #1076

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

Merged
merged 2 commits into from
Oct 10, 2022
Merged

Implement blocks filter & refactor regions #1076

merged 2 commits into from
Oct 10, 2022

Conversation

Pablete1234
Copy link
Member
@Pablete1234 Pablete1234 commented Oct 10, 2022

Implements a new filter type, blocks.
They allows for complex structures where you let players freely edit the air blocks (or other blocks) but prevent then from breaking the original blocks. PGM will on match load check all blocks that match the filter, and reuse them later to allow/deny queries against the filter.

<union id="woolroom-regions">
  <cuboid min="-50,0,-110" max="-20,20,-100"/>
  <cuboid min="-50,0,100" max="-20,20,110"/>
</union>

<deny id="deny-woolroom-blocks">
  <blocks region="woolroom-regions">
    <not>
      <any>
        <material>air</material>
        <material>web</material>
      </any>
    </not>
  </blocks>
</deny>

<apply block="deny-woolroom-blocks" region="woolroom-regions"/>

In this example, the blocks within the woolroom region that aren't air or cobwebs, are made part of the blocks filter. They will be denied from breaking/replacing those blocks in any way.

The region is required, the filter may be specified as a filter attribute or a child filter (as shown in the example). Filter is not required and will default to a not-air filter.

Keep in mind there can be performance considerations, with the new filter, avoid making unnecessarily big regions, when possible make smaller regions and join them in an union as pgm will handle them better.

The PR has been tested and works as intended.

@Pablete1234 Pablete1234 added the feature New feature or request label Oct 10, 2022
Signed-off-by: Pablete1234 <pabloherrerapalacio@gmail.com>
Signed-off-by: Pablete1234 <pabloherrerapalacio@gmail.com>
Copy link
Member
@Electroid Electroid left a comment

Choose a reason for hiding this comment

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

Nice refactor, looks good!

@Electroid Electroid merged commit 576db6b into dev Oct 10, 2022
@Electroid Electroid deleted the blocks-filter branch October 10, 2022 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants
0