-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix many bugs, now ready for release
- Loading branch information
1 parent
422b215
commit ae82dfc
Showing
7 changed files
with
75 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 3 additions & 17 deletions
20
src/main/kotlin/com/viral32111/progression/UpdateExperienceProgress.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,18 @@ | ||
package com.viral32111.progression | ||
|
||
import com.viral32111.progression.Progression.Companion.LOGGER | ||
import com.viral32111.progression.Progression.Companion.bossBar | ||
import com.viral32111.progression.Progression.Companion.configuration | ||
import com.viral32111.progression.Progression.Companion.isEndUnlocked | ||
import com.viral32111.progression.Progression.Companion.isNetherUnlocked | ||
import com.viral32111.progression.Progression.Companion.state | ||
import com.viral32111.progression.Progression.Companion.updateBossBar | ||
import net.minecraft.entity.player.PlayerEntity | ||
import net.minecraft.text.Text | ||
import net.minecraft.util.ActionResult | ||
|
||
fun updateExperienceProgress( player: PlayerEntity, experience: Int ): ActionResult { | ||
state.experienceCounter += experience | ||
state.markDirty() | ||
|
||
LOGGER.info( "Incremented global experience counter to ${ state.experienceCounter } due to player '${ player.displayName }' (${ player.uuidAsString }) gaining $experience experience." ) | ||
LOGGER.info( "Incremented global experience counter to ${ state.experienceCounter } due to player '${ player.displayName.string }' (${ player.uuidAsString }) gaining $experience experience." ) | ||
|
||
if ( !isNetherUnlocked() ) { | ||
bossBar.name = Text.of( configuration.bossBarTitles.nether ) | ||
bossBar.isVisible = state.experienceCounter < configuration.experienceThresholds.nether | ||
bossBar.percent = state.experienceCounter.toFloat() / configuration.experienceThresholds.nether | ||
} else if ( isNetherUnlocked() && !isEndUnlocked() ) { | ||
bossBar.name = Text.of( configuration.bossBarTitles.end ) | ||
bossBar.isVisible = state.experienceCounter < configuration.experienceThresholds.end | ||
bossBar.percent = state.experienceCounter.toFloat() / configuration.experienceThresholds.end | ||
} else { | ||
bossBar.isVisible = false | ||
} | ||
updateBossBar() | ||
|
||
return ActionResult.PASS | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters