Deprecate unit cube in block components (#4470)

* Depricate unit cube

* Didn't mean to remove that
This commit is contained in:
rtm516 2024-03-02 00:56:35 +00:00 committed by GitHub
parent f8e6d26fc2
commit 3c4a1a82c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 9 deletions

View File

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

View File

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

View File

@ -488,7 +488,9 @@ public class MappingsReader_v1 extends MappingsReader {
} }
if (node.has("unit_cube")) { 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")) { if (node.has("material_instances")) {

View File

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