fixes (hud: vehicle health), improvements

This commit is contained in:
Bixilon 2021-10-29 18:15:31 +02:00
parent 5aafc44d70
commit c148102a7a
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
7 changed files with 13 additions and 13 deletions

View File

@ -51,7 +51,7 @@ class Horse(connection: PlayConnection, entityType: EntityType, position: Vec3d,
1 -> LEGACY_IRON_ARMOR 1 -> LEGACY_IRON_ARMOR
2 -> LEGACY_GOLD_ARMOR 2 -> LEGACY_GOLD_ARMOR
3 -> LEGACY_DIAMOND_ARMOR 3 -> LEGACY_DIAMOND_ARMOR
else -> error("Invalid armor set") else -> null
}] }]
} }

View File

@ -253,6 +253,10 @@ class BaseComponent : ChatComponent {
} }
} }
override fun hashCode(): Int {
return parts.hashCode()
}
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (other === this) { if (other === this) {
return true return true

View File

@ -211,6 +211,11 @@ open class TextComponent(
) )
} }
override fun hashCode(): Int {
return message.hashCode()
}
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (other === this) { if (other === this) {
return true return true

View File

@ -66,9 +66,9 @@ class HotbarCoreElement(hudRenderer: HUDRenderer) : Element(hudRenderer) {
topLeft += protection topLeft += protection
topLeft += health topLeft += health
topRight += vehicleHealth // ToDo: Also show in creative
topRight += air topRight += air
topRight += hunger topRight += hunger
topRight += vehicleHealth // non notchain, but better imho
base.parent = this base.parent = this

View File

@ -428,7 +428,6 @@ object KUtil {
return this.toString().replace("-", "") return this.toString().replace("-", "")
} }
fun <T : ResourceLocationAble> List<T>.asResourceLocationMap(): Map<ResourceLocation, T> { fun <T : ResourceLocationAble> List<T>.asResourceLocationMap(): Map<ResourceLocation, T> {
val ret: MutableMap<ResourceLocation, T> = mutableMapOf() val ret: MutableMap<ResourceLocation, T> = mutableMapOf()
@ -450,7 +449,6 @@ object KUtil {
return Base64.getEncoder().encodeToString(this) return Base64.getEncoder().encodeToString(this)
} }
fun String?.nullCompare(other: String?): Int? { fun String?.nullCompare(other: String?): Int? {
(this ?: "").compareTo(other ?: "").let { (this ?: "").compareTo(other ?: "").let {
if (it != 0) { if (it != 0) {

View File

@ -19,13 +19,6 @@ import kotlin.math.floor
object MMath { object MMath {
fun minClamp(value: Int, min: Int): Int {
if (value < min) {
return min
}
return value
}
fun clamp(value: Vec2i, min: Vec2i, max: Vec2i): Vec2i { fun clamp(value: Vec2i, min: Vec2i, max: Vec2i): Vec2i {
value.x = clamp(value.x, min.x, max.x) value.x = clamp(value.x, min.x, max.x)
value.y = clamp(value.y, min.y, max.y) value.y = clamp(value.y, min.y, max.y)

View File

@ -478,14 +478,14 @@
"end": [61, 18] "end": [61, 18]
} }
}, },
"minecraft:vehicle_heart": { "minecraft:vehicle_half_heart": {
"0": { "0": {
"texture": "minecraft:textures/gui/icons.png", "texture": "minecraft:textures/gui/icons.png",
"start": [97, 9], "start": [97, 9],
"end": [106, 18] "end": [106, 18]
} }
}, },
"minecraft:vehicle_half_heart": { "minecraft:vehicle_heart": {
"0": { "0": {
"texture": "minecraft:textures/gui/icons.png", "texture": "minecraft:textures/gui/icons.png",
"start": [88, 9], "start": [88, 9],