Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f79b9198d0 | ||
|
|
3599dc97cc | ||
|
|
8a5d895f03 |
No files matched your search
@@ -9,6 +9,8 @@
|
||||
- A finished battle now has winners and losers set inside of `PokemonBattle` instead of them always being empty.
|
||||
- Dialogues are correctly removed from memory when they are stopped.
|
||||
- Dialogues with variably-set initial pages now properly start timeout tracking.
|
||||
### Additions
|
||||
- Added `/cobblemonconfig reload` command to reload `main.json` configuration. **Note:** Some settings require a server restart to take effect; use this command cautiously.
|
||||
|
||||
## [1.6.1 (January 26th, 2025)](#1-6-1)
|
||||
|
||||
|
||||
@@ -125,6 +125,7 @@ import kotlin.reflect.jvm.javaField
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.commands.synchronization.SingletonArgumentInfo
|
||||
import net.minecraft.resources.ResourceKey
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.server.packs.PackType
|
||||
import net.minecraft.world.item.NameTagItem
|
||||
import net.minecraft.world.level.Level
|
||||
@@ -220,7 +221,7 @@ object Cobblemon {
|
||||
storage.onPlayerDataSync(it)
|
||||
playerDataManager.syncAllToPlayer(it)
|
||||
starterHandler.handleJoin(it)
|
||||
ServerSettingsPacket(this.config.preventCompletePartyDeposit, this.config.displayEntityLevelLabel, this.config.displayEntityNameLabel, this.config.maxPokemonLevel, this.config.maxPokemonFriendship, this.config.maxDynamaxLevel).sendToPlayer(it)
|
||||
sendServerSettingsPacketToPlayer(it)
|
||||
}
|
||||
PlatformEvents.SERVER_PLAYER_LOGOUT.subscribe {
|
||||
PCLinkManager.removeLink(it.player.uuid)
|
||||
@@ -268,8 +269,17 @@ object Cobblemon {
|
||||
}
|
||||
|
||||
HeldItemProvider.register(CobblemonHeldItemManager, Priority.LOWEST)
|
||||
}
|
||||
|
||||
|
||||
fun sendServerSettingsPacketToPlayer(player: ServerPlayer) {
|
||||
ServerSettingsPacket(
|
||||
this.config.preventCompletePartyDeposit,
|
||||
this.config.displayEntityLevelLabel,
|
||||
this.config.displayEntityNameLabel,
|
||||
this.config.maxPokemonLevel,
|
||||
this.config.maxPokemonFriendship,
|
||||
this.config.maxDynamaxLevel,
|
||||
).sendToPlayer(player)
|
||||
}
|
||||
|
||||
fun initialize() {
|
||||
@@ -429,7 +439,23 @@ object Cobblemon {
|
||||
}
|
||||
}
|
||||
|
||||
private fun initializeConfig() {
|
||||
loadCobblemonConfig()
|
||||
saveConfig()
|
||||
PokemonSpecies.observable.subscribe { starterConfig = this.loadStarterConfig() }
|
||||
}
|
||||
|
||||
fun loadConfig() {
|
||||
initializeConfig()
|
||||
bestSpawner.init()
|
||||
}
|
||||
|
||||
fun reloadConfig() {
|
||||
initializeConfig()
|
||||
bestSpawner.reloadConfig()
|
||||
}
|
||||
|
||||
private fun loadCobblemonConfig() {
|
||||
val configFile = File(CONFIG_PATH)
|
||||
configFile.parentFile.mkdirs()
|
||||
|
||||
@@ -472,12 +498,6 @@ object Cobblemon {
|
||||
} else {
|
||||
this.config = CobblemonConfig()
|
||||
}
|
||||
|
||||
config.lastSavedVersion = VERSION
|
||||
this.saveConfig()
|
||||
|
||||
bestSpawner.loadConfig()
|
||||
PokemonSpecies.observable.subscribe { starterConfig = this.loadStarterConfig() }
|
||||
}
|
||||
|
||||
fun loadStarterConfig(): StarterConfig {
|
||||
@@ -501,6 +521,8 @@ object Cobblemon {
|
||||
}
|
||||
|
||||
fun saveConfig() {
|
||||
config.lastSavedVersion = VERSION
|
||||
|
||||
try {
|
||||
val configFile = File(CONFIG_PATH)
|
||||
val fileWriter = FileWriter(configFile)
|
||||
@@ -527,4 +549,4 @@ object Cobblemon {
|
||||
this.implementation.registerCommandArgument(cobblemonResource("npc_class"), NPCClassArgumentType::class, SingletonArgumentInfo.contextFree(NPCClassArgumentType::npcClass))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,7 @@ object CobblemonCommands {
|
||||
FreezePokemonCommand.register(dispatcher)
|
||||
ApplyPlayerTextureCommand.register(dispatcher)
|
||||
RunMolangScriptCommand.register(dispatcher)
|
||||
CobblemonConfigCommand.register(dispatcher)
|
||||
|
||||
// Possibly lock down registration if and only if under dev environment or running in an environment
|
||||
// with a certain system environment variable set
|
||||
|
||||
+2
-2
@@ -8,8 +8,6 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.permission
|
||||
|
||||
import com.cobblemon.mod.common.command.AbandonMultiTeam
|
||||
|
||||
object CobblemonPermissions {
|
||||
|
||||
private const val COMMAND_PREFIX = "command."
|
||||
@@ -84,6 +82,8 @@ object CobblemonPermissions {
|
||||
|
||||
val RUN_MOLANG_SCRIPT = this.create("${COMMAND_PREFIX}runmolangscript", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
|
||||
|
||||
val COBBLEMON_CONFIG_RELOAD = this.create("${COMMAND_PREFIX}cobblemonconfig.reload", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
|
||||
|
||||
fun all(): Iterable<Permission> = this.permissions
|
||||
|
||||
private fun create(node: String, level: PermissionLevel): Permission {
|
||||
|
||||
@@ -83,8 +83,9 @@ object BestSpawner {
|
||||
var defaultPokemonDespawner: Despawner<PokemonEntity> = CobblemonAgingDespawner(getAgeTicks = { it.ticksLived })
|
||||
lateinit var fishingSpawner: FishingSpawner
|
||||
|
||||
fun loadConfig() {
|
||||
fun init() {
|
||||
LOGGER.info("Starting the Best Spawner...")
|
||||
|
||||
SpawningCondition.register(BasicSpawningCondition.NAME, BasicSpawningCondition::class.java)
|
||||
SpawningCondition.register(AreaSpawningCondition.NAME, AreaSpawningCondition::class.java)
|
||||
SpawningCondition.register(SubmergedSpawningCondition.NAME, SubmergedSpawningCondition::class.java)
|
||||
@@ -94,6 +95,7 @@ object BestSpawner {
|
||||
SpawningCondition.register(FishingSpawningCondition.NAME, FishingSpawningCondition::class.java)
|
||||
|
||||
LOGGER.info("Loaded ${SpawningCondition.conditionTypes.size} spawning condition types.")
|
||||
|
||||
SpawningContextCalculator.register(GroundedSpawningContextCalculator)
|
||||
SpawningContextCalculator.register(SeafloorSpawningContextCalculator)
|
||||
SpawningContextCalculator.register(LavafloorSpawningContextCalculator)
|
||||
@@ -113,14 +115,23 @@ object BestSpawner {
|
||||
SpawnDetail.registerSpawnType(name = NPCSpawnDetail.TYPE, NPCSpawnDetail::class.java)
|
||||
LOGGER.info("Loaded ${SpawnDetail.spawnDetailTypes.size} spawn detail types.")
|
||||
|
||||
config = BestSpawnerConfig.load()
|
||||
loadConfig()
|
||||
|
||||
SpawnDetailPresets.registerPresetType(BasicSpawnDetailPreset.NAME, BasicSpawnDetailPreset::class.java)
|
||||
SpawnDetailPresets.registerPresetType(PokemonSpawnDetailPreset.NAME, PokemonSpawnDetailPreset::class.java)
|
||||
}
|
||||
|
||||
fun loadConfig() {
|
||||
config = BestSpawnerConfig.load()
|
||||
}
|
||||
|
||||
fun reloadConfig() {
|
||||
loadConfig()
|
||||
spawnerManagers.forEach(SpawnerManager::onConfigReload)
|
||||
}
|
||||
|
||||
fun onServerStarted() {
|
||||
spawnerManagers.forEach(SpawnerManager::onServerStarted)
|
||||
fishingSpawner = FishingSpawner()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,4 +96,4 @@ object SpawnDetailPresets : JsonDataRegistry<SpawnDetailPreset> {
|
||||
this.presets = data.toMutableMap()
|
||||
Cobblemon.LOGGER.info("Loaded ${presets.size} spawn detail presets.")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ package com.cobblemon.mod.common.api.spawning
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.api.spawning.influence.SpawningInfluence
|
||||
import com.cobblemon.mod.common.api.spawning.spawner.PlayerSpawner
|
||||
import com.cobblemon.mod.common.api.spawning.spawner.Spawner
|
||||
import com.cobblemon.mod.common.api.spawning.spawner.TickingSpawner
|
||||
import com.cobblemon.mod.common.util.server
|
||||
@@ -58,6 +59,12 @@ open class SpawnerManager {
|
||||
}
|
||||
}
|
||||
|
||||
open fun onConfigReload() {
|
||||
spawners.filterIsInstance<PlayerSpawner>().forEach {
|
||||
it.ticksBetweenSpawns = Cobblemon.config.ticksBetweenSpawnAttempts
|
||||
}
|
||||
}
|
||||
|
||||
open fun onServerStarted() {
|
||||
spawners.clear()
|
||||
}
|
||||
|
||||
+1
-1
@@ -161,4 +161,4 @@ abstract class SpawningCondition<T : SpawningContext> {
|
||||
return false
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -221,4 +221,4 @@ abstract class SpawningContext {
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -64,4 +64,4 @@ open class SpawningContextInput(
|
||||
val cause: SpawnCause,
|
||||
/** The [Level] the spawning context exists in. */
|
||||
val world: ServerLevel
|
||||
)
|
||||
)
|
||||
@@ -103,4 +103,4 @@ abstract class SpawnDetail : ModDependant {
|
||||
}
|
||||
|
||||
abstract fun doSpawn(ctx: SpawningContext): SpawnAction<*>
|
||||
}
|
||||
}
|
||||
@@ -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.command
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.api.permission.CobblemonPermissions
|
||||
import com.cobblemon.mod.common.util.commandLang
|
||||
import com.cobblemon.mod.common.util.permission
|
||||
import com.mojang.brigadier.Command
|
||||
import com.mojang.brigadier.CommandDispatcher
|
||||
import net.minecraft.commands.CommandSourceStack
|
||||
import net.minecraft.commands.Commands
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
|
||||
object CobblemonConfigCommand {
|
||||
fun register(dispatcher: CommandDispatcher<CommandSourceStack>) {
|
||||
dispatcher.register(
|
||||
Commands.literal("cobblemonconfig")
|
||||
.then(
|
||||
Commands.literal("reload")
|
||||
.permission(CobblemonPermissions.COBBLEMON_CONFIG_RELOAD)
|
||||
.executes {
|
||||
Cobblemon.reloadConfig()
|
||||
it.source.server.playerList.players.forEach { player ->
|
||||
if (player is ServerPlayer) {
|
||||
Cobblemon.sendServerSettingsPacketToPlayer(player)
|
||||
}
|
||||
}
|
||||
|
||||
it.source.sendSuccess({ commandLang("cobblemon_config.reload") }, true)
|
||||
Command.SINGLE_SUCCESS
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1528,6 +1528,7 @@
|
||||
"cobblemon.command.pokemonrestart": "Cleared %1$s's party and PC.",
|
||||
"cobblemon.command.freezepokemon.non_pokemon": "You are not looking at a Pokémon.",
|
||||
"cobblemon.command.npcedit.non_npc": "You are not looking at a NPC.",
|
||||
"cobblemon.command.cobblemon_config.reload": "Reloading Cobblemon settings.",
|
||||
|
||||
"advancements.cobblemon.root": "The World of Cobblemon!",
|
||||
"advancements.cobblemon.root.description": "Choose a starter Pokémon and set out on a new adventure",
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
{
|
||||
"id": "whiscash-1",
|
||||
"pokemon": "whiscash",
|
||||
"presets": [
|
||||
"water"
|
||||
],
|
||||
"presets": ["water"],
|
||||
"type": "pokemon",
|
||||
"context": "submerged",
|
||||
"bucket": "common",
|
||||
@@ -16,17 +14,13 @@
|
||||
"weight": 1.0,
|
||||
"condition": {
|
||||
"canSeeSky": true,
|
||||
"biomes": [
|
||||
"#cobblemon:is_swamp"
|
||||
]
|
||||
"biomes": ["#cobblemon:is_swamp"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "whiscash-2",
|
||||
"pokemon": "whiscash",
|
||||
"presets": [
|
||||
"water"
|
||||
],
|
||||
"presets": ["water"],
|
||||
"type": "pokemon",
|
||||
"context": "submerged",
|
||||
"bucket": "uncommon",
|
||||
@@ -35,9 +29,7 @@
|
||||
"condition": {
|
||||
"minSkyLight": 0,
|
||||
"maxSkyLight": 7,
|
||||
"biomes": [
|
||||
"#cobblemon:is_overworld"
|
||||
]
|
||||
"biomes": ["#cobblemon:is_overworld"]
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -60,9 +52,7 @@
|
||||
]
|
||||
},
|
||||
"anticondition": {
|
||||
"biomes": [
|
||||
"#cobblemon:is_freezing"
|
||||
]
|
||||
"biomes": ["#cobblemon:is_freezing"]
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -76,14 +66,12 @@
|
||||
"condition": {
|
||||
"minSkyLight": 0,
|
||||
"maxSkyLight": 7,
|
||||
"biomes": [
|
||||
"#cobblemon:is_overworld"
|
||||
]
|
||||
"biomes": ["#cobblemon:is_overworld"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "whiscash-5",
|
||||
"pokemon": "whiscash",
|
||||
"pokemon": "whiscash whiscash_nero",
|
||||
"type": "pokemon",
|
||||
"context": "fishing",
|
||||
"bucket": "rare",
|
||||
@@ -102,34 +90,13 @@
|
||||
"bobber": "cobblemon:master_ball"
|
||||
},
|
||||
"anticondition": {
|
||||
"biomes": [
|
||||
"#cobblemon:is_freezing"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "whiscash-6",
|
||||
"pokemon": "whiscash",
|
||||
"type": "pokemon",
|
||||
"context": "fishing",
|
||||
"bucket": "rare",
|
||||
"level": "30-47",
|
||||
"weight": 10.0,
|
||||
"condition": {
|
||||
"minSkyLight": 0,
|
||||
"maxSkyLight": 7,
|
||||
"biomes": [
|
||||
"#cobblemon:is_overworld"
|
||||
],
|
||||
"bobber": "cobblemon:master_ball"
|
||||
"biomes": ["#cobblemon:is_freezing"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "whiscash-7",
|
||||
"pokemon": "whiscash",
|
||||
"presets": [
|
||||
"water"
|
||||
],
|
||||
"presets": ["water"],
|
||||
"type": "pokemon",
|
||||
"context": "submerged",
|
||||
"bucket": "common",
|
||||
@@ -139,9 +106,7 @@
|
||||
"canSeeSky": false,
|
||||
"minSkyLight": 8,
|
||||
"maxSkyLight": 15,
|
||||
"biomes": [
|
||||
"#cobblemon:is_swamp"
|
||||
]
|
||||
"biomes": ["#cobblemon:is_swamp"]
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -166,38 +131,8 @@
|
||||
]
|
||||
},
|
||||
"anticondition": {
|
||||
"biomes": [
|
||||
"#cobblemon:is_freezing"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "whiscash-9",
|
||||
"pokemon": "whiscash",
|
||||
"type": "pokemon",
|
||||
"context": "fishing",
|
||||
"bucket": "rare",
|
||||
"level": "30-47",
|
||||
"weight": 10.0,
|
||||
"condition": {
|
||||
"canSeeSky": false,
|
||||
"minSkyLight": 8,
|
||||
"maxSkyLight": 15,
|
||||
"biomes": [
|
||||
"#cobblemon:is_arid",
|
||||
"#cobblemon:is_freshwater",
|
||||
"#cobblemon:is_hills",
|
||||
"#cobblemon:is_jungle",
|
||||
"#cobblemon:is_mushroom",
|
||||
"#cobblemon:is_temperate"
|
||||
],
|
||||
"bobber": "cobblemon:master_ball"
|
||||
},
|
||||
"anticondition": {
|
||||
"biomes": [
|
||||
"#cobblemon:is_freezing"
|
||||
]
|
||||
"biomes": ["#cobblemon:is_freezing"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"#cobblemon:is_swamp",
|
||||
"#cobblemon:is_overworld"
|
||||
"#cobblemon:is_swamp"
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user