mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -04:00
Fix item using when not able to use; hud: fix vehicle health not disappearing
This commit is contained in:
parent
397cfd916c
commit
ca85ca017f
@ -25,9 +25,6 @@ import de.bixilon.minosoft.util.KUtil.decide
|
|||||||
import de.bixilon.minosoft.util.KUtil.toBoolean
|
import de.bixilon.minosoft.util.KUtil.toBoolean
|
||||||
import de.bixilon.minosoft.util.KUtil.toFloat
|
import de.bixilon.minosoft.util.KUtil.toFloat
|
||||||
import de.bixilon.minosoft.util.KUtil.toInt
|
import de.bixilon.minosoft.util.KUtil.toInt
|
||||||
import de.bixilon.minosoft.util.logging.Log
|
|
||||||
import de.bixilon.minosoft.util.logging.LogLevels
|
|
||||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
|
||||||
import de.bixilon.minosoft.util.nbt.tag.NBTUtil.asCompound
|
import de.bixilon.minosoft.util.nbt.tag.NBTUtil.asCompound
|
||||||
|
|
||||||
open class FoodItem(
|
open class FoodItem(
|
||||||
@ -61,7 +58,6 @@ open class FoodItem(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun finishUsing(connection: PlayConnection, itemStack: ItemStack) {
|
override fun finishUsing(connection: PlayConnection, itemStack: ItemStack) {
|
||||||
Log.log(LogMessageType.OTHER, LogLevels.VERBOSE) { "Finished eating: $timeToEat" }
|
|
||||||
if (connection.player.gamemode != Gamemodes.CREATIVE) {
|
if (connection.player.gamemode != Gamemodes.CREATIVE) {
|
||||||
itemStack.count--
|
itemStack.count--
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,9 @@ class HotbarVehicleHealthElement(hudRenderer: HUDRenderer) : AbstractHotbarHealt
|
|||||||
override var totalMaxHealth = 0.0f
|
override var totalMaxHealth = 0.0f
|
||||||
|
|
||||||
override fun forceRender(offset: Vec2i, z: Int, consumer: GUIVertexConsumer, options: GUIVertexOptions?): Int {
|
override fun forceRender(offset: Vec2i, z: Int, consumer: GUIVertexConsumer, options: GUIVertexOptions?): Int {
|
||||||
|
if (!shown) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
if (text) {
|
if (text) {
|
||||||
return super.forceRender(offset, z, consumer, options)
|
return super.forceRender(offset, z, consumer, options)
|
||||||
}
|
}
|
||||||
@ -77,6 +80,8 @@ class HotbarVehicleHealthElement(hudRenderer: HUDRenderer) : AbstractHotbarHealt
|
|||||||
val riddenEntity = hudRenderer.connection.player.vehicle
|
val riddenEntity = hudRenderer.connection.player.vehicle
|
||||||
if (riddenEntity == null || riddenEntity !is LivingEntity) {
|
if (riddenEntity == null || riddenEntity !is LivingEntity) {
|
||||||
if (this.shown) {
|
if (this.shown) {
|
||||||
|
totalHealth = 0.0f
|
||||||
|
totalMaxHealth = 0.0f
|
||||||
this.shown = false
|
this.shown = false
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ class InteractInteractionHandler(
|
|||||||
|
|
||||||
val interactingItem = interactingItem
|
val interactingItem = interactingItem
|
||||||
val item = interactingItem?.item
|
val item = interactingItem?.item
|
||||||
if (item is UsableItem) {
|
if (item is UsableItem && connection.player.isUsingItem) {
|
||||||
interactingTicksLeft--
|
interactingTicksLeft--
|
||||||
if (interactingTicksLeft < 0) {
|
if (interactingTicksLeft < 0) {
|
||||||
item.finishUsing(connection, interactingItem)
|
item.finishUsing(connection, interactingItem)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user