diff --git a/src/main/java/de/bixilon/minosoft/config/profile/profiles/block/rendering/RenderingC.kt b/src/main/java/de/bixilon/minosoft/config/profile/profiles/block/rendering/RenderingC.kt
index 43d1bda2e..9266086ea 100644
--- a/src/main/java/de/bixilon/minosoft/config/profile/profiles/block/rendering/RenderingC.kt
+++ b/src/main/java/de/bixilon/minosoft/config/profile/profiles/block/rendering/RenderingC.kt
@@ -15,6 +15,7 @@ package de.bixilon.minosoft.config.profile.profiles.block.rendering
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
import de.bixilon.minosoft.config.profile.profiles.block.BlockProfile
+import de.bixilon.minosoft.config.profile.profiles.block.rendering.entities.EntitiesC
class RenderingC(profile: BlockProfile) {
@@ -23,4 +24,6 @@ class RenderingC(profile: BlockProfile) {
* If set position based random block models are disabled
*/
var antiMoirePattern by BooleanDelegate(profile, true, "profile.block.rendering.anti_moire_pattern")
+
+ val entities = EntitiesC(profile)
}
diff --git a/src/main/java/de/bixilon/minosoft/config/profile/profiles/block/rendering/entities/EntitiesC.kt b/src/main/java/de/bixilon/minosoft/config/profile/profiles/block/rendering/entities/EntitiesC.kt
new file mode 100644
index 000000000..9dd4715fc
--- /dev/null
+++ b/src/main/java/de/bixilon/minosoft/config/profile/profiles/block/rendering/entities/EntitiesC.kt
@@ -0,0 +1,21 @@
+/*
+ * Minosoft
+ * Copyright (C) 2020-2022 Moritz Zwerger
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program. If not, see .
+ *
+ * This software is not affiliated with Mojang AB, the original developer of Minecraft.
+ */
+
+package de.bixilon.minosoft.config.profile.profiles.block.rendering.entities
+
+import de.bixilon.minosoft.config.profile.profiles.block.BlockProfile
+import de.bixilon.minosoft.config.profile.profiles.block.rendering.entities.sign.SignC
+
+class EntitiesC(profile: BlockProfile) {
+ val sign = SignC(profile)
+}
diff --git a/src/main/java/de/bixilon/minosoft/config/profile/profiles/block/rendering/entities/sign/SignC.kt b/src/main/java/de/bixilon/minosoft/config/profile/profiles/block/rendering/entities/sign/SignC.kt
new file mode 100644
index 000000000..77da6900a
--- /dev/null
+++ b/src/main/java/de/bixilon/minosoft/config/profile/profiles/block/rendering/entities/sign/SignC.kt
@@ -0,0 +1,25 @@
+/*
+ * Minosoft
+ * Copyright (C) 2020-2023 Moritz Zwerger
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program. If not, see .
+ *
+ * This software is not affiliated with Mojang AB, the original developer of Minecraft.
+ */
+
+package de.bixilon.minosoft.config.profile.profiles.block.rendering.entities.sign
+
+import de.bixilon.minosoft.config.profile.delegate.types.EnumDelegate
+import de.bixilon.minosoft.config.profile.profiles.block.BlockProfile
+import de.bixilon.minosoft.gui.rendering.gui.elements.HorizontalAlignments
+
+class SignC(profile: BlockProfile) {
+ /**
+ * Font alignment of the text on a sign
+ */
+ var fontAlignment by EnumDelegate(profile, HorizontalAlignments.LEFT, HorizontalAlignments)
+}
diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/gui/elements/HorizontalAlignments.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/gui/elements/HorizontalAlignments.kt
index d94ed2dfb..59f912d06 100644
--- a/src/main/java/de/bixilon/minosoft/gui/rendering/gui/elements/HorizontalAlignments.kt
+++ b/src/main/java/de/bixilon/minosoft/gui/rendering/gui/elements/HorizontalAlignments.kt
@@ -14,6 +14,8 @@
package de.bixilon.minosoft.gui.rendering.gui.elements
import de.bixilon.kotlinglm.vec2.Vec2
+import de.bixilon.kutil.enums.EnumUtil
+import de.bixilon.kutil.enums.ValuesEnum
enum class HorizontalAlignments {
LEFT,
@@ -21,7 +23,10 @@ enum class HorizontalAlignments {
RIGHT,
;
- companion object {
+ companion object : ValuesEnum {
+ override val VALUES = values()
+ override val NAME_MAP = EnumUtil.getEnumValues(VALUES)
+
fun HorizontalAlignments.getOffset(width: Float, childWidth: Float): Float {
return when (this) {
LEFT -> 0.0f
diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/world/entities/renderer/sign/SignBlockEntityRenderer.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/world/entities/renderer/sign/SignBlockEntityRenderer.kt
index b22b79fab..73263b7a7 100644
--- a/src/main/java/de/bixilon/minosoft/gui/rendering/world/entities/renderer/sign/SignBlockEntityRenderer.kt
+++ b/src/main/java/de/bixilon/minosoft/gui/rendering/world/entities/renderer/sign/SignBlockEntityRenderer.kt
@@ -74,8 +74,12 @@ class SignBlockEntityRenderer(
}
textMesh.data.ensureSize(primitives * textMesh.order.size * SingleWorldMesh.WorldMeshStruct.FLOATS_PER_VERTEX)
+ val alignment = context.connection.profiles.block.rendering.entities.sign.fontAlignment
+
+ val properties = if (alignment == TEXT_PROPERTIES.alignment) TEXT_PROPERTIES else TEXT_PROPERTIES.copy(alignment = alignment)
+
for (line in sign.lines) {
- ChatComponentRenderer.render3dFlat(context, textPosition, TEXT_PROPERTIES, Vec3(0.0f, -yRotation, 0.0f), MAX_SIZE, mesh, line, light)
+ ChatComponentRenderer.render3dFlat(context, textPosition, properties, Vec3(0.0f, -yRotation, 0.0f), MAX_SIZE, mesh, line, light)
textPosition.y -= 0.11f
}
}