Skip to content

fix: schematic format detection#3289

Merged
NotMyFault merged 8 commits intomainfrom
fix/schematicFormatDetection
Aug 30, 2025
Merged

fix: schematic format detection#3289
NotMyFault merged 8 commits intomainfrom
fix/schematicFormatDetection

Conversation

@PierreSchwang
Copy link
Copy Markdown
Member

@PierreSchwang PierreSchwang commented Aug 20, 2025

Overview

Fixes IntellectualSites/PlotSquared#4478

fixes regression by bf07548 which resulted in format check of sponge v1 schematics to delegate to mcedit format check.

Submitter Checklist

  • Make sure you are opening from a topic branch (/feature/fix/docs/ branch (right side)) and not your main branch.
  • Ensure that the pull request title represents the desired changelog entry.
  • New public fields and methods are annotated with @since TODO.
  • I read and followed the contribution guidelines.

@PierreSchwang PierreSchwang requested a review from a team as a code owner August 20, 2025 20:48
@github-actions github-actions Bot added the Bugfix This PR fixes a bug label Aug 20, 2025
@PierreSchwang PierreSchwang force-pushed the fix/schematicFormatDetection branch from 8c8e5cb to 9b8106c Compare August 20, 2025 20:49
@PierreSchwang PierreSchwang force-pushed the fix/schematicFormatDetection branch from 9b8106c to 4167b07 Compare August 20, 2025 20:51
@dordsor21
Copy link
Copy Markdown
Member

My approach with having a negative filter on the schematic, mcedit, etc was to allow V2 and V3 to have other file endings as we don't need to try too hard to support legacy tbh. I don't want to regress on support for extra extensions for V2/3

@PierreSchwang PierreSchwang force-pushed the fix/schematicFormatDetection branch from 4167b07 to 1049aa3 Compare August 20, 2025 21:08
@PierreSchwang
Copy link
Copy Markdown
Member Author

My approach with having a negative filter on the schematic, mcedit, etc was to allow V2 and V3 to have other file endings as we don't need to try too hard to support legacy tbh. I don't want to regress on support for extra extensions for V2/3

adjusted - though I'm unsure if .mce and .mcedit should be "allowed" for sponge v1

@dordsor21
Copy link
Copy Markdown
Member

adjusted - though I'm unsure if .mce and .mcedit should be "allowed" for sponge v1

Those have been allowed from the very start so I assume those files are v1 format?

@PierreSchwang
Copy link
Copy Markdown
Member Author

adjusted - though I'm unsure if .mce and .mcedit should be "allowed" for sponge v1

Those have been allowed from the very start so I assume those files are v1 format?

I do think those formats differ quite significantly. MCEdit should have a Material tag, whereas V1 already uses the Palette tag.

But I also just read, that v1 uses - or rather recommends - the .schem extension as well. So I should update the PR.

@PierreSchwang
Copy link
Copy Markdown
Member Author

I've adjusted the file extension check.

I also reworked the findByFile method itself, as it previously had to open multiple stream and check against multiple formats after another when loading older formats. The new approach should be quicker, may it be a little bit quirkier. Not 100% sure if I like it.

@dordsor21 dordsor21 requested a review from a team August 24, 2025 17:10
@NotMyFault NotMyFault requested a review from Copilot August 26, 2025 17:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a regression in schematic format detection where Sponge v1 schematics were incorrectly being delegated to the MCEdit format check, causing format misidentification.

  • Implements optimized format detection algorithm for built-in clipboard formats
  • Adds comprehensive test coverage for format detection functionality
  • Updates dependency version for Paper dev bundle

Reviewed Changes

Copilot reviewed 5 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ClipboardFormats.java Implements fast format detection algorithm with NBT parsing to correctly identify schematic formats
BuiltInClipboardFormat.java Fixes SPONGE_V1_SCHEMATIC format detection by preventing delegation to MCEDIT format
ClipboardFormatsTest.java Adds comprehensive test cases for format detection including custom format registration
custom_format.xyz Test file for custom format detection testing
build.gradle.kts Updates Paper dev bundle dependency version

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link
Copy Markdown

Please take a moment and address the merge conflicts of your pull request. Thanks!

1 similar comment
@github-actions
Copy link
Copy Markdown

Please take a moment and address the merge conflicts of your pull request. Thanks!

@NotMyFault NotMyFault merged commit e94a3b5 into main Aug 30, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugfix This PR fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"This schematic format is not recognised or supported" since latest update

4 participants