mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-10-24 08:06:24 -04:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ce2a7a83e |
+28
-71
@@ -5,84 +5,41 @@
|
||||
- Added config setting `maxPokedexScanningDetectionRange` to control from what distance the player can scan Pokémon using the Pokédex.
|
||||
- Added the `is_standing_on_blocks(depth, blocks...)` MoLang function, which returns whether the specified entity is standing on a specific block or set of blocks. Example usage: `q.is_standing_on_blocks(2, minecraft:sand)`
|
||||
- Added config setting `hideUnimplementedPokemonInThePokedex` which hides unimplemented Pokémon from the Pokédex when set to true.
|
||||
- Added molang particle queries for getting distance to targeted entities.
|
||||
- Added debug renderer for poseable entity locators.
|
||||
- Added molang particle queries for getting distance to targeted entities
|
||||
- Added debug renderer for poseable entity locators
|
||||
- Added `baseScale` property to NPCs.
|
||||
- Added the player to `PokerodReelEvent`.
|
||||
- Pokédex and Dialogue API screens now close when the inventory keybind is pressed.
|
||||
- Added Galarica Nuts, used for crafting Galarica Cuffs and Wreaths. Dropped from certain Pokémon.
|
||||
- Added specific compatibility with Repurposed Structures. (Thank you, TelepathicGrunt!)
|
||||
|
||||
### Changes
|
||||
- Pokémon will now be dynamically revealed to the Pokédex as they're seen instead of revealing entire parties at the end of battle regardless.
|
||||
- Unseen wild Pokémon will update their name from '???' to their real name as soon as a battle starts to reflect the battle UI showing the actual species name.
|
||||
- Pokémon under the illusion effect will reveal their disguise to the Pokédex first and then the base Pokémon once the disguise is broken.
|
||||
|
||||
### Fixes
|
||||
- Fixed Pokédex sometimes crashing when switching forms.
|
||||
- Fixed Pokédex interface not transitioning out when closed.
|
||||
- Fixed texture dimensions for the interact interface.
|
||||
- Fixed crash related to Tom's Simple Storage mod and Fossil Machine.
|
||||
- Fixed not being able to retrieve a fossil from the Fossil Machine with an empty hand.
|
||||
- Fixed Pokémon being collidable while being captured by a Poké Ball.
|
||||
- Fixed `full_party`, `own_zangoose_seviper`, `use_revive` and `use_candy` Advancement triggers.
|
||||
- Fixed `healing_machine` Advancement by using the correct 1.21 trigger.
|
||||
- Fix Display Cases not dropping items if destroyed through explosions.
|
||||
- Fix Pokédex sometimes crashing when switching forms
|
||||
- Fix crash related to Tom's Simple Storage and Fossil Machine
|
||||
- Fixed not being able to retrieve a fossil from the Fossil Machine with an empty hand
|
||||
- Fix Pokémon being collidable while being captured by a Pokéball.
|
||||
- Fixed `full_party`, `own_zangoose_seviper`, `use_revive` and `use_candy` Advancement triggers
|
||||
- Fixed `healing_machine` Advancement by using the correct 1.21 trigger
|
||||
- Fixed an issue where the first Pokémon in the pastured Pokémon list clipped into the interface.
|
||||
- Fixed all Pokémon facing South on spawn.
|
||||
- Parametric particle motion now works.
|
||||
- Event spawned particles now work.
|
||||
- Particles can now have independent coordinate spaces.
|
||||
- Fixed bait being consumed when not reeling in any Pokémon.
|
||||
- Fixed Miltank milk magically disappearing out of your bucket.
|
||||
- Fixed Pokémon nicknames migrating from 1.5.2 not being displayed properly.
|
||||
- Fixed capitalization in one of our config fields, but allowing typo'd version to still be valid.
|
||||
- Fixed Poké Rods not working if lure or luck of the sea enchantments get removed by other mods.
|
||||
- Fixed crashes related to Pokémon when they are ready to evolve while holding an enchanted item.
|
||||
- Fixed crashes that sometimes occur when evolving Nincada.
|
||||
- Fixed plants not being compostible on NeoForge.
|
||||
- Fixed hide UI (F1 key) not hiding the party overlay.
|
||||
- Fixed all Pokémon facing South on spawn
|
||||
- Fixed not being able to retrieve a fossil from the Fossil Machine with an empty hand
|
||||
- Parametric particle motion now works
|
||||
- Event spawned particles now work
|
||||
- Particles can now have independent coordinate spaces
|
||||
- Fixed bait being consumed when not reeling in any pokémon.
|
||||
- Fix Miltank milk magically disappearing out of your bucket
|
||||
- Fix Cobblemon Nicknames migrating from 1.5.2 not being displayed properly
|
||||
- Fix capitalization in one of our config fields, but allowing typo'd version to still be valid
|
||||
- Fix Pokerod not working if lure or luck of the sea enchantments get removed by other mods
|
||||
- Fix crashes related to Pokémon when they are ready to evolve while holding an enchanted item
|
||||
- Fix crashes that sometimes occur when evolving Nincada
|
||||
- Fix plants not being compostible on NeoForge
|
||||
- Fix hide UI (F1 key) not hiding the party overlay.
|
||||
- Fixed NPC MoLang command `player_lose_command` not working.
|
||||
- Corrected misaligned tooltips with editboxes in the NPC editor screen.
|
||||
- Fixed Pokémon riding two boats when attempting to deploy a platform on water.
|
||||
- Made berry trees be shearable by dispenser blocks.
|
||||
- Fixed the summary screen showing there's experience to reach the next level when at level cap.
|
||||
- Fixed Pokémon forgetting moves when evolving on specific cases.
|
||||
- Fixed Adorn compatibility, including improvements when using JEI/REI (Apricorn items now show up under the collapsed entries rather than standalone).
|
||||
- Fixed error message appearing on battle log when using Solar Beam with Sunny Day.
|
||||
- Fixed Pokémon Model offsets for larger species.
|
||||
- Fixed `/pokedex grant all` command not giving male/female/shininess completion for some Pokémon.
|
||||
- Fixed `/pokedex grant only` and `/pokedex remove only` not respecting the form parameter passed.
|
||||
- Fixed variant forms appearing incorrectly in the Pokédex when the normal form had not been unlocked.
|
||||
- Fixed Pokémon occasionally being shot into the sky during battle.
|
||||
- Fixed NPC editing GUI not updating aspects until a game restart.
|
||||
- Fix some users being unable to open their PC if a Pokémon in said PC had a lot of pp raises beyond normal bounds
|
||||
- Fix some color variants (dubwool, conkeldurr and undyed wooloo) missing in the Pokédex
|
||||
- Fix invalid species or held_items causing Players to not be able to load into their world anymore (commonly happening after removing addons/mods)
|
||||
- Fixed Wooloo variants not being automatically registered in the owner's Pokédex when dyed.
|
||||
- Fixed Vivichoke Dip and Leek and Potato Stew not returning a bowl upon consumption.
|
||||
- Fixed Fossil Restoration Machine not accepting Hay Bales.
|
||||
- Fixed Potion items so that they no longer apply over double their intended healing value.
|
||||
|
||||
### Molang & Datapacks
|
||||
- Added flows for:
|
||||
- `forme_change`: Triggered when a Pokémon changes form in battle.
|
||||
- `mega_evolution`: Triggered when a Pokémon mega evolves in battle. (Note: Third party mods are required for this feature currently)
|
||||
- `zpower_used`: Triggered when a Pokémon uses a Z-Power move in battle. (Note: Third party mods are required for this feature currently)
|
||||
- `terastallization`: Triggered when a Pokémon terastallizes in battle. (Note: Third party mods are required for this feature currently)
|
||||
- `battle_fainted`: Triggered when a Pokémon faints in battle.
|
||||
- `battle_fled`: Triggered when a Player flees from battle.
|
||||
- `battle_started_pre`: Triggered when a battle starts. Cancelable!
|
||||
- `battle_started_post`: Triggered when a battle starts.
|
||||
- `apricorn_harvested`: Triggered when an apricorn is harvested.
|
||||
- `thrown_pokeball_hit`: Triggered when a thrown Pokéball hits a Pokémon.
|
||||
- `level_up`: Triggered when a Pokémon levels up.
|
||||
- `pokemon_fainted`: Triggered when a Pokémon faints.
|
||||
- `pokemon_gained`: Triggered when a Player gains a Pokémon.
|
||||
- Added molang functions:
|
||||
- For Pokémon:
|
||||
- `pokemon.apply(PokemonProperties)`: Applies the given properties to the Pokémon.
|
||||
- `pokemon.owner`: Returns the owner of the Pokémon or 0.0 if there is no owner or they are not online.
|
||||
- Made berry trees be shearable by dispenser blocks
|
||||
- Fix the summary screen showing there's experience to reach the next level when at level cap.
|
||||
- Fix Pokémon forgetting moves when evolving on specific cases.
|
||||
- Fixed Adorn compatibility, including improvements when using JEI/REI (Apricorn items now show up under the collapsed entries rather than standalone)
|
||||
- Fix error message appearing on battle log when using Solar Beam with Sunny Day.
|
||||
- Fix Pokémon Model offsets for larger species.
|
||||
|
||||
## [1.6.0 - The Record Catch Update (December 25th, 2024)](#1-6-0)
|
||||
#### "Now that there's a fishing mechanic, the mod is actually good!"
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
plugins {
|
||||
id("java-gradle-plugin")
|
||||
kotlin("jvm") version "2.1.0"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.architectury.dev/")
|
||||
maven("https://maven.fabricmc.net/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("net.neoforged:moddev-gradle:2.0.75")
|
||||
implementation("dev.architectury:at:1.0.1")
|
||||
implementation("net.fabricmc:access-widener:2.1.0")
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
plugins {
|
||||
create("cobblemongradle") {
|
||||
id = "com.cobblemon.gradle"
|
||||
implementationClass = "com.cobblemon.gradle.CobblemonGradle"
|
||||
version = "1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
dependencyResolutionManagement {
|
||||
versionCatalogs {
|
||||
create("libs") {
|
||||
from(files("../gradle/libs.versions.toml"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.cobblemon.gradle
|
||||
|
||||
import com.cobblemon.gradle.extension.CobblemonGradleExtension
|
||||
import com.cobblemon.gradle.extension.tasks.ConvertAccessWidenersTask
|
||||
import com.cobblemon.gradle.extension.tasks.UnzipAccessWidenersTask
|
||||
import net.neoforged.nfrtgradle.CreateMinecraftArtifacts
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.attributes.LibraryElements
|
||||
import org.gradle.language.jvm.tasks.ProcessResources
|
||||
|
||||
class CobblemonGradle : Plugin<Project> {
|
||||
override fun apply(project: Project) {
|
||||
val cobblemonExtension = project.extensions.create(
|
||||
CobblemonGradleExtension.EXTENSION_NAME,
|
||||
CobblemonGradleExtension::class.java
|
||||
)
|
||||
|
||||
//This exists because all of
|
||||
// - com.cobblemon:mod
|
||||
// - com.cobblemon:mod-resources
|
||||
// - com.cobblemon:accesswidener
|
||||
//technically point to the same dependency (the :common project). To pick the proper artifact from that project
|
||||
//we set attributes in that project and check for them here.
|
||||
val accessWideners = project.configurations.register("accessWidener") { configuration ->
|
||||
configuration.isCanBeConsumed = false
|
||||
configuration.isCanBeResolved = true
|
||||
configuration.isCanBeDeclared = true
|
||||
configuration.attributes {
|
||||
it.attribute(
|
||||
LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE,
|
||||
project.objects.named(LibraryElements::class.java, LibraryElements.OBJECTS)
|
||||
)
|
||||
}
|
||||
}
|
||||
val includeRootResources = project.configurations.register("includeRootResources") { configuration ->
|
||||
configuration.isCanBeConsumed = false
|
||||
configuration.isCanBeResolved = true
|
||||
configuration.isCanBeDeclared = true
|
||||
configuration.attributes {
|
||||
it.attribute(
|
||||
LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE,
|
||||
project.objects.named(LibraryElements::class.java, LibraryElements.RESOURCES)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val unzipAwTask = project.tasks.register("unzipAccessWideners", UnzipAccessWidenersTask::class.java) {
|
||||
it.accessWidenerZips = accessWideners.get()
|
||||
}
|
||||
|
||||
|
||||
val convertAwTask = project.tasks.register(ConvertAccessWidenersTask.NAME, ConvertAccessWidenersTask::class.java) {
|
||||
it.enabled = cobblemonExtension.convertAccessWideners
|
||||
it.dependsOn(unzipAwTask)
|
||||
it.accessWideners = project.files(unzipAwTask).plus(project.files(cobblemonExtension.additionalAccessWideners))
|
||||
}
|
||||
|
||||
//Add root resources and access wideners to output jar
|
||||
project.tasks.named("processResources", ProcessResources::class.java) { task ->
|
||||
task.dependsOn(includeRootResources)
|
||||
if (cobblemonExtension.convertAccessWideners) {
|
||||
task.dependsOn(convertAwTask)
|
||||
task.from(convertAwTask)
|
||||
}
|
||||
else {
|
||||
task.dependsOn(unzipAwTask)
|
||||
task.from(unzipAwTask)
|
||||
}
|
||||
task.doLast {
|
||||
project.copy {
|
||||
it.from(project.provider {
|
||||
includeRootResources.get().resolve().map { project.zipTree(it) }
|
||||
})
|
||||
it.into(task.destinationDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
project.tasks.withType(CreateMinecraftArtifacts::class.java) {
|
||||
it.dependsOn(convertAwTask)
|
||||
it.accessTransformers.from(convertAwTask)
|
||||
}
|
||||
}
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
package com.cobblemon.gradle.extension
|
||||
|
||||
import org.gradle.api.file.FileCollection
|
||||
|
||||
abstract class CobblemonGradleExtension {
|
||||
var additionalAccessWideners: FileCollection? = null
|
||||
var convertAccessWideners = true
|
||||
|
||||
companion object {
|
||||
const val EXTENSION_NAME = "cobblemon"
|
||||
}
|
||||
}
|
||||
-82
@@ -1,82 +0,0 @@
|
||||
package com.cobblemon.gradle.extension.tasks
|
||||
|
||||
import dev.architectury.at.AccessChange
|
||||
import dev.architectury.at.AccessTransform
|
||||
import dev.architectury.at.AccessTransformSet
|
||||
import dev.architectury.at.ModifierChange
|
||||
import dev.architectury.at.io.AccessTransformFormats
|
||||
import net.fabricmc.accesswidener.AccessWidenerReader
|
||||
import net.fabricmc.accesswidener.AccessWidenerVisitor
|
||||
import org.cadixdev.bombe.type.signature.MethodSignature
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.OutputFiles
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import java.io.Writer
|
||||
import java.nio.file.Files
|
||||
|
||||
abstract class ConvertAccessWidenersTask : DefaultTask() {
|
||||
abstract var accessWideners: FileCollection
|
||||
@InputFiles get
|
||||
|
||||
@Internal
|
||||
val accessTransformerDir = project.layout.buildDirectory.dir("access-transformers")
|
||||
|
||||
@OutputFiles
|
||||
val accessTransformers = project.files ({
|
||||
accessWideners.files.map {
|
||||
accessTransformerDir.get().file(it.name.replace("accesswidener", "accesstransformer.cfg"))
|
||||
}
|
||||
})
|
||||
|
||||
@TaskAction
|
||||
fun convertAccessWideners() {
|
||||
accessWideners.files.forEach { file ->
|
||||
val awFile = Files.newBufferedReader(file.toPath())
|
||||
val result = AccessTransformSet.create();
|
||||
|
||||
AccessWidenerReader(object : AccessWidenerVisitor {
|
||||
override fun visitClass(name: String, access: AccessWidenerReader.AccessType, transitive: Boolean) {
|
||||
result.getOrCreateClass(name).merge(toAt(access));
|
||||
}
|
||||
|
||||
override fun visitMethod(owner: String, name: String, descriptor: String, access: AccessWidenerReader.AccessType, transitive: Boolean) {
|
||||
result.getOrCreateClass(owner).mergeMethod(MethodSignature.of(name, descriptor), toAt(access));
|
||||
}
|
||||
|
||||
override fun visitField(owner: String, name: String, descriptor: String, access: AccessWidenerReader.AccessType, transitive: Boolean) {
|
||||
result.getOrCreateClass(owner).mergeField(name, toAt(access));
|
||||
}
|
||||
}).read(awFile)
|
||||
|
||||
val outputFile = accessTransformerDir.get().file(
|
||||
file.name.replace("accesswidener", "accesstransformer.cfg")
|
||||
)
|
||||
var outputWriter: Writer? = null
|
||||
try {
|
||||
outputWriter = outputFile.asFile.writer()
|
||||
AccessTransformFormats.FML.write(outputWriter, result)
|
||||
}
|
||||
finally {
|
||||
outputWriter?.flush()
|
||||
outputWriter?.close()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun toAt(access: AccessWidenerReader.AccessType): AccessTransform {
|
||||
return when (access) {
|
||||
AccessWidenerReader.AccessType.ACCESSIBLE -> AccessTransform.of(AccessChange.PUBLIC)
|
||||
AccessWidenerReader.AccessType.EXTENDABLE, AccessWidenerReader.AccessType.MUTABLE -> AccessTransform.of(
|
||||
AccessChange.PUBLIC,
|
||||
ModifierChange.REMOVE
|
||||
)
|
||||
}
|
||||
}
|
||||
companion object {
|
||||
const val NAME = "convertAccessWideners"
|
||||
}
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package com.cobblemon.gradle.extension.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.OutputFiles
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
abstract class UnzipAccessWidenersTask : DefaultTask() {
|
||||
abstract var accessWidenerZips: FileCollection
|
||||
@InputFiles get
|
||||
|
||||
@OutputFiles
|
||||
val outputFiles = project.provider {
|
||||
project.files(accessWidenerZips.flatMap { zip ->
|
||||
project.zipTree(zip).files.map { OUTPUT_DIR.get().file(it.name) }
|
||||
})
|
||||
}
|
||||
|
||||
@Internal
|
||||
val OUTPUT_DIR = project.layout.buildDirectory.dir("cobblemon-working/access-wideners")
|
||||
|
||||
@TaskAction
|
||||
fun run() {
|
||||
project.copy {
|
||||
it.from(accessWidenerZips.map(project::zipTree))
|
||||
it.into(OUTPUT_DIR)
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -1,14 +1,12 @@
|
||||
plugins {
|
||||
//id("cobblemon.root-conventions")
|
||||
id("cobblemon.root-conventions")
|
||||
id ("net.nemerosa.versioning") version "3.1.0"
|
||||
}
|
||||
|
||||
version = "${project.property("mod_version")}+${project.property("mc_version")}"
|
||||
|
||||
val isSnapshot = project.property("snapshot")?.equals("true") ?: false
|
||||
/*
|
||||
if (isSnapshot) {
|
||||
val fixedBranchName = versioning.info.branch.substringAfter("/")
|
||||
version = "$version-${fixedBranchName}-${versioning.info.build}"
|
||||
}
|
||||
*/
|
||||
+54
-90
@@ -1,102 +1,68 @@
|
||||
import java.time.OffsetDateTime
|
||||
import java.time.ZoneOffset
|
||||
import java.time.format.DateTimeFormatter
|
||||
import utilities.isSnapshot
|
||||
import utilities.version
|
||||
|
||||
/*
|
||||
*
|
||||
* * 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/.
|
||||
*
|
||||
*/
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "2.1.0"
|
||||
id ("net.neoforged.moddev") version "2.0.75"
|
||||
id("net.kyori.blossom") version "2.1.0"
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1"
|
||||
id("com.cobblemon.gradle")
|
||||
id("cobblemon.base-conventions")
|
||||
id("cobblemon.publish-conventions")
|
||||
|
||||
id("net.kyori.blossom")
|
||||
id("org.jetbrains.gradle.plugin.idea-ext")
|
||||
id("net.nemerosa.versioning") version "3.1.0"
|
||||
}
|
||||
|
||||
cobblemon {
|
||||
additionalAccessWideners = files(sourceSets.main.get().resources).filter { it.extension == "accesswidener" }
|
||||
}
|
||||
|
||||
val rootResources = configurations.create("rootResources") {
|
||||
isCanBeConsumed = true
|
||||
isCanBeResolved = false
|
||||
attributes {
|
||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.RESOURCES))
|
||||
}
|
||||
}
|
||||
|
||||
val accessWidenerExport = configurations.create("accessWidenerExport") {
|
||||
isCanBeConsumed = true
|
||||
isCanBeResolved = false
|
||||
attributes {
|
||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.OBJECTS))
|
||||
}
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
exclude("*.accesswidener")
|
||||
}
|
||||
|
||||
tasks.create<Zip>("zipResources") {
|
||||
dependsOn("processResources")
|
||||
from(tasks.processResources.get().destinationDir)
|
||||
this.archiveBaseName = "mod-resources"
|
||||
}
|
||||
|
||||
tasks.create<Zip>("zipAccessWideners") {
|
||||
from(sourceSets.main.get().resources)
|
||||
include("*.accesswidener")
|
||||
this.archiveBaseName = "mod-accesswideners"
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
archiveBaseName = "mod"
|
||||
manifest {
|
||||
attributes(mapOf("FMLModType" to "GAMELIBRARY"))
|
||||
}
|
||||
exclude {
|
||||
it.file in tasks.processResources.get().outputs.files
|
||||
}
|
||||
}
|
||||
|
||||
tasks.assemble {
|
||||
dependsOn(tasks.named("zipResources"))
|
||||
dependsOn(tasks.named("zipAccessWideners"))
|
||||
}
|
||||
|
||||
artifacts {
|
||||
add("rootResources", tasks.getByName<Zip>("zipResources"))
|
||||
add("accessWidenerExport", tasks.getByName("zipAccessWideners"))
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.architectury.dev/")
|
||||
maven("https://maven.fabricmc.net/")
|
||||
}
|
||||
architectury {
|
||||
common("neoforge", "fabric")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://maven.fabricmc.net/")
|
||||
maven("https://maven.blamejared.com/")
|
||||
maven("https://api.modrinth.com/maven")
|
||||
maven(url = "../deps")
|
||||
maven(url = "${rootProject.projectDir}/deps")
|
||||
maven(url = "https://api.modrinth.com/maven")
|
||||
maven(url = "https://maven.neoforged.net/releases")
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(libs.bundles.mongo)
|
||||
compileOnly(libs.bundles.kotlin)
|
||||
compileOnly(libs.molang)
|
||||
compileOnly(libs.graal)
|
||||
compileOnly(libs.jei.api)
|
||||
compileOnly(libs.bundles.fabric.integrations.compileOnly) {
|
||||
implementation(libs.bundles.kotlin)
|
||||
modImplementation(libs.fabric.loader)
|
||||
modApi(libs.molang)
|
||||
|
||||
// Integrations
|
||||
compileOnlyApi(libs.jei.api)
|
||||
modCompileOnly(libs.bundles.fabric.integrations.compileOnly) {
|
||||
isTransitive = false
|
||||
}
|
||||
compileOnly("net.fabricmc:sponge-mixin:0.15.5+mixin.0.8.7")
|
||||
compileOnly("io.github.llamalad7:mixinextras-fabric:0.4.1")
|
||||
// Flywheel has no common dep so just pick one and don't use any platform specific code in common
|
||||
// modCompileOnly(libs.flywheelFabric)
|
||||
|
||||
// Showdown
|
||||
modCompileOnly(libs.graal)
|
||||
|
||||
// Data Storage
|
||||
modCompileOnly(libs.bundles.mongo)
|
||||
|
||||
// Unit Testing
|
||||
testImplementation(libs.bundles.unitTesting)
|
||||
}
|
||||
|
||||
neoForge {
|
||||
neoFormVersion = "1.21.1-20240808.144430"
|
||||
interfaceInjectionData.from("src/main/resources/interfaces.json")
|
||||
validateAccessTransformers = true
|
||||
tasks.withType<Test> {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
setEvents(listOf("failed"))
|
||||
setExceptionFormat("full")
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -106,7 +72,7 @@ sourceSets {
|
||||
fun generateLicenseHeader() : String {
|
||||
val builder = StringBuilder()
|
||||
builder.append("/*\n")
|
||||
project.projectDir.parentFile.resolve("HEADER").forEachLine {
|
||||
rootProject.file("HEADER").forEachLine {
|
||||
if(it.isEmpty()) {
|
||||
builder.append(" *").append("\n")
|
||||
} else {
|
||||
@@ -119,14 +85,12 @@ sourceSets {
|
||||
|
||||
property("license", generateLicenseHeader())
|
||||
property("modid", "cobblemon")
|
||||
property("version", project.version as String)
|
||||
property("isSnapshot", "true")
|
||||
/*
|
||||
property("version", project.version())
|
||||
property("isSnapshot", if(rootProject.isSnapshot()) "true" else "false")
|
||||
property("gitCommit", versioning.info.commit)
|
||||
property("branch", versioning.info.branch)
|
||||
System.getProperty("buildNumber")?.let { property("buildNumber", it) }
|
||||
property("timestamp", OffsetDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern("MM/dd/yyyy hh:mm:ss")) + " UTC")
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
import java.time.OffsetDateTime
|
||||
import java.time.ZoneOffset
|
||||
import java.time.format.DateTimeFormatter
|
||||
import utilities.isSnapshot
|
||||
import utilities.version
|
||||
|
||||
/*
|
||||
*
|
||||
* * 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/.
|
||||
*
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id("cobblemon.base-conventions")
|
||||
id("cobblemon.publish-conventions")
|
||||
|
||||
id("net.kyori.blossom")
|
||||
id("org.jetbrains.gradle.plugin.idea-ext")
|
||||
id("net.nemerosa.versioning") version "3.1.0"
|
||||
}
|
||||
|
||||
architectury {
|
||||
common("neoforge", "fabric")
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven(url = "${rootProject.projectDir}/deps")
|
||||
maven(url = "https://api.modrinth.com/maven")
|
||||
maven(url = "https://maven.neoforged.net/releases")
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.bundles.kotlin)
|
||||
modImplementation(libs.fabric.loader)
|
||||
modApi(libs.molang)
|
||||
|
||||
// Integrations
|
||||
compileOnlyApi(libs.jei.api)
|
||||
modCompileOnly(libs.bundles.fabric.integrations.compileOnly) {
|
||||
isTransitive = false
|
||||
}
|
||||
// Flywheel has no common dep so just pick one and don't use any platform specific code in common
|
||||
// modCompileOnly(libs.flywheelFabric)
|
||||
|
||||
// Showdown
|
||||
modCompileOnly(libs.graal)
|
||||
|
||||
// Data Storage
|
||||
modCompileOnly(libs.bundles.mongo)
|
||||
|
||||
// Unit Testing
|
||||
testImplementation(libs.bundles.unitTesting)
|
||||
}
|
||||
|
||||
tasks.withType<Test> {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
setEvents(listOf("failed"))
|
||||
setExceptionFormat("full")
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
blossom {
|
||||
kotlinSources {
|
||||
fun generateLicenseHeader() : String {
|
||||
val builder = StringBuilder()
|
||||
builder.append("/*\n")
|
||||
rootProject.file("HEADER").forEachLine {
|
||||
if(it.isEmpty()) {
|
||||
builder.append(" *").append("\n")
|
||||
} else {
|
||||
builder.append(" * ").append(it).append("\n")
|
||||
}
|
||||
}
|
||||
|
||||
return builder.append(" */").append("\n").toString()
|
||||
}
|
||||
|
||||
property("license", generateLicenseHeader())
|
||||
property("modid", "cobblemon")
|
||||
property("version", project.version())
|
||||
property("isSnapshot", if(rootProject.isSnapshot()) "true" else "false")
|
||||
property("gitCommit", versioning.info.commit)
|
||||
property("branch", versioning.info.branch)
|
||||
System.getProperty("buildNumber")?.let { property("buildNumber", it) }
|
||||
property("timestamp", OffsetDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern("MM/dd/yyyy hh:mm:ss")) + " UTC")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
[versions]
|
||||
# Kotlin
|
||||
kotlin = "2.0.0"
|
||||
|
||||
# Plugins
|
||||
licenser = "0.6.1"
|
||||
shadow = "8.1.1"
|
||||
blossom = "2.1.0"
|
||||
idea-ext = "1.1.7"
|
||||
|
||||
# Loom
|
||||
loom = "1.7-SNAPSHOT"
|
||||
architectury-plugin = "3.4-SNAPSHOT"
|
||||
|
||||
# Common
|
||||
molang = "1.1.18"
|
||||
graal = "22.3.0"
|
||||
icu4j = "71.1"
|
||||
jei-api = "19.8.2.99"
|
||||
|
||||
# Fabric
|
||||
fabric-loader = "0.16.5"
|
||||
fabric-api = "0.104.0+1.21.1"
|
||||
fabric-kotlin = "1.11.0+kotlin.2.0.0"
|
||||
fabric-permissions-api = "0.2-SNAPSHOT"
|
||||
lambDynamicLights = "3.0.1+1.21.1"
|
||||
debugutils-fabric = "1.21-1.0.6-fabric"
|
||||
|
||||
# NeoForge
|
||||
neoforge = "21.1.66"
|
||||
neo-kotlin-for-forge = "5.5.0"
|
||||
debugutils-forge = "1.21-1.0.6-neoforge"
|
||||
|
||||
# Data Storage
|
||||
mongo = "4.10.2"
|
||||
|
||||
# Testing
|
||||
junit = "5.9.0"
|
||||
mockito = "5.2.0"
|
||||
mockk = "1.12.1"
|
||||
classgraph = "4.8.153"
|
||||
|
||||
[libraries]
|
||||
# General Buildscript Plugins
|
||||
kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||
loom = { group = "dev.architectury", name = "architectury-loom", version.ref = "loom" }
|
||||
architectury = { group = "architectury-plugin", name = "architectury-plugin.gradle.plugin", version.ref = "architectury-plugin" }
|
||||
shadow = { group = "com.github.johnrengelman", name = "shadow", version.ref = "shadow" }
|
||||
blossom = { group = "net.kyori", name = "blossom", version.ref = "blossom" }
|
||||
ideaExt = { group = "org.jetbrains.gradle.plugin.idea-ext", name = "org.jetbrains.gradle.plugin.idea-ext.gradle.plugin", version.ref = "idea-ext"}
|
||||
licenser = { group = "gradle.plugin.org.cadixdev.gradle", name = "licenser", version.ref = "licenser" }
|
||||
|
||||
# Kotlin
|
||||
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version.ref = "kotlin" }
|
||||
kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect", version.ref = "kotlin" }
|
||||
|
||||
# Common
|
||||
jei-api = { group = "mezz.jei", name = "jei-1.21-common-api", version.ref = "jei-api"}
|
||||
molang = { group = "local.com.bedrockk", name = "molang", version.ref = "molang" }
|
||||
graal = { group = "org.graalvm.js", name = "js", version.ref = "graal" }
|
||||
icu4j = { group = "com.ibm.icu", name = "icu4j", version.ref = "icu4j" }
|
||||
|
||||
# Fabric
|
||||
fabric-loader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabric-loader" }
|
||||
fabric-api = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fabric-api" }
|
||||
fabric-kotlin = { group = "net.fabricmc", name = "fabric-language-kotlin", version.ref = "fabric-kotlin" }
|
||||
fabric-permissions = { group = "me.lucko", name = "fabric-permissions-api", version.ref = "fabric-permissions-api" }
|
||||
adorn-fabric = { group = "maven.modrinth", name = "adorn", version = "6.0.0-neoforge"}
|
||||
lambDynamicLights = { group = "maven.modrinth", name = "lambdynamiclights", version.ref = "lambDynamicLights"}
|
||||
jei-api-fabric = { group = "mezz.jei", name = "jei-1.21-fabric-api", version.ref = "jei-api" }
|
||||
jei-fabric = { group = "mezz.jei", name = "jei-1.21-fabric", version.ref = "jei-api"}
|
||||
fabric-debugutils = { group = "maven.modrinth", name = "debugutils", version.ref = "debugutils-fabric"}
|
||||
|
||||
# NeoForge
|
||||
neoforge = { group = "net.neoforged", name = "neoforge", version.ref = "neoforge" }
|
||||
neo-kotlin-forge = { group = "thedarkcolour", name = "kotlinforforge-neoforge", version.ref = "neo-kotlin-for-forge" }
|
||||
neoforge-debugutils = { group = "maven.modrinth", name = "debugutils", version.ref = "debugutils-forge"}
|
||||
|
||||
# Data Storage
|
||||
mongo-driver-core = { group = "org.mongodb", name = "mongodb-driver-core", version.ref = "mongo" }
|
||||
mongo-driver-sync = { group = "org.mongodb", name = "mongodb-driver-sync", version.ref = "mongo" }
|
||||
|
||||
# Testing
|
||||
junit = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" }
|
||||
mockito-core = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
|
||||
mock-kotlin = { group = "io.mockk", name = "mockk", version.ref = "mockk" }
|
||||
classgraph = { group = "io.github.classgraph", name = "classgraph", version.ref = "classgraph" }
|
||||
|
||||
[bundles]
|
||||
kotlin = [ "kotlin-stdlib", "kotlin-reflect" ]
|
||||
fabric = [ "fabric-kotlin", "fabric-permissions" ]
|
||||
fabric-integrations-compileOnly = [ "adorn-fabric", "lambDynamicLights", "jei-api-fabric" ]
|
||||
fabric-integrations-runtimeOnly = [ "jei-fabric" ]
|
||||
mongo = [ "mongo-driver-core", "mongo-driver-sync" ]
|
||||
unitTesting = [ "junit", "mockito-core", "mock-kotlin", "classgraph" ]
|
||||
@@ -68,7 +68,6 @@ import com.cobblemon.mod.common.battles.BattleSide
|
||||
import com.cobblemon.mod.common.battles.ShowdownThread
|
||||
import com.cobblemon.mod.common.battles.actor.PokemonBattleActor
|
||||
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
|
||||
import com.cobblemon.mod.common.client.CobblemonPack
|
||||
import com.cobblemon.mod.common.command.argument.*
|
||||
import com.cobblemon.mod.common.config.CobblemonConfig
|
||||
import com.cobblemon.mod.common.config.LastChangedVersion
|
||||
@@ -124,7 +123,6 @@ 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.packs.PackType
|
||||
import net.minecraft.world.item.NameTagItem
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.storage.LevelResource
|
||||
@@ -164,16 +162,6 @@ object Cobblemon {
|
||||
var statProvider: StatProvider = CobblemonStatProvider
|
||||
var seasonResolver: SeasonResolver = TagSeasonResolver
|
||||
|
||||
@JvmStatic
|
||||
val builtinPacks = listOf<CobblemonPack>(
|
||||
CobblemonPack(id = "adorncompatibility", name = "Adorn Compatibility", packType = PackType.CLIENT_RESOURCES, activationBehaviour = ResourcePackActivationBehaviour.ALWAYS_ENABLED, neededMods = setOf("adorn")),
|
||||
CobblemonPack(id = "gyaradosjump", name = "Gyarados Jump Patterns", packType = PackType.CLIENT_RESOURCES, activationBehaviour = ResourcePackActivationBehaviour.DEFAULT_ENABLED),
|
||||
CobblemonPack(id = "regionbiasforms", name = "Region Bias Forms", packType = PackType.CLIENT_RESOURCES, activationBehaviour = ResourcePackActivationBehaviour.DEFAULT_ENABLED),
|
||||
CobblemonPack(id = "uniqueshinyforms", name = "Shinies for Magikarp Jump", packType = PackType.CLIENT_RESOURCES, activationBehaviour = ResourcePackActivationBehaviour.NORMAL),
|
||||
|
||||
CobblemonPack(id = "repurposedstructurescobblemon", name = "Repurposed Structures Cobblemon", packType = PackType.SERVER_DATA, activationBehaviour = ResourcePackActivationBehaviour.DEFAULT_ENABLED, neededMods = setOf("repurposed_structures")),
|
||||
)
|
||||
|
||||
fun preInitialize(implementation: CobblemonImplementation) {
|
||||
this.implementation = implementation
|
||||
|
||||
|
||||
@@ -392,9 +392,6 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
|
||||
@JvmField val BERRY_JUICE = this.create("berry_juice", BerryJuiceItem())
|
||||
|
||||
@JvmField
|
||||
val GALARICA_NUTS = create("galarica_nuts", GalaricaNutItem())
|
||||
|
||||
// Medicine
|
||||
@JvmField
|
||||
val RARE_CANDY = candyItem("rare_candy") { _, pokemon -> pokemon.getExperienceToNextLevel() }
|
||||
@@ -445,7 +442,6 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
.saturationModifier(1.2F)
|
||||
.effect(MobEffectInstance(MobEffects.ABSORPTION, 900, 0), 1F)
|
||||
.alwaysEdible()
|
||||
.usingConvertsTo(Items.BOWL)
|
||||
.build())) {
|
||||
override fun finishUsingItem(stack: ItemStack, world: Level, user: LivingEntity): ItemStack {
|
||||
user.removeAllEffects()
|
||||
@@ -481,7 +477,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField
|
||||
val HEAL_POWDER = create("heal_powder", HealPowderItem())
|
||||
@JvmField
|
||||
val LEEK_AND_POTATO_STEW = create("leek_and_potato_stew", Item(Item.Properties().food(FoodProperties.Builder().nutrition(8).saturationModifier(0.6f).usingConvertsTo(Items.BOWL).build()).stacksTo(1)))
|
||||
val LEEK_AND_POTATO_STEW = create("leek_and_potato_stew", Item(Item.Properties().food(FoodProperties.Builder().nutrition(8).saturationModifier(0.6f).build()).stacksTo(1)))
|
||||
@JvmField
|
||||
val REVIVE = create("revive", ReviveItem(max = false))
|
||||
@JvmField
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.cobblemon.mod.common.api.events.battles.BattleFledEvent
|
||||
import com.cobblemon.mod.common.api.events.battles.BattleStartedPostEvent
|
||||
import com.cobblemon.mod.common.api.events.battles.BattleStartedPreEvent
|
||||
import com.cobblemon.mod.common.api.events.battles.BattleVictoryEvent
|
||||
import com.cobblemon.mod.common.api.events.battles.instruction.FormeChangeEvent
|
||||
import com.cobblemon.mod.common.api.events.battles.instruction.MegaEvolutionEvent
|
||||
import com.cobblemon.mod.common.api.events.battles.instruction.TerastallizationEvent
|
||||
import com.cobblemon.mod.common.api.events.battles.instruction.ZMoveUsedEvent
|
||||
@@ -106,8 +105,6 @@ object CobblemonEvents {
|
||||
val TERASTALLIZATION = EventObservable<TerastallizationEvent>()
|
||||
@JvmField
|
||||
val ZPOWER_USED = EventObservable<ZMoveUsedEvent>()
|
||||
@JvmField
|
||||
val FORME_CHANGE = EventObservable<FormeChangeEvent>()
|
||||
|
||||
@JvmField
|
||||
val POKEMON_SENT_PRE = CancelableObservable<PokemonSentPreEvent>()
|
||||
@@ -196,8 +193,6 @@ object CobblemonEvents {
|
||||
@JvmField
|
||||
val POKEMON_SEEN = EventObservable<PokemonSeenEvent>()
|
||||
@JvmField
|
||||
val POKEMON_ASPECTS_CHANGED = EventObservable<PokemonAspectsChangedEvent>()
|
||||
@JvmField
|
||||
val POKEDEX_DATA_CHANGED_PRE = CancelableObservable<PokedexDataChangedEvent.Pre>()
|
||||
@JvmField
|
||||
val POKEDEX_DATA_CHANGED_POST = EventObservable<PokedexDataChangedEvent.Post>()
|
||||
|
||||
+1
-24
@@ -8,16 +8,9 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.events.battles
|
||||
|
||||
import com.bedrockk.molang.runtime.struct.QueryStruct
|
||||
import com.bedrockk.molang.runtime.value.DoubleValue
|
||||
import com.bedrockk.molang.runtime.value.MoValue
|
||||
import com.bedrockk.molang.runtime.value.StringValue
|
||||
import com.cobblemon.mod.common.api.battles.interpreter.BattleContext
|
||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import com.cobblemon.mod.common.api.battles.model.actor.ActorType
|
||||
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
|
||||
import com.cobblemon.mod.common.util.asArrayValue
|
||||
import java.util.function.Function
|
||||
|
||||
/**
|
||||
* Event fired when a [BattlePokemon] faints. Exposes the [BattlePokemon] that fainted and the [BattleContext]
|
||||
@@ -30,20 +23,4 @@ data class BattleFaintedEvent(
|
||||
override val battle: PokemonBattle,
|
||||
val killed: BattlePokemon,
|
||||
val context: BattleContext
|
||||
) : BattleEvent {
|
||||
val structContext = mutableMapOf<String, MoValue>(
|
||||
"battle" to battle.struct,
|
||||
"players" to battle.actors.filter { it.type == ActorType.PLAYER }.asArrayValue { it.struct },
|
||||
"npcs" to battle.actors.filter { it.type == ActorType.NPC }.asArrayValue { it.struct },
|
||||
"wild_pokemon" to battle.actors.filter { it.type == ActorType.WILD }.asArrayValue { it.struct },
|
||||
"pokemon" to killed.struct,
|
||||
"context" to QueryStruct(
|
||||
hashMapOf(
|
||||
"type" to Function { StringValue(context.type.name) },
|
||||
"origin" to Function { context.origin?.struct ?: DoubleValue(0.0) },
|
||||
"id" to Function { StringValue(context.id) },
|
||||
"turn_created" to Function { DoubleValue(context.turn.toDouble()) },
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
) : BattleEvent
|
||||
|
||||
+1
-12
@@ -8,12 +8,8 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.events.battles
|
||||
|
||||
import com.bedrockk.molang.runtime.value.MoValue
|
||||
import com.bedrockk.molang.runtime.value.StringValue
|
||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import com.cobblemon.mod.common.api.battles.model.actor.ActorType
|
||||
import com.cobblemon.mod.common.battles.actor.PlayerBattleActor
|
||||
import com.cobblemon.mod.common.util.asArrayValue
|
||||
|
||||
/**
|
||||
* Event fired when a [PokemonBattle] is fled by a [PlayerBattleActor].
|
||||
@@ -24,11 +20,4 @@ import com.cobblemon.mod.common.util.asArrayValue
|
||||
data class BattleFledEvent (
|
||||
override val battle: PokemonBattle,
|
||||
val player: PlayerBattleActor
|
||||
) : BattleEvent {
|
||||
val context = mutableMapOf<String, MoValue>(
|
||||
"battle" to battle.struct,
|
||||
"players" to battle.actors.filter { it.type == ActorType.PLAYER }.asArrayValue { it.struct },
|
||||
"npcs" to battle.actors.filter { it.type == ActorType.NPC }.asArrayValue { it.struct },
|
||||
"wild_pokemon" to battle.actors.filter { it.type == ActorType.WILD }.asArrayValue { it.struct }
|
||||
)
|
||||
}
|
||||
) : BattleEvent
|
||||
+2
-18
@@ -9,9 +9,7 @@
|
||||
package com.cobblemon.mod.common.api.events.battles
|
||||
|
||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import com.cobblemon.mod.common.api.battles.model.actor.ActorType
|
||||
import com.cobblemon.mod.common.api.events.Cancelable
|
||||
import com.cobblemon.mod.common.util.asArrayValue
|
||||
import net.minecraft.network.chat.MutableComponent
|
||||
|
||||
/**
|
||||
@@ -23,14 +21,7 @@ import net.minecraft.network.chat.MutableComponent
|
||||
* @author Segfault Guy
|
||||
* @since March 26th 2023
|
||||
*/
|
||||
data class BattleStartedPreEvent (override val battle: PokemonBattle, var reason: MutableComponent? = null) : BattleEvent, Cancelable() {
|
||||
val context = mutableMapOf(
|
||||
"battle" to battle.struct,
|
||||
"players" to battle.actors.filter { it.type == ActorType.PLAYER }.asArrayValue { it.struct },
|
||||
"npcs" to battle.actors.filter { it.type == ActorType.NPC }.asArrayValue { it.struct },
|
||||
"wild_pokemon" to battle.actors.filter { it.type == ActorType.WILD }.asArrayValue { it.struct }
|
||||
)
|
||||
}
|
||||
data class BattleStartedPreEvent (override val battle: PokemonBattle, var reason: MutableComponent? = null) : BattleEvent, Cancelable()
|
||||
|
||||
/**
|
||||
* Event fired after a [PokemonBattle] starts.
|
||||
@@ -38,11 +29,4 @@ data class BattleStartedPreEvent (override val battle: PokemonBattle, var reason
|
||||
* @author Segfault Guy
|
||||
* @since March 26th 2023
|
||||
*/
|
||||
data class BattleStartedPostEvent (override val battle: PokemonBattle) : BattleEvent {
|
||||
val context = mutableMapOf(
|
||||
"battle" to battle.struct,
|
||||
"players" to battle.actors.filter { it.type == ActorType.PLAYER }.asArrayValue { it.struct },
|
||||
"npcs" to battle.actors.filter { it.type == ActorType.NPC }.asArrayValue { it.struct },
|
||||
"wild_pokemon" to battle.actors.filter { it.type == ActorType.WILD }.asArrayValue { it.struct }
|
||||
)
|
||||
}
|
||||
data class BattleStartedPostEvent (override val battle: PokemonBattle) : BattleEvent
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* 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.api.events.battles.instruction
|
||||
|
||||
import com.bedrockk.molang.runtime.value.MoValue
|
||||
import com.bedrockk.molang.runtime.value.StringValue
|
||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import com.cobblemon.mod.common.api.battles.model.actor.ActorType
|
||||
import com.cobblemon.mod.common.api.events.battles.BattleEvent
|
||||
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
|
||||
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
|
||||
import com.cobblemon.mod.common.util.asArrayValue
|
||||
|
||||
/**
|
||||
* Event that is fired when a Pokemon changes Forme in battle.
|
||||
* @param battle The battle where the change occurred.
|
||||
* @param pokemon The Pokemon that changed Forme.
|
||||
*/
|
||||
data class FormeChangeEvent(
|
||||
override val battle: PokemonBattle,
|
||||
val pokemon: BattlePokemon,
|
||||
val formeName: String
|
||||
) : BattleEvent {
|
||||
val context = mutableMapOf(
|
||||
"battle" to battle.struct,
|
||||
"players" to battle.actors.filter { it.type == ActorType.PLAYER }.asArrayValue { it.struct },
|
||||
"npcs" to battle.actors.filter { it.type == ActorType.NPC }.asArrayValue { it.struct },
|
||||
"wild_pokemon" to battle.actors.filter { it.type == ActorType.WILD }.asArrayValue { it.struct },
|
||||
"pokemon" to pokemon.struct,
|
||||
"forme" to StringValue(formeName)
|
||||
)
|
||||
}
|
||||
+1
-13
@@ -8,25 +8,13 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.events.battles.instruction
|
||||
|
||||
import com.bedrockk.molang.runtime.value.MoValue
|
||||
import com.bedrockk.molang.runtime.value.StringValue
|
||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import com.cobblemon.mod.common.api.battles.model.actor.ActorType
|
||||
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
|
||||
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
|
||||
import com.cobblemon.mod.common.util.asArrayValue
|
||||
|
||||
/**
|
||||
* Event that is fired when a Pokemon Mega Evolves.
|
||||
* @param battle The Pokemon Battle.
|
||||
* @param pokemon The Pokemon that Mega Evolves.
|
||||
*/
|
||||
data class MegaEvolutionEvent(val battle: PokemonBattle, val pokemon: BattlePokemon) {
|
||||
val context = mutableMapOf<String, MoValue>(
|
||||
"battle" to battle.struct,
|
||||
"players" to battle.actors.filter { it.type == ActorType.PLAYER }.asArrayValue { it.struct },
|
||||
"npcs" to battle.actors.filter { it.type == ActorType.NPC }.asArrayValue { it.struct },
|
||||
"wild_pokemon" to battle.actors.filter { it.type == ActorType.WILD }.asArrayValue { it.struct },
|
||||
"pokemon" to pokemon.struct
|
||||
)
|
||||
}
|
||||
data class MegaEvolutionEvent(val battle: PokemonBattle, val pokemon: BattlePokemon)
|
||||
|
||||
+1
-14
@@ -8,13 +8,9 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.events.battles.instruction
|
||||
|
||||
import com.bedrockk.molang.runtime.value.MoValue
|
||||
import com.bedrockk.molang.runtime.value.StringValue
|
||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import com.cobblemon.mod.common.api.battles.model.actor.ActorType
|
||||
import com.cobblemon.mod.common.api.types.tera.TeraType
|
||||
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
|
||||
import com.cobblemon.mod.common.util.asArrayValue
|
||||
|
||||
/**
|
||||
* Event that is fired when a Pokemon Terastallizes.
|
||||
@@ -26,13 +22,4 @@ data class TerastallizationEvent(
|
||||
val battle: PokemonBattle,
|
||||
val pokemon: BattlePokemon,
|
||||
val teraType: TeraType
|
||||
) {
|
||||
val context = mutableMapOf<String, MoValue>(
|
||||
"battle" to battle.struct,
|
||||
"players" to battle.actors.filter { it.type == ActorType.PLAYER }.asArrayValue { it.struct },
|
||||
"npcs" to battle.actors.filter { it.type == ActorType.NPC }.asArrayValue { it.struct },
|
||||
"wild_pokemon" to battle.actors.filter { it.type == ActorType.WILD }.asArrayValue { it.struct },
|
||||
"pokemon" to pokemon.struct,
|
||||
"tera_type" to StringValue(teraType.id.toString())
|
||||
)
|
||||
}
|
||||
)
|
||||
+1
-13
@@ -8,24 +8,12 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.events.battles.instruction
|
||||
|
||||
import com.bedrockk.molang.runtime.value.MoValue
|
||||
import com.bedrockk.molang.runtime.value.StringValue
|
||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import com.cobblemon.mod.common.api.battles.model.actor.ActorType
|
||||
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
|
||||
import com.cobblemon.mod.common.util.asArrayValue
|
||||
|
||||
/**
|
||||
* Event that is fired when a Pokemon uses a Z-Move.
|
||||
* @param battle The Pokemon Battle.
|
||||
* @param pokemon The Pokemon that uses the Z-Move.
|
||||
*/
|
||||
data class ZMoveUsedEvent(val battle: PokemonBattle, val pokemon: BattlePokemon) {
|
||||
val context = mutableMapOf<String, MoValue>(
|
||||
"battle" to battle.struct,
|
||||
"players" to battle.actors.filter { it.type == ActorType.PLAYER }.asArrayValue { it.struct },
|
||||
"npcs" to battle.actors.filter { it.type == ActorType.NPC }.asArrayValue { it.struct },
|
||||
"wild_pokemon" to battle.actors.filter { it.type == ActorType.WILD }.asArrayValue { it.struct },
|
||||
"pokemon" to pokemon.struct
|
||||
)
|
||||
}
|
||||
data class ZMoveUsedEvent(val battle: PokemonBattle, val pokemon: BattlePokemon)
|
||||
-12
@@ -8,13 +8,8 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.events.farming
|
||||
|
||||
import com.bedrockk.molang.runtime.value.StringValue
|
||||
import com.cobblemon.mod.common.api.apricorn.Apricorn
|
||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMoLangValue
|
||||
import com.cobblemon.mod.common.util.toArrayStruct
|
||||
import com.cobblemon.mod.common.util.worldRegistry
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.registries.Registries
|
||||
import net.minecraft.server.level.ServerLevel
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
@@ -31,11 +26,4 @@ class ApricornHarvestEvent(
|
||||
fun getBlock(): BlockState {
|
||||
return world.getBlockState(pos)
|
||||
}
|
||||
|
||||
val context = mutableMapOf(
|
||||
"player" to player.asMoLangValue(),
|
||||
"apricorn" to StringValue(apricorn.name),
|
||||
"world" to world.worldRegistry.wrapAsHolder(world).asMoLangValue(Registries.DIMENSION),
|
||||
"pos" to pos.toArrayStruct()
|
||||
)
|
||||
}
|
||||
+1
-2
@@ -9,11 +9,10 @@
|
||||
package com.cobblemon.mod.common.api.events.fishing
|
||||
|
||||
import com.cobblemon.mod.common.api.events.Cancelable
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.item.ItemStack
|
||||
|
||||
/**
|
||||
* Event that is fired when a fishing rod is reeled.
|
||||
* @param rod The ItemStack of the rod that is being reeled.
|
||||
*/
|
||||
class PokerodReelEvent(val player: Player, val rod: ItemStack) : Cancelable()
|
||||
class PokerodReelEvent(val rod: ItemStack) : Cancelable()
|
||||
+1
-7
@@ -9,7 +9,6 @@
|
||||
package com.cobblemon.mod.common.api.events.pokeball
|
||||
|
||||
import com.cobblemon.mod.common.api.events.Cancelable
|
||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMoLangValue
|
||||
import com.cobblemon.mod.common.entity.pokeball.EmptyPokeBallEntity
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
|
||||
@@ -19,9 +18,4 @@ import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
class ThrownPokeballHitEvent(
|
||||
val pokeBall : EmptyPokeBallEntity,
|
||||
val pokemon : PokemonEntity
|
||||
) : Cancelable() {
|
||||
val context = mutableMapOf(
|
||||
"pokeball" to pokeBall.struct,
|
||||
"pokemon" to pokemon.asMoLangValue()
|
||||
)
|
||||
}
|
||||
) : Cancelable()
|
||||
-16
@@ -8,14 +8,9 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.events.pokedex.scanning
|
||||
|
||||
import com.bedrockk.molang.runtime.value.DoubleValue
|
||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMoLangValue
|
||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import com.cobblemon.mod.common.pokedex.scanner.PokedexEntityData
|
||||
import com.cobblemon.mod.common.pokedex.scanner.ScannableEntity
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.world.entity.LivingEntity
|
||||
|
||||
data class PokemonScannedEvent(val player: ServerPlayer, val scannedPokemonEntityData: PokedexEntityData, val scannedEntity: ScannableEntity) {
|
||||
val pokedexEntityData: PokedexEntityData
|
||||
@@ -23,15 +18,4 @@ data class PokemonScannedEvent(val player: ServerPlayer, val scannedPokemonEntit
|
||||
|
||||
val isOwned: Boolean
|
||||
get() = scannedPokemonEntityData.ownerUUID == player.uuid
|
||||
|
||||
val context = mutableMapOf(
|
||||
"player" to player.asMoLangValue(),
|
||||
"pokemon" to scannedPokemonEntityData.struct,
|
||||
"entity" to {
|
||||
when (scannedEntity) {
|
||||
is LivingEntity -> scannedEntity.asMostSpecificMoLangValue()
|
||||
else -> DoubleValue(0.0)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.events.pokemon
|
||||
|
||||
import com.bedrockk.molang.runtime.value.DoubleValue
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
|
||||
/**
|
||||
@@ -17,10 +16,4 @@ import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
* @author Hiroku
|
||||
* @since August 5th, 2022
|
||||
*/
|
||||
class LevelUpEvent(val pokemon: Pokemon, val oldLevel: Int, var newLevel: Int) {
|
||||
val context = mutableMapOf(
|
||||
"pokemon" to pokemon.struct,
|
||||
"old_level" to DoubleValue(oldLevel.toDouble()),
|
||||
"new_level" to DoubleValue(newLevel.toDouble())
|
||||
)
|
||||
}
|
||||
class LevelUpEvent(val pokemon: Pokemon, val oldLevel: Int, var newLevel: Int)
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* 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.api.events.pokemon
|
||||
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import java.util.*
|
||||
|
||||
data class PokemonAspectsChangedEvent(
|
||||
val ownerId: UUID?,
|
||||
val pokemon: Pokemon,
|
||||
)
|
||||
+1
-7
@@ -8,7 +8,6 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.events.pokemon
|
||||
|
||||
import com.bedrockk.molang.runtime.value.DoubleValue
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
|
||||
/**
|
||||
@@ -17,9 +16,4 @@ import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
data class PokemonFaintedEvent(
|
||||
val pokemon: Pokemon,
|
||||
var faintedTimer: Int
|
||||
) {
|
||||
val context = mutableMapOf(
|
||||
"pokemon" to pokemon.struct,
|
||||
"fainted_timer" to DoubleValue(faintedTimer)
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
+1
-7
@@ -8,16 +8,10 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.events.pokemon
|
||||
|
||||
import com.bedrockk.molang.runtime.value.StringValue
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import java.util.UUID
|
||||
|
||||
data class PokemonGainedEvent(
|
||||
val playerId: UUID,
|
||||
val pokemon: Pokemon
|
||||
) {
|
||||
val context = mutableMapOf(
|
||||
"player_id" to StringValue(playerId.toString()),
|
||||
"pokemon" to pokemon.struct
|
||||
)
|
||||
}
|
||||
)
|
||||
@@ -718,11 +718,6 @@ object MoLangFunctions {
|
||||
map.put("form") { StringValue(pokemon.form.name) }
|
||||
map.put("weight") { DoubleValue(pokemon.species.weight.toDouble()) }
|
||||
map.put("matches") { params -> DoubleValue(params.getString(0).toProperties().matches(pokemon)) }
|
||||
map.put("apply") { params ->
|
||||
params.getString(0).toProperties().apply(pokemon)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map.put("owner") { pokemon.getOwnerPlayer()?.asMoLangValue() ?: DoubleValue.ZERO }
|
||||
map
|
||||
}
|
||||
)
|
||||
|
||||
@@ -8,12 +8,6 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.moves
|
||||
|
||||
import com.bedrockk.molang.runtime.MoParams
|
||||
import com.bedrockk.molang.runtime.struct.QueryStruct
|
||||
import com.bedrockk.molang.runtime.value.DoubleValue
|
||||
import com.bedrockk.molang.runtime.value.StringValue
|
||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.addFunctions
|
||||
import com.cobblemon.mod.common.api.molang.ObjectValue
|
||||
import com.cobblemon.mod.common.api.moves.categories.DamageCategory
|
||||
import com.cobblemon.mod.common.api.reactive.SimpleObservable
|
||||
import com.cobblemon.mod.common.api.types.ElementalType
|
||||
@@ -31,7 +25,6 @@ import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import kotlin.math.ceil
|
||||
import kotlin.properties.Delegates
|
||||
import net.minecraft.network.chat.MutableComponent
|
||||
import java.util.function.Function
|
||||
|
||||
/**
|
||||
* Representing a Move based on some template and with current PP and the number of raised PP stages.
|
||||
@@ -97,21 +90,6 @@ open class Move(
|
||||
val maxPp: Int
|
||||
get() = template.pp + raisedPpStages * template.pp / 5
|
||||
|
||||
val struct: QueryStruct = ObjectValue(this).also {
|
||||
it.addFunctions(
|
||||
hashMapOf(
|
||||
"name" to Function { StringValue(name) },
|
||||
"display_name" to Function { StringValue(displayName.string) },
|
||||
"description" to Function { StringValue(description.string) },
|
||||
"type" to Function { StringValue(type.name) },
|
||||
"damage_category" to Function { StringValue(damageCategory.name) },
|
||||
"power" to Function { DoubleValue(power) },
|
||||
"accuracy" to Function { DoubleValue(accuracy) },
|
||||
"max_pp" to Function { DoubleValue(maxPp.toDouble()) }
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/** Raises the max PP and rescales the current PP value. Returns false if it was already maxed out. */
|
||||
fun raiseMaxPP(amount: Int): Boolean {
|
||||
val oldPp = maxPp
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.moves
|
||||
|
||||
import com.bedrockk.molang.runtime.struct.QueryStruct
|
||||
import com.bedrockk.molang.runtime.value.DoubleValue
|
||||
import com.cobblemon.mod.common.api.reactive.SimpleObservable
|
||||
import com.cobblemon.mod.common.net.IntSize
|
||||
import com.cobblemon.mod.common.util.DataKeys
|
||||
@@ -29,22 +27,6 @@ class MoveSet : Iterable<Move> {
|
||||
|
||||
private val moves = arrayOfNulls<Move>(MOVE_COUNT)
|
||||
|
||||
fun toStruct(): QueryStruct {
|
||||
val struct = QueryStruct(hashMapOf())
|
||||
struct.addFunction("move") { params ->
|
||||
val index = params.getInt(0) as? Int ?: return@addFunction null
|
||||
return@addFunction get(index)?.struct
|
||||
}
|
||||
struct.addFunction("has_move") { params ->
|
||||
val moveID = params.getString(0) ?: return@addFunction null
|
||||
return@addFunction if(moves.any { it?.template?.name == moveID }) DoubleValue(1.0) else DoubleValue(0.0)
|
||||
}
|
||||
struct.addFunction("get_move") { params ->
|
||||
val moveID = params.getString(0) ?: return@addFunction null
|
||||
return@addFunction moves.firstOrNull { it?.template?.name == moveID }?.struct
|
||||
}
|
||||
return struct
|
||||
}
|
||||
|
||||
override fun iterator() = moves.filterNotNull().iterator()
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class NPCClass {
|
||||
var aspects: MutableSet<String> = mutableSetOf() // These only make sense when applied via presets
|
||||
var baseScale: Float = 1F
|
||||
var hitbox = EntityDimensions.scalable(0.6F, 1.8F).withEyeHeight(1.62F)
|
||||
var modelScale: Float = 0.9375F
|
||||
var modelScale: Float = 0.94F
|
||||
var battleConfiguration = NPCBattleConfiguration()
|
||||
var interaction: NPCInteractConfiguration? = null
|
||||
var canDespawn = true
|
||||
|
||||
@@ -32,18 +32,6 @@ abstract class AbstractPokedexManager {
|
||||
markDirty()
|
||||
}
|
||||
|
||||
fun deleteFormRecord(speciesId: ResourceLocation, formName: String) {
|
||||
val speciesRecord = speciesRecords[speciesId] ?: return
|
||||
speciesRecord.deleteFormRecord(formName)
|
||||
|
||||
if (speciesRecord.isFormRecordsEmpty) {
|
||||
deleteSpeciesRecord(speciesId)
|
||||
return
|
||||
}
|
||||
|
||||
markDirty()
|
||||
}
|
||||
|
||||
fun getSpeciesRecord(speciesId: ResourceLocation): SpeciesDexRecord? {
|
||||
return speciesRecords[speciesId]
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.bedrockk.molang.runtime.struct.VariableStruct
|
||||
import com.bedrockk.molang.runtime.value.StringValue
|
||||
import com.cobblemon.mod.common.api.events.CobblemonEvents
|
||||
import com.cobblemon.mod.common.api.events.pokemon.PokedexDataChangedEvent
|
||||
import com.cobblemon.mod.common.api.pokemon.PokemonSpecies
|
||||
import com.cobblemon.mod.common.pokedex.scanner.PokedexEntityData
|
||||
import com.cobblemon.mod.common.pokemon.Gender
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
@@ -113,11 +112,8 @@ class FormDexRecord {
|
||||
|
||||
//Used when granting all entries in dex, should figure out better way
|
||||
fun addAllShinyStatesAndGenders() {
|
||||
val form = PokemonSpecies.getByIdentifier(speciesDexRecord.id)?.getFormByName(formName)
|
||||
genders.addAll(form?.possibleGenders ?: listOf(Gender.MALE, Gender.FEMALE))
|
||||
|
||||
genders.addAll(listOf(Gender.MALE, Gender.FEMALE))
|
||||
seenShinyStates.addAll(listOf("shiny", "normal"))
|
||||
speciesDexRecord.onFormRecordUpdated(this)
|
||||
}
|
||||
|
||||
fun setKnowledgeProgress(newKnowledge: PokedexEntryProgress) {
|
||||
|
||||
@@ -50,8 +50,6 @@ class SpeciesDexRecord {
|
||||
lateinit var id: ResourceLocation
|
||||
private val aspects: MutableSet<String> = mutableSetOf()
|
||||
private val formRecords: MutableMap<String, FormDexRecord> = mutableMapOf()
|
||||
val isFormRecordsEmpty: Boolean
|
||||
get() = formRecords.isEmpty()
|
||||
|
||||
fun describe(): String {
|
||||
return "SpeciesDexRecord(aspects=$aspects, formRecords=$formRecords)"
|
||||
|
||||
+3
-3
@@ -40,7 +40,7 @@ class BestSpawnerConfig {
|
||||
val buckets = mutableListOf(
|
||||
SpawnBucket("common", 93.8F),
|
||||
SpawnBucket("uncommon", 5F),
|
||||
SpawnBucket("rare", 1.0F),
|
||||
SpawnBucket("rare", 0.5F),
|
||||
SpawnBucket("ultra-rare", 0.2F)
|
||||
)
|
||||
|
||||
@@ -53,7 +53,7 @@ class BestSpawnerConfig {
|
||||
.create()
|
||||
|
||||
const val CONFIG_NAME = "best-spawner-config"
|
||||
const val INTERNAL_PATH = "data/${Cobblemon.MODID}/spawning/$CONFIG_NAME.json"
|
||||
const val INTERNAL_PATH = "/data/${Cobblemon.MODID}/spawning/$CONFIG_NAME.json"
|
||||
const val EXTERNAL_PATH = "config/${Cobblemon.MODID}/spawning/$CONFIG_NAME.json"
|
||||
|
||||
fun load(): BestSpawnerConfig {
|
||||
@@ -77,7 +77,7 @@ class BestSpawnerConfig {
|
||||
}
|
||||
|
||||
private fun loadInternal(): BestSpawnerConfig {
|
||||
val reader = InputStreamReader(Cobblemon.javaClass.classLoader.getResourceAsStream(INTERNAL_PATH)!!)
|
||||
val reader = InputStreamReader(Cobblemon::class.java.getResourceAsStream(INTERNAL_PATH)!!)
|
||||
val config = GSON.fromJson(reader, BestSpawnerConfig::class.java)
|
||||
reader.close()
|
||||
return config
|
||||
|
||||
@@ -8,14 +8,12 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.storage
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.CobblemonNetwork.sendPacket
|
||||
import com.cobblemon.mod.common.api.net.NetworkPacket
|
||||
import com.cobblemon.mod.common.api.reactive.Observable
|
||||
import com.cobblemon.mod.common.api.storage.factory.FileBackedPokemonStoreFactory
|
||||
import com.cobblemon.mod.common.api.storage.factory.PokemonStoreFactory
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.util.DataKeys
|
||||
import com.google.gson.JsonObject
|
||||
import java.util.UUID
|
||||
import net.minecraft.core.RegistryAccess
|
||||
@@ -149,14 +147,10 @@ abstract class PokemonStore<T : StorePosition> : Iterable<Pokemon> {
|
||||
|
||||
operator fun get(uuid: UUID) = find { it.uuid == uuid }
|
||||
|
||||
open fun handleInvalidSpeciesNBT(nbt: CompoundTag) {
|
||||
Cobblemon.LOGGER.error("Failed to read unknown species: ${nbt.getString(DataKeys.POKEMON_SPECIES_IDENTIFIER)}")
|
||||
}
|
||||
open fun handleInvalidSpeciesNBT(nbt: CompoundTag) {}
|
||||
abstract fun saveToNBT(nbt: CompoundTag, registryAccess: RegistryAccess): CompoundTag
|
||||
abstract fun loadFromNBT(nbt: CompoundTag, registryAccess: RegistryAccess): PokemonStore<T>
|
||||
open fun handleInvalidSpeciesJSON(json: JsonObject) {
|
||||
Cobblemon.LOGGER.error("Failed to read unknown species: ${json.get(DataKeys.POKEMON_SPECIES_IDENTIFIER).asString}")
|
||||
}
|
||||
open fun handleInvalidSpeciesJSON(json: JsonObject) {}
|
||||
abstract fun saveToJSON(json: JsonObject, registryAccess: RegistryAccess): JsonObject
|
||||
abstract fun loadFromJSON(json: JsonObject, registryAccess: RegistryAccess): PokemonStore<T>
|
||||
abstract fun savePositionToNBT(position: T, nbt: CompoundTag)
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
package com.cobblemon.mod.common.battles.dispatch
|
||||
|
||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import org.objectweb.asm.tree.analysis.Interpreter
|
||||
|
||||
class InstructionSet {
|
||||
val instructions: MutableList<InterpreterInstruction> = mutableListOf()
|
||||
|
||||
-3
@@ -10,8 +10,6 @@ package com.cobblemon.mod.common.battles.interpreter.instructions
|
||||
|
||||
import com.cobblemon.mod.common.api.battles.interpreter.BattleMessage
|
||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import com.cobblemon.mod.common.api.events.CobblemonEvents
|
||||
import com.cobblemon.mod.common.api.events.battles.instruction.FormeChangeEvent
|
||||
import com.cobblemon.mod.common.battles.ShowdownInterpreter
|
||||
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
|
||||
import com.cobblemon.mod.common.util.battleLang
|
||||
@@ -37,7 +35,6 @@ class FormeChangeInstruction(val message: BattleMessage): InterpreterInstruction
|
||||
battle.dispatchWaiting {
|
||||
battle.minorBattleActions[battlePokemon.uuid] = message
|
||||
|
||||
CobblemonEvents.FORME_CHANGE.post(FormeChangeEvent(battle, battlePokemon, formName))
|
||||
val pokemonName = battlePokemon.getName()
|
||||
val lang = when(formName) {
|
||||
"busted", "hero", "complete" -> return@dispatchWaiting
|
||||
|
||||
+1
-8
@@ -13,8 +13,6 @@ import com.cobblemon.mod.common.api.battles.interpreter.BattleMessage
|
||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor
|
||||
import com.cobblemon.mod.common.api.battles.model.actor.EntityBackedBattleActor
|
||||
import com.cobblemon.mod.common.api.events.CobblemonEvents
|
||||
import com.cobblemon.mod.common.api.events.pokemon.PokemonSeenEvent
|
||||
import com.cobblemon.mod.common.api.scheduling.afterOnServer
|
||||
import com.cobblemon.mod.common.battles.ActiveBattlePokemon
|
||||
import com.cobblemon.mod.common.battles.ShowdownInterpreter
|
||||
@@ -215,12 +213,7 @@ class SwitchInstruction(val instructionSet: InstructionSet, val battleActor: Bat
|
||||
battleLang("switch.other.nickname", actor.getName(), nickname, publicPokemon.species.translatedName)
|
||||
} ?: battleLang("switch.other", actor.getName(), publicPokemon.getDisplayName())
|
||||
actor.sendMessage(battleLang("switch.self", publicPokemon.getDisplayName()))
|
||||
battle.actors.filter { it != actor }.forEach {
|
||||
it.sendMessage(publicLang)
|
||||
}
|
||||
battle.playerUUIDs.forEach { uuid ->
|
||||
CobblemonEvents.POKEMON_SEEN.post(PokemonSeenEvent(uuid, publicPokemon))
|
||||
}
|
||||
battle.actors.filter { it != actor }.forEach { it.sendMessage(publicLang) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -13,6 +13,7 @@ import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import com.cobblemon.mod.common.api.battles.model.actor.ActorType
|
||||
import com.cobblemon.mod.common.api.events.CobblemonEvents
|
||||
import com.cobblemon.mod.common.api.events.battles.BattleVictoryEvent
|
||||
import com.cobblemon.mod.common.api.events.pokemon.PokemonSeenEvent
|
||||
import com.cobblemon.mod.common.api.text.gold
|
||||
import com.cobblemon.mod.common.api.text.plus
|
||||
import com.cobblemon.mod.common.api.text.red
|
||||
@@ -69,6 +70,11 @@ class WinInstruction(val message: BattleMessage): InterpreterInstruction {
|
||||
}
|
||||
battle.dispatchGo {
|
||||
battle.end()
|
||||
battle.actors.flatMap { it.pokemonList }.map { it.originalPokemon }.forEach { pokemon ->
|
||||
battle.playerUUIDs.forEach { playerUuid ->
|
||||
CobblemonEvents.POKEMON_SEEN.post(PokemonSeenEvent(playerUuid, pokemon))
|
||||
}
|
||||
}
|
||||
CobblemonEvents.BATTLE_VICTORY.post(BattleVictoryEvent(battle, winners, losers, wasCaught))
|
||||
ShowdownInterpreter.lastCauser.remove(battle.battleId)
|
||||
}
|
||||
|
||||
@@ -8,11 +8,7 @@
|
||||
|
||||
package com.cobblemon.mod.common.battles.pokemon
|
||||
|
||||
import com.bedrockk.molang.runtime.struct.QueryStruct
|
||||
import com.bedrockk.molang.runtime.value.DoubleValue
|
||||
import com.bedrockk.molang.runtime.value.StringValue
|
||||
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor
|
||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asStruct
|
||||
import com.cobblemon.mod.common.api.moves.MoveSet
|
||||
import com.cobblemon.mod.common.api.pokemon.helditem.HeldItemManager
|
||||
import com.cobblemon.mod.common.api.pokemon.helditem.HeldItemProvider
|
||||
@@ -31,7 +27,6 @@ import com.cobblemon.mod.common.util.battleLang
|
||||
import com.cobblemon.mod.common.util.server
|
||||
import java.util.UUID
|
||||
import net.minecraft.network.chat.MutableComponent
|
||||
import java.util.function.Function
|
||||
|
||||
open class BattlePokemon(
|
||||
val originalPokemon: Pokemon,
|
||||
@@ -39,7 +34,6 @@ open class BattlePokemon(
|
||||
val postBattleEntityOperation: (PokemonEntity) -> Unit = {}
|
||||
) {
|
||||
lateinit var actor: BattleActor
|
||||
|
||||
companion object {
|
||||
fun safeCopyOf(pokemon: Pokemon): BattlePokemon {
|
||||
//TOOD figure out a closer registry access (might have to break some method signatures for this (1.7?)
|
||||
@@ -62,22 +56,6 @@ open class BattlePokemon(
|
||||
)
|
||||
}
|
||||
|
||||
val struct = QueryStruct(
|
||||
hashMapOf(
|
||||
"pokemon" to Function { effectedPokemon.asStruct() },
|
||||
"original_pokemon" to Function {
|
||||
originalPokemon.asStruct()
|
||||
},
|
||||
"actor" to Function { actor.struct },
|
||||
"battle" to Function { actor.battle.struct },
|
||||
"uuid" to Function { StringValue(uuid.toString()) },
|
||||
"health" to Function { DoubleValue(health.toDouble()) },
|
||||
"max_health" to Function { DoubleValue(maxHealth.toDouble()) },
|
||||
"ivs" to Function { effectedPokemon.ivs.struct },
|
||||
"nature" to Function { StringValue(effectedPokemon.nature.name.toString()) },
|
||||
"moveset" to Function { effectedPokemon.moveSet.toStruct() }
|
||||
))
|
||||
|
||||
val uuid: UUID
|
||||
get() = effectedPokemon.uuid
|
||||
val health: Int
|
||||
@@ -106,7 +84,7 @@ open class BattlePokemon(
|
||||
* The [HeldItemManager] backing this [BattlePokemon].
|
||||
*/
|
||||
val heldItemManager: HeldItemManager by lazy { HeldItemProvider.provide(this) }
|
||||
|
||||
|
||||
val contextManager = ContextManager()
|
||||
|
||||
open fun getName(): MutableComponent {
|
||||
@@ -124,11 +102,11 @@ open class BattlePokemon(
|
||||
|
||||
fun isSentOut() = actor.battle.activePokemon.any { it.battlePokemon == this }
|
||||
fun canBeSentOut() =
|
||||
if (actor.request?.side?.pokemon?.any { it.reviving } == true) {
|
||||
!isSentOut() && !willBeSwitchedIn && health <= 0
|
||||
} else {
|
||||
!isSentOut() && !willBeSwitchedIn && health > 0
|
||||
}
|
||||
if (actor.request?.side?.pokemon?.any{ it.reviving } == true) {
|
||||
!isSentOut() && !willBeSwitchedIn && health <= 0
|
||||
} else {
|
||||
!isSentOut() && !willBeSwitchedIn && health > 0
|
||||
}
|
||||
|
||||
fun getIllusion(): BattlePokemon? = this.actor.activePokemon.find { it.battlePokemon == this }?.illusion
|
||||
}
|
||||
+3
-3
@@ -65,8 +65,8 @@ class GraalShowdownUnbundler {
|
||||
}
|
||||
|
||||
if (extract) {
|
||||
FileUtils.copyInternalToExternal("data/${Cobblemon.MODID}/showdown.zip", showdownZip.toPath())
|
||||
FileUtils.copyInternalToExternal("data/${Cobblemon.MODID}/showdown.json", showdownMetadataFile.toPath())
|
||||
FileUtils.copyInternalToExternal("/data/${Cobblemon.MODID}/showdown.zip", showdownZip.toPath())
|
||||
FileUtils.copyInternalToExternal("/data/${Cobblemon.MODID}/showdown.json", showdownMetadataFile.toPath())
|
||||
FileUtils.unzipFile(showdownZip.toPath(), showdownDir.toPath())
|
||||
showdownZip.delete()
|
||||
}
|
||||
@@ -75,7 +75,7 @@ class GraalShowdownUnbundler {
|
||||
|
||||
private fun loadShowdownMetadata() : ShowdownMetadata? {
|
||||
try {
|
||||
val inputStream = javaClass.classLoader.getResourceAsStream("data/${Cobblemon.MODID}/showdown.json")!!
|
||||
val inputStream = javaClass.getResourceAsStream("/data/${Cobblemon.MODID}/showdown.json")!!
|
||||
return gson.fromJson<ShowdownMetadata>(InputStreamReader(inputStream))
|
||||
} catch (exception: Exception) {
|
||||
exception.printStackTrace()
|
||||
|
||||
@@ -334,7 +334,6 @@ class BerryBlock(private val berryIdentifier: ResourceLocation, settings: Proper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun attemptShear(world: Level, state: BlockState, pos: BlockPos, successCallback: () -> Unit): Boolean {
|
||||
return if (this.isMaxAge(state)) {
|
||||
harvestBerry(world, state, pos)
|
||||
@@ -342,16 +341,12 @@ class BerryBlock(private val berryIdentifier: ResourceLocation, settings: Proper
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
private fun harvestBerry(world: Level, state: BlockState, pos: BlockPos, player: Player? = null): Boolean {
|
||||
val blockEntity = world.getBlockEntity(pos) as? BerryBlockEntity ?: return false
|
||||
blockEntity.harvest(world, state, pos, player).forEach { drop ->
|
||||
Block.popResource(world, pos, drop)
|
||||
}
|
||||
|
||||
val sound = if (player != null) CobblemonSounds.BERRY_HARVEST else SoundEvents.SHEEP_SHEAR
|
||||
world.playSound(null, pos, sound, SoundSource.BLOCKS, 1F, 1F)
|
||||
|
||||
world.playSound(null, pos, SoundEvents.SHEEP_SHEAR, SoundSource.BLOCKS, 1F, 1F)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -94,18 +94,12 @@ class DisplayCaseBlock(settings: Properties) : BaseEntityBlock(settings) {
|
||||
return result
|
||||
}
|
||||
|
||||
override fun onRemove(
|
||||
state: BlockState,
|
||||
world: Level,
|
||||
pos: BlockPos,
|
||||
newState: BlockState,
|
||||
moved: Boolean
|
||||
) {
|
||||
override fun playerWillDestroy(world: Level, pos: BlockPos, state: BlockState, player: Player): BlockState {
|
||||
val entity = world.getBlockEntity(pos) as DisplayCaseBlockEntity
|
||||
if (!entity.getStack().isEmpty) {
|
||||
Containers.dropContentsOnDestroy(state, newState, world, pos)
|
||||
if (!entity.getStack().isEmpty && !player.isCreative) {
|
||||
Containers.dropContents(world, pos, entity.inv)
|
||||
}
|
||||
super.onRemove(state, world, pos, newState, moved)
|
||||
return super.playerWillDestroy(world, pos, state, player)
|
||||
}
|
||||
|
||||
override fun getRenderShape(state: BlockState) = RenderShape.MODEL
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.cobblemon.mod.common.CobblemonBlocks
|
||||
import com.cobblemon.mod.common.CobblemonClientImplementation
|
||||
import com.cobblemon.mod.common.CobblemonEntities
|
||||
import com.cobblemon.mod.common.CobblemonItems
|
||||
import com.cobblemon.mod.common.ResourcePackActivationBehaviour
|
||||
import com.cobblemon.mod.common.api.berry.Berries
|
||||
import com.cobblemon.mod.common.api.scheduling.ClientTaskTracker
|
||||
import com.cobblemon.mod.common.api.storage.player.client.ClientGeneralPlayerData
|
||||
@@ -103,6 +104,14 @@ object CobblemonClient {
|
||||
GenericBedrockEntityModelRepository
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
val builtinResourcePacks = listOf<CobblemonResourcePack>(
|
||||
CobblemonResourcePack(id = "adorncompatibility", name = "Adorn Compatibility", activationBehaviour = ResourcePackActivationBehaviour.ALWAYS_ENABLED, neededMods = setOf("adorn")),
|
||||
CobblemonResourcePack(id = "gyaradosjump", name = "Gyarados Jump Patterns", activationBehaviour = ResourcePackActivationBehaviour.DEFAULT_ENABLED),
|
||||
CobblemonResourcePack(id = "regionbiasforms", name = "Region Bias Forms", activationBehaviour = ResourcePackActivationBehaviour.DEFAULT_ENABLED),
|
||||
CobblemonResourcePack(id = "uniqueshinyforms", name = "Shinies for Magikarp Jump", activationBehaviour = ResourcePackActivationBehaviour.NORMAL),
|
||||
)
|
||||
|
||||
val overlay: PartyOverlay by lazy { PartyOverlay() }
|
||||
val battleOverlay: BattleOverlay by lazy { BattleOverlay() }
|
||||
val pokedexUsageContext: PokedexUsageContext by lazy { PokedexUsageContext() }
|
||||
|
||||
+1
-3
@@ -10,12 +10,10 @@ package com.cobblemon.mod.common.client
|
||||
|
||||
import com.cobblemon.mod.common.ResourcePackActivationBehaviour
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.server.packs.PackType
|
||||
|
||||
class CobblemonPack(
|
||||
class CobblemonResourcePack(
|
||||
val id: String,
|
||||
val name: String,
|
||||
val packType: PackType,
|
||||
val activationBehaviour: ResourcePackActivationBehaviour,
|
||||
val neededMods: Set<String> = setOf()
|
||||
) {
|
||||
+5
-11
@@ -28,10 +28,13 @@ import com.cobblemon.mod.common.entity.PosableEntity
|
||||
import com.cobblemon.mod.common.net.messages.client.dialogue.dto.DialogueDTO
|
||||
import com.cobblemon.mod.common.net.messages.client.dialogue.dto.DialogueInputDTO
|
||||
import com.cobblemon.mod.common.net.messages.server.dialogue.EscapeDialoguePacket
|
||||
import com.cobblemon.mod.common.util.*
|
||||
import com.cobblemon.mod.common.util.asExpressionLike
|
||||
import com.cobblemon.mod.common.util.asExpressions
|
||||
import com.cobblemon.mod.common.util.asTranslated
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import com.cobblemon.mod.common.util.resolve
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.components.EditBox
|
||||
import net.minecraft.client.gui.screens.Screen
|
||||
|
||||
class DialogueScreen(var dialogueDTO: DialogueDTO) : Screen("gui.dialogue".asTranslated()), CobblemonRenderable {
|
||||
@@ -227,13 +230,4 @@ class DialogueScreen(var dialogueDTO: DialogueDTO) : Screen("gui.dialogue".asTra
|
||||
override fun onClose() {
|
||||
EscapeDialoguePacket().sendToServer()
|
||||
}
|
||||
|
||||
override fun keyPressed(keyCode: Int, scanCode: Int, modifiers: Int): Boolean {
|
||||
if (isInventoryKeyPressed(minecraft, keyCode, scanCode) && focused !is EditBox) {
|
||||
onClose()
|
||||
return true
|
||||
}
|
||||
|
||||
return super.keyPressed(keyCode, scanCode, modifiers)
|
||||
}
|
||||
}
|
||||
+4
-8
@@ -113,17 +113,13 @@ class InteractWheelButton(
|
||||
override fun playDownSound(soundManager: SoundManager) {}
|
||||
|
||||
private fun isHovered(mouseX: Float, mouseY: Float): Boolean {
|
||||
val xMin = x.toFloat() + 1
|
||||
val xMax = xMin + BUTTON_SIZE - 2
|
||||
val yMin = y.toFloat() + 1
|
||||
val yMax = yMin + BUTTON_SIZE - 2
|
||||
val xMin = x.toFloat()
|
||||
val xMax = xMin + BUTTON_SIZE
|
||||
val yMin = y.toFloat()
|
||||
val yMax = yMin + BUTTON_SIZE
|
||||
return canHover(mouseX.toDouble(), mouseY.toDouble()) && mouseX in xMin..xMax && mouseY in yMin..yMax
|
||||
}
|
||||
|
||||
override fun mouseClicked(mouseX: Double, mouseY: Double, button: Int): Boolean {
|
||||
return if (isHovered(mouseX.toFloat(), mouseY.toFloat())) super.mouseClicked(mouseX, mouseY, button) else false
|
||||
}
|
||||
|
||||
override fun getTooltip(): Tooltip? {
|
||||
tooltipText?.let { return Tooltip.create(Component.translatable(it)) } ?: return super.getTooltip()
|
||||
}
|
||||
|
||||
+5
-5
@@ -10,7 +10,6 @@ package com.cobblemon.mod.common.client.gui.interact.wheel
|
||||
|
||||
import com.cobblemon.mod.common.api.gui.blitk
|
||||
import com.cobblemon.mod.common.client.gui.CobblemonRenderable
|
||||
import com.cobblemon.mod.common.client.gui.interact.wheel.InteractWheelButton.Companion.BUTTON_SIZE
|
||||
import com.cobblemon.mod.common.client.gui.startselection.widgets.preview.ArrowButton
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import com.google.common.collect.Multimap
|
||||
@@ -24,7 +23,8 @@ import kotlin.math.max
|
||||
|
||||
class InteractWheelGUI(private val options: Multimap<Orientation, InteractWheelOption>, title: Component) : Screen(title), CobblemonRenderable {
|
||||
companion object {
|
||||
const val SIZE = 138
|
||||
const val SIZE = 140
|
||||
const val OPTION_SIZE = 71
|
||||
private val backgroundResource = cobblemonResource("textures/gui/interact/interact_base.png")
|
||||
private val buttonResources = mutableMapOf(
|
||||
Orientation.TOP_LEFT to cobblemonResource("textures/gui/interact/button_left_top.png"),
|
||||
@@ -142,9 +142,9 @@ class InteractWheelGUI(private val options: Multimap<Orientation, InteractWheelO
|
||||
val (x, y) = getDimensions()
|
||||
return when (orientation) {
|
||||
Orientation.TOP_LEFT -> Pair(x, y)
|
||||
Orientation.TOP_RIGHT -> Pair(x + BUTTON_SIZE, y)
|
||||
Orientation.BOTTOM_LEFT -> Pair(x, y + BUTTON_SIZE)
|
||||
Orientation.BOTTOM_RIGHT -> Pair(x + BUTTON_SIZE, y + BUTTON_SIZE)
|
||||
Orientation.TOP_RIGHT -> Pair(x + OPTION_SIZE, y)
|
||||
Orientation.BOTTOM_LEFT -> Pair(x, y + OPTION_SIZE)
|
||||
Orientation.BOTTOM_RIGHT -> Pair(x + OPTION_SIZE, y + OPTION_SIZE)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,17 +41,22 @@ import com.cobblemon.mod.common.client.gui.pokedex.PokedexGUIConstants.TAB_DROPS
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.PokedexGUIConstants.TAB_ICON_SIZE
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.PokedexGUIConstants.TAB_SIZE
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.PokedexGUIConstants.TAB_STATS
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.widgets.*
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.widgets.AbilitiesWidget
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.widgets.DescriptionWidget
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.widgets.DropsScrollingWidget
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.widgets.EntriesScrollingWidget
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.widgets.PokemonInfoWidget
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.widgets.SearchWidget
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.widgets.SizeWidget
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.widgets.StatsWidget
|
||||
import com.cobblemon.mod.common.client.pokedex.PokedexType
|
||||
import com.cobblemon.mod.common.client.render.drawScaledText
|
||||
import com.cobblemon.mod.common.net.messages.server.block.AdjustBlockEntityViewerCountPacket
|
||||
import com.cobblemon.mod.common.pokemon.abilities.HiddenAbility
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import com.cobblemon.mod.common.util.isInventoryKeyPressed
|
||||
import com.cobblemon.mod.common.util.lang
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.components.EditBox
|
||||
import net.minecraft.client.gui.components.Renderable
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener
|
||||
import net.minecraft.client.gui.narration.NarratableEntry
|
||||
@@ -583,15 +588,6 @@ class PokedexGUI private constructor(
|
||||
|
||||
override fun isPauseScreen(): Boolean = false
|
||||
|
||||
override fun keyPressed(keyCode: Int, scanCode: Int, modifiers: Int): Boolean {
|
||||
if (isInventoryKeyPressed(minecraft, keyCode, scanCode) && focused !is EditBox) {
|
||||
onClose()
|
||||
return true
|
||||
}
|
||||
|
||||
return super.keyPressed(keyCode, scanCode, modifiers)
|
||||
}
|
||||
|
||||
fun playSound(soundEvent: SoundEvent) {
|
||||
Minecraft.getInstance().soundManager.play(SimpleSoundInstance.forUI(soundEvent, 1.0F))
|
||||
}
|
||||
|
||||
+6
-4
@@ -113,7 +113,6 @@ class PokemonInfoWidget(val pX: Int, val pY: Int, val updateForm: (PokedexForm)
|
||||
var selectedFormIndex: Int = 0
|
||||
|
||||
var type: Array<ElementalType?> = arrayOf(null, null)
|
||||
var seenShinyStates: Set<String> = setOf()
|
||||
var shiny = false
|
||||
var maleRatio = -1F
|
||||
var gender: Gender = Gender.GENDERLESS
|
||||
@@ -208,6 +207,9 @@ class PokemonInfoWidget(val pX: Int, val pY: Int, val updateForm: (PokedexForm)
|
||||
20,
|
||||
buttonNone,
|
||||
clickAction = {
|
||||
val currentEntry = currentEntry ?: return@ScaledButton
|
||||
val currentForm = currentEntry.forms[selectedFormIndex]
|
||||
val seenShinyStates = CobblemonClient.clientPokedexData.getSeenShinyStates(currentEntry, currentForm)
|
||||
if (seenShinyStates.size > 1) {
|
||||
shiny = !shiny
|
||||
updateAspects()
|
||||
@@ -534,11 +536,11 @@ class PokemonInfoWidget(val pX: Int, val pY: Int, val updateForm: (PokedexForm)
|
||||
}
|
||||
selectedFormIndex = 0
|
||||
|
||||
setupButtons(pokedexEntry, forms[selectedFormIndex])
|
||||
|
||||
if (visibleForms.isNotEmpty()) {
|
||||
setupButtons(pokedexEntry, visibleForms[selectedFormIndex])
|
||||
updateAspects()
|
||||
} else {
|
||||
setupButtons(pokedexEntry, forms[selectedFormIndex])
|
||||
type = arrayOf(null, null)
|
||||
}
|
||||
}
|
||||
@@ -549,7 +551,7 @@ class PokemonInfoWidget(val pX: Int, val pY: Int, val updateForm: (PokedexForm)
|
||||
variationButtons.forEach { removeWidget(it.getWidget()) }
|
||||
variationButtons.clear()
|
||||
|
||||
seenShinyStates = CobblemonClient.clientPokedexData.getSeenShinyStates(pokedexEntry, pokedexForm)
|
||||
val seenShinyStates = CobblemonClient.clientPokedexData.getSeenShinyStates(pokedexEntry, pokedexForm)
|
||||
shiny = seenShinyStates.count() == 1 && seenShinyStates.first() == "shiny"
|
||||
shinyButton.resource = if (shiny) buttonShiny else buttonNone
|
||||
shinyButton.visible = shiny || seenShinyStates.size > 1
|
||||
|
||||
+1
-6
@@ -90,12 +90,7 @@ class InfoWidget(
|
||||
typeWidget.render(context, pMouseX, pMouseY, pPartialTicks)
|
||||
|
||||
// Original Trainer
|
||||
val otName: MutableComponent = pokemon.originalTrainerName?.let { name ->
|
||||
Component.literal(name)
|
||||
} ?: pokemon.originalTrainer?.let { trainer ->
|
||||
Component.literal("${trainer.take(15)}...")
|
||||
} ?: Component.literal("")
|
||||
|
||||
val otName: MutableComponent = Component.literal(pokemon.originalTrainerName ?: "")
|
||||
val otWidget = InfoOneLineWidget(
|
||||
pX = x,
|
||||
pY = y + 3 * ROW_HEIGHT,
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
package com.cobblemon.mod.common.client.gui.toast
|
||||
|
||||
import com.cobblemon.mod.common.net.messages.client.toast.ToastPacket
|
||||
import net.fabricmc.api.EnvType
|
||||
import net.fabricmc.api.Environment
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.components.toasts.Toast
|
||||
import net.minecraft.client.gui.components.toasts.ToastComponent
|
||||
@@ -19,6 +21,7 @@ import net.minecraft.util.Mth
|
||||
import java.util.*
|
||||
import kotlin.math.min
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
class CobblemonToast(
|
||||
val id: UUID,
|
||||
var icon: ItemStack,
|
||||
|
||||
@@ -110,7 +110,7 @@ class ParticleStorm(
|
||||
}
|
||||
|
||||
runtime.environment.setSimpleVariable("target_deltax", DoubleValue(distanceTo(destinationPosSupplier.invoke()).x))
|
||||
runtime.environment.setSimpleVariable("target_deltay", DoubleValue(distanceTo(destinationPosSupplier.invoke()).y * -1))
|
||||
runtime.environment.setSimpleVariable("target_deltay", DoubleValue(distanceTo(destinationPosSupplier.invoke()).y))
|
||||
runtime.environment.setSimpleVariable("target_deltaz", DoubleValue(distanceTo(destinationPosSupplier.invoke()).z))
|
||||
runtime.environment.setSimpleVariable("target_distance", DoubleValue(distanceTo(destinationPosSupplier.invoke()).length()))
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ package com.cobblemon.mod.common.client.render
|
||||
|
||||
import com.cobblemon.mod.common.util.math.geometry.getOrigin
|
||||
import com.cobblemon.mod.common.util.math.geometry.transformPosition
|
||||
import net.fabricmc.loader.impl.lib.sat4j.core.Vec
|
||||
import org.joml.Matrix4f
|
||||
import net.minecraft.world.phys.Vec3
|
||||
|
||||
|
||||
+3
@@ -14,6 +14,8 @@ import com.cobblemon.mod.common.entity.fishing.PokeRodFishingBobberEntity
|
||||
import com.cobblemon.mod.common.item.interactive.PokerodItem
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import java.awt.Color
|
||||
import net.fabricmc.api.EnvType
|
||||
import net.fabricmc.api.Environment
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture
|
||||
import net.minecraft.client.renderer.RenderType
|
||||
@@ -31,6 +33,7 @@ import net.minecraft.world.entity.HumanoidArm
|
||||
import net.minecraft.world.item.ItemDisplayContext
|
||||
import org.joml.Quaternionf
|
||||
|
||||
@Environment(value = EnvType.CLIENT)
|
||||
class PokeBobberEntityRenderer(context: EntityRendererProvider.Context?) : EntityRenderer<PokeRodFishingBobberEntity>(context) {
|
||||
|
||||
override fun render(fishingBobberEntity: PokeRodFishingBobberEntity, elapsedPartialTicks: Float, tickDelta: Float, matrixStack: PoseStack, vertexConsumerProvider: MultiBufferSource, light: Int) {
|
||||
|
||||
+13
-19
@@ -51,7 +51,6 @@ import net.minecraft.client.renderer.entity.ItemRenderer
|
||||
import net.minecraft.client.renderer.entity.MobRenderer
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.network.chat.MutableComponent
|
||||
import net.minecraft.network.chat.Style
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.util.Mth
|
||||
@@ -76,11 +75,6 @@ class PokemonRenderer(
|
||||
.withUnderlined(false)
|
||||
.withStrikethrough(false)
|
||||
.withObfuscated(false)
|
||||
|
||||
private const val HIDDEN_NAME = "???"
|
||||
|
||||
private const val SPACE = " "
|
||||
|
||||
}
|
||||
|
||||
val ballContext = RenderContext().also {
|
||||
@@ -361,15 +355,23 @@ class PokemonRenderer(
|
||||
matrices.scale((0.025 * sizeScale).toFloat(), (-0.025 * sizeScale).toFloat(), (1 * sizeScale).toFloat())
|
||||
val matrix4f = matrices.last().pose()
|
||||
val opacity = (Minecraft.getInstance().options.getBackgroundOpacity(0.25F) * 255.0F).toInt() shl 24
|
||||
val label = this.resolveBaseLabel(entity)
|
||||
var label = if (ServerSettings.displayEntityNameLabel &&
|
||||
!Cobblemon.config.displayNameForUnknownPokemon &&
|
||||
CobblemonClient.clientPokedexData.getKnowledgeForSpecies(entity.pokemon.species.resourceIdentifier) == PokedexEntryProgress.NONE) {
|
||||
Component.literal("???")
|
||||
} else if (ServerSettings.displayEntityNameLabel) {
|
||||
entity.name.copy()
|
||||
} else {
|
||||
Component.empty()
|
||||
}
|
||||
if(ServerSettings.displayEntityNameLabel && ServerSettings.displayEntityLevelLabel && entity.labelLevel() > 0) {
|
||||
label.append(Component.literal(" "))
|
||||
}
|
||||
if (ServerSettings.displayEntityLevelLabel && entity.labelLevel() > 0) {
|
||||
if (ServerSettings.displayEntityNameLabel) {
|
||||
label.append(SPACE)
|
||||
}
|
||||
// This a Style.EMPTY with a lot of effects set to false and color set to white, renderer inherits these from nick otherwise
|
||||
val levelLabel = lang("label.lv", entity.labelLevel())
|
||||
.setStyle(LEVEL_LABEL_STYLE)
|
||||
label.append(levelLabel)
|
||||
label = label.append(levelLabel)
|
||||
}
|
||||
var h = (-this.font.width(label) / 2).toFloat()
|
||||
val y = 0F
|
||||
@@ -388,14 +390,6 @@ class PokemonRenderer(
|
||||
}
|
||||
}
|
||||
|
||||
private fun resolveBaseLabel(entity: PokemonEntity): MutableComponent {
|
||||
return when {
|
||||
!ServerSettings.displayEntityNameLabel -> Component.empty()
|
||||
Cobblemon.config.displayNameForUnknownPokemon || CobblemonClient.clientPokedexData.getKnowledgeForSpecies(entity.pokemon.species.resourceIdentifier) != PokedexEntryProgress.NONE -> entity.name.copy()
|
||||
else -> Component.literal(HIDDEN_NAME)
|
||||
}
|
||||
}
|
||||
|
||||
private fun drawPokeBall(
|
||||
state: ClientBallDisplay,
|
||||
matrixStack: PoseStack,
|
||||
|
||||
@@ -87,18 +87,15 @@ object PokedexCommand {
|
||||
val form = context.getArgument("form", FormData::class.java)
|
||||
players.forEach {
|
||||
val dex = Cobblemon.playerDataManager.getPokedexData(it)
|
||||
val completeEntry = Dexes.dexEntryMap[cobblemonResource("national")]!!.getEntries().first { it.speciesId == species.resourceIdentifier }
|
||||
var completeEntry = Dexes.dexEntryMap[cobblemonResource("national")]!!.getEntries().first { it.speciesId == species.resourceIdentifier }
|
||||
val entry = dex.getOrCreateSpeciesRecord(species.resourceIdentifier)
|
||||
|
||||
completeEntry.forms
|
||||
.filter { it.displayForm == form.name }
|
||||
.forEach { form ->
|
||||
form.unlockForms.forEach { unlockForm ->
|
||||
val formRecord = entry.getOrCreateFormRecord(unlockForm)
|
||||
formRecord.setKnowledgeProgress(PokedexEntryProgress.CAUGHT)
|
||||
formRecord.addAllShinyStatesAndGenders()
|
||||
}
|
||||
completeEntry.forms.forEach { form ->
|
||||
form.unlockForms.forEach {unlockForm ->
|
||||
val formRecord = entry.getOrCreateFormRecord(unlockForm)
|
||||
formRecord.setKnowledgeProgress(PokedexEntryProgress.CAUGHT)
|
||||
formRecord.addAllShinyStatesAndGenders()
|
||||
}
|
||||
}
|
||||
entry.addAspects(completeEntry.variations.flatMap { it.aspects }.toSet())
|
||||
}
|
||||
val selectorStr = if (players.size == 1) players.first().name.string else "${players.size} players"
|
||||
@@ -114,7 +111,7 @@ object PokedexCommand {
|
||||
val form = context.getArgument("form", FormData::class.java)
|
||||
players.forEach {
|
||||
val dex = Cobblemon.playerDataManager.getPokedexData(it)
|
||||
dex.deleteFormRecord(species.resourceIdentifier, form.name.lowercase())
|
||||
dex.deleteSpeciesRecord(species.resourceIdentifier)
|
||||
dex.clearCalculatedValues()
|
||||
it.sendPacket(SetClientPlayerDataPacket(PlayerInstancedDataStoreTypes.POKEDEX, dex.toClientData()))
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import com.cobblemon.mod.common.datafixer.fix.FeatureFix
|
||||
import com.cobblemon.mod.common.datafixer.fix.IvEvToIdentifierFix
|
||||
import com.cobblemon.mod.common.datafixer.fix.MovesetJsonFix
|
||||
import com.cobblemon.mod.common.datafixer.fix.NicknameFix
|
||||
import com.cobblemon.mod.common.datafixer.fix.RaisedPPStagesFix
|
||||
import com.cobblemon.mod.common.datafixer.fix.ShoulderStateJsonFix
|
||||
import com.cobblemon.mod.common.datafixer.fix.TeraTypeFix
|
||||
import com.cobblemon.mod.common.datafixer.fix.TradeableMissingFix
|
||||
@@ -90,7 +89,6 @@ object CobblemonSchemas {
|
||||
builder.addFixer(MovesetJsonFix(schema1))
|
||||
builder.addFixer(ShoulderStateJsonFix(schema1))
|
||||
builder.addFixer(NicknameFix(schema1))
|
||||
builder.addFixer(RaisedPPStagesFix(schema1))
|
||||
}
|
||||
|
||||
private class CobblemonDataFixerCodec<R>(private val baseCodec: Codec<R>, private val typeReference: TypeReference) : Codec<R> {
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* 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.datafixer.fix
|
||||
|
||||
import com.mojang.datafixers.schemas.Schema
|
||||
import com.mojang.serialization.Dynamic
|
||||
|
||||
class RaisedPPStagesFix(output: Schema) : PokemonFix(output) {
|
||||
|
||||
override fun fixPokemonData(dynamic: Dynamic<*>): Dynamic<*> {
|
||||
var result = processPPStages(dynamic, "MoveSet")
|
||||
result = processPPStages(result, "BenchedMoves")
|
||||
return result
|
||||
}
|
||||
|
||||
private fun processPPStages(dynamic: Dynamic<*>, key: String): Dynamic<*> {
|
||||
var moveSetJson = dynamic.get(key).asListOpt { it }.result()
|
||||
if (!moveSetJson.isPresent) {
|
||||
return dynamic
|
||||
}
|
||||
|
||||
var moves = moveSetJson.get()
|
||||
for(i in 0..moves.size) {
|
||||
var move = moves.getOrNull(i)
|
||||
if(move != null && move.get("RaisedPPStages").asNumber(0).toInt() > 3) {
|
||||
moves[i] = move.set("RaisedPPStages", dynamic.createInt(3))
|
||||
}
|
||||
}
|
||||
|
||||
return dynamic.set(key, dynamic.createList(moves.stream()))
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -183,7 +183,7 @@ class PokeRodFishingBobberEntity(type: EntityType<out PokeRodFishingBobberEntity
|
||||
}
|
||||
|
||||
fun chooseAdjustedSpawnBucket(buckets: List<SpawnBucket>, luckOfTheSeaLevel: Int): SpawnBucket {
|
||||
val baseIncreases = listOf(2.5F, 0.5F, 0.2F) // Base increases for the first three buckets beyond the first
|
||||
val baseIncreases = listOf(2.5F, 0.9F, 0.35F) // Base increases for the first three buckets beyond the first
|
||||
val adjustedWeights = buckets.mapIndexed { index, bucket ->
|
||||
if (index == 0) {
|
||||
// Placeholder, will be recalculated
|
||||
|
||||
+21
-30
@@ -197,37 +197,28 @@ class PokemonMoveControl(val pokemonEntity: PokemonEntity) : MoveControl(pokemon
|
||||
pokemonEntity.yya = 0.2F
|
||||
}
|
||||
|
||||
if (this.pokemonEntity.isBattling) {
|
||||
if (this.pokemonEntity.getBehaviourFlag(PokemonBehaviourFlag.FLYING)) {
|
||||
// Flying Pokemon have extremely low vertical deceleration and can fly into the stratosphere if their movement is not dampened
|
||||
// This can happen when:
|
||||
// A Pokemon was jumping when the battle begins
|
||||
// A Pokemon receives knockback from sweeping edge striking a nearby target, wind charges, etc.
|
||||
mob.deltaMovement = Vec3(mob.deltaMovement.x, min(0.01, mob.deltaMovement.y), mob.deltaMovement.z)
|
||||
// In battle water antics
|
||||
// Borrowing hard from Minecraft's Boat logic
|
||||
if (this.pokemonEntity.isBattling && mob.isInWater) {
|
||||
var e = 0.0F
|
||||
val exposedForm = this.pokemonEntity.exposedForm
|
||||
if (isUnderwater()) {
|
||||
if (this.pokemonEntity.platform != PlatformType.NONE) {
|
||||
// Float up if on a platform
|
||||
e = 0.3F
|
||||
}
|
||||
} else if (checkInWater()) {
|
||||
if (this.pokemonEntity.platform != PlatformType.NONE ) {
|
||||
// Hold Steady
|
||||
e = ((this.waterLevel - this.pokemonEntity.y) / this.pokemonEntity.bbHeight).toFloat()
|
||||
} else if (exposedForm.behaviour.moving.swim.canBreatheUnderwater) {
|
||||
// allow swimmers to sink a bit into the water
|
||||
e = -1.5F
|
||||
}
|
||||
}
|
||||
if (mob.isInWater) {
|
||||
// In battle water antics
|
||||
// Borrowing hard from Minecraft's Boat logic
|
||||
var e = 0.0F
|
||||
val exposedForm = this.pokemonEntity.exposedForm
|
||||
if (isUnderwater()) {
|
||||
if (this.pokemonEntity.platform != PlatformType.NONE) {
|
||||
// Float up if on a platform
|
||||
e = 0.3F
|
||||
}
|
||||
} else if (checkInWater()) {
|
||||
if (this.pokemonEntity.platform != PlatformType.NONE ) {
|
||||
// Hold Steady
|
||||
e = ((this.waterLevel - this.pokemonEntity.y) / this.pokemonEntity.bbHeight).toFloat()
|
||||
} else if (exposedForm.behaviour.moving.swim.canBreatheUnderwater) {
|
||||
// allow swimmers to sink a bit into the water
|
||||
e = -1.5F
|
||||
}
|
||||
}
|
||||
if (Mth.abs(e) > VERY_CLOSE) {
|
||||
val vec32: Vec3 = this.pokemonEntity.deltaMovement
|
||||
this.pokemonEntity.setDeltaMovement(vec32.x, (vec32.y + e * (this.pokemonEntity.gravity / 0.65)) * 0.75, vec32.z)
|
||||
}
|
||||
if (Mth.abs(e) > VERY_CLOSE) {
|
||||
val vec32: Vec3 = this.pokemonEntity.deltaMovement
|
||||
this.pokemonEntity.setDeltaMovement(vec32.x, (vec32.y + e * (this.pokemonEntity.gravity / 0.65)) * 0.75, vec32.z)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-21
@@ -9,12 +9,9 @@
|
||||
package com.cobblemon.mod.common.entity.pokemon.effects
|
||||
|
||||
import com.cobblemon.mod.common.api.entity.pokemon.*
|
||||
import com.cobblemon.mod.common.api.events.CobblemonEvents
|
||||
import com.cobblemon.mod.common.api.events.pokemon.PokemonSeenEvent
|
||||
import com.cobblemon.mod.common.api.pokemon.PokemonProperties
|
||||
import com.cobblemon.mod.common.api.pokemon.PokemonPropertyExtractor
|
||||
import com.cobblemon.mod.common.api.scheduling.afterOnServer
|
||||
import com.cobblemon.mod.common.battles.BattleRegistry
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonBehaviourFlag
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import com.cobblemon.mod.common.net.messages.client.effect.SpawnSnowstormEntityParticlePacket
|
||||
@@ -58,7 +55,6 @@ class IllusionEffect(
|
||||
afterOnServer(seconds = 1.0F) {
|
||||
entity.cry()
|
||||
if (entity.pokemon.shiny) SpawnSnowstormEntityParticlePacket(cobblemonResource("shiny_ring"), entity.id, listOf("shiny_particles", "middle")).sendToPlayersAround(entity.x, entity.y, entity.z, 64.0, entity.level().dimension())
|
||||
this.revealToDex(entity)
|
||||
future.complete(entity)
|
||||
}
|
||||
}
|
||||
@@ -76,23 +72,6 @@ class IllusionEffect(
|
||||
if (nbt.contains(DataKeys.POKEMON_ENTITY_SCALE)) this.scale = nbt.getFloat(DataKeys.POKEMON_ENTITY_SCALE)
|
||||
}
|
||||
|
||||
/**
|
||||
* Reveals the "base" Pokemon to everyone in the battle for dex purposes.
|
||||
*
|
||||
* @param entity The [PokemonEntity] being revealed.
|
||||
*/
|
||||
private fun revealToDex(entity: PokemonEntity) {
|
||||
// Step 1 resolve source battle and presence in actor.
|
||||
val battleId = entity.battleId ?: return
|
||||
val battle = BattleRegistry.getBattle(battleId) ?: return
|
||||
val wildActor = battle.getActor(entity.pokemon.uuid) ?: return
|
||||
val battlePokemon = wildActor.pokemonList.firstOrNull { it.uuid == entity.pokemon.uuid } ?: return
|
||||
// Step 2 flag all players as seeing the Pokemon
|
||||
battle.playerUUIDs.forEach { uuid ->
|
||||
CobblemonEvents.POKEMON_SEEN.post(PokemonSeenEvent(uuid, battlePokemon.effectedPokemon))
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
val ID = "ILLUSION"
|
||||
}
|
||||
|
||||
@@ -21,19 +21,6 @@ object FlowHandler {
|
||||
CobblemonEvents.BATTLE_VICTORY.subscribe { CobblemonFlows.run(cobblemonResource("battle_victory"), it.context) }
|
||||
CobblemonEvents.POKEDEX_DATA_CHANGED_PRE.subscribe { CobblemonFlows.run(cobblemonResource("pokedex_data_changed_pre"), it.getContext(), it) }
|
||||
CobblemonEvents.POKEDEX_DATA_CHANGED_POST.subscribe { CobblemonFlows.run(cobblemonResource("pokedex_data_changed_post"), it.getContext()) }
|
||||
CobblemonEvents.FORME_CHANGE.subscribe { CobblemonFlows.run(cobblemonResource("forme_change"), it.context) }
|
||||
CobblemonEvents.MEGA_EVOLUTION.subscribe { CobblemonFlows.run(cobblemonResource("mega_evolution"), it.context) }
|
||||
CobblemonEvents.ZPOWER_USED.subscribe { CobblemonFlows.run(cobblemonResource("zpower_used"), it.context) }
|
||||
CobblemonEvents.TERASTALLIZATION.subscribe { CobblemonFlows.run(cobblemonResource("terastallization"), it.context) }
|
||||
CobblemonEvents.BATTLE_FAINTED.subscribe { CobblemonFlows.run(cobblemonResource("battle_fainted"), it.structContext) }
|
||||
CobblemonEvents.BATTLE_FLED.subscribe { CobblemonFlows.run(cobblemonResource("battle_fled"), it.context) }
|
||||
CobblemonEvents.BATTLE_STARTED_PRE.subscribe { CobblemonFlows.run(cobblemonResource("battle_started_pre"), it.context, it) }
|
||||
CobblemonEvents.BATTLE_STARTED_POST.subscribe { CobblemonFlows.run(cobblemonResource("battle_started_post"), it.context) }
|
||||
CobblemonEvents.APRICORN_HARVESTED.subscribe { CobblemonFlows.run(cobblemonResource("apricorn_harvested"), it.context) }
|
||||
CobblemonEvents.THROWN_POKEBALL_HIT.subscribe { CobblemonFlows.run(cobblemonResource("thrown_pokeball_hit"), it.context) }
|
||||
CobblemonEvents.LEVEL_UP_EVENT.subscribe { CobblemonFlows.run(cobblemonResource("level_up"), it.context) }
|
||||
CobblemonEvents.POKEMON_FAINTED.subscribe { CobblemonFlows.run(cobblemonResource("pokemon_fainted"), it.context) }
|
||||
CobblemonEvents.POKEMON_GAINED.subscribe { CobblemonFlows.run(cobblemonResource("pokemon_gained"), it.context) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ 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
|
||||
import com.cobblemon.mod.common.api.events.pokemon.PokemonAspectsChangedEvent
|
||||
import com.cobblemon.mod.common.api.events.pokemon.PokemonGainedEvent
|
||||
import com.cobblemon.mod.common.api.events.pokemon.PokemonSeenEvent
|
||||
|
||||
@@ -19,7 +18,6 @@ object PokedexHandler : EventHandler {
|
||||
override fun registerListeners() {
|
||||
CobblemonEvents.POKEMON_GAINED.subscribe(Priority.NORMAL, ::onPokemonGained)
|
||||
CobblemonEvents.POKEMON_SEEN.subscribe(Priority.NORMAL, ::onPokemonSeen)
|
||||
CobblemonEvents.POKEMON_ASPECTS_CHANGED.subscribe(Priority.NORMAL, ::onPokemonAspectsChanged)
|
||||
}
|
||||
|
||||
fun onPokemonGained(event: PokemonGainedEvent) {
|
||||
@@ -29,10 +27,4 @@ object PokedexHandler : EventHandler {
|
||||
fun onPokemonSeen(event: PokemonSeenEvent) {
|
||||
Cobblemon.playerDataManager.getPokedexData(event.playerId).encounter(event.pokemon)
|
||||
}
|
||||
|
||||
fun onPokemonAspectsChanged(event: PokemonAspectsChangedEvent) {
|
||||
if (event.ownerId != null) {
|
||||
Cobblemon.playerDataManager.getPokedexData(event.ownerId).catch(event.pokemon)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
/*
|
||||
* 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.item
|
||||
|
||||
class GalaricaNutItem : CobblemonItem(Properties()) {
|
||||
// Eventually, put some logic here for planting it or something
|
||||
}
|
||||
@@ -106,7 +106,6 @@ object CobblemonItemGroups {
|
||||
entries.accept(CobblemonItems.MIRROR_HERB)
|
||||
entries.accept(CobblemonItems.VIVICHOKE)
|
||||
entries.accept(CobblemonItems.VIVICHOKE_SEEDS)
|
||||
entries.accept(CobblemonItems.GALARICA_NUTS)
|
||||
|
||||
entries.accept(CobblemonItems.RED_APRICORN)
|
||||
entries.accept(CobblemonItems.YELLOW_APRICORN)
|
||||
|
||||
@@ -195,7 +195,7 @@ class PokerodItem(val pokeRodId: ResourceLocation, settings: Properties) : Fishi
|
||||
if (user.fishing != null) { // if the bobber is out yet
|
||||
if (!world.isClientSide) {
|
||||
CobblemonEvents.POKEROD_REEL.postThen(
|
||||
PokerodReelEvent(user, itemStack),
|
||||
PokerodReelEvent(itemStack),
|
||||
{ event -> return InteractionResultHolder.fail(itemStack) },
|
||||
{ event ->
|
||||
i = user.fishing!!.retrieve(itemStack)
|
||||
|
||||
@@ -51,11 +51,13 @@ class PotionItem(val type: PotionType) : CobblemonItem(Properties()), PokemonSel
|
||||
if (pokemon.isFullHealth()) {
|
||||
return InteractionResultHolder.fail(stack)
|
||||
}
|
||||
val potionHealAmount = genericRuntime.resolveInt(type.amountToHeal())
|
||||
var healthToRestore = potionHealAmount
|
||||
CobblemonEvents.POKEMON_HEALED.postThen(PokemonHealedEvent(pokemon, potionHealAmount, this), { cancelledEvent -> return InteractionResultHolder.fail(stack)}) { event ->
|
||||
healthToRestore = event.amount
|
||||
var amount = genericRuntime.resolveInt(type.amountToHeal())
|
||||
CobblemonEvents.POKEMON_HEALED.postThen(PokemonHealedEvent(pokemon, amount, this), { cancelledEvent -> return InteractionResultHolder.fail(stack)}) { event ->
|
||||
amount = event.amount
|
||||
}
|
||||
pokemon.currentHealth = min(pokemon.currentHealth + amount, pokemon.maxHealth)
|
||||
|
||||
val healthToRestore = genericRuntime.resolveInt(type.amountToHeal())
|
||||
pokemon.currentHealth = min(pokemon.currentHealth + healthToRestore, pokemon.maxHealth)
|
||||
if (type.curesStatus) {
|
||||
pokemon.status = null
|
||||
|
||||
-1
@@ -95,7 +95,6 @@ class NPCConfigurationDTO : Encodable, Decodable {
|
||||
}
|
||||
entity.appliedAspects.clear()
|
||||
entity.appliedAspects.addAll(aspects)
|
||||
entity.updateAspects()
|
||||
variables.forEach { (key, value) ->
|
||||
val variable = entity.npc.config.find { it.variableName == key } ?: return@forEach
|
||||
entity.config.setDirectly(key, variable.type.toMoValue(value))
|
||||
|
||||
+1
-17
@@ -9,15 +9,11 @@
|
||||
package com.cobblemon.mod.common.net.serverhandling
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import com.cobblemon.mod.common.api.events.CobblemonEvents
|
||||
import com.cobblemon.mod.common.api.events.pokemon.PokemonSeenEvent
|
||||
import com.cobblemon.mod.common.api.net.ServerNetworkPacketHandler
|
||||
import com.cobblemon.mod.common.api.text.red
|
||||
import com.cobblemon.mod.common.battles.BattleBuilder
|
||||
import com.cobblemon.mod.common.battles.BattleTypes
|
||||
import com.cobblemon.mod.common.battles.ChallengeManager
|
||||
import com.cobblemon.mod.common.battles.actor.PokemonBattleActor
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import com.cobblemon.mod.common.net.messages.client.battle.BattleChallengeNotificationPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.BattleChallengePacket
|
||||
@@ -49,9 +45,7 @@ object ChallengeHandler : ServerNetworkPacketHandler<BattleChallengePacket> {
|
||||
|
||||
val leadingPokemon = player.party()[packet.selectedPokemonId]?.uuid ?: return // validate id
|
||||
if (targetedEntity is PokemonEntity && player.canInteractWith(targetedEntity, Cobblemon.config.battleWildMaxDistance) && targetedEntity.canBattle(player)) {
|
||||
BattleBuilder.pve(player, targetedEntity, leadingPokemon)
|
||||
.ifSuccessful { battle -> this.flagAsSeen(battle, targetedEntity) }
|
||||
.ifErrored { it.sendTo(player) { it.red() } }
|
||||
BattleBuilder.pve(player, targetedEntity, leadingPokemon).ifErrored { it.sendTo(player) { it.red() } }
|
||||
}
|
||||
else if (targetedEntity is ServerPlayer) {
|
||||
ChallengeManager.setLead(player, leadingPokemon)
|
||||
@@ -65,14 +59,4 @@ object ChallengeHandler : ServerNetworkPacketHandler<BattleChallengePacket> {
|
||||
ChallengeManager.sendRequest(challenge)
|
||||
}
|
||||
}
|
||||
|
||||
private fun flagAsSeen(battle: PokemonBattle, entity: PokemonEntity) {
|
||||
// Wild actor is tied to Pokemon UUID not entity
|
||||
val actor = battle.getActor(entity.pokemon.uuid) as? PokemonBattleActor ?: return
|
||||
val battlePokemon = actor.pokemonList.firstOrNull { it.uuid == entity.pokemon.uuid } ?: return
|
||||
battle.playerUUIDs.forEach { uuid ->
|
||||
CobblemonEvents.POKEMON_SEEN.post(PokemonSeenEvent(uuid, battlePokemon.effectedPokemon))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -208,19 +208,6 @@ class FormData(
|
||||
return this._lightingData
|
||||
}
|
||||
|
||||
val possibleGenders: Set<Gender>
|
||||
get() {
|
||||
return if (maleRatio == -1F) {
|
||||
setOf(Gender.GENDERLESS)
|
||||
} else if (maleRatio == 0F) {
|
||||
setOf(Gender.FEMALE)
|
||||
} else if (maleRatio == 1F) {
|
||||
setOf(Gender.MALE)
|
||||
} else {
|
||||
setOf(Gender.FEMALE, Gender.MALE)
|
||||
}
|
||||
}
|
||||
|
||||
fun eyeHeight(entity: PokemonEntity): Float {
|
||||
return this.resolveEyeHeight(entity) ?: return this.species.eyeHeight(entity)
|
||||
}
|
||||
|
||||
@@ -1215,12 +1215,7 @@ open class Pokemon : ShowdownIdentifiable {
|
||||
* aspect providers, and we want the server side to entirely manage them anyway.
|
||||
*/
|
||||
if (!isClient) {
|
||||
val oldAspects = aspects
|
||||
aspects = AspectProvider.providers.flatMap { it.provide(this) }.toSet() + forcedAspects
|
||||
|
||||
if (oldAspects != aspects && !isWild()) {
|
||||
CobblemonEvents.POKEMON_ASPECTS_CHANGED.post(PokemonAspectsChangedEvent(getOwnerUUID(), this))
|
||||
}
|
||||
} else {
|
||||
aspects = forcedAspects
|
||||
}
|
||||
|
||||
@@ -8,10 +8,7 @@
|
||||
|
||||
package com.cobblemon.mod.common.pokemon
|
||||
|
||||
import com.bedrockk.molang.runtime.struct.QueryStruct
|
||||
import com.bedrockk.molang.runtime.value.DoubleValue
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.api.molang.ObjectValue
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stat
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stats
|
||||
import com.cobblemon.mod.common.api.reactive.SimpleObservable
|
||||
@@ -30,12 +27,6 @@ abstract class PokemonStats : Iterable<Map.Entry<Stat, Int>> {
|
||||
abstract val defaultValue: Int
|
||||
override fun iterator() = stats.entries.iterator()
|
||||
|
||||
val struct = ObjectValue(this).also {
|
||||
for (stat in Stats.PERMANENT) {
|
||||
it.addFunction(stat.showdownId) { DoubleValue(this.getOrDefault(stat)) }
|
||||
}
|
||||
}
|
||||
|
||||
/** Emits any stat change. */
|
||||
val observable = SimpleObservable<PokemonStats>()
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.cobblemon.mod.common.api.pokemon.evolution.PreEvolution
|
||||
import com.cobblemon.mod.common.api.pokemon.experience.ExperienceGroups
|
||||
import com.cobblemon.mod.common.api.pokemon.moves.Learnset
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stat
|
||||
import com.cobblemon.mod.common.api.storage.InvalidSpeciesException
|
||||
import com.cobblemon.mod.common.api.types.ElementalType
|
||||
import com.cobblemon.mod.common.api.types.ElementalTypes
|
||||
import com.cobblemon.mod.common.entity.PoseType.Companion.FLYING_POSES
|
||||
@@ -40,6 +39,7 @@ import com.cobblemon.mod.common.net.IntSize
|
||||
import com.cobblemon.mod.common.pokemon.abilities.HiddenAbility
|
||||
import com.cobblemon.mod.common.pokemon.ai.PokemonBehaviour
|
||||
import com.cobblemon.mod.common.pokemon.lighthing.LightingData
|
||||
import com.cobblemon.mod.common.util.codec.CodecUtils
|
||||
import com.cobblemon.mod.common.util.readEntityDimensions
|
||||
import com.cobblemon.mod.common.util.readEnumConstant
|
||||
import com.cobblemon.mod.common.util.readIdentifier
|
||||
@@ -50,7 +50,6 @@ import com.cobblemon.mod.common.util.writeIdentifier
|
||||
import com.cobblemon.mod.common.util.writeSizedInt
|
||||
import com.cobblemon.mod.common.util.writeString
|
||||
import com.mojang.serialization.Codec
|
||||
import com.mojang.serialization.DataResult
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.network.chat.MutableComponent
|
||||
@@ -130,7 +129,15 @@ class Species : ClientDataSynchronizer<Species>, ShowdownIdentifiable {
|
||||
|
||||
val possibleGenders: Set<Gender>
|
||||
get() = forms.flatMap {
|
||||
it.possibleGenders
|
||||
if (it.maleRatio == -1F) {
|
||||
setOf(Gender.GENDERLESS)
|
||||
} else if (it.maleRatio == 0F) {
|
||||
setOf(Gender.FEMALE)
|
||||
} else if (it.maleRatio == 1F) {
|
||||
setOf(Gender.MALE)
|
||||
} else {
|
||||
setOf(Gender.FEMALE, Gender.MALE)
|
||||
}
|
||||
}.toSet() + (if (maleRatio == -1F) {
|
||||
setOf(Gender.GENDERLESS)
|
||||
} else if (maleRatio == 0F) {
|
||||
@@ -346,13 +353,13 @@ class Species : ClientDataSynchronizer<Species>, ShowdownIdentifiable {
|
||||
|
||||
// TODO: Registries have dedicated Codecs, migrate to that once this is a proper registry impl
|
||||
/**
|
||||
* A [Codec] that maps to/from an [ResourceLocation] associated as [Species.resourceIdentifier].
|
||||
* A [Codec] that maps to/from an [Identifier] associated as [Species.resourceIdentifier].
|
||||
* Uses [PokemonSpecies.getByIdentifier] to query.
|
||||
*/
|
||||
@JvmStatic
|
||||
val BY_IDENTIFIER_CODEC: Codec<Species> = ResourceLocation.CODEC.comapFlatMap(
|
||||
{ identifier -> DataResult.success(PokemonSpecies.getByIdentifier(identifier) ?: throw InvalidSpeciesException(identifier)) },
|
||||
val BY_IDENTIFIER_CODEC: Codec<Species> = CodecUtils.createByIdentifierCodec(
|
||||
PokemonSpecies::getByIdentifier,
|
||||
Species::resourceIdentifier
|
||||
)
|
||||
) { identifier -> "No species for ID $identifier" }
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,6 @@ object DataKeys {
|
||||
const val POKEMON_PLATFORM_TYPE = "PlatformType"
|
||||
|
||||
const val POKEMON_ORIGINAL_TRAINER = "PokemonOriginalTrainer"
|
||||
const val POKEMON_ORIGINAL_TRAINER_NAME = "PokemonOriginalTrainerName"
|
||||
const val POKEMON_ORIGINAL_TRAINER_TYPE = "PokemonOriginalTrainerType"
|
||||
|
||||
const val POKEMON_PROPERTIES_MOVES = "Moves"
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.zip.ZipInputStream
|
||||
object FileUtils {
|
||||
|
||||
private fun getResourceStream(internal: String): InputStream {
|
||||
return Cobblemon.javaClass.classLoader.getResourceAsStream(internal)
|
||||
return Cobblemon::class.java.getResourceAsStream(internal)
|
||||
?: throw Exception("Could not read $internal")
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ internal data class ClientPokemonP3(
|
||||
instance.group(
|
||||
OriginalTrainerType.CODEC.optionalFieldOf(DataKeys.POKEMON_ORIGINAL_TRAINER_TYPE, OriginalTrainerType.NONE).forGetter(ClientPokemonP3::originalTrainerType),
|
||||
Codec.STRING.optionalFieldOf(DataKeys.POKEMON_ORIGINAL_TRAINER).forGetter(ClientPokemonP3::originalTrainer),
|
||||
Codec.STRING.optionalFieldOf(DataKeys.POKEMON_ORIGINAL_TRAINER_NAME).forGetter(ClientPokemonP3::originalTrainerName),
|
||||
Codec.STRING.optionalFieldOf(DataKeys.POKEMON_ORIGINAL_TRAINER).forGetter(ClientPokemonP3::originalTrainerName),
|
||||
Codec.list(Codec.STRING).optionalFieldOf(DataKeys.POKEMON_FORCED_ASPECTS, emptyList()).xmap({ it.toSet() }, { it.toMutableList() }).forGetter(ClientPokemonP3::aspects),
|
||||
).apply(instance, ::ClientPokemonP3)
|
||||
}
|
||||
|
||||
@@ -20,10 +20,7 @@ import com.cobblemon.mod.common.pokemon.evolution.controller.ServerEvolutionCont
|
||||
import com.cobblemon.mod.common.pokemon.status.PersistentStatusContainer
|
||||
import com.cobblemon.mod.common.util.DataKeys
|
||||
import com.cobblemon.mod.common.util.codec.CodecUtils
|
||||
import com.mojang.datafixers.util.Pair
|
||||
import com.mojang.serialization.Codec
|
||||
import com.mojang.serialization.DataResult
|
||||
import com.mojang.serialization.DynamicOps
|
||||
import com.mojang.serialization.MapCodec
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import net.minecraft.core.UUIDUtil
|
||||
@@ -85,26 +82,7 @@ internal data class PokemonP2(
|
||||
PokemonProperties.CUSTOM_PROPERTIES_CODEC.optionalFieldOf(DataKeys.POKEMON_DATA, arrayListOf()).forGetter(PokemonP2::customProperties),
|
||||
Nature.BY_IDENTIFIER_CODEC.fieldOf(DataKeys.POKEMON_NATURE).forGetter(PokemonP2::nature),
|
||||
Nature.BY_IDENTIFIER_CODEC.optionalFieldOf(DataKeys.POKEMON_MINTED_NATURE).forGetter(PokemonP2::mintedNature),
|
||||
ItemStack.CODEC.mapResult(object: Codec.ResultFunction<ItemStack> {
|
||||
override fun <T : Any> apply(
|
||||
ops: DynamicOps<T>,
|
||||
input: T,
|
||||
a: DataResult<Pair<ItemStack, T>>
|
||||
): DataResult<Pair<ItemStack, T>> {
|
||||
a.error().ifPresent {
|
||||
Cobblemon.LOGGER.error("Failed to read held item due to following error: ${it.message()}")
|
||||
}
|
||||
return DataResult.success(a.result().orElse(Pair.of(ItemStack.EMPTY, input)))
|
||||
}
|
||||
|
||||
override fun <T : Any> coApply(
|
||||
ops: DynamicOps<T>,
|
||||
input: ItemStack?,
|
||||
t: DataResult<T>
|
||||
): DataResult<T> {
|
||||
return t
|
||||
}
|
||||
}).optionalFieldOf(DataKeys.HELD_ITEM, ItemStack.EMPTY).forGetter(PokemonP2::heldItem),
|
||||
ItemStack.CODEC.optionalFieldOf(DataKeys.HELD_ITEM, ItemStack.EMPTY).forGetter(PokemonP2::heldItem),
|
||||
CompoundTag.CODEC.fieldOf(DataKeys.POKEMON_PERSISTENT_DATA).forGetter(PokemonP2::persistentData),
|
||||
UUIDUtil.LENIENT_CODEC.optionalFieldOf(DataKeys.TETHERING_ID).forGetter(PokemonP2::tetheringId),
|
||||
TeraType.BY_IDENTIFIER_CODEC.fieldOf(DataKeys.POKEMON_TERA_TYPE).forGetter(PokemonP2::teraType),
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"accessWidener": "cobblemon-common.accesswidener",
|
||||
"injected_interfaces": {
|
||||
"net/minecraft/class_630": ["com/cobblemon/mod/common/client/render/models/blockbench/pose/Bone"]
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,6 @@
|
||||
"item.cobblemon.yellow_apricorn": "Yellow Apricorn",
|
||||
"item.cobblemon.vivichoke_seeds": "Vivichoke Seeds",
|
||||
"item.cobblemon.vivichoke": "Vivichoke",
|
||||
"item.cobblemon.galarica_nuts": "Galarica Nuts",
|
||||
|
||||
"item.cobblemon.apricorn_boat": "Apricorn Boat",
|
||||
"item.cobblemon.apricorn_chest_boat": "Apricorn Boat with Chest",
|
||||
@@ -347,7 +346,7 @@
|
||||
"item.cobblemon.everstone": "Everstone",
|
||||
"item.cobblemon.everstone.tooltip": "Prevents the holder from evolving",
|
||||
"item.cobblemon.eviolite": "Eviolite",
|
||||
"item.cobblemon.eviolite.tooltip": "Boosts the holder's Defense and Sp. Defense if it is not fully evolved",
|
||||
"item.cobblemon.eviolite.tooltip": "Boosts the holder's Defense and Sp. Atk if it is not fully evolved",
|
||||
"item.cobblemon.exp_share": "Exp. Share",
|
||||
"item.cobblemon.exp_share.tooltip": "Allows the holder to receive a share of experience from battles without participating",
|
||||
"item.cobblemon.expert_belt": "Expert Belt",
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "cobblemon:item/galarica_nuts"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 573 B After Width: | Height: | Size: 337 B |
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 599 B After Width: | Height: | Size: 361 B |
Binary file not shown.
|
Before Width: | Height: | Size: 577 B |
@@ -32,7 +32,7 @@ transitive-accessible field net/minecraft/client/model/geom/builders/CubeDeforma
|
||||
transitive-accessible field net/minecraft/client/model/geom/builders/CubeDeformation growZ F
|
||||
transitive-extendable method net/minecraft/world/entity/LivingEntity canBreatheUnderwater ()Z
|
||||
transitive-extendable class net/minecraft/world/level/block/grower/TreeGrower
|
||||
#accessible method net/minecraft/world/level/block/state/BlockBehaviour codec ()Lcom/mojang/serialization/MapCodec;
|
||||
accessible method net/minecraft/world/level/block/state/BlockBehaviour codec ()Lcom/mojang/serialization/MapCodec;
|
||||
accessible method net/minecraft/network/protocol/game/ClientboundAddEntityPacket <init> (Lnet/minecraft/network/RegistryFriendlyByteBuf;)V
|
||||
|
||||
transitive-accessible field net/minecraft/world/entity/player/Inventory compartments Ljava/util/List;
|
||||
@@ -68,7 +68,6 @@ transitive-accessible field net/minecraft/client/renderer/RenderStateShard NO_CU
|
||||
#transitive-accessible field net/minecraft/recipe/BrewingRecipeRegistry ITEM_RECIPES Ljava/util/List;
|
||||
#transitive-accessible field net/minecraft/recipe/BrewingRecipeRegistry POTION_RECIPES Ljava/util/List;
|
||||
#transitive-accessible field net/minecraft/recipe/BrewingRecipeRegistry POTION_TYPES Ljava/util/List;
|
||||
transitive-accessible method net/minecraft/world/item/alchemy/PotionBrewing$Mix <init> (Lnet/minecraft/core/Holder;Lnet/minecraft/world/item/crafting/Ingredient;Lnet/minecraft/core/Holder;)V
|
||||
transitive-accessible class net/minecraft/world/item/alchemy/PotionBrewing$Mix
|
||||
|
||||
transitive-accessible class net/minecraft/util/datafix/fixes/ItemStackComponentizationFix$ItemStackData
|
||||
@@ -77,7 +76,6 @@ accessible field net/minecraft/server/network/ServerCommonPacketListenerImpl con
|
||||
transitive-accessible method net/minecraft/world/level/block/state/properties/WoodType register (Lnet/minecraft/world/level/block/state/properties/WoodType;)Lnet/minecraft/world/level/block/state/properties/WoodType;
|
||||
transitive-accessible field com/mojang/blaze3d/systems/RenderSystem shaderLightDirections [Lorg/joml/Vector3f;
|
||||
transitive-accessible class net/minecraft/world/inventory/BrewingStandMenu$PotionSlot
|
||||
transitive-accessible method net/minecraft/world/level/biome/Biome$ClimateSettings <init> (ZFLnet/minecraft/world/level/biome/Biome$TemperatureModifier;F)V
|
||||
transitive-accessible class net/minecraft/world/level/biome/Biome$ClimateSettings
|
||||
accessible field net/minecraft/client/gui/components/toasts/AdvancementToast BACKGROUND_SPRITE Lnet/minecraft/resources/ResourceLocation;
|
||||
#accessible method net/minecraft/text/Text$Serialization fromJson (Lcom/google/gson/JsonElement;)Lnet/minecraft/text/MutableComponent;
|
||||
@@ -92,7 +90,7 @@ transitive-accessible field net/minecraft/world/entity/ai/goal/FollowOwnerGoal s
|
||||
transitive-accessible field net/minecraft/world/level/levelgen/structure/pools/SinglePoolElement template Lcom/mojang/datafixers/util/Either;
|
||||
transitive-accessible class net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement$Placer
|
||||
transitive-accessible class net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement$PieceState
|
||||
transitive-accessible method net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement$PieceState <init> (Lnet/minecraft/world/level/levelgen/structure/PoolElementStructurePiece;Lorg/apache/commons/lang3/mutable/MutableObject;I)V
|
||||
transitive-accessible field net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement$PieceState piece Lnet/minecraft/world/level/levelgen/structure/PoolElementStructurePiece;
|
||||
transitive-accessible method net/minecraft/client/resources/TextureAtlasHolder getSprite (Lnet/minecraft/resources/ResourceLocation;)Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;
|
||||
transitive-accessible field net/minecraft/client/resources/TextureAtlasHolder textureAtlas Lnet/minecraft/client/renderer/texture/TextureAtlas;
|
||||
transitive-accessible field net/minecraft/client/renderer/texture/TextureAtlas width I
|
||||
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"parent": "cobblemon:recipes/root",
|
||||
"criteria": {
|
||||
"has_nuts": {
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"items": [
|
||||
"cobblemon:galarica_nuts"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"trigger": "minecraft:inventory_changed"
|
||||
},
|
||||
"has_the_recipe": {
|
||||
"conditions": {
|
||||
"recipe": "cobblemon:galarica_cuff"
|
||||
},
|
||||
"trigger": "minecraft:recipe_unlocked"
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
[
|
||||
"has_nuts",
|
||||
"has_the_recipe"
|
||||
]
|
||||
],
|
||||
"rewards": {
|
||||
"recipes": [
|
||||
"cobblemon:galarica_cuff"
|
||||
]
|
||||
}
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"parent": "cobblemon:recipes/root",
|
||||
"criteria": {
|
||||
"has_nuts": {
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"items": [
|
||||
"cobblemon:galarica_nuts"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"trigger": "minecraft:inventory_changed"
|
||||
},
|
||||
"has_the_recipe": {
|
||||
"conditions": {
|
||||
"recipe": "cobblemon:galarica_wreath"
|
||||
},
|
||||
"trigger": "minecraft:recipe_unlocked"
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
[
|
||||
"has_nuts",
|
||||
"has_the_recipe"
|
||||
]
|
||||
],
|
||||
"rewards": {
|
||||
"recipes": [
|
||||
"cobblemon:galarica_wreath"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -11,29 +11,5 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"variations": [
|
||||
{
|
||||
"displayName": "cobblemon.pokedex.variation.color",
|
||||
"icon": "cobblemon:textures/gui/pokedex/variation/color.png",
|
||||
"aspects": [
|
||||
"color-none",
|
||||
"color-white",
|
||||
"color-light_gray",
|
||||
"color-gray",
|
||||
"color-black",
|
||||
"color-brown",
|
||||
"color-red",
|
||||
"color-orange",
|
||||
"color-yellow",
|
||||
"color-lime",
|
||||
"color-green",
|
||||
"color-cyan",
|
||||
"color-light_blue",
|
||||
"color-blue",
|
||||
"color-purple",
|
||||
"color-magenta",
|
||||
"color-pink"
|
||||
]
|
||||
}
|
||||
]
|
||||
"variations": []
|
||||
}
|
||||
@@ -16,7 +16,6 @@
|
||||
"displayName": "cobblemon.pokedex.variation.color",
|
||||
"icon": "cobblemon:textures/gui/pokedex/variation/color.png",
|
||||
"aspects": [
|
||||
"color-none",
|
||||
"color-white",
|
||||
"color-light_gray",
|
||||
"color-gray",
|
||||
|
||||
@@ -11,29 +11,5 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"variations": [
|
||||
{
|
||||
"displayName": "cobblemon.pokedex.variation.color",
|
||||
"icon": "cobblemon:textures/gui/pokedex/variation/color.png",
|
||||
"aspects": [
|
||||
"color-none",
|
||||
"color-white",
|
||||
"color-light_gray",
|
||||
"color-gray",
|
||||
"color-black",
|
||||
"color-brown",
|
||||
"color-red",
|
||||
"color-orange",
|
||||
"color-yellow",
|
||||
"color-lime",
|
||||
"color-green",
|
||||
"color-cyan",
|
||||
"color-light_blue",
|
||||
"color-blue",
|
||||
"color-purple",
|
||||
"color-magenta",
|
||||
"color-pink"
|
||||
]
|
||||
}
|
||||
]
|
||||
"variations": []
|
||||
}
|
||||
@@ -494,7 +494,7 @@
|
||||
},
|
||||
{
|
||||
"content": 16,
|
||||
"item": "minecraft:hay_block"
|
||||
"item": "minecraft:hay_bale"
|
||||
},
|
||||
{
|
||||
"content": 16,
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"sns",
|
||||
"n n",
|
||||
"sns"
|
||||
],
|
||||
"key": {
|
||||
"s": {
|
||||
"item": "minecraft:stick"
|
||||
},
|
||||
"n": {
|
||||
"item": "cobblemon:galarica_nuts"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"count": 1,
|
||||
"id": "cobblemon:galarica_cuff"
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"nnn",
|
||||
"n n",
|
||||
"nnn"
|
||||
],
|
||||
"key": {
|
||||
"n": {
|
||||
"item": "cobblemon:galarica_nuts"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"count": 1,
|
||||
"id": "cobblemon:galarica_wreath"
|
||||
}
|
||||
}
|
||||
@@ -351,15 +351,15 @@
|
||||
},
|
||||
{
|
||||
"variant": "biome",
|
||||
"biomeAnticondition": "#cobblemon:is_arid"
|
||||
"biomeAnitcondition": "#cobblemon:is_arid"
|
||||
},
|
||||
{
|
||||
"variant": "biome",
|
||||
"biomeAnticondition": "#cobblemon:is_freezing"
|
||||
"biomeAnitcondition": "#cobblemon:is_freezing"
|
||||
},
|
||||
{
|
||||
"variant": "biome",
|
||||
"biomeAnticondition": "#cobblemon:is_spooky"
|
||||
"biomeAnitcondition": "#cobblemon:is_spooky"
|
||||
}
|
||||
],
|
||||
"requiredContext": "cobblemon:sun_stone"
|
||||
|
||||
@@ -15,9 +15,6 @@
|
||||
"special_defence": 75,
|
||||
"speed": 55
|
||||
},
|
||||
"features": [
|
||||
"three_segment"
|
||||
],
|
||||
"catchRate": 45,
|
||||
"maleRatio": 0.5,
|
||||
"baseExperienceYield": 182,
|
||||
|
||||
@@ -145,9 +145,6 @@
|
||||
"special_defence": 87,
|
||||
"speed": 100
|
||||
},
|
||||
"features": [
|
||||
"hero"
|
||||
],
|
||||
"catchRate": 45,
|
||||
"maleRatio": 0.5,
|
||||
"baseExperienceYield": 160,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user