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

Treat CAVE_AIR just like normal AIR blocks #92

Merged
merged 2 commits into from
May 26, 2024

Conversation

fuhry
Copy link
Contributor

@fuhry fuhry commented Sep 15, 2022

Recently, Minecraft began using CAVE_AIR for air blocks inside of caves, however AncientGates presently does not recognize this as air and refuses to construct portals inside of caves.

This PR resolves this issue. It has been successfully tested on a server running Minecraft 1.20 with no issues.

@sonarcloud
Copy link

sonarcloud bot commented Sep 15, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@ChanceSD
Copy link
Owner

Thank you, unfortunately that probably stops the plugin from working in older versions where Material.CAVE_AIR doesn't exist.
If you could replace that with something from XMaterial, I'm not sure if XMaterial.AIR already includes cave air or not, if so it would be the easiest way to support all versions.

If you can't change that I will try to test it and adjust your PR,, thank you either way though since getting a new PR is very rare

@fuhry
Copy link
Contributor Author

fuhry commented Dec 13, 2022

@ChanceSD Thanks for this, sorry that I didn't see your comment until now!

I'll look into adapting this to XMaterial and update the PR.

@fuhry
Copy link
Contributor Author

fuhry commented Dec 20, 2022

Update - I made the changes but still need to test them, I'll get that done this week.

@ChanceSD
Copy link
Owner

ChanceSD commented Apr 7, 2023

@fuhry Any update on this? No problem if not

@fuhry
Copy link
Contributor Author

fuhry commented May 18, 2023

@ChanceSD I haven't had a chance to actually test this yet. Do you still need that done?

@ChanceSD
Copy link
Owner

I didn't try it either tbh

@fuhry
Copy link
Contributor Author

fuhry commented Jun 12, 2023

I've finally gotten around to testing this now that 1.20 is released. I'm getting the "the from location is not air" message with both XBlock.isAir() and XMaterial.AIR.matchXMaterial(). The isAir() function looks particularly simple, so I don't know what's going on. Here's my squashed code versus the latest state of master..

Edit: I was missing a ! operator. Update incoming.

@sonarcloud
Copy link

sonarcloud bot commented Jun 12, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@fuhry
Copy link
Contributor Author

fuhry commented Jun 13, 2023

@ChanceSD Just wanted to let you know this should now be ready to merge!

I've noticed a couple of other issues, which I'm fairly certain are separate. If you think any could be regressions introduced by this PR, can you let me know? Otherwise I'll file separate issues and pull requests for them.

  1. Decorative non-obstructing block types, like grass, flowers, etc. can't be placed around a gate
  2. Water, sugar cane and potentially other block types aren't replaced with air when a gate closes. Particularly problematic for water as this causes flooding
  3. A room with several gates that use water as a material can experience flooding in all gates when one gate is closed

Have a feeling 2 and 3 are related, and maybe 1 is intended to prevent 2 and 3 from happening, will peek into the Bukkit/Spigot APIs to see if flow recalc can be inhibited directly.

@BangXi
Copy link

BangXi commented May 24, 2024

bump

@@ -28,7 +28,7 @@ public class BlockUtil {
standableMaterials = new EnumMap<>(Material.class);
try {
Arrays.asList(GateMaterial.values()).stream().forEach(x -> standableMaterials.put(x.getMaterial(), true));
standableMaterials.put(Material.AIR, true); // 0 Air
standableMaterials.put(XMaterial.AIR.parseMaterial(), true); // 0 Air
Copy link
Owner

Choose a reason for hiding this comment

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

I believe it would be necessary to add CAVE_AIR to the standable materials as well, not entirely sure if it would make a difference.

@ChanceSD
Copy link
Owner

Sorry, it's been so long, I will fix the conflicts and merge it soon.
And yes, I believe there are some issues with water currently, not sure if possible to fix.

fuhry and others added 2 commits May 26, 2024 14:32
Recently, Minecraft began using CAVE_AIR for air blocks inside of caves, however AncientGates presently does not recognize this as air and refuses to construct portals inside of caves.

This PR resolves this issue by using `XBlock.isAir()` instead of direct block material comparison.
Copy link

sonarcloud bot commented May 26, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@ChanceSD ChanceSD merged commit 094674e into ChanceSD:master May 26, 2024
2 checks passed
@ChanceSD
Copy link
Owner

Should be good, merging now, thank you for your contribution!

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.

None yet

3 participants