forked from mirrors/cobblemon
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
496590c2e0 | ||
|
|
75a5f08148 | ||
|
|
87d35da780 |
@@ -21,6 +21,7 @@
|
||||
- Factor in the weight of pokemon when calculating pushing forces between hitboxes.
|
||||
- Remade the Starter Selection Screen with new assets
|
||||
- Refactored berry trees to be less impactful on TPS (more performant)
|
||||
- Wearing Exp. Share on your head now grants you XP from any wild battle involving your Pokémon.
|
||||
|
||||
### Fixes
|
||||
- Fixes https://gitlab.com/cable-mc/cobblemon/-/issues/1943
|
||||
|
||||
@@ -83,6 +83,7 @@ import com.cobblemon.mod.common.data.CobblemonDataProvider
|
||||
import com.cobblemon.mod.common.events.AdvancementHandler
|
||||
import com.cobblemon.mod.common.events.CallbackHandler
|
||||
import com.cobblemon.mod.common.events.EntityCallbackHandler
|
||||
import com.cobblemon.mod.common.events.ExpShareHatHandler
|
||||
import com.cobblemon.mod.common.events.PokedexHandler
|
||||
import com.cobblemon.mod.common.events.ServerTickHandler
|
||||
import com.cobblemon.mod.common.events.StatHandler
|
||||
@@ -465,6 +466,7 @@ object Cobblemon {
|
||||
AdvancementHandler.registerListeners()
|
||||
PokedexHandler.registerListeners()
|
||||
StatHandler.registerListeners()
|
||||
ExpShareHatHandler.registerListeners()
|
||||
}
|
||||
|
||||
fun getLevel(dimension: ResourceKey<Level>): Level? {
|
||||
|
||||
@@ -347,6 +347,13 @@ class CobblemonConfig {
|
||||
@CobblemonConfigField(Category.Spawning, lang = "despawner_max_age_ticks", SERVER)
|
||||
var despawnerMaxAgeTicks = 3600
|
||||
|
||||
@CobblemonConfigField(Category.Battles, lang = "exp_share_hat_player_xp_enabled", SERVER)
|
||||
var expShareHatPlayerXpEnabled = true
|
||||
|
||||
@CobblemonConfigField(Category.Battles, lang = "exp_share_hat_player_xp_amount", SERVER)
|
||||
@IntConstraint(min = 0, max = 100)
|
||||
var expShareHatPlayerXpAmount = 3
|
||||
|
||||
fun clone(): CobblemonConfig {
|
||||
val newConfig = CobblemonConfig()
|
||||
CobblemonConfig::class.memberProperties.forEach { property ->
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.events
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.api.Priority
|
||||
import com.cobblemon.mod.common.api.events.CobblemonEvents.BATTLE_VICTORY
|
||||
import com.cobblemon.mod.common.api.events.battles.BattleVictoryEvent
|
||||
import com.cobblemon.mod.common.api.tags.CobblemonItemTags
|
||||
import com.cobblemon.mod.common.util.getPlayer
|
||||
import net.minecraft.world.entity.EquipmentSlot
|
||||
import java.util.*
|
||||
|
||||
object ExpShareHatHandler : EventHandler {
|
||||
override fun registerListeners() {
|
||||
BATTLE_VICTORY.subscribe(Priority.NORMAL, ::onWinBattle)
|
||||
}
|
||||
|
||||
fun onWinBattle(event: BattleVictoryEvent) {
|
||||
if (!event.battle.isPvW || event.wasWildCapture) return
|
||||
if (!Cobblemon.config.expShareHatPlayerXpEnabled) return
|
||||
|
||||
val xpAmount = Cobblemon.config.expShareHatPlayerXpAmount
|
||||
if (xpAmount <= 0) return
|
||||
|
||||
event.winners
|
||||
.flatMap { it.getPlayerUUIDs().mapNotNull(UUID::getPlayer) }
|
||||
.filter { player ->
|
||||
val headItem = player.getItemBySlot(EquipmentSlot.HEAD)
|
||||
headItem.`is`(CobblemonItemTags.EXPERIENCE_SHARE)
|
||||
}
|
||||
.forEach { player ->
|
||||
player.giveExperiencePoints(xpAmount)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2460,6 +2460,10 @@
|
||||
"cobblemon.config.ui.minimum_level_range_max.tooltip": "The value considered to be the highest party Pokémon level when a player's party is empty or extremely low level. The higher this value, the higher the levels of Pokémon can be around players with no or very weak Pokémon.",
|
||||
"cobblemon.config.ui.enable_spawning": "Enable Spawning",
|
||||
"cobblemon.config.ui.enable_spawning.tooltip": "Whether to allow Pokémon to spawn.",
|
||||
"cobblemon.config.ui.exp_share_hat_player_xp_enabled": "Exp. Share Hat Player XP",
|
||||
"cobblemon.config.ui.exp_share_hat_player_xp_enabled.tooltip": "Whether wearing an Exp. Share on the head grants Minecraft XP from wild battles.",
|
||||
"cobblemon.config.ui.exp_share_hat_player_xp_amount": "Exp. Share Hat XP Amount",
|
||||
"cobblemon.config.ui.exp_share_hat_player_xp_amount.tooltip": "Amount of Minecraft XP points given to the player when winning a wild battle with an Exp. Share on the head",
|
||||
"cobblemon.config.ui.minimum_distance_between_entities": "Minimum Distance Between Entities",
|
||||
"cobblemon.config.ui.minimum_distance_between_entities.tooltip": "The minimum block distance between spawning Pokémon and existing Entities in the World. This prevents clustered Pokémon spawning.",
|
||||
"cobblemon.config.ui.max_nearby_blocks_horizontal_range": "Max Nearby Blocks Horizontal Range",
|
||||
|
||||
Reference in New Issue
Block a user