mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-20 15:39:22 +00:00
优化旋转过程
This commit is contained in:
@@ -61,14 +61,14 @@ public class ItemDisplayBlockEntityElementConfig implements BlockEntityElementCo
|
|||||||
this.shadowStrength = shadowStrength;
|
this.shadowStrength = shadowStrength;
|
||||||
this.lazyMetadataPacket = player -> {
|
this.lazyMetadataPacket = player -> {
|
||||||
List<Object> dataValues = new ArrayList<>();
|
List<Object> dataValues = new ArrayList<>();
|
||||||
ItemDisplayEntityData.DisplayedItem.addEntityDataIfNotDefaultValue(item.apply(player).getLiteralObject(), dataValues);
|
ItemDisplayEntityData.DisplayedItem.addEntityData(item.apply(player).getLiteralObject(), dataValues);
|
||||||
ItemDisplayEntityData.Scale.addEntityDataIfNotDefaultValue(this.scale, dataValues);
|
ItemDisplayEntityData.Scale.addEntityData(this.scale, dataValues);
|
||||||
ItemDisplayEntityData.RotationLeft.addEntityDataIfNotDefaultValue(this.rotation, dataValues);
|
ItemDisplayEntityData.RotationLeft.addEntityData(this.rotation, dataValues);
|
||||||
ItemDisplayEntityData.BillboardConstraints.addEntityDataIfNotDefaultValue(this.billboard.id(), dataValues);
|
ItemDisplayEntityData.BillboardConstraints.addEntityData(this.billboard.id(), dataValues);
|
||||||
ItemDisplayEntityData.Translation.addEntityDataIfNotDefaultValue(this.translation, dataValues);
|
ItemDisplayEntityData.Translation.addEntityData(this.translation, dataValues);
|
||||||
ItemDisplayEntityData.DisplayType.addEntityDataIfNotDefaultValue(this.displayContext.id(), dataValues);
|
ItemDisplayEntityData.DisplayType.addEntityData(this.displayContext.id(), dataValues);
|
||||||
ItemDisplayEntityData.ShadowRadius.addEntityDataIfNotDefaultValue(this.shadowRadius, dataValues);
|
ItemDisplayEntityData.ShadowRadius.addEntityData(this.shadowRadius, dataValues);
|
||||||
ItemDisplayEntityData.ShadowStrength.addEntityDataIfNotDefaultValue(this.shadowStrength, dataValues);
|
ItemDisplayEntityData.ShadowStrength.addEntityData(this.shadowStrength, dataValues);
|
||||||
return dataValues;
|
return dataValues;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -80,14 +80,6 @@ public class ItemDisplayBlockEntityElementConfig implements BlockEntityElementCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemDisplayBlockEntityElement create(World world, BlockPos pos, ItemDisplayBlockEntityElement previous) {
|
public ItemDisplayBlockEntityElement create(World world, BlockPos pos, ItemDisplayBlockEntityElement previous) {
|
||||||
Quaternionf previousRotation = previous.config.rotation;
|
|
||||||
if (previousRotation.x != 0 || previousRotation.y != 0 || previousRotation.z != 0 || previousRotation.w != 1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Vector3f translation = previous.config.translation;
|
|
||||||
if (translation.x != 0 || translation.y != 0 || translation.z != 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new ItemDisplayBlockEntityElement(this, pos, previous.entityId,
|
return new ItemDisplayBlockEntityElement(this, pos, previous.entityId,
|
||||||
previous.config.yRot != this.yRot ||
|
previous.config.yRot != this.yRot ||
|
||||||
previous.config.xRot != this.xRot ||
|
previous.config.xRot != this.xRot ||
|
||||||
|
|||||||
@@ -52,11 +52,11 @@ public class TextDisplayBlockEntityElementConfig implements BlockEntityElementCo
|
|||||||
this.billboard = billboard;
|
this.billboard = billboard;
|
||||||
this.lazyMetadataPacket = player -> {
|
this.lazyMetadataPacket = player -> {
|
||||||
List<Object> dataValues = new ArrayList<>();
|
List<Object> dataValues = new ArrayList<>();
|
||||||
TextDisplayEntityData.Text.addEntityDataIfNotDefaultValue(ComponentUtils.adventureToMinecraft(text(player)), dataValues);
|
TextDisplayEntityData.Text.addEntityData(ComponentUtils.adventureToMinecraft(text(player)), dataValues);
|
||||||
TextDisplayEntityData.Scale.addEntityDataIfNotDefaultValue(this.scale, dataValues);
|
TextDisplayEntityData.Scale.addEntityData(this.scale, dataValues);
|
||||||
TextDisplayEntityData.RotationLeft.addEntityDataIfNotDefaultValue(this.rotation, dataValues);
|
TextDisplayEntityData.RotationLeft.addEntityData(this.rotation, dataValues);
|
||||||
TextDisplayEntityData.BillboardConstraints.addEntityDataIfNotDefaultValue(this.billboard.id(), dataValues);
|
TextDisplayEntityData.BillboardConstraints.addEntityData(this.billboard.id(), dataValues);
|
||||||
TextDisplayEntityData.Translation.addEntityDataIfNotDefaultValue(this.translation, dataValues);
|
TextDisplayEntityData.Translation.addEntityData(this.translation, dataValues);
|
||||||
return dataValues;
|
return dataValues;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -68,14 +68,6 @@ public class TextDisplayBlockEntityElementConfig implements BlockEntityElementCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TextDisplayBlockEntityElement create(World world, BlockPos pos, TextDisplayBlockEntityElement previous) {
|
public TextDisplayBlockEntityElement create(World world, BlockPos pos, TextDisplayBlockEntityElement previous) {
|
||||||
Quaternionf previousRotation = previous.config.rotation;
|
|
||||||
if (previousRotation.x != 0 || previousRotation.y != 0 || previousRotation.z != 0 || previousRotation.w != 1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Vector3f translation = previous.config.translation;
|
|
||||||
if (translation.x != 0 || translation.y != 0 || translation.z != 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new TextDisplayBlockEntityElement(this, pos, previous.entityId,
|
return new TextDisplayBlockEntityElement(this, pos, previous.entityId,
|
||||||
previous.config.yRot != this.yRot ||
|
previous.config.yRot != this.yRot ||
|
||||||
previous.config.xRot != this.xRot ||
|
previous.config.xRot != this.xRot ||
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ items:
|
|||||||
state: barrier
|
state: barrier
|
||||||
entity-renderer:
|
entity-renderer:
|
||||||
item: default:sofa
|
item: default:sofa
|
||||||
yaw: 90
|
rotation: 90
|
||||||
facing=north,shape=straight:
|
facing=north,shape=straight:
|
||||||
state: barrier
|
state: barrier
|
||||||
entity-renderer:
|
entity-renderer:
|
||||||
@@ -102,12 +102,12 @@ items:
|
|||||||
state: barrier
|
state: barrier
|
||||||
entity-renderer:
|
entity-renderer:
|
||||||
item: default:sofa
|
item: default:sofa
|
||||||
yaw: 180
|
rotation: 180
|
||||||
facing=west,shape=straight:
|
facing=west,shape=straight:
|
||||||
state: barrier
|
state: barrier
|
||||||
entity-renderer:
|
entity-renderer:
|
||||||
item: default:sofa
|
item: default:sofa
|
||||||
yaw: 270
|
rotation: 270
|
||||||
facing=east,shape=inner_left:
|
facing=east,shape=inner_left:
|
||||||
state: barrier
|
state: barrier
|
||||||
entity-renderer:
|
entity-renderer:
|
||||||
@@ -116,22 +116,22 @@ items:
|
|||||||
state: barrier
|
state: barrier
|
||||||
entity-renderer:
|
entity-renderer:
|
||||||
item: default:sofa_inner
|
item: default:sofa_inner
|
||||||
yaw: 270
|
rotation: 270
|
||||||
facing=south,shape=inner_left:
|
facing=south,shape=inner_left:
|
||||||
state: barrier
|
state: barrier
|
||||||
entity-renderer:
|
entity-renderer:
|
||||||
item: default:sofa_inner
|
item: default:sofa_inner
|
||||||
yaw: 90
|
rotation: 90
|
||||||
facing=west,shape=inner_left:
|
facing=west,shape=inner_left:
|
||||||
state: barrier
|
state: barrier
|
||||||
entity-renderer:
|
entity-renderer:
|
||||||
item: default:sofa_inner
|
item: default:sofa_inner
|
||||||
yaw: 180
|
rotation: 180
|
||||||
facing=east,shape=inner_right:
|
facing=east,shape=inner_right:
|
||||||
state: barrier
|
state: barrier
|
||||||
entity-renderer:
|
entity-renderer:
|
||||||
item: default:sofa_inner
|
item: default:sofa_inner
|
||||||
yaw: 90
|
rotation: 90
|
||||||
facing=north,shape=inner_right:
|
facing=north,shape=inner_right:
|
||||||
state: barrier
|
state: barrier
|
||||||
entity-renderer:
|
entity-renderer:
|
||||||
@@ -140,12 +140,12 @@ items:
|
|||||||
state: barrier
|
state: barrier
|
||||||
entity-renderer:
|
entity-renderer:
|
||||||
item: default:sofa_inner
|
item: default:sofa_inner
|
||||||
yaw: 180
|
rotation: 180
|
||||||
facing=west,shape=inner_right:
|
facing=west,shape=inner_right:
|
||||||
state: barrier
|
state: barrier
|
||||||
entity-renderer:
|
entity-renderer:
|
||||||
item: default:sofa_inner
|
item: default:sofa_inner
|
||||||
yaw: 270
|
rotation: 270
|
||||||
variants:
|
variants:
|
||||||
facing=east,shape=inner_left:
|
facing=east,shape=inner_left:
|
||||||
appearance: facing=east,shape=inner_left
|
appearance: facing=east,shape=inner_left
|
||||||
|
|||||||
Reference in New Issue
Block a user