3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-25 07:40:10 +01:00

Deprecate unit cube in block components (#4470)

* Depricate unit cube

* Didn't mean to remove that
Dieser Commit ist enthalten in:
rtm516 2024-03-02 00:56:35 +00:00 committet von GitHub
Ursprung f8e6d26fc2
Commit 3c4a1a82c9
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
4 geänderte Dateien mit 18 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -129,8 +129,11 @@ public interface CustomBlockComponents {
* Gets the unit cube component
* Equivalent to "minecraft:unit_cube"
*
* @deprecated Use {@link #geometry()} and compare with `minecraft:geometry.full_block` instead.
*
* @return The rotation.
*/
@Deprecated
boolean unitCube();
/**
@ -181,6 +184,10 @@ public interface CustomBlockComponents {
Builder transformation(TransformationComponent transformation);
/**
* @deprecated Use {@link #geometry(GeometryComponent)} with `minecraft:geometry.full_block` instead.
*/
@Deprecated
Builder unitCube(boolean unitCube);
Builder placeAir(boolean placeAir);

Datei anzeigen

@ -58,7 +58,6 @@ public class GeyserCustomBlockComponents implements CustomBlockComponents {
Integer lightEmission;
Integer lightDampening;
TransformationComponent transformation;
boolean unitCube;
boolean placeAir;
Set<String> tags;
@ -66,7 +65,13 @@ public class GeyserCustomBlockComponents implements CustomBlockComponents {
this.selectionBox = builder.selectionBox;
this.collisionBox = builder.collisionBox;
this.displayName = builder.displayName;
this.geometry = builder.geometry;
GeometryComponent geo = builder.geometry;
if (builder.unitCube && geo == null) {
geo = GeometryComponent.builder()
.identifier("minecraft:geometry.full_block")
.build();
}
this.geometry = geo;
if (builder.materialInstances.isEmpty()) {
this.materialInstances = Object2ObjectMaps.emptyMap();
} else {
@ -78,7 +83,6 @@ public class GeyserCustomBlockComponents implements CustomBlockComponents {
this.lightEmission = builder.lightEmission;
this.lightDampening = builder.lightDampening;
this.transformation = builder.transformation;
this.unitCube = builder.unitCube;
this.placeAir = builder.placeAir;
if (builder.tags.isEmpty()) {
this.tags = Set.of();
@ -144,7 +148,7 @@ public class GeyserCustomBlockComponents implements CustomBlockComponents {
@Override
public boolean unitCube() {
return unitCube;
return geometry.identifier().equals("minecraft:geometry.full_block");
}
@Override

Datei anzeigen

@ -488,7 +488,9 @@ public class MappingsReader_v1 extends MappingsReader {
}
if (node.has("unit_cube")) {
builder.unitCube(node.get("unit_cube").asBoolean());
builder.geometry(GeometryComponent.builder()
.identifier("minecraft:geometry.full_block")
.build());
}
if (node.has("material_instances")) {

Datei anzeigen

@ -422,10 +422,6 @@ public class CustomBlockRegistryPopulator {
.build());
}
if (components.unitCube()) {
builder.putCompound("minecraft:unit_cube", NbtMap.EMPTY);
}
// place_air is not an actual component
// We just apply a dummy event to prevent the client from trying to place a block
// This mitigates the issue with the client sometimes double placing blocks