-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump minestom version to support 1.21.1 for testing
Create BlockEntity record to support block entity format across versions Apply Block data when applying rotations Add empty block data when generating a new schematic, will be replaced Add loading tile entity support for v1, v2, and v3 schematics
- Loading branch information
1 parent
d46f28e
commit 599a08a
Showing
6 changed files
with
103 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package net.hollowcube.schem; | ||
|
||
import net.kyori.adventure.nbt.CompoundBinaryTag; | ||
import net.minestom.server.coordinate.Point; | ||
import net.minestom.server.coordinate.Vec; | ||
|
||
public record BlockEntity(String id, Point point, CompoundBinaryTag trimmedTag) { | ||
|
||
public static BlockEntity fromV3(CompoundBinaryTag blockTag) { | ||
int[] position = blockTag.getIntArray("Pos"); | ||
return new BlockEntity(blockTag.getString("Id"), new Vec(position[0], position[1], position[2]), blockTag.getCompound("Data")); | ||
} | ||
|
||
public static BlockEntity fromV1(CompoundBinaryTag entityCompound) { | ||
int[] position = entityCompound.getIntArray("Pos"); | ||
String id = entityCompound.getString("Id"); | ||
CompoundBinaryTag stripped = CompoundBinaryTag | ||
.builder() | ||
.put(entityCompound) | ||
.remove("Pos") | ||
.remove("Id") | ||
.remove("Extra").build(); | ||
return new BlockEntity(id, new Vec(position[0], position[1], position[2]), stripped); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters