mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-11-01 05:48:53 -05:00
Compare commits
60
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
263bccca4b | ||
|
|
1d94adface | ||
|
|
c741ddbc2e | ||
|
|
8cad44ffb1 | ||
|
|
dec0376d11 | ||
|
|
007b2a49f4 | ||
|
|
082683723d | ||
|
|
bbd2b3aeed | ||
|
|
33951c868b | ||
|
|
02f0e62bf8 | ||
|
|
977b39e65c | ||
|
|
25a02e0b27 | ||
|
|
4950297daa | ||
|
|
1c09cf6f30 | ||
|
|
00d72902af | ||
|
|
eb986087cf | ||
|
|
294e439f5e | ||
|
|
6e7e870a1f | ||
|
|
ab78185689 | ||
|
|
7403556fa2 | ||
|
|
7f451f1989 | ||
|
|
3b2bfd5548 | ||
|
|
3d1ee5ee0f | ||
|
|
0584276189 | ||
|
|
a16b17582d | ||
|
|
71c1ae5540 | ||
|
|
0233d2b0be | ||
|
|
b67d474386 | ||
|
|
3239362e1a | ||
|
|
0d240f01b6 | ||
|
|
99a71dc2e1 | ||
|
|
fd99573a46 | ||
|
|
fbcae404c0 | ||
|
|
68cfd16fed | ||
|
|
818038c715 | ||
|
|
7c4b31db25 | ||
|
|
da6a88292e | ||
|
|
dee9a268d7 | ||
|
|
5fd37438fc | ||
|
|
51b30ab468 | ||
|
|
36a3549b3e | ||
|
|
9e0ea63db6 | ||
|
|
739459c061 | ||
|
|
a6e06c80fe | ||
|
|
fc1cc54107 | ||
|
|
210bf9f5fb | ||
|
|
9454f2046a | ||
|
|
5621e69d58 | ||
|
|
0c0f022e34 | ||
|
|
220b363864 | ||
|
|
978064d2d0 | ||
|
|
baca93c9b2 | ||
|
|
b6d13b8861 | ||
|
|
b271223f6a | ||
|
|
004f2de623 | ||
|
|
570629bff2 | ||
|
|
7e5b8260de | ||
|
|
3e5e851dba | ||
|
|
c4948a6611 | ||
|
|
cc459c99aa |
No files matched your search
+71
-28
@@ -5,41 +5,84 @@
|
||||
- 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
|
||||
- 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 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.
|
||||
- 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
|
||||
- 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 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 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
|
||||
- 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.
|
||||
- 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.
|
||||
|
||||
## [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!"
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
dependencyResolutionManagement {
|
||||
versionCatalogs {
|
||||
create("libs") {
|
||||
from(files("../gradle/libs.versions.toml"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
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
@@ -0,0 +1,12 @@
|
||||
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
@@ -0,0 +1,82 @@
|
||||
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
@@ -0,0 +1,33 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -1,12 +1,14 @@
|
||||
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}"
|
||||
}
|
||||
*/
|
||||
+90
-54
@@ -1,68 +1,102 @@
|
||||
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"
|
||||
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")
|
||||
}
|
||||
|
||||
architectury {
|
||||
common("neoforge", "fabric")
|
||||
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/")
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven(url = "${rootProject.projectDir}/deps")
|
||||
maven(url = "https://api.modrinth.com/maven")
|
||||
maven(url = "https://maven.neoforged.net/releases")
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
maven("https://maven.fabricmc.net/")
|
||||
maven("https://maven.blamejared.com/")
|
||||
maven("https://api.modrinth.com/maven")
|
||||
maven(url = "../deps")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.bundles.kotlin)
|
||||
modImplementation(libs.fabric.loader)
|
||||
modApi(libs.molang)
|
||||
|
||||
// Integrations
|
||||
compileOnlyApi(libs.jei.api)
|
||||
modCompileOnly(libs.bundles.fabric.integrations.compileOnly) {
|
||||
compileOnly(libs.bundles.mongo)
|
||||
compileOnly(libs.bundles.kotlin)
|
||||
compileOnly(libs.molang)
|
||||
compileOnly(libs.graal)
|
||||
compileOnly(libs.jei.api)
|
||||
compileOnly(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
|
||||
compileOnly("net.fabricmc:sponge-mixin:0.15.5+mixin.0.8.7")
|
||||
compileOnly("io.github.llamalad7:mixinextras-fabric:0.4.1")
|
||||
testImplementation(libs.bundles.unitTesting)
|
||||
}
|
||||
|
||||
tasks.withType<Test> {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
setEvents(listOf("failed"))
|
||||
setExceptionFormat("full")
|
||||
}
|
||||
neoForge {
|
||||
neoFormVersion = "1.21.1-20240808.144430"
|
||||
interfaceInjectionData.from("src/main/resources/interfaces.json")
|
||||
validateAccessTransformers = true
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -72,7 +106,7 @@ sourceSets {
|
||||
fun generateLicenseHeader() : String {
|
||||
val builder = StringBuilder()
|
||||
builder.append("/*\n")
|
||||
rootProject.file("HEADER").forEachLine {
|
||||
project.projectDir.parentFile.resolve("HEADER").forEachLine {
|
||||
if(it.isEmpty()) {
|
||||
builder.append(" *").append("\n")
|
||||
} else {
|
||||
@@ -85,12 +119,14 @@ sourceSets {
|
||||
|
||||
property("license", generateLicenseHeader())
|
||||
property("modid", "cobblemon")
|
||||
property("version", project.version())
|
||||
property("isSnapshot", if(rootProject.isSnapshot()) "true" else "false")
|
||||
property("version", project.version as String)
|
||||
property("isSnapshot", "true")
|
||||
/*
|
||||
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")
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
[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,6 +68,7 @@ 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
|
||||
@@ -123,6 +124,7 @@ import kotlin.reflect.jvm.javaField
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.commands.synchronization.SingletonArgumentInfo
|
||||
import net.minecraft.resources.ResourceKey
|
||||
import net.minecraft.server.packs.PackType
|
||||
import net.minecraft.world.item.NameTagItem
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.storage.LevelResource
|
||||
@@ -162,6 +164,16 @@ 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,6 +392,9 @@ 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() }
|
||||
@@ -442,6 +445,7 @@ 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()
|
||||
@@ -477,7 +481,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).build()).stacksTo(1)))
|
||||
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)))
|
||||
@JvmField
|
||||
val REVIVE = create("revive", ReviveItem(max = false))
|
||||
@JvmField
|
||||
|
||||
@@ -13,6 +13,7 @@ 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
|
||||
@@ -105,6 +106,8 @@ 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>()
|
||||
@@ -193,6 +196,8 @@ 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>()
|
||||
|
||||
+24
-1
@@ -8,9 +8,16 @@
|
||||
|
||||
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]
|
||||
@@ -23,4 +30,20 @@ data class BattleFaintedEvent(
|
||||
override val battle: PokemonBattle,
|
||||
val killed: BattlePokemon,
|
||||
val context: BattleContext
|
||||
) : BattleEvent
|
||||
) : 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()) },
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
+12
-1
@@ -8,8 +8,12 @@
|
||||
|
||||
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].
|
||||
@@ -20,4 +24,11 @@ import com.cobblemon.mod.common.battles.actor.PlayerBattleActor
|
||||
data class BattleFledEvent (
|
||||
override val battle: PokemonBattle,
|
||||
val player: PlayerBattleActor
|
||||
) : BattleEvent
|
||||
) : 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 }
|
||||
)
|
||||
}
|
||||
+18
-2
@@ -9,7 +9,9 @@
|
||||
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
|
||||
|
||||
/**
|
||||
@@ -21,7 +23,14 @@ 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()
|
||||
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 }
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Event fired after a [PokemonBattle] starts.
|
||||
@@ -29,4 +38,11 @@ data class BattleStartedPreEvent (override val battle: PokemonBattle, var reason
|
||||
* @author Segfault Guy
|
||||
* @since March 26th 2023
|
||||
*/
|
||||
data class BattleStartedPostEvent (override val battle: PokemonBattle) : BattleEvent
|
||||
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 }
|
||||
)
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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)
|
||||
)
|
||||
}
|
||||
+13
-1
@@ -8,13 +8,25 @@
|
||||
|
||||
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)
|
||||
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
|
||||
)
|
||||
}
|
||||
+14
-1
@@ -8,9 +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.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.
|
||||
@@ -22,4 +26,13 @@ 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())
|
||||
)
|
||||
}
|
||||
+13
-1
@@ -8,12 +8,24 @@
|
||||
|
||||
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)
|
||||
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
|
||||
)
|
||||
}
|
||||
+12
@@ -8,8 +8,13 @@
|
||||
|
||||
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
|
||||
@@ -26,4 +31,11 @@ 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()
|
||||
)
|
||||
}
|
||||
+2
-1
@@ -9,10 +9,11 @@
|
||||
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 rod: ItemStack) : Cancelable()
|
||||
class PokerodReelEvent(val player: Player, val rod: ItemStack) : Cancelable()
|
||||
+7
-1
@@ -9,6 +9,7 @@
|
||||
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
|
||||
|
||||
@@ -18,4 +19,9 @@ import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
class ThrownPokeballHitEvent(
|
||||
val pokeBall : EmptyPokeBallEntity,
|
||||
val pokemon : PokemonEntity
|
||||
) : Cancelable()
|
||||
) : Cancelable() {
|
||||
val context = mutableMapOf(
|
||||
"pokeball" to pokeBall.struct,
|
||||
"pokemon" to pokemon.asMoLangValue()
|
||||
)
|
||||
}
|
||||
+16
@@ -8,9 +8,14 @@
|
||||
|
||||
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
|
||||
@@ -18,4 +23,15 @@ 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,6 +8,7 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.events.pokemon
|
||||
|
||||
import com.bedrockk.molang.runtime.value.DoubleValue
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
|
||||
/**
|
||||
@@ -16,4 +17,10 @@ import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
* @author Hiroku
|
||||
* @since August 5th, 2022
|
||||
*/
|
||||
class LevelUpEvent(val pokemon: Pokemon, val oldLevel: Int, var newLevel: Int)
|
||||
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())
|
||||
)
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* 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,
|
||||
)
|
||||
+7
-1
@@ -8,6 +8,7 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.events.pokemon
|
||||
|
||||
import com.bedrockk.molang.runtime.value.DoubleValue
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
|
||||
/**
|
||||
@@ -16,4 +17,9 @@ 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)
|
||||
)
|
||||
}
|
||||
+7
-1
@@ -8,10 +8,16 @@
|
||||
|
||||
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,6 +718,11 @@ 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,6 +8,12 @@
|
||||
|
||||
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
|
||||
@@ -25,6 +31,7 @@ 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.
|
||||
@@ -90,6 +97,21 @@ 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,6 +8,8 @@
|
||||
|
||||
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
|
||||
@@ -27,6 +29,22 @@ 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.94F
|
||||
var modelScale: Float = 0.9375F
|
||||
var battleConfiguration = NPCBattleConfiguration()
|
||||
var interaction: NPCInteractConfiguration? = null
|
||||
var canDespawn = true
|
||||
|
||||
@@ -32,6 +32,18 @@ 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,6 +13,7 @@ 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
|
||||
@@ -112,8 +113,11 @@ class FormDexRecord {
|
||||
|
||||
//Used when granting all entries in dex, should figure out better way
|
||||
fun addAllShinyStatesAndGenders() {
|
||||
genders.addAll(listOf(Gender.MALE, Gender.FEMALE))
|
||||
val form = PokemonSpecies.getByIdentifier(speciesDexRecord.id)?.getFormByName(formName)
|
||||
genders.addAll(form?.possibleGenders ?: listOf(Gender.MALE, Gender.FEMALE))
|
||||
|
||||
seenShinyStates.addAll(listOf("shiny", "normal"))
|
||||
speciesDexRecord.onFormRecordUpdated(this)
|
||||
}
|
||||
|
||||
fun setKnowledgeProgress(newKnowledge: PokedexEntryProgress) {
|
||||
|
||||
@@ -50,6 +50,8 @@ 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)"
|
||||
|
||||
+2
-2
@@ -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::class.java.getResourceAsStream(INTERNAL_PATH)!!)
|
||||
val reader = InputStreamReader(Cobblemon.javaClass.classLoader.getResourceAsStream(INTERNAL_PATH)!!)
|
||||
val config = GSON.fromJson(reader, BestSpawnerConfig::class.java)
|
||||
reader.close()
|
||||
return config
|
||||
|
||||
@@ -8,12 +8,14 @@
|
||||
|
||||
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
|
||||
@@ -147,10 +149,14 @@ abstract class PokemonStore<T : StorePosition> : Iterable<Pokemon> {
|
||||
|
||||
operator fun get(uuid: UUID) = find { it.uuid == uuid }
|
||||
|
||||
open fun handleInvalidSpeciesNBT(nbt: CompoundTag) {}
|
||||
open fun handleInvalidSpeciesNBT(nbt: CompoundTag) {
|
||||
Cobblemon.LOGGER.error("Failed to read unknown species: ${nbt.getString(DataKeys.POKEMON_SPECIES_IDENTIFIER)}")
|
||||
}
|
||||
abstract fun saveToNBT(nbt: CompoundTag, registryAccess: RegistryAccess): CompoundTag
|
||||
abstract fun loadFromNBT(nbt: CompoundTag, registryAccess: RegistryAccess): PokemonStore<T>
|
||||
open fun handleInvalidSpeciesJSON(json: JsonObject) {}
|
||||
open fun handleInvalidSpeciesJSON(json: JsonObject) {
|
||||
Cobblemon.LOGGER.error("Failed to read unknown species: ${json.get(DataKeys.POKEMON_SPECIES_IDENTIFIER).asString}")
|
||||
}
|
||||
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,7 +9,6 @@
|
||||
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,6 +10,8 @@ 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
|
||||
@@ -35,6 +37,7 @@ 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
|
||||
|
||||
+8
-1
@@ -13,6 +13,8 @@ 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
|
||||
@@ -213,7 +215,12 @@ 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.actors.filter { it != actor }.forEach {
|
||||
it.sendMessage(publicLang)
|
||||
}
|
||||
battle.playerUUIDs.forEach { uuid ->
|
||||
CobblemonEvents.POKEMON_SEEN.post(PokemonSeenEvent(uuid, publicPokemon))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-6
@@ -13,7 +13,6 @@ 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
|
||||
@@ -70,11 +69,6 @@ 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,7 +8,11 @@
|
||||
|
||||
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
|
||||
@@ -27,6 +31,7 @@ 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,
|
||||
@@ -34,6 +39,7 @@ 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?)
|
||||
@@ -56,6 +62,22 @@ 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
|
||||
@@ -84,7 +106,7 @@ open class BattlePokemon(
|
||||
* The [HeldItemManager] backing this [BattlePokemon].
|
||||
*/
|
||||
val heldItemManager: HeldItemManager by lazy { HeldItemProvider.provide(this) }
|
||||
|
||||
|
||||
val contextManager = ContextManager()
|
||||
|
||||
open fun getName(): MutableComponent {
|
||||
@@ -102,11 +124,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.getResourceAsStream("/data/${Cobblemon.MODID}/showdown.json")!!
|
||||
val inputStream = javaClass.classLoader.getResourceAsStream("data/${Cobblemon.MODID}/showdown.json")!!
|
||||
return gson.fromJson<ShowdownMetadata>(InputStreamReader(inputStream))
|
||||
} catch (exception: Exception) {
|
||||
exception.printStackTrace()
|
||||
|
||||
@@ -334,6 +334,7 @@ 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)
|
||||
@@ -341,12 +342,16 @@ 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)
|
||||
}
|
||||
world.playSound(null, pos, SoundEvents.SHEEP_SHEAR, SoundSource.BLOCKS, 1F, 1F)
|
||||
|
||||
val sound = if (player != null) CobblemonSounds.BERRY_HARVEST else SoundEvents.SHEEP_SHEAR
|
||||
world.playSound(null, pos, sound, SoundSource.BLOCKS, 1F, 1F)
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -94,12 +94,18 @@ class DisplayCaseBlock(settings: Properties) : BaseEntityBlock(settings) {
|
||||
return result
|
||||
}
|
||||
|
||||
override fun playerWillDestroy(world: Level, pos: BlockPos, state: BlockState, player: Player): BlockState {
|
||||
override fun onRemove(
|
||||
state: BlockState,
|
||||
world: Level,
|
||||
pos: BlockPos,
|
||||
newState: BlockState,
|
||||
moved: Boolean
|
||||
) {
|
||||
val entity = world.getBlockEntity(pos) as DisplayCaseBlockEntity
|
||||
if (!entity.getStack().isEmpty && !player.isCreative) {
|
||||
Containers.dropContents(world, pos, entity.inv)
|
||||
if (!entity.getStack().isEmpty) {
|
||||
Containers.dropContentsOnDestroy(state, newState, world, pos)
|
||||
}
|
||||
return super.playerWillDestroy(world, pos, state, player)
|
||||
super.onRemove(state, world, pos, newState, moved)
|
||||
}
|
||||
|
||||
override fun getRenderShape(state: BlockState) = RenderShape.MODEL
|
||||
|
||||
@@ -14,7 +14,6 @@ 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
|
||||
@@ -104,14 +103,6 @@ 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() }
|
||||
|
||||
+3
-1
@@ -10,10 +10,12 @@ 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 CobblemonResourcePack(
|
||||
class CobblemonPack(
|
||||
val id: String,
|
||||
val name: String,
|
||||
val packType: PackType,
|
||||
val activationBehaviour: ResourcePackActivationBehaviour,
|
||||
val neededMods: Set<String> = setOf()
|
||||
) {
|
||||
+11
-5
@@ -28,13 +28,10 @@ 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.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 com.cobblemon.mod.common.util.*
|
||||
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 {
|
||||
@@ -230,4 +227,13 @@ 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)
|
||||
}
|
||||
}
|
||||
+8
-4
@@ -113,13 +113,17 @@ class InteractWheelButton(
|
||||
override fun playDownSound(soundManager: SoundManager) {}
|
||||
|
||||
private fun isHovered(mouseX: Float, mouseY: Float): Boolean {
|
||||
val xMin = x.toFloat()
|
||||
val xMax = xMin + BUTTON_SIZE
|
||||
val yMin = y.toFloat()
|
||||
val yMax = yMin + BUTTON_SIZE
|
||||
val xMin = x.toFloat() + 1
|
||||
val xMax = xMin + BUTTON_SIZE - 2
|
||||
val yMin = y.toFloat() + 1
|
||||
val yMax = yMin + BUTTON_SIZE - 2
|
||||
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,6 +10,7 @@ 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
|
||||
@@ -23,8 +24,7 @@ import kotlin.math.max
|
||||
|
||||
class InteractWheelGUI(private val options: Multimap<Orientation, InteractWheelOption>, title: Component) : Screen(title), CobblemonRenderable {
|
||||
companion object {
|
||||
const val SIZE = 140
|
||||
const val OPTION_SIZE = 71
|
||||
const val SIZE = 138
|
||||
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 + OPTION_SIZE, y)
|
||||
Orientation.BOTTOM_LEFT -> Pair(x, y + OPTION_SIZE)
|
||||
Orientation.BOTTOM_RIGHT -> Pair(x + OPTION_SIZE, y + OPTION_SIZE)
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,22 +41,17 @@ 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.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.gui.pokedex.widgets.*
|
||||
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
|
||||
@@ -588,6 +583,15 @@ 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))
|
||||
}
|
||||
|
||||
+4
-6
@@ -113,6 +113,7 @@ 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
|
||||
@@ -207,9 +208,6 @@ 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()
|
||||
@@ -536,11 +534,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)
|
||||
}
|
||||
}
|
||||
@@ -551,7 +549,7 @@ class PokemonInfoWidget(val pX: Int, val pY: Int, val updateForm: (PokedexForm)
|
||||
variationButtons.forEach { removeWidget(it.getWidget()) }
|
||||
variationButtons.clear()
|
||||
|
||||
val seenShinyStates = CobblemonClient.clientPokedexData.getSeenShinyStates(pokedexEntry, pokedexForm)
|
||||
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
|
||||
|
||||
+6
-1
@@ -90,7 +90,12 @@ class InfoWidget(
|
||||
typeWidget.render(context, pMouseX, pMouseY, pPartialTicks)
|
||||
|
||||
// Original Trainer
|
||||
val otName: MutableComponent = Component.literal(pokemon.originalTrainerName ?: "")
|
||||
val otName: MutableComponent = pokemon.originalTrainerName?.let { name ->
|
||||
Component.literal(name)
|
||||
} ?: pokemon.originalTrainer?.let { trainer ->
|
||||
Component.literal("${trainer.take(15)}...")
|
||||
} ?: Component.literal("")
|
||||
|
||||
val otWidget = InfoOneLineWidget(
|
||||
pX = x,
|
||||
pY = y + 3 * ROW_HEIGHT,
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
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
|
||||
@@ -21,7 +19,6 @@ 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))
|
||||
runtime.environment.setSimpleVariable("target_deltay", DoubleValue(distanceTo(destinationPosSupplier.invoke()).y * -1))
|
||||
runtime.environment.setSimpleVariable("target_deltaz", DoubleValue(distanceTo(destinationPosSupplier.invoke()).z))
|
||||
runtime.environment.setSimpleVariable("target_distance", DoubleValue(distanceTo(destinationPosSupplier.invoke()).length()))
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ 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,8 +14,6 @@ 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
|
||||
@@ -33,7 +31,6 @@ 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) {
|
||||
|
||||
+19
-13
@@ -51,6 +51,7 @@ 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
|
||||
@@ -75,6 +76,11 @@ class PokemonRenderer(
|
||||
.withUnderlined(false)
|
||||
.withStrikethrough(false)
|
||||
.withObfuscated(false)
|
||||
|
||||
private const val HIDDEN_NAME = "???"
|
||||
|
||||
private const val SPACE = " "
|
||||
|
||||
}
|
||||
|
||||
val ballContext = RenderContext().also {
|
||||
@@ -355,23 +361,15 @@ 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
|
||||
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(" "))
|
||||
}
|
||||
val label = this.resolveBaseLabel(entity)
|
||||
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 = label.append(levelLabel)
|
||||
label.append(levelLabel)
|
||||
}
|
||||
var h = (-this.font.width(label) / 2).toFloat()
|
||||
val y = 0F
|
||||
@@ -390,6 +388,14 @@ 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,15 +87,18 @@ object PokedexCommand {
|
||||
val form = context.getArgument("form", FormData::class.java)
|
||||
players.forEach {
|
||||
val dex = Cobblemon.playerDataManager.getPokedexData(it)
|
||||
var completeEntry = Dexes.dexEntryMap[cobblemonResource("national")]!!.getEntries().first { it.speciesId == species.resourceIdentifier }
|
||||
val completeEntry = Dexes.dexEntryMap[cobblemonResource("national")]!!.getEntries().first { it.speciesId == species.resourceIdentifier }
|
||||
val entry = dex.getOrCreateSpeciesRecord(species.resourceIdentifier)
|
||||
completeEntry.forms.forEach { form ->
|
||||
form.unlockForms.forEach {unlockForm ->
|
||||
val formRecord = entry.getOrCreateFormRecord(unlockForm)
|
||||
formRecord.setKnowledgeProgress(PokedexEntryProgress.CAUGHT)
|
||||
formRecord.addAllShinyStatesAndGenders()
|
||||
|
||||
completeEntry.forms
|
||||
.filter { it.displayForm == form.name }
|
||||
.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"
|
||||
@@ -111,7 +114,7 @@ object PokedexCommand {
|
||||
val form = context.getArgument("form", FormData::class.java)
|
||||
players.forEach {
|
||||
val dex = Cobblemon.playerDataManager.getPokedexData(it)
|
||||
dex.deleteSpeciesRecord(species.resourceIdentifier)
|
||||
dex.deleteFormRecord(species.resourceIdentifier, form.name.lowercase())
|
||||
dex.clearCalculatedValues()
|
||||
it.sendPacket(SetClientPlayerDataPacket(PlayerInstancedDataStoreTypes.POKEDEX, dex.toClientData()))
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ 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
|
||||
@@ -89,6 +90,7 @@ 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> {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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()))
|
||||
}
|
||||
}
|
||||
+30
-21
@@ -197,28 +197,37 @@ class PokemonMoveControl(val pokemonEntity: PokemonEntity) : MoveControl(pokemon
|
||||
pokemonEntity.yya = 0.2F
|
||||
}
|
||||
|
||||
// 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 (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)
|
||||
}
|
||||
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 (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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+21
@@ -9,9 +9,12 @@
|
||||
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
|
||||
@@ -55,6 +58,7 @@ 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)
|
||||
}
|
||||
}
|
||||
@@ -72,6 +76,23 @@ 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,6 +21,19 @@ 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,6 +11,7 @@ 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
|
||||
|
||||
@@ -18,6 +19,7 @@ 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) {
|
||||
@@ -27,4 +29,10 @@ 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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,6 +106,7 @@ 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(itemStack),
|
||||
PokerodReelEvent(user, itemStack),
|
||||
{ event -> return InteractionResultHolder.fail(itemStack) },
|
||||
{ event ->
|
||||
i = user.fishing!!.retrieve(itemStack)
|
||||
|
||||
@@ -51,13 +51,11 @@ class PotionItem(val type: PotionType) : CobblemonItem(Properties()), PokemonSel
|
||||
if (pokemon.isFullHealth()) {
|
||||
return InteractionResultHolder.fail(stack)
|
||||
}
|
||||
var amount = genericRuntime.resolveInt(type.amountToHeal())
|
||||
CobblemonEvents.POKEMON_HEALED.postThen(PokemonHealedEvent(pokemon, amount, this), { cancelledEvent -> return InteractionResultHolder.fail(stack)}) { event ->
|
||||
amount = event.amount
|
||||
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
|
||||
}
|
||||
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,6 +95,7 @@ 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))
|
||||
|
||||
+17
-1
@@ -9,11 +9,15 @@
|
||||
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
|
||||
@@ -45,7 +49,9 @@ 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).ifErrored { it.sendTo(player) { it.red() } }
|
||||
BattleBuilder.pve(player, targetedEntity, leadingPokemon)
|
||||
.ifSuccessful { battle -> this.flagAsSeen(battle, targetedEntity) }
|
||||
.ifErrored { it.sendTo(player) { it.red() } }
|
||||
}
|
||||
else if (targetedEntity is ServerPlayer) {
|
||||
ChallengeManager.setLead(player, leadingPokemon)
|
||||
@@ -59,4 +65,14 @@ 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,6 +208,19 @@ 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,7 +1215,12 @@ 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,7 +8,10 @@
|
||||
|
||||
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
|
||||
@@ -27,6 +30,12 @@ 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,6 +30,7 @@ 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
|
||||
@@ -39,7 +40,6 @@ 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,6 +50,7 @@ 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
|
||||
@@ -129,15 +130,7 @@ class Species : ClientDataSynchronizer<Species>, ShowdownIdentifiable {
|
||||
|
||||
val possibleGenders: Set<Gender>
|
||||
get() = forms.flatMap {
|
||||
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)
|
||||
}
|
||||
it.possibleGenders
|
||||
}.toSet() + (if (maleRatio == -1F) {
|
||||
setOf(Gender.GENDERLESS)
|
||||
} else if (maleRatio == 0F) {
|
||||
@@ -353,13 +346,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 [Identifier] associated as [Species.resourceIdentifier].
|
||||
* A [Codec] that maps to/from an [ResourceLocation] associated as [Species.resourceIdentifier].
|
||||
* Uses [PokemonSpecies.getByIdentifier] to query.
|
||||
*/
|
||||
@JvmStatic
|
||||
val BY_IDENTIFIER_CODEC: Codec<Species> = CodecUtils.createByIdentifierCodec(
|
||||
PokemonSpecies::getByIdentifier,
|
||||
val BY_IDENTIFIER_CODEC: Codec<Species> = ResourceLocation.CODEC.comapFlatMap(
|
||||
{ identifier -> DataResult.success(PokemonSpecies.getByIdentifier(identifier) ?: throw InvalidSpeciesException(identifier)) },
|
||||
Species::resourceIdentifier
|
||||
) { identifier -> "No species for ID $identifier" }
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,7 @@ 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::class.java.getResourceAsStream(internal)
|
||||
return Cobblemon.javaClass.classLoader.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).forGetter(ClientPokemonP3::originalTrainerName),
|
||||
Codec.STRING.optionalFieldOf(DataKeys.POKEMON_ORIGINAL_TRAINER_NAME).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,7 +20,10 @@ 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
|
||||
@@ -82,7 +85,26 @@ 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.optionalFieldOf(DataKeys.HELD_ITEM, ItemStack.EMPTY).forGetter(PokemonP2::heldItem),
|
||||
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),
|
||||
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),
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"accessWidener": "cobblemon-common.accesswidener",
|
||||
"injected_interfaces": {
|
||||
"net/minecraft/class_630": ["com/cobblemon/mod/common/client/render/models/blockbench/pose/Bone"]
|
||||
}
|
||||
}
|
||||
@@ -75,6 +75,7 @@
|
||||
"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",
|
||||
@@ -346,7 +347,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. Atk if it is not fully evolved",
|
||||
"item.cobblemon.eviolite.tooltip": "Boosts the holder's Defense and Sp. Defense 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",
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "cobblemon:item/galarica_nuts"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 337 B After Width: | Height: | Size: 573 B |
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 361 B After Width: | Height: | Size: 599 B |
Binary file not shown.
|
After 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,6 +68,7 @@ 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
|
||||
@@ -76,6 +77,7 @@ 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;
|
||||
@@ -90,7 +92,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 field net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement$PieceState piece Lnet/minecraft/world/level/levelgen/structure/PoolElementStructurePiece;
|
||||
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 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
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"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
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"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,5 +11,29 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"variations": []
|
||||
"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"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
"displayName": "cobblemon.pokedex.variation.color",
|
||||
"icon": "cobblemon:textures/gui/pokedex/variation/color.png",
|
||||
"aspects": [
|
||||
"color-none",
|
||||
"color-white",
|
||||
"color-light_gray",
|
||||
"color-gray",
|
||||
|
||||
@@ -11,5 +11,29 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"variations": []
|
||||
"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"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -494,7 +494,7 @@
|
||||
},
|
||||
{
|
||||
"content": 16,
|
||||
"item": "minecraft:hay_bale"
|
||||
"item": "minecraft:hay_block"
|
||||
},
|
||||
{
|
||||
"content": 16,
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"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",
|
||||
"biomeAnitcondition": "#cobblemon:is_arid"
|
||||
"biomeAnticondition": "#cobblemon:is_arid"
|
||||
},
|
||||
{
|
||||
"variant": "biome",
|
||||
"biomeAnitcondition": "#cobblemon:is_freezing"
|
||||
"biomeAnticondition": "#cobblemon:is_freezing"
|
||||
},
|
||||
{
|
||||
"variant": "biome",
|
||||
"biomeAnitcondition": "#cobblemon:is_spooky"
|
||||
"biomeAnticondition": "#cobblemon:is_spooky"
|
||||
}
|
||||
],
|
||||
"requiredContext": "cobblemon:sun_stone"
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
"special_defence": 75,
|
||||
"speed": 55
|
||||
},
|
||||
"features": [
|
||||
"three_segment"
|
||||
],
|
||||
"catchRate": 45,
|
||||
"maleRatio": 0.5,
|
||||
"baseExperienceYield": 182,
|
||||
|
||||
@@ -145,6 +145,9 @@
|
||||
"special_defence": 87,
|
||||
"speed": 100
|
||||
},
|
||||
"features": [
|
||||
"hero"
|
||||
],
|
||||
"catchRate": 45,
|
||||
"maleRatio": 0.5,
|
||||
"baseExperienceYield": 160,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Loaded 100 of 237 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user