Fixed small upgrades needed display bug
This commit is contained in:
parent
aafae9e8ce
commit
702b64ecc0
@ -98,6 +98,8 @@ class QuarryTile(private val myPos: BlockPos, state: BlockState) : BlockEntity(Q
|
|||||||
return super<BlockEntity>.getCapability(cap, side)
|
return super<BlockEntity>.getCapability(cap, side)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun upgradesNeededForLevel(level: Int): Int = level.toFloat().pow(1.5f).toInt()
|
||||||
|
|
||||||
private fun getPickaxe(): ItemStack = Items.NETHERITE_PICKAXE.defaultInstance.apply {
|
private fun getPickaxe(): ItemStack = Items.NETHERITE_PICKAXE.defaultInstance.apply {
|
||||||
if (fortuneLevel > 0) enchant(Enchantments.BLOCK_FORTUNE, fortuneLevel)
|
if (fortuneLevel > 0) enchant(Enchantments.BLOCK_FORTUNE, fortuneLevel)
|
||||||
}
|
}
|
||||||
@ -174,7 +176,7 @@ class QuarryTile(private val myPos: BlockPos, state: BlockState) : BlockEntity(Q
|
|||||||
speedUpgradesNeeded -= used
|
speedUpgradesNeeded -= used
|
||||||
if (speedUpgradesNeeded == 0) {
|
if (speedUpgradesNeeded == 0) {
|
||||||
speedLevel++
|
speedLevel++
|
||||||
speedUpgradesNeeded = speedLevel.toFloat().pow(1.5f).toInt()
|
speedUpgradesNeeded = upgradesNeededForLevel(speedLevel)
|
||||||
player.displayClientMessage(TextComponent("New speed level: $speedLevel, upgrades needed for next level: $speedUpgradesNeeded"), true)
|
player.displayClientMessage(TextComponent("New speed level: $speedLevel, upgrades needed for next level: $speedUpgradesNeeded"), true)
|
||||||
} else
|
} else
|
||||||
player.displayClientMessage(TextComponent("Upgrades needed for next level: $speedUpgradesNeeded"), true)
|
player.displayClientMessage(TextComponent("Upgrades needed for next level: $speedUpgradesNeeded"), true)
|
||||||
@ -184,7 +186,7 @@ class QuarryTile(private val myPos: BlockPos, state: BlockState) : BlockEntity(Q
|
|||||||
fortuneUpgradesNeeded -= used
|
fortuneUpgradesNeeded -= used
|
||||||
if (fortuneUpgradesNeeded == 0) {
|
if (fortuneUpgradesNeeded == 0) {
|
||||||
fortuneLevel++
|
fortuneLevel++
|
||||||
fortuneUpgradesNeeded = fortuneLevel.toFloat().pow(1.5f).toInt()
|
fortuneUpgradesNeeded = upgradesNeededForLevel(fortuneLevel)
|
||||||
player.displayClientMessage(TextComponent("New fortune level: $fortuneLevel, upgrades needed for next level: $fortuneUpgradesNeeded"), true)
|
player.displayClientMessage(TextComponent("New fortune level: $fortuneLevel, upgrades needed for next level: $fortuneUpgradesNeeded"), true)
|
||||||
} else
|
} else
|
||||||
player.displayClientMessage(TextComponent("Upgrades needed for next level: $fortuneUpgradesNeeded"), true)
|
player.displayClientMessage(TextComponent("Upgrades needed for next level: $fortuneUpgradesNeeded"), true)
|
||||||
@ -265,9 +267,9 @@ class QuarryTile(private val myPos: BlockPos, state: BlockState) : BlockEntity(Q
|
|||||||
override fun getUpdatePacket(): Packet<ClientGamePacketListener>? = ClientboundBlockEntityDataPacket.create(this)
|
override fun getUpdatePacket(): Packet<ClientGamePacketListener>? = ClientboundBlockEntityDataPacket.create(this)
|
||||||
|
|
||||||
fun probeInfo(info: IProbeInfo) {
|
fun probeInfo(info: IProbeInfo) {
|
||||||
val speedMax = (2.0).pow(speedLevel).toInt()
|
val speedMax = upgradesNeededForLevel(speedLevel)
|
||||||
info.text("Speed: level $speedLevel, ${speedMax - speedUpgradesNeeded}/$speedMax")
|
info.text("Speed: level $speedLevel, ${speedMax - speedUpgradesNeeded}/$speedMax")
|
||||||
val fortuneMax = (2.0).pow(fortuneLevel).toInt()
|
val fortuneMax = upgradesNeededForLevel(fortuneLevel)
|
||||||
info.text("Fortune: level $fortuneLevel, ${fortuneMax - fortuneUpgradesNeeded}/$fortuneMax")
|
info.text("Fortune: level $fortuneLevel, ${fortuneMax - fortuneUpgradesNeeded}/$fortuneMax")
|
||||||
if (itemsToDrop.isNotEmpty())
|
if (itemsToDrop.isNotEmpty())
|
||||||
info.text("Waiting to extract items...")
|
info.text("Waiting to extract items...")
|
||||||
|
Loading…
Reference in New Issue
Block a user