better sprint assist energy sync
This commit is contained in:
parent
2d4556268e
commit
7a35f9739f
1 changed files with 5 additions and 1 deletions
|
@ -15,6 +15,7 @@ import net.minecraft.nbt.NBTTagCompound
|
||||||
import net.minecraft.nbt.NBTTagList
|
import net.minecraft.nbt.NBTTagList
|
||||||
import net.minecraft.util.StatCollector
|
import net.minecraft.util.StatCollector
|
||||||
import java.util.List
|
import java.util.List
|
||||||
|
import net.machinemuse.numina.general.MuseLogger
|
||||||
|
|
||||||
object SprintAssistModule {
|
object SprintAssistModule {
|
||||||
val MODULE_SPRINT_ASSIST: String = "Sprint Assist"
|
val MODULE_SPRINT_ASSIST: String = "Sprint Assist"
|
||||||
|
@ -44,7 +45,10 @@ class SprintAssistModule(validItems: List[IModularItem]) extends PowerModuleBase
|
||||||
def getDescription: String = "A set of servo motors to help you sprint (double-tap forward) and walk faster."
|
def getDescription: String = "A set of servo motors to help you sprint (double-tap forward) and walk faster."
|
||||||
|
|
||||||
def onPlayerTickActive(player: EntityPlayer, item: ItemStack) {
|
def onPlayerTickActive(player: EntityPlayer, item: ItemStack) {
|
||||||
val horzMovement: Double = Math.sqrt(player.motionX * player.motionX + player.motionZ * player.motionZ)
|
val motionX = player.posX - player.lastTickPosX
|
||||||
|
val motionY = player.posY - player.lastTickPosY
|
||||||
|
val motionZ = player.posZ - player.lastTickPosZ
|
||||||
|
val horzMovement: Double = Math.sqrt(motionX * motionX + motionZ * motionZ)
|
||||||
val totalEnergy: Double = ElectricItemUtils.getPlayerEnergy(player)
|
val totalEnergy: Double = ElectricItemUtils.getPlayerEnergy(player)
|
||||||
if (player.isSprinting) {
|
if (player.isSprinting) {
|
||||||
val exhaustion: Double = Math.round(horzMovement * 100.0F) * 0.01
|
val exhaustion: Double = Math.round(horzMovement * 100.0F) * 0.01
|
||||||
|
|
Loading…
Reference in a new issue