Compare commits

..
Author SHA1 Message Date
Test bc0d530484 loisence 2026-01-20 19:19:53 -05:00
Test 1537816132 log of change 2026-01-20 00:56:36 -05:00
Test 1705639950 loot 2026-01-20 00:50:04 -05:00
Test ce32541dd6 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into decor-split 2026-01-19 23:45:28 -05:00
Test 3ffea4f4dd split items 2026-01-19 23:44:20 -05:00
Hiroku f942d7c34a Merge branch 'misc-additions-fixes' into 'main'
Couple of misc API additions and bug fixes.

See merge request cable-mc/cobblemon!2125
2026-01-19 02:16:09 +00:00
Deltric 0f1ada4624 Pass in pnx to the event 2026-01-18 18:52:27 -06:00
Deltric b4ee4629bf Couple of misc API additions and bug fixes. 2026-01-18 17:57:28 -06:00
Paul d0b64e2d82 Respect the BYPASSES_INVULNERABILITY damage tag 2026-01-18 22:12:25 +10:00
Paul 1ed2042283 Fixed /calculateseatpositions expecting no underscore when actually we always use an underscore 2026-01-17 22:32:57 +10:00
Test fc720916fb wall block properties 2025-12-31 00:24:39 -05:00
Test e5699c1cdc plaques, policies 2025-12-22 01:34:10 -05:00
613 changed files with 12833 additions and 679 deletions
+23 -16
View File
@@ -4,8 +4,6 @@
### Additions
- Added riding statistics: `Distance by Pokémon on Land`, `Distance by Pokémon in Air` and `Distance by Pokémon in Liquid`.
- Added the Partner Mark, which party Pokémon have a very small chance to earn as the player walks, provided they have enough friendship.
- Added trades for Saccharine Saplings, Hearty Grains, Chipped Pot, and Masterpiece Teacup to the Wandering Trader.
- Added brewing recipe for Throat Spray.
- Added new effects
- Mental Restoration: Reduces "Time Since Last Rest" statistic, which controls Insomnia, by half a minute per second per effect level
- Negative Effect Cleanse: Removes all negative effects
@@ -17,6 +15,8 @@
- Moomoo Milk - Effect Cleanse
- Added `label` as an alternate key to the `tag` property.
- Added Saccharine wood furniture for Adorn.
- Added block models for existing items: Potion, Super Potion, Hyper Potion, Max Potion, Full Restore, Antidote, Awakening, Burn Heal, Ice Heal, Paralyze Heal, Full Heal, Ether, Elixir, Max Ether, Max Elixir, X Accuracy, X Attack, X Defence, X Special Attack, X Special Defence, X Speed, Dire Hit, Guard Spec, Weakness Policy, Blunder Policy, Cleanse Tag, and Spell Tag.
- Added decorative sign blocks, Plaques.
### Changes
- Ride sounds have been separated into stereo for passengers and mono for other players. Riding will now sound more spacious.
@@ -27,33 +27,33 @@
- Example: `this.add('-activate', pokemon, 'ability: example', '[msg]message1');` will parse to lang key `cobblemon.battle.activate.example.message1`
### Fixes
- Fixed an issue in the OmniPathNodeMaker/Navigation that prevented Combees from pathing into and out of Saccharine leaves.
- Fixed an issue in the OmniPathNodeMaker/Navigation that prevented Combee from pathing into and out of Saccharine Leaves.
- Fixed orientation not getting reset after crashing while flying and getting back on the Pokémon.
- Fixed Furfrou not being trimmable on NeoForge.
- Fixed shiny Pokémon not respecting the silent flag on spawn.
- Fixed honey from Saccharine Leaves being harvestable at less than the max age.
- Items given from interacting with Saccharine Leaves are placed in the active hotbar slot if possible.
- Fix all Pokémon being saved to chunks and never despawning.
- Fixed possible error on world generation when Combees are placed in naturally generated bee nests.
- Fixed PokeSnacks crashing if there was no available spawn.
- Fixed Pokémon spawn influences not being specific to regional forms
- Fixed crashing when viewing another player in spectator mode
- Fixed missing apricorn textures for Adorn blocks
- Fixed crashing when riding due to malformed json file, instead resetting it
- Fixed mochi items consuming two items at a time
- Fixed possible error on world generation when Combee are placed in naturally generated bee nests.
- Fixed Poké Snacks crashing if there was no available spawn.
- Fixed Pokémon spawn influences not being specific to regional forms.
- Fixed crashing when viewing another player in spectator mode.
- Fixed missing apricorn textures for Adorn blocks.
- Fixed crashing when riding due to malformed json file instead of resetting it.
- Fixed mochi items consuming two items at a time.
- Fix item interaction sometimes not working properly when playing on servers.
- Fixed Soothe Bell not being properly tagged as a held item.
- Fixed Mint Leaves not being usable for filling the Resurrection Machine.
- Added Saccharine Boats and Saccharine Boat with Chests to relevant boat tags.
- Fixed the `run_script` Molang function to not fail if the environment's context is null.
- Fixed issue #1917
- Fixed battle item duplication issue.
- Fixed the movesets of certain Pokémon being incorrectly sanitized upon reload.
- Fixed the ordering of Aprijuice's riding stat boosts to always have the same order.
- Fixed the Molang functions `date_local_time`, `date_of`, `date_is_after` to use the correct date format.
- Fixed the bottom half of pasture blocks having an incorrect hit-box when facing north or south.
- Fixed Galarian Mr. Mime incorrectly being rideable.
- Fixed gimmicks not being usable in double / triple battles
- Fixed gimmick buttons showing when already used in the same turn in double / triple battles
- Fixed gimmicks not being usable in double / triple battles.
- Fixed gimmick buttons showing when already used in the same turn in double / triple battles.
- Fixed Apricorn block model rotation for counters/sinks/cupboards/drawers to match that of most recent version of Adorn.
- Fixed Fresh Start Mochi EV reset not syncing health changes properly.
- Fixed requirements such as `biomeCondition` crashing the game when used to define Pokémon interactions.
@@ -61,15 +61,22 @@
- Fixed Pokémon interaction cooldowns taking longer than intended when the Pokémon was in the player’s party.
- Fixed Pokémon interactions occasionally crashing the game when spamming an interaction with a 0 cooldown.
- Fixed Pokémon fullness decreasing more than intended when the Pokémon was pastured.
- Fixed crashing when sending a Pokémon out after editing its form
- Fixed crashing when sending a Pokémon out after editing its form.
- Fixed Super Potion recipes incorrectly using Hondew Berry instead of Aguav Berry.
- Fixed `/calculateseatpositions` expecting a locator format that even we don't use. It needs an underscore after "seat".
- Fixed invulnerability-bypassed damage being resisted by invulnerable NPC entities.
- Fixed selected leading Pokémon in battle not being used when levels are raised.
- Fixed killer not being set early enough on a wild wild Pokémon entity from WinInstruction.
### Developer
- Changed the `owner` parameter in the `OwnerQueryRequirement` interface from `ServerPlayer` to `Player`. This method is now also called on the client to verify whether a Pokémon interaction succeeded, so make sure to update your implementations to handle both server and client contexts.
- Added `pnx` to the `BattleFaintedEvent` and `FormeChangeEvent`.
- Added register methods for custom instructions to `ShowdownInterpreter`.
- Changed callback operations in `BattlePokemon` to allow multiple callbacks and is now mutable.
### Molang & Datapacks
- Ride sounds can now be set as exclusive to passengers
- Ride sounds no longer play when submerged unless specified with a new setting
- Ride sounds can now be set as exclusive to passengers.
- Ride sounds no longer play when submerged unless specified with a new setting.
- Exception handling has been added to `run_molang`, resolving some crashes caused by malformed MoLang expressions.
### Particles
@@ -33,7 +33,7 @@ public class SimpleBlockFeatureMixin {
if (!(blockState.getBlock() instanceof HeartyGrainsBlock)) {
return;
}
if (blockState.getValue(HeartyGrainsBlock.AGE) <= HeartyGrainsBlock.AGE_AFTER_HARVEST) {
if (blockState.getValue(HeartyGrainsBlock.Companion.getAGE()) <= HeartyGrainsBlock.AGE_AFTER_HARVEST) {
return; //block is too young to be double
}
if (!worldGenLevel.isEmptyBlock(blockPos.above())) {
@@ -43,4 +43,4 @@ public class SimpleBlockFeatureMixin {
DoublePlantBlock.placeAt(worldGenLevel, blockState, blockPos, Block.UPDATE_CLIENTS);
cir.setReturnValue(true);
}
}
}
@@ -164,7 +164,7 @@ object Cobblemon {
val statistics: CobblemonStats = CobblemonStats
@JvmField
@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),
@@ -569,4 +569,4 @@ object Cobblemon {
this.implementation.registerCommandArgument(cobblemonResource("model_part"), ModelPartArgumentType::class, SingletonArgumentInfo.contextFree(ModelPartArgumentType::modelPart))
}
}
}
@@ -9,6 +9,7 @@
package com.cobblemon.mod.common
import com.cobblemon.mod.common.api.apricorn.Apricorn
import com.cobblemon.mod.common.api.pokemon.stats.Stats
import com.cobblemon.mod.common.block.*
import com.cobblemon.mod.common.block.campfirepot.CampfireBlock
import com.cobblemon.mod.common.block.LecternBlock
@@ -41,11 +42,11 @@ import net.minecraft.world.level.block.state.BlockBehaviour
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.block.state.properties.BlockSetType
import net.minecraft.world.level.block.state.properties.BlockStateProperties
import net.minecraft.world.level.block.state.properties.BlockStateProperties.LIT
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument
import net.minecraft.world.level.block.state.properties.WoodType
import net.minecraft.world.level.material.MapColor
import net.minecraft.world.level.material.PushReaction
import net.minecraft.world.phys.shapes.Shapes
@Suppress("SameParameterValue", "HasPlatformType", "MemberVisibilityCanBePrivate", "unused")
object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<Block>>, Block>() {
@@ -243,9 +244,9 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
val REVIVAL_HERB = this.create("revival_herb", RevivalHerbBlock(BlockBehaviour.Properties.of().pushReaction(PushReaction.DESTROY).mapColor(MapColor.PLANT).ignitedByLava().noCollission().instabreak().sound(CobblemonSounds.REVIVAL_HERB_SOUNDS)))
@JvmField
val POKE_CAKE = this.create("poke_cake", PokeSnackBlock(BlockBehaviour.Properties.of().forceSolidOn().strength(0.5F).sound(SoundType.WOOL).pushReaction(PushReaction.DESTROY).lightLevel { if (it.getValue(LIT)) 3 else 0 }, false))
val POKE_CAKE = this.create("poke_cake", PokeSnackBlock(BlockBehaviour.Properties.of().forceSolidOn().strength(0.5F).sound(SoundType.WOOL).pushReaction(PushReaction.DESTROY).lightLevel { if (it.getValue(BlockStateProperties.LIT)) 3 else 0 }, false))
@JvmField
val POKE_SNACK = this.create("poke_snack", PokeSnackBlock(BlockBehaviour.Properties.of().forceSolidOn().strength(0.5F).sound(SoundType.WOOL).pushReaction(PushReaction.DESTROY).lightLevel { if (it.getValue(LIT)) 3 else 0 }, true))
val POKE_SNACK = this.create("poke_snack", PokeSnackBlock(BlockBehaviour.Properties.of().forceSolidOn().strength(0.5F).sound(SoundType.WOOL).pushReaction(PushReaction.DESTROY).lightLevel { if (it.getValue(BlockStateProperties.LIT)) 3 else 0 }, true))
@JvmField
val TUMBLESTONE_CLUSTER = tumblestoneBlock("tumblestone_cluster", GrowableStoneBlock.STAGE_3, 7, 3, null)
@@ -477,6 +478,99 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
@JvmField
val GIMMIGHOUL_CHEST = create("gimmighoul_chest", GildedChestBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.CHEST).noOcclusion().sound(CobblemonSounds.GILDED_CHEST_SOUNDS), GildedChestBlock.Type.FAKE))
@JvmField
val WHITE_PLAQUE = create("white_plaque", PlaqueBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
@JvmField
val LIGHT_GRAY_PLAQUE = create("light_gray_plaque", PlaqueBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
@JvmField
val GRAY_PLAQUE = create("gray_plaque", PlaqueBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
@JvmField
val BLACK_PLAQUE = create("black_plaque", PlaqueBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
@JvmField
val BROWN_PLAQUE = create("brown_plaque", PlaqueBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
@JvmField
val RED_PLAQUE = create("red_plaque", PlaqueBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
@JvmField
val ORANGE_PLAQUE = create("orange_plaque", PlaqueBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
@JvmField
val YELLOW_PLAQUE = create("yellow_plaque", PlaqueBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
@JvmField
val LIME_PLAQUE = create("lime_plaque", PlaqueBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
@JvmField
val GREEN_PLAQUE = create("green_plaque", PlaqueBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
@JvmField
val CYAN_PLAQUE = create("cyan_plaque", PlaqueBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
@JvmField
val LIGHT_BLUE_PLAQUE = create("light_blue_plaque", PlaqueBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
@JvmField
val BLUE_PLAQUE = create("blue_plaque", PlaqueBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
@JvmField
val PURPLE_PLAQUE = create("purple_plaque", PlaqueBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
@JvmField
val MAGENTA_PLAQUE = create("magenta_plaque", PlaqueBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
@JvmField
val PINK_PLAQUE = create("pink_plaque", PlaqueBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.METAL).noOcclusion().pushReaction(PushReaction.DESTROY).strength(5.0F)))
@JvmField
val CLEANSE_TAG = create("cleanse_tag", WallAttachedStackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.WOOD).mapColor(MapColor.NONE).pushReaction(PushReaction.DESTROY).noOcclusion().noCollission(), WallAttachedStackableItemBlock.WallStackableItemBlockType.TAG))
@JvmField
val SPELL_TAG = create("spell_tag", WallAttachedStackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.WOOD).mapColor(MapColor.NONE).pushReaction(PushReaction.DESTROY).noOcclusion().noCollission(), WallAttachedStackableItemBlock.WallStackableItemBlockType.TAG))
@JvmField
val BLUNDER_POLICY = create("blunder_policy", WallAttachedDirectionalShapeBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion().noCollission(), 14, 12, 1))
@JvmField
val WEAKNESS_POLICY = create("weakness_policy", WallAttachedDirectionalShapeBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion().noCollission(), 14, 12, 1))
@JvmField
val FULL_HEAL = create("full_heal", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.STATUS_RESTORE))
@JvmField
val ANTIDOTE = create("antidote", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.STATUS_RESTORE))
@JvmField
val AWAKENING = create("awakening", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.STATUS_RESTORE))
@JvmField
val BURN_HEAL = create("burn_heal", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.STATUS_RESTORE))
@JvmField
val ICE_HEAL = create("ice_heal", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.STATUS_RESTORE))
@JvmField
val PARALYZE_HEAL = create("paralyze_heal", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.STATUS_RESTORE))
@JvmField
val ETHER = create("ether", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.ETHER))
@JvmField
val MAX_ETHER = create("max_ether", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.ETHER))
@JvmField
val ELIXIR = create("elixir", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.ETHER))
@JvmField
val MAX_ELIXIR = create("max_elixir", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.ETHER))
@JvmField
val POTION = create("potion", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.POTION))
@JvmField
val SUPER_POTION = create("super_potion", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.POTION))
@JvmField
val HYPER_POTION = create("hyper_potion", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.POTION))
@JvmField
val MAX_POTION = create("max_potion", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.MAX_POTION))
@JvmField
val FULL_RESTORE = create("full_restore", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.MAX_POTION))
@JvmField
val DIRE_HIT = create("dire_hit", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.BATTLE_ITEM))
@JvmField
val GUARD_SPEC = create("guard_spec", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.BATTLE_ITEM))
@JvmField
val X_ACCURACY = create("x_${Stats.ACCURACY.identifier.path}", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.BATTLE_ITEM))
@JvmField
val X_ATTACK = create("x_${Stats.ATTACK.identifier.path}", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.BATTLE_ITEM))
@JvmField
val X_DEFENSE = create("x_${Stats.DEFENCE.identifier.path}", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.BATTLE_ITEM))
@JvmField
val X_SP_ATK = create("x_${Stats.SPECIAL_ATTACK.identifier.path}", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.BATTLE_ITEM))
@JvmField
val X_SP_DEF = create("x_${Stats.SPECIAL_DEFENCE.identifier.path}", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.BATTLE_ITEM))
@JvmField
val X_SPEED = create("x_${Stats.SPEED.identifier.path}", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.BATTLE_ITEM))
@JvmField
val MONITOR = create("monitor", MonitorBlock(BlockBehaviour.Properties.of().mapColor(MapColor.METAL).sound(SoundType.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().strength(5.0F, 6.0F).lightLevel { if (it.getValue(MonitorBlock.SCREEN) != MonitorBlock.MonitorScreen.OFF) 13 else 0 }))
@JvmField
@@ -507,6 +507,23 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
@JvmField val SCROLL_OF_DARKNESS = noSettingsItem("scroll_of_darkness")
@JvmField val SCROLL_OF_WATERS = noSettingsItem("scroll_of_waters")
@JvmField val WHITE_PLAQUE = blockItem("white_plaque", CobblemonBlocks.WHITE_PLAQUE)
@JvmField val LIGHT_GRAY_PLAQUE = blockItem("light_gray_plaque", CobblemonBlocks.LIGHT_GRAY_PLAQUE)
@JvmField val GRAY_PLAQUE = blockItem("gray_plaque", CobblemonBlocks.GRAY_PLAQUE)
@JvmField val BLACK_PLAQUE = blockItem("black_plaque", CobblemonBlocks.BLACK_PLAQUE)
@JvmField val BROWN_PLAQUE = blockItem("brown_plaque", CobblemonBlocks.BROWN_PLAQUE)
@JvmField val RED_PLAQUE = blockItem("red_plaque", CobblemonBlocks.RED_PLAQUE)
@JvmField val ORANGE_PLAQUE = blockItem("orange_plaque", CobblemonBlocks.ORANGE_PLAQUE)
@JvmField val YELLOW_PLAQUE = blockItem("yellow_plaque", CobblemonBlocks.YELLOW_PLAQUE)
@JvmField val LIME_PLAQUE = blockItem("lime_plaque", CobblemonBlocks.LIME_PLAQUE)
@JvmField val GREEN_PLAQUE = blockItem("green_plaque", CobblemonBlocks.GREEN_PLAQUE)
@JvmField val CYAN_PLAQUE = blockItem("cyan_plaque", CobblemonBlocks.CYAN_PLAQUE)
@JvmField val LIGHT_BLUE_PLAQUE = blockItem("light_blue_plaque", CobblemonBlocks.LIGHT_BLUE_PLAQUE)
@JvmField val BLUE_PLAQUE = blockItem("blue_plaque", CobblemonBlocks.BLUE_PLAQUE)
@JvmField val PURPLE_PLAQUE = blockItem("purple_plaque", CobblemonBlocks.PURPLE_PLAQUE)
@JvmField val MAGENTA_PLAQUE = blockItem("magenta_plaque", CobblemonBlocks.MAGENTA_PLAQUE)
@JvmField val PINK_PLAQUE = blockItem("pink_plaque", CobblemonBlocks.PINK_PLAQUE)
private val berries = mutableMapOf<ResourceLocation, BerryItem>()
// Plants
@JvmField val CHERI_BERRY = berryItem("cheri", StatusCuringBerryItem(CobblemonBlocks.CHERI_BERRY, Statuses.PARALYSIS))
@@ -699,15 +716,15 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
val MOOMOO_MILK = create("moomoo_milk", MoomooMilk(Item.Properties().craftRemainder(Items.GLASS_BOTTLE).stacksTo((16))))
@JvmField
val POTION = create("potion", PotionItem(PotionType.POTION))
val POTION = create("potion", PotionItem(PotionType.POTION, CobblemonBlocks.POTION))
@JvmField
val SUPER_POTION = create("super_potion", PotionItem(PotionType.SUPER_POTION))
val SUPER_POTION = create("super_potion", PotionItem(PotionType.SUPER_POTION, CobblemonBlocks.SUPER_POTION))
@JvmField
val HYPER_POTION = create("hyper_potion", PotionItem(PotionType.HYPER_POTION))
val HYPER_POTION = create("hyper_potion", PotionItem(PotionType.HYPER_POTION, CobblemonBlocks.HYPER_POTION))
@JvmField
val MAX_POTION = create("max_potion", PotionItem(PotionType.MAX_POTION))
val MAX_POTION = create("max_potion", PotionItem(PotionType.MAX_POTION, CobblemonBlocks.MAX_POTION))
@JvmField
val FULL_RESTORE = create("full_restore", PotionItem(PotionType.FULL_RESTORE))
val FULL_RESTORE = create("full_restore", PotionItem(PotionType.FULL_RESTORE, CobblemonBlocks.FULL_RESTORE))
@JvmField
val HEAL_POWDER = create("heal_powder", HealPowderItem())
@@ -792,28 +809,27 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
@JvmField
val SERIOUS_MINT = mintItem("serious_mint", MintItem(Natures.SERIOUS))
@JvmField val X_ACCURACY = create("x_${Stats.ACCURACY.identifier.path}", XStatItem(Stats.ACCURACY))
@JvmField val X_ATTACK = create("x_${Stats.ATTACK.identifier.path}", XStatItem(Stats.ATTACK))
@JvmField val X_DEFENSE = create("x_${Stats.DEFENCE.identifier.path}", XStatItem(Stats.DEFENCE))
@JvmField val X_SP_ATK = create("x_${Stats.SPECIAL_ATTACK.identifier.path}", XStatItem(Stats.SPECIAL_ATTACK))
@JvmField val X_SP_DEF = create("x_${Stats.SPECIAL_DEFENCE.identifier.path}", XStatItem(Stats.SPECIAL_DEFENCE))
@JvmField val X_SPEED = create("x_${Stats.SPEED.identifier.path}", XStatItem(Stats.SPEED))
@JvmField val X_ACCURACY = create("x_${Stats.ACCURACY.identifier.path}", XStatItem(Stats.ACCURACY, block = CobblemonBlocks.X_ACCURACY))
@JvmField val X_ATTACK = create("x_${Stats.ATTACK.identifier.path}", XStatItem(Stats.ATTACK, block = CobblemonBlocks.X_ATTACK))
@JvmField val X_DEFENSE = create("x_${Stats.DEFENCE.identifier.path}", XStatItem(Stats.DEFENCE, block = CobblemonBlocks.X_DEFENSE))
@JvmField val X_SP_ATK = create("x_${Stats.SPECIAL_ATTACK.identifier.path}", XStatItem(Stats.SPECIAL_ATTACK, block = CobblemonBlocks.X_SP_ATK))
@JvmField val X_SP_DEF = create("x_${Stats.SPECIAL_DEFENCE.identifier.path}", XStatItem(Stats.SPECIAL_DEFENCE, block = CobblemonBlocks.X_SP_DEF))
@JvmField val X_SPEED = create("x_${Stats.SPEED.identifier.path}", XStatItem(Stats.SPEED, block = CobblemonBlocks.X_SPEED))
@JvmField val DIRE_HIT = create("dire_hit", DireHitItem())
@JvmField val GUARD_SPEC = create("guard_spec", GuardSpecItem())
@JvmField val DIRE_HIT = create("dire_hit", DireHitItem(CobblemonBlocks.DIRE_HIT))
@JvmField val GUARD_SPEC = create("guard_spec", GuardSpecItem(CobblemonBlocks.GUARD_SPEC))
@JvmField val BURN_HEAL = create("burn_heal", StatusCureItem("item.cobblemon.burn_heal", Statuses.BURN))
@JvmField val PARALYZE_HEAL = create("paralyze_heal", StatusCureItem("item.cobblemon.paralyze_heal", Statuses.PARALYSIS))
@JvmField val ICE_HEAL = create("ice_heal", StatusCureItem("item.cobblemon.ice_heal", Statuses.FROZEN))
@JvmField val ANTIDOTE = create("antidote", StatusCureItem("item.cobblemon.antidote", Statuses.POISON, Statuses.POISON_BADLY))
@JvmField val AWAKENING = create("awakening", StatusCureItem("item.cobblemon.awakening", Statuses.SLEEP))
@JvmField val FULL_HEAL = create("full_heal", StatusCureItem("item.cobblemon.full_heal", block = CobblemonBlocks.FULL_HEAL))
@JvmField val ANTIDOTE = create("antidote", StatusCureItem("item.cobblemon.antidote", Statuses.POISON, Statuses.POISON_BADLY, block = CobblemonBlocks.ANTIDOTE))
@JvmField val AWAKENING = create("awakening", StatusCureItem("item.cobblemon.awakening", Statuses.SLEEP, block = CobblemonBlocks.AWAKENING))
@JvmField val BURN_HEAL = create("burn_heal", StatusCureItem("item.cobblemon.burn_heal", Statuses.BURN, block = CobblemonBlocks.BURN_HEAL))
@JvmField val ICE_HEAL = create("ice_heal", StatusCureItem("item.cobblemon.ice_heal", Statuses.FROZEN, block = CobblemonBlocks.ICE_HEAL))
@JvmField val PARALYZE_HEAL = create("paralyze_heal", StatusCureItem("item.cobblemon.paralyze_heal", Statuses.PARALYSIS, block = CobblemonBlocks.PARALYZE_HEAL))
@JvmField val FULL_HEAL = create("full_heal", StatusCureItem("item.cobblemon.full_heal"))
@JvmField val ETHER = create("ether", EtherItem(max = false))
@JvmField val MAX_ETHER = create("max_ether", EtherItem(max = true))
@JvmField val ELIXIR = create("elixir", ElixirItem(max = false))
@JvmField val MAX_ELIXIR = create("max_elixir", ElixirItem(max = true))
@JvmField val ETHER = create("ether", EtherItem(max = false, CobblemonBlocks.ETHER))
@JvmField val MAX_ETHER = create("max_ether", EtherItem(max = true, CobblemonBlocks.MAX_ETHER))
@JvmField val ELIXIR = create("elixir", ElixirItem(max = false, CobblemonBlocks.ELIXIR))
@JvmField val MAX_ELIXIR = create("max_elixir", ElixirItem(max = true, CobblemonBlocks.MAX_ELIXIR))
@JvmField
val ABILITY_CAPSULE = this.create("ability_capsule", AbilityChangeItem(AbilityChanger.COMMON_ABILITY))
@@ -922,7 +938,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
@JvmField
val BLACK_SLUDGE = heldItem("black_sludge")
@JvmField
val BLUNDER_POLICY = heldItem("blunder_policy")
val BLUNDER_POLICY = itemNameBlockItem("blunder_policy", CobblemonBlocks.BLUNDER_POLICY)
@JvmField
val CELL_BATTERY = heldItem("cell_battery")
@JvmField
@@ -930,7 +946,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
@JvmField
val CHOICE_SCARF = heldItem("choice_scarf")
@JvmField
val CLEANSE_TAG = heldItem("cleanse_tag")
val CLEANSE_TAG = itemNameBlockItem("cleanse_tag", CobblemonBlocks.CLEANSE_TAG)
@JvmField
val CLEAR_AMULET = heldItem("clear_amulet")
@JvmField
@@ -1038,7 +1054,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
@JvmField
val SOFT_SAND = heldItem("soft_sand")
@JvmField
val SPELL_TAG = heldItem("spell_tag")
val SPELL_TAG = itemNameBlockItem("spell_tag", CobblemonBlocks.SPELL_TAG)
@JvmField
val SMOKE_BALL = heldItem("smoke_ball")
@JvmField
@@ -1056,7 +1072,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
@JvmField
val UTILITY_UMBRELLA = heldItem("utility_umbrella")
@JvmField
val WEAKNESS_POLICY = heldItem("weakness_policy")
val WEAKNESS_POLICY = itemNameBlockItem("weakness_policy", CobblemonBlocks.WEAKNESS_POLICY)
@JvmField
val WIDE_LENS = heldItem("wide_lens")
@JvmField
@@ -1553,6 +1569,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
}
}
)
private fun heldItem(name: String, item: Item, remappedName: String? = null) = create(
name = name,
entry = item.also {
@@ -23,7 +23,6 @@ class AspectCriterion(
): SimpleCriterionCondition<MutableMap<ResourceLocation, MutableSet<String>>>(playerCtx) {
companion object {
@JvmField
val CODEC: Codec<AspectCriterion> = RecordCodecBuilder.create { it.group(
//All three of these codecs used to use Codecs.createStrictOptionalFieldCodec, that no longer exists
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(AspectCriterion::playerCtx),
@@ -36,4 +35,4 @@ class AspectCriterion(
val caughtAspects = context.getOrDefault(species, mutableSetOf())
return this.aspects.all { it in caughtAspects }
}
}
}
@@ -25,7 +25,6 @@ class BattleCountableCriterion(
): CountableCriterion<BattleCountableContext>(playerCtx, count) {
companion object {
@JvmField
val CODEC: Codec<BattleCountableCriterion> = RecordCodecBuilder.create { it.group(
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(BattleCountableCriterion::playerCtx),
Codec.STRING.listOf().optionalFieldOf("battle_types", listOf("any")).forGetter(BattleCountableCriterion::battleTypes),
@@ -25,7 +25,6 @@ class CastPokeRodCriterionCondition(
): SimpleCriterionCondition<CastPokeRodContext>(playerCtx) {
companion object {
@JvmField
val CODEC: Codec<CastPokeRodCriterionCondition> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(CastPokeRodCriterionCondition::playerCtx),
Codec.STRING.optionalFieldOf("baitId", "empty_bait").forGetter(CastPokeRodCriterionCondition::baitId)
@@ -35,4 +34,4 @@ class CastPokeRodCriterionCondition(
override fun matches(player: ServerPlayer, context: CastPokeRodContext): Boolean {
return (context.baitId == this.baitId.asIdentifierDefaultingNamespace() || this.baitId == "empty_bait")
}
}
}
@@ -31,7 +31,6 @@ class CaughtPokemonCriterion(
): CountableCriterion<CountablePokemonTypeContext>(playerCtx, count) {
companion object {
@JvmField
val CODEC: Codec<CaughtPokemonCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(CaughtPokemonCriterion::playerCtx),
Codec.STRING.optionalFieldOf("type", "any").forGetter(CaughtPokemonCriterion::type),
@@ -43,4 +42,4 @@ class CaughtPokemonCriterion(
override fun matches(player: ServerPlayer, context: CountablePokemonTypeContext): Boolean {
return super.matches(player, context) && (context.type == type || type == "any")// && (context.species == species || species == "any")
}
}
}
@@ -23,7 +23,6 @@ open class CountableCriterion<T : CountableContext>(
): SimpleCriterionCondition<T>(playerCtx) {
companion object {
@JvmField
val CODEC: Codec<CountableCriterion<CountableContext>> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(CountableCriterion<CountableContext>::playerCtx),
Codec.INT.optionalFieldOf("count", 0).forGetter(CountableCriterion<CountableContext>::count)
@@ -26,7 +26,6 @@ class EvolvePokemonCriterion(
): CountableCriterion<EvolvePokemonContext>(playerCtx, count) {
companion object {
@JvmField
val CODEC: Codec<EvolvePokemonCriterion> = RecordCodecBuilder.create { it.group(
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(EvolvePokemonCriterion::playerCtx),
Codec.STRING.optionalFieldOf("species", "any").forGetter(EvolvePokemonCriterion::species),
@@ -25,7 +25,6 @@ class LevelUpCriterion(
): SimpleCriterionCondition<LevelUpContext>(playerCtx) {
companion object {
@JvmField
val CODEC: Codec<LevelUpCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(LevelUpCriterion::playerCtx),
Codec.INT.optionalFieldOf("level", 0).forGetter(LevelUpCriterion::level),
@@ -43,4 +42,4 @@ class LevelUpCriterion(
return level == context.level && evolutionCheck == evolved
}
}
}
@@ -24,7 +24,6 @@ class PartyCheckCriterion(
): SimpleCriterionCondition<PlayerPartyStore>(playerCtx) {
companion object {
@JvmField
val CODEC: Codec<PartyCheckCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(PartyCheckCriterion::playerCtx),
ResourceLocation.CODEC.listOf().optionalFieldOf("party", listOf()).forGetter(PartyCheckCriterion::party)
@@ -48,4 +47,4 @@ class PartyCheckCriterion(
}
return matches.containsAll(party) && matches.size == party.size
}
}
}
@@ -23,7 +23,6 @@ class PlantTumblestoneCriterion(
): SimpleCriterionCondition<PlantTumblestoneContext>(playerCtx) {
companion object {
@JvmField
val CODEC: Codec<PlantTumblestoneCriterion> = RecordCodecBuilder.create { it.group(
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(PlantTumblestoneCriterion::playerCtx)
).apply(it, ::PlantTumblestoneCriterion) }
@@ -24,7 +24,6 @@ class PokemonCriterion(
): SimpleCriterionCondition<Pokemon>(playerCtx) {
companion object {
@JvmField
val CODEC: Codec<PokemonCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(PokemonCriterion::playerCtx),
Codec.STRING.optionalFieldOf("species", "any").forGetter(PokemonCriterion::species),
@@ -36,4 +35,4 @@ class PokemonCriterion(
var speciesCheck = (species.equals(context.species.resourceIdentifier.path) || species.equals(context.species.resourceIdentifier.toString())) || species.equals("any")
return speciesCheck && properties.matches(context)
}
}
}
@@ -25,7 +25,6 @@ class PokemonInteractCriterion(
val item: String
): SimpleCriterionCondition<PokemonInteractContext>(playerCtx) {
companion object {
@JvmField
val CODEC: Codec<PokemonInteractCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(PokemonInteractCriterion::playerCtx),
Codec.STRING.optionalFieldOf("species", "any").forGetter(PokemonInteractCriterion::species),
@@ -36,4 +35,4 @@ class PokemonInteractCriterion(
override fun matches(player: ServerPlayer, context: PokemonInteractContext): Boolean {
return (context.species == this.species.asIdentifierDefaultingNamespace() || this.species == "any") && (context.item == this.item.asIdentifierDefaultingNamespace() || this.item == "any")
}
}
}
@@ -26,7 +26,6 @@ class ReelInPokemonCriterionCondition(
) : SimpleCriterionCondition<ReelInPokemonContext>(playerCtx) {
companion object {
@JvmField
val CODEC: Codec<ReelInPokemonCriterionCondition> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter { it.playerCtx },
Codec.STRING.optionalFieldOf("species", "any").forGetter { it.species },
@@ -38,4 +37,4 @@ class ReelInPokemonCriterionCondition(
return (context.species == this.species.asIdentifierDefaultingNamespace() || this.species == "any")
&& (context.baitId == this.baitId.asIdentifierDefaultingNamespace() || this.baitId == "any" || this.baitId == "empty_bait")
}
}
}
@@ -28,7 +28,6 @@ class TradePokemonCriterion(
): SimpleCriterionCondition<TradePokemonContext>(playerCtx) {
companion object {
@JvmField
val CODEC: Codec<TradePokemonCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(TradePokemonCriterion::playerCtx),
Codec.STRING.optionalFieldOf("traded", "any").forGetter(TradePokemonCriterion::traded),
@@ -18,7 +18,7 @@ import net.minecraft.resources.ResourceKey
object CobblemonEntitySubPredicates : PlatformRegistry<Registry<MapCodec<out EntitySubPredicate>>, ResourceKey<Registry<MapCodec<out EntitySubPredicate>>>, MapCodec<out EntitySubPredicate>>() {
@JvmField
@JvmStatic
val POKE_POBBER = this.create("poke_bobber", FishingBobberPredicate.CODEC)
override val registry: Registry<MapCodec<out EntitySubPredicate>> = BuiltInRegistries.ENTITY_SUB_PREDICATE_TYPE
@@ -24,7 +24,7 @@ class FishingBobberPredicate(val inOpenWater: Boolean) : EntitySubPredicate {
return (entity as? PokeRodFishingBobberEntity)?.inOpenWater == this.inOpenWater
}
companion object {
@JvmField
@JvmStatic
val CODEC: MapCodec<FishingBobberPredicate> = RecordCodecBuilder.mapCodec { instance ->
instance.group(
Codec.BOOL.fieldOf("in_open_water").forGetter(FishingBobberPredicate::inOpenWater)
@@ -22,7 +22,7 @@ enum class Priority : StringRepresentable {
companion object {
@JvmField
@JvmStatic
val CODEC: Codec<Priority> = StringRepresentable.fromEnum(Priority::values)
}
@@ -104,7 +104,7 @@ open class Ability internal constructor(var template: AbilityTemplate, forced: B
companion object {
@JvmField
@JvmStatic
val CODEC: Codec<Ability> = RecordCodecBuilder.create {
it.group(
AbilityTemplate.CODEC.fieldOf(DataKeys.POKEMON_ABILITY_NAME).forGetter(Ability::template),
@@ -47,7 +47,7 @@ class AbilityTemplate(
companion object {
@JvmField
@JvmStatic
val CODEC: Codec<AbilityTemplate> = CodecUtils.createByStringCodec(
Abilities::getOrDummy,
AbilityTemplate::name
@@ -29,7 +29,6 @@ interface PotentialAbility {
val type: PotentialAbilityType<*>
fun isSatisfiedBy(aspects: Set<String>): Boolean
companion object {
@JvmField
val types = mutableListOf<PotentialAbilityType<*>>()
}
}
@@ -52,4 +51,5 @@ open class CommonAbility(override val template: AbilityTemplate) : PotentialAbil
override val priority = Priority.LOWEST
override val type = CommonAbilityType
override fun isSatisfiedBy(aspects: Set<String>) = true
}
}
@@ -26,9 +26,8 @@ class AttackHostileMobsTaskConfig : SingleTaskConfig {
): BehaviorControl<in LivingEntity>? {
return AttackHostileMobsTask.create()
}
companion object {
@JvmField
val CODEC: Codec<AttackHostileMobsTaskConfig> = Codec.unit(AttackHostileMobsTaskConfig())
}
}
@@ -99,7 +99,6 @@ enum class Apricorn : StringRepresentable {
override fun getSerializedName() = this.name.lowercase()
companion object {
@JvmField
val CODEC: Codec<Apricorn> = StringRepresentable.fromValues(::values)
}
}
@@ -304,7 +304,8 @@ open class PokemonBattle(
.forEach{it.pokemon.heal()}
actors.forEach { actor ->
actor.pokemonList.forEach { battlePokemon ->
battlePokemon.entity?.let { entity -> battlePokemon.postBattleEntityOperation(entity) }
battlePokemon.postBattlePokemonOperations.forEach { it(battlePokemon) }
battlePokemon.entity?.let { entity -> battlePokemon.postBattleEntityOperations.forEach { it(entity) } }
if (battlePokemon.effectedPokemon.entity != null
&& battlePokemon.effectedPokemon.entity?.beamMode == 0
&& battlePokemon.effectedPokemon.entity?.platform != PlatformType.NONE) {
@@ -24,7 +24,6 @@ class AllBiomeCondition(val minGroveSize: Int, val maxGroveSize: Int) : BerrySpa
}
companion object {
@JvmField
val ID = cobblemonResource("all_biome")
}
}
}
@@ -26,7 +26,6 @@ class PreferredBiomeCondition(val minGroveSize: Int, val maxGroveSize: Int) : Be
}
companion object {
@JvmField
val ID = cobblemonResource("preferred_biome")
}
}
}
@@ -24,7 +24,6 @@ class SpecificBiomeCondition : BerrySpawnCondition {
override fun getGroveSize(random: RandomSource) = random.nextIntBetweenInclusive(minGroveSize, maxGroveSize)
companion object {
@JvmField
val ID = cobblemonResource("specific_biome")
}
}
@@ -27,7 +27,6 @@ enum class Flavour(val colour: Int): StringRepresentable {
override fun getSerializedName() = name
companion object {
@JvmField
val CODEC = StringRepresentable.fromEnum<Flavour> { Flavour.entries.toTypedArray() }
}
}
}
@@ -17,7 +17,6 @@ data class Food(
val saturation: Float = 0f,
) {
companion object {
@JvmField
val CODEC: Codec<Food> = RecordCodecBuilder.create { builder ->
builder.group(
Codec.INT.optionalFieldOf("hunger", 0).forGetter { it.hunger },
@@ -38,7 +38,6 @@ data class Seasoning(
val mobEffects: List<SerializableMobEffectInstance>? = null
) {
companion object {
@JvmField
val CODEC: Codec<Seasoning> = RecordCodecBuilder.create { builder ->
builder.group(
ITEM_REGISTRY_LIKE_CODEC.fieldOf("ingredient").forGetter { it.ingredient },
@@ -59,7 +58,6 @@ data class Seasoning(
}
}
@JvmField
val STREAM_CODEC: StreamCodec<ByteBuf, Seasoning> = ByteBufCodecs.fromCodec(CODEC)
}
}
}
@@ -31,7 +31,6 @@ data class SerializableMobEffectInstance(
}
companion object {
@JvmField
val CODEC: Codec<SerializableMobEffectInstance> = RecordCodecBuilder.create { builder ->
builder.group(
ResourceLocation.CODEC.fieldOf("effect").forGetter { it.effect },
@@ -43,4 +42,4 @@ data class SerializableMobEffectInstance(
).apply(builder, ::SerializableMobEffectInstance)
}
}
}
}
@@ -26,11 +26,9 @@ class Dialogue(
val initializationAction: DialogueAction = FunctionDialogueAction { _, _ -> }
) {
companion object {
@JvmField
val DEFAULT_BACKGROUND = cobblemonResource("textures/gui/dialogue/dialogue_box.png")
@JvmOverloads
@JvmStatic
fun of(
pages: Iterable<DialoguePage>,
background: ResourceLocation = DEFAULT_BACKGROUND,
@@ -46,7 +44,6 @@ class Dialogue(
}
@JvmOverloads
@JvmStatic
fun of(
pages: Iterable<DialoguePage>,
background: ResourceLocation = DEFAULT_BACKGROUND,
@@ -23,7 +23,7 @@ import com.cobblemon.mod.common.util.resolve
*/
interface DialogueAction {
companion object {
@JvmField
@JvmStatic
val types = mutableMapOf<String, Class<out DialogueAction>>()
}
@@ -23,7 +23,6 @@ sealed interface DialogueFaceProvider {
val isLeftSide: Boolean
companion object {
@JvmField
val types = mutableMapOf(
"artificial" to ArtificialDialogueFaceProvider::class.java,
"player" to PlayerDialogueFaceProvider::class.java,
@@ -58,9 +58,4 @@ object DialogueManager {
DialogueClosedPacket(activeDialogue.dialogueId).sendToPlayer(playerEntity)
activeDialogues.remove(playerEntity.uuid)
}
@JvmStatic
fun getDialogue(playerEntity: ServerPlayer): ActiveDialogue? {
return activeDialogues[playerEntity.uuid]
}
}
@@ -38,7 +38,6 @@ class DialoguePage(
) {
companion object {
@JvmOverloads
@JvmStatic
fun of(
/** The ID is optional, but if you want to be able to jump to this page from other pages then you probably want to set this. */
id: String = "",
@@ -79,4 +78,4 @@ class DialoguePage(
)
)
}
}
}
@@ -20,7 +20,6 @@ import com.cobblemon.mod.common.util.resolveBoolean
*/
interface DialoguePredicate {
companion object {
@JvmField
val types = mutableMapOf<String, Class<out DialoguePredicate>>()
}
@@ -24,7 +24,6 @@ import net.minecraft.network.chat.MutableComponent
*/
interface DialogueText {
companion object {
@JvmField
val types = mutableMapOf<String, Class<out DialogueText>>(
"expression" to ExpressionLikeDialogueText::class.java,
)
@@ -26,10 +26,7 @@ interface DropEntry {
companion object {
val entryTypes = mutableMapOf<String, Class<out DropEntry>>()
var defaultType: Class<out DropEntry>? = null
@JvmStatic
fun getByName(name: String) = entryTypes[name]
@JvmOverloads
@JvmStatic
fun <T : DropEntry> register(name: String, clazz: Class<T>, isDefault: Boolean = false) {
entryTypes[name] = clazz
if (isDefault) {
@@ -63,16 +63,13 @@ interface EntityEffect {
register(TransformEffect.ID, TransformEffect::class, ::TransformEffect)
}
@JvmStatic
fun <T : EntityEffect> register(id: String, type: KClass<T>, default: () -> T) {
effects[id] = type
defaults[id] = default
}
@JvmStatic
fun createDefault(id: String): EntityEffect? = defaults[id]?.invoke()
@JvmStatic
fun loadFromNbt(nbt: CompoundTag, registryLookup: HolderLookup.Provider): EntityEffect? {
if (nbt.contains(DataKeys.ENTITY_EFFECT_ID)) {
val id = nbt.getString(DataKeys.ENTITY_EFFECT_ID)
@@ -103,4 +100,4 @@ interface MocKEffect : PhysicalEffect {
val exposedBall: PokeBall?
get() = this.mock.pokeball?.let { PokeBalls.getPokeBall(it.asIdentifierDefaultingNamespace()) }
}
}
@@ -9,6 +9,7 @@
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.interpreter.BattleContext
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.battles.model.actor.ActorType
@@ -25,7 +26,8 @@ import com.cobblemon.mod.common.util.asArrayValue
data class BattleFaintedEvent(
override val battle: PokemonBattle,
val killed: BattlePokemon,
val context: BattleContext
val context: BattleContext,
val pnx: String
) : BattleEvent {
val structContext = mutableMapOf<String, MoValue>(
"battle" to battle.struct,
@@ -33,6 +35,7 @@ data class BattleFaintedEvent(
"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 context.getStruct()
"context" to context.getStruct(),
"pnx" to StringValue(pnx)
)
}
}
@@ -8,10 +8,12 @@
package com.cobblemon.mod.common.api.events.battles.instruction
import com.bedrockk.molang.runtime.value.MoValue
import com.bedrockk.molang.runtime.value.StringValue
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.battles.model.actor.ActorType
import com.cobblemon.mod.common.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
@@ -35,7 +35,6 @@ class SpawnBait(
constructor(type: ResourceLocation, subcategory: Optional<ResourceLocation>, chance: Double, value: Double) : this(type, subcategory.orElse(null), chance, value)
companion object {
@JvmField
val CODEC = RecordCodecBuilder.create<Effect> { instance ->
instance.group(
ResourceLocation.CODEC.fieldOf("type").forGetter { it.type },
@@ -48,7 +47,6 @@ class SpawnBait(
}
companion object {
@JvmField
val CODEC = RecordCodecBuilder.create<SpawnBait> { instance ->
instance.group(
ITEM_REGISTRY_LIKE_CODEC.fieldOf("item").forGetter { it.item },
@@ -56,7 +54,6 @@ class SpawnBait(
).apply(instance, ::SpawnBait)
}
@JvmField
val STREAM_CODEC = ByteBufCodecs.fromCodec(CODEC)
}
@@ -99,4 +96,6 @@ class SpawnBait(
}
}
}
}
}
@@ -223,7 +223,6 @@ abstract class RequestManager<T : ServerPlayerActionRequest> {
companion object {
private val managers = mutableListOf<RequestManager<*>>()
@JvmStatic
fun register(manager: RequestManager<*>) = managers.add(manager)
fun onLogoff(player: ServerPlayer) = managers.forEach { it.onLogoff(player) }
@@ -59,7 +59,7 @@ interface AbilityChanger<T : PotentialAbility> {
*
* While this can be used in custom data scenarios this functions most "game-like" if the Pokémon only has 2 common abilities.
*/
@JvmField
@JvmStatic
val COMMON_ABILITY: AbilityChanger<CommonAbility> = AbilityTypeChanger(CommonAbilityType) { other -> other == CommonAbilityType }
/**
@@ -67,7 +67,7 @@ interface AbilityChanger<T : PotentialAbility> {
*
* While this can be used in custom data scenarios this functions most "game-like" if the Pokémon only has 1 hidden ability.
*/
@JvmField
@JvmStatic
val HIDDEN_ABILITY: AbilityChanger<HiddenAbility> = AbilityTypeChanger(HiddenAbilityType) { other -> other == CommonAbilityType || other == HiddenAbilityType }
}
@@ -35,11 +35,10 @@ interface ExpressionLike {
fun resolveObject(runtime: MoLangRuntime) = resolve(runtime) as ObjectValue<*>
companion object {
@JvmField
val CODEC: Codec<ExpressionLike> = Codec.STRING.xmap({
it.asExpressionLike()
}) {
it.getString()
}
}
}
}
@@ -112,7 +112,7 @@ class BenchedMoves : Iterable<BenchedMove> {
}
companion object {
@JvmField
@JvmStatic
val CODEC: Codec<BenchedMoves> = Codec.list(BenchedMove.CODEC)
.xmap(
{ moveList ->
@@ -144,7 +144,6 @@ data class BenchedMove(val moveTemplate: MoveTemplate, val ppRaisedStages: Int)
}
companion object {
@JvmStatic
fun loadFromNBT(nbt: CompoundTag): BenchedMove {
val name = nbt.getString(DataKeys.POKEMON_MOVESET_MOVENAME)
return BenchedMove(
@@ -153,7 +152,6 @@ data class BenchedMove(val moveTemplate: MoveTemplate, val ppRaisedStages: Int)
)
}
@JvmStatic
fun loadFromJSON(json: JsonObject): BenchedMove {
val name = json.get(DataKeys.POKEMON_MOVESET_MOVENAME).asString
return BenchedMove(
@@ -162,7 +160,6 @@ data class BenchedMove(val moveTemplate: MoveTemplate, val ppRaisedStages: Int)
)
}
@JvmStatic
fun loadFromBuffer(buffer: RegistryFriendlyByteBuf): BenchedMove {
val name = buffer.readString()
return BenchedMove(
@@ -171,7 +168,7 @@ data class BenchedMove(val moveTemplate: MoveTemplate, val ppRaisedStages: Int)
)
}
@JvmField
@JvmStatic
val CODEC: Codec<BenchedMove> = RecordCodecBuilder.create { it.group(
MoveTemplate.BY_STRING_CODEC.fieldOf(DataKeys.POKEMON_MOVESET_MOVENAME).forGetter(BenchedMove::moveTemplate),
Codec.intRange(0, 3).fieldOf(DataKeys.POKEMON_MOVESET_RAISED_PP_STAGES).forGetter(BenchedMove::ppRaisedStages)
@@ -149,14 +149,12 @@ open class Move(
}
companion object {
@JvmStatic
fun loadFromNBT(nbt: CompoundTag): Move {
val moveName = nbt.getString(DataKeys.POKEMON_MOVESET_MOVENAME)
val template = Moves.getByNameOrDummy(moveName)
return template.create(nbt.getInt(DataKeys.POKEMON_MOVESET_MOVEPP), nbt.getInt(DataKeys.POKEMON_MOVESET_RAISED_PP_STAGES))
}
@JvmStatic
fun loadFromJSON(json: JsonObject): Move {
val moveName = json.get(DataKeys.POKEMON_MOVESET_MOVENAME).asString
val template = Moves.getByNameOrDummy(moveName)
@@ -165,7 +163,6 @@ open class Move(
return Move(template, currentPp, raisedPpStages)
}
@JvmStatic
fun loadFromBuffer(buffer: RegistryFriendlyByteBuf): Move {
val moveName = buffer.readString()
val currentPp = buffer.readSizedInt(IntSize.U_BYTE)
@@ -174,7 +171,7 @@ open class Move(
return template.create(currentPp, raisedPpStages)
}
@JvmField
@JvmStatic
val CODEC: Codec<Move> = RecordCodecBuilder.create { it.group(
MoveTemplate.BY_STRING_CODEC.fieldOf(DataKeys.POKEMON_MOVESET_MOVENAME).forGetter(Move::template),
Codec.intRange(0, Int.MAX_VALUE).fieldOf(DataKeys.POKEMON_MOVESET_MOVEPP).forGetter(Move::currentPp),
@@ -208,7 +208,7 @@ class MoveSet : Iterable<Move> {
companion object {
const val MOVE_COUNT = 4
@JvmField
@JvmStatic
val CODEC: Codec<MoveSet> = Codec.list(Move.CODEC, 0, MOVE_COUNT)
.xmap(
{ moveList ->
@@ -90,10 +90,9 @@ open class MoveTemplate(
)
companion object {
@JvmStatic
fun dummy(name: String) = Dummy(name)
@JvmField
@JvmStatic
val BY_STRING_CODEC: Codec<MoveTemplate> = CodecUtils.createByStringCodec(
Moves::getByNameOrDummy,
MoveTemplate::name
@@ -158,4 +157,4 @@ open class MoveTemplate(
}
return this.elementalType
}
}
}
@@ -32,7 +32,6 @@ class ActionEffectTimeline(
val condition: ExpressionLike = "true".asExpressionLike()
) {
companion object {
@JvmField
val NONE = ActionEffectTimeline()
}
@@ -99,4 +98,4 @@ interface EntityProvider {
// val sound: ResourceLocation? = null,
// val animation: List<AnimationWithMoments> = listOf(),
// val effects: List<ActionEffect> = listOf()
//)
//)
@@ -21,10 +21,8 @@ import java.util.concurrent.CompletableFuture
*/
interface ActionEffectKeyframe {
companion object {
@JvmField
val types = mutableMapOf<String, Class<out ActionEffectKeyframe>>()
@JvmStatic
inline fun <reified T : ActionEffectKeyframe> register(type: String) {
types[type] = T::class.java
}
@@ -33,4 +31,4 @@ interface ActionEffectKeyframe {
fun play(context: ActionEffectContext): CompletableFuture<Unit>
fun interrupt(context: ActionEffectContext) {}
fun skip(): CompletableFuture<Unit> = CompletableFuture.completedFuture(Unit)
}
}
@@ -32,4 +32,4 @@ enum class MulchVariant(val duration: Int = -1) : StringRepresentable {
companion object {
const val GROWTH_TIME_MULTIPLIER = 0.5
}
}
}
@@ -109,7 +109,6 @@ object NPCClasses : JsonDataRegistry<NPCClass> {
* @param name The path of the NPC class asset.
* @return The [NPCClass] if existing.
*/
@JvmStatic
fun getByName(name: String) = this.getByIdentifier(cobblemonResource(name))
/**
@@ -25,7 +25,6 @@ import net.minecraft.server.level.ServerPlayer
*/
interface NPCPartyProvider {
companion object {
@JvmField
val types = mutableMapOf<String, (String) -> NPCPartyProvider>(
SimplePartyProvider.TYPE to { SimplePartyProvider() },
PoolPartyProvider.TYPE to { PoolPartyProvider() },
@@ -34,7 +34,6 @@ interface NPCInteractConfiguration {
companion object {
val types = mutableMapOf<String, NPCInteractConfigurationType<out NPCInteractConfiguration>>()
@JvmStatic
fun register(type: String, displayName: MutableComponent, clazz: Class<out NPCInteractConfiguration>) {
types[type] = NPCInteractConfigurationType(displayName, clazz)
}
@@ -34,7 +34,6 @@ interface NPCVariationProvider {
"random" to RandomNPCVariationProvider::class.java
)
@JvmStatic
fun register(type: String, clazz: Class<out NPCVariationProvider>) {
types[type] = clazz
}
@@ -23,11 +23,8 @@ import kotlin.math.sign
open class OrientationController(val entity: LivingEntity) {
companion object {
@JvmField
val FORWARDS: Vector3f = Vector3f(0.0f, 0.0f, -1.0f)
@JvmField
val UP: Vector3f = Vector3f(0.0f, 1.0f, 0.0f)
@JvmField
val LEFT: Vector3f = Vector3f(-1.0f, 0.0f, 0.0f)
}
@@ -132,4 +129,4 @@ open class OrientationController(val entity: LivingEntity) {
return@updateOrientation Matrix3f().set(resultQuat)
}
}
}
@@ -25,7 +25,6 @@ enum class PermissionLevel(val numericalValue: Int) {
ALL_COMMANDS(4);
companion object {
@JvmStatic
fun byNumericValue(value: Int): PermissionLevel {
return entries.first { it.numericalValue == value }
}
@@ -23,8 +23,6 @@ data class CaptureContext(
* @param critical If the capture is a critical capture, defaults to false.
* @return The generated [CaptureContext].
*/
@JvmOverloads
@JvmStatic
fun successful(critical: Boolean = false): CaptureContext {
if (critical) {
return CaptureContext(numberOfShakes = 1, isSuccessfulCapture = true, isCriticalCapture = true)
@@ -37,7 +37,6 @@ import net.minecraft.network.RegistryFriendlyByteBuf
*/
class FormDexRecord {
companion object {
@JvmField
val CODEC: Codec<FormDexRecord> = RecordCodecBuilder.create { instance ->
instance.group(
ListCodec(Codec.STRING, 0, 3).fieldOf("genders").forGetter { it.genders.map { it.name } },
@@ -26,11 +26,10 @@ enum class PokedexEntryProgress : StringRepresentable, Comparable<PokedexEntryPr
override fun getSerializedName() = this.name
companion object {
@JvmField
val CODEC: Codec<PokedexEntryProgress> = RecordCodecBuilder.create { instance ->
instance.map ({
PokedexEntryProgress.valueOf(it)
}, PrimitiveCodec.STRING.fieldOf("name").forGetter { it.name })
}
}
}
}
@@ -70,7 +70,6 @@ class PokedexManager(
}
companion object {
@JvmField
val CODEC = RecordCodecBuilder.create<PokedexManager> { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("uuid").forGetter { it.uuid.toString() },
@@ -33,7 +33,6 @@ import net.minecraft.resources.ResourceLocation
*/
class SpeciesDexRecord {
companion object {
@JvmField
val CODEC: Codec<SpeciesDexRecord> = RecordCodecBuilder.create { instance ->
instance.group(
ListCodec(PrimitiveCodec.STRING, 0, 512).fieldOf("aspects").forGetter { it.aspects.toList() },
@@ -76,9 +76,7 @@ class AggregatePokedexDef(
}
companion object {
@JvmField
val ID = cobblemonResource("aggregate_pokedex_def")
@JvmField
val CODEC: MapCodec<AggregatePokedexDef> = RecordCodecBuilder.mapCodec { instance ->
instance.group(
ResourceLocation.CODEC.fieldOf("id").forGetter { it.id },
@@ -34,12 +34,9 @@ abstract class PokedexDef: ClientDataSynchronizer<PokedexDef> {
abstract fun getEntries(): List<PokedexEntry>
companion object {
@JvmField
val CODEC: Codec<PokedexDef> = ResourceLocation.CODEC.dispatch("type", PokedexDef::typeId, PokedexDef::getCodecById)
@JvmField
val PACKET_CODEC: StreamCodec<ByteBuf, PokedexDef> = ResourceLocation.STREAM_CODEC.dispatch({ it.typeId }, ::getPacketCodecById)
@JvmStatic
fun getPacketCodecById(id: ResourceLocation): StreamCodec<ByteBuf, out PokedexDef> {
return when (id) {
SimplePokedexDef.ID -> SimplePokedexDef.PACKET_CODEC
@@ -48,7 +45,6 @@ abstract class PokedexDef: ClientDataSynchronizer<PokedexDef> {
}
}
@JvmStatic
fun getCodecById(id: ResourceLocation): MapCodec<out PokedexDef> {
return when (id) {
SimplePokedexDef.ID -> SimplePokedexDef.CODEC
@@ -64,9 +64,7 @@ class SimplePokedexDef(
}
companion object {
@JvmField
val ID = cobblemonResource("simple_pokedex_def")
@JvmField
val CODEC: MapCodec<SimplePokedexDef> = RecordCodecBuilder.mapCodec { instance ->
instance.group(
ResourceLocation.CODEC.fieldOf("id").forGetter { it.id },
@@ -80,7 +78,6 @@ class SimplePokedexDef(
}
}
@JvmField
val PACKET_CODEC: StreamCodec<ByteBuf, SimplePokedexDef> = StreamCodec.composite(
ResourceLocation.STREAM_CODEC, SimplePokedexDef::id,
ByteBufCodecs.INT, SimplePokedexDef::sortOrder,
@@ -82,13 +82,13 @@ import kotlin.jvm.optionals.getOrNull
open class PokemonProperties {
companion object {
@JvmField
@JvmStatic
val CODEC: Codec<PokemonProperties> = Codec.STRING.xmap(
{ parse(it) },
{ it.asString() }
)
@JvmField
@JvmStatic
val CUSTOM_PROPERTIES_CODEC: Codec<MutableList<CustomPokemonProperty>> = Codec.list(Codec.STRING)
.xmap(
{ string -> parse(string.joinToString(" ")).customProperties },
@@ -96,7 +96,6 @@ open class PokemonProperties {
)
@JvmOverloads
@JvmStatic
fun parse(string: String, delimiter: String = " ", assigner: String = "="): PokemonProperties {
val props = PokemonProperties()
props.originalString = string
@@ -22,14 +22,10 @@ import com.cobblemon.mod.common.pokemon.Pokemon
interface AspectProvider {
companion object {
val providers = mutableListOf<AspectProvider>()
@JvmStatic
fun register(provider: AspectProvider): AspectProvider {
providers.add(provider)
return provider
}
@JvmStatic
fun unregister(provider: AspectProvider) {
providers.remove(provider)
}
@@ -21,7 +21,6 @@ import com.cobblemon.mod.common.pokemon.Pokemon
*/
interface SingleConditionalAspectProvider : AspectProvider {
companion object {
@JvmStatic
fun getForFeature(name: String): SingleConditionalAspectProvider {
return object : SingleConditionalAspectProvider {
override val aspect: String = name
@@ -38,7 +38,6 @@ enum class EggGroup(val showdownID: String) {
it.showdownID.lowercase().replace(" ", "_").replace("-", "_")
}
@JvmStatic
fun fromIdentifier(identifier: String): EggGroup? {
val key = identifier.lowercase().replace(" ", "_").replace("-", "_")
return identifierMap[key]
@@ -26,9 +26,9 @@ interface PreEvolution {
val form: FormData
companion object {
@JvmOverloads
@JvmStatic
fun of(species: Species, form: FormData = species.standardForm): PreEvolution = StandardPreEvolution(species, form)
}
}
@@ -25,15 +25,15 @@ object EvolutionProgressTypes {
ResourceKey.createRegistryKey(cobblemonResource("evolution_progress")), Lifecycle.stable()
)
@JvmField
@JvmStatic
val DAMAGE_TAKEN = this.registerType(DamageTakenEvolutionProgress.ID, EvolutionProgressType(DamageTakenEvolutionProgress.CODEC))
@JvmField
@JvmStatic
val DEFEAT = this.registerType(DefeatEvolutionProgress.ID, EvolutionProgressType(DefeatEvolutionProgress.CODEC))
@JvmField
@JvmStatic
val LAST_BATTLE_CRITICAL_HITS = this.registerType(LastBattleCriticalHitsEvolutionProgress.ID, EvolutionProgressType(LastBattleCriticalHitsEvolutionProgress.CODEC))
@JvmField
@JvmStatic
val RECOIL = this.registerType(RecoilEvolutionProgress.ID, EvolutionProgressType(RecoilEvolutionProgress.CODEC))
@JvmField
@JvmStatic
val USE_MOVE = this.registerType(UseMoveEvolutionProgress.ID, EvolutionProgressType(UseMoveEvolutionProgress.CODEC))
/**
@@ -34,7 +34,6 @@ fun interface FriendshipMutationCalculator {
* For more information see this [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Friendship#Generation_VIII) entry.
* It will yield 3 between 0 and 99 friendship, 2 between 100 and 199 otherwise 0.
*/
@JvmField
val SWORD_AND_SHIELD_LEVEL_UP = FriendshipMutationCalculator { pokemon ->
when {
pokemon.friendship <= 99 -> 3
@@ -23,7 +23,6 @@ open class Learnset : ClientDataSynchronizer<Learnset> {
val loadMove: (JsonElement, Learnset) -> Boolean
) {
companion object {
@JvmStatic
fun parseFromPrefixIntoList(prefix: String, list: (Learnset) -> MutableList<MoveTemplate>): Interpreter {
return Interpreter { element, learnset ->
val str = element.takeIf { it.isJsonPrimitive }?.asString ?: return@Interpreter false
@@ -41,19 +40,12 @@ open class Learnset : ClientDataSynchronizer<Learnset> {
}
companion object {
@JvmField
val tmInterpreter = Interpreter.parseFromPrefixIntoList("tm") { it.tmMoves }
@JvmField
val eggInterpreter = Interpreter.parseFromPrefixIntoList("egg") { it.eggMoves }
@JvmField
val tutorInterpreter = Interpreter.parseFromPrefixIntoList("tutor") { it.tutorMoves }
@JvmField
val legacyInterpreter = Interpreter.parseFromPrefixIntoList("legacy") { it.legacyMoves }
@JvmField
val specialInterpreter = Interpreter.parseFromPrefixIntoList("special") { it.specialMoves }
@JvmField
val formChangeInterpreter = Interpreter.parseFromPrefixIntoList("form_change") { it.formChangeMoves }
@JvmField
val levelUpInterpreter = Interpreter { element, learnset ->
val str = element.takeIf { it.isJsonPrimitive }?.asString ?: return@Interpreter false
val splits = str.split(":")
@@ -76,7 +68,6 @@ open class Learnset : ClientDataSynchronizer<Learnset> {
}
@JvmField
val interpreters = mutableListOf(
tmInterpreter,
eggInterpreter,
@@ -22,7 +22,7 @@ fun interface LearnsetQuery {
fun canLearn(move: MoveTemplate, learnset: Learnset): Boolean
companion object {
@JvmField
val ANY = LearnsetQuery { move, learnset ->
learnset.levelUpMoves.values.any { it.contains(move) }
|| learnset.eggMoves.contains(move)
@@ -34,7 +34,6 @@ fun interface LearnsetQuery {
|| learnset.specialMoves.contains(move)
}
@JvmField
val LEGAL = LearnsetQuery { move, learnset ->
learnset.levelUpMoves.values.any { it.contains(move) }
|| learnset.eggMoves.contains(move)
@@ -44,31 +43,22 @@ fun interface LearnsetQuery {
|| learnset.evolutionMoves.contains(move)
}
@JvmStatic
fun level(level: Int) = LearnsetQuery { move, learnset -> learnset.getLevelUpMovesUpTo(level).contains(move) }
@JvmField
val ANY_LEVEL = LearnsetQuery { move, learnset -> learnset.levelUpMoves.values.any { it.contains(move) } }
@JvmField
val EGG_MOVE = LearnsetQuery { move, learnset -> learnset.eggMoves.contains(move) }
@JvmField
val TUTOR_MOVES = LearnsetQuery { move, learnset -> learnset.tutorMoves.contains(move) }
@JvmField
val TM_MOVE = LearnsetQuery { move, learnset -> learnset.tmMoves.contains(move) }
@JvmField
val FORM_CHANGE = LearnsetQuery { move, learnset -> learnset.formChangeMoves.contains(move) }
@JvmField
val EVOLUTION = LearnsetQuery { move, learnset -> learnset.evolutionMoves.contains(move) }
@JvmField
val LEGACY_MOVES = LearnsetQuery { move, learnset -> learnset.legacyMoves.contains(move) }
@JvmField
val SPECIAL_MOVES = LearnsetQuery { move, learnset -> learnset.specialMoves.contains(move) }
}
@@ -70,7 +70,7 @@ interface Stat {
/**
* A [Codec] for [Stat] without filtering the [Stat.Type].
*/
@JvmField
@JvmStatic
val ALL_CODEC: Codec<Stat> = CodecUtils.createByIdentifierCodec(
Cobblemon.statProvider::fromIdentifier,
Stat::identifier
@@ -79,7 +79,7 @@ interface Stat {
/**
* A [Codec] for [Stat] with the [Stat.Type.PERMANENT].
*/
@JvmField
@JvmStatic
val PERMANENT_ONLY_CODEC: Codec<Stat> = ALL_CODEC.comapFlatMap(
{ stat -> if (stat.type == Type.PERMANENT) DataResult.success(stat) else DataResult.error { "${stat.identifier} is not of type ${Type.PERMANENT}" } },
{ stat -> stat }
@@ -88,7 +88,7 @@ interface Stat {
/**
* A [Codec] for [Stat] with the [Stat.Type.BATTLE_ONLY].
*/
@JvmField
@JvmStatic
val BATTLE_ONLY_CODEC: Codec<Stat> = ALL_CODEC.comapFlatMap(
{ stat -> if (stat.type == Type.BATTLE_ONLY) DataResult.success(stat) else DataResult.error { "${stat.identifier} is not of type ${Type.BATTLE_ONLY}" } },
{ stat -> stat }
@@ -35,25 +35,21 @@ enum class Stats(override val identifier: ResourceLocation, override val display
* All the stats, an alternative to [values].
* Using [StatProvider.all] is recommended instead for maximum addon compatibility.
*/
@JvmField
val ALL: Set<Stat> = EnumSet.allOf(Stats::class.java)
/**
* All the stats with type of [Stat.Type.PERMANENT].
* Using [StatProvider.ofType] with type [Stat.Type.PERMANENT] is recommended instead for maximum addon compatibility.
*/
@JvmField
val PERMANENT: Set<Stat> = EnumSet.of(HP, ATTACK, DEFENCE, SPECIAL_ATTACK, SPECIAL_DEFENCE, SPEED)
/**
* All the stats with type of [Stat.Type.BATTLE_ONLY].
* Using [StatProvider.ofType] with type [Stat.Type.BATTLE_ONLY] is recommended instead for maximum addon compatibility.
*/
@JvmField
val BATTLE_ONLY: Set<Stat> = EnumSet.of(EVASION, ACCURACY)
/** Gets the [Stat] from the respective Showdown id. */
@JvmStatic
fun getStat(statKey: String) = when(statKey.lowercase()) {
"hp" -> HP
"atk", "attack" -> ATTACK // Hyper Cutter states the full stat name "Attack"
@@ -66,7 +62,6 @@ enum class Stats(override val identifier: ResourceLocation, override val display
}
/** Gets the severity lang key from the respective boost/unboost stage. */
@JvmStatic
fun getSeverity(stages: Int) = when(stages) {
0 -> "cap.single"
1 -> "slight"
@@ -30,7 +30,7 @@ open class Status(
/**
* A [Codec] for [Status].
*/
@JvmField
@JvmStatic
val CODEC: Codec<Status> = CodecUtils.createByIdentifierCodec(
Statuses::getStatus,
Status::name
@@ -25,23 +25,17 @@ import com.cobblemon.mod.common.util.server
interface CustomPokemonProperty {
companion object {
/** A list of all the registered [CustomPokemonPropertyType]s. */
@JvmField
val properties = mutableListOf<CustomPokemonPropertyType<*>>()
@JvmStatic
fun <T: CustomPokemonProperty> register(propertyType: CustomPokemonPropertyType<T>) {
properties.add(propertyType)
this.triggerSyncAttempt()
}
@JvmStatic
@JvmOverloads
fun <T : CustomPokemonProperty> register(name: String, needsLabel: Boolean = true, fromString: (String?) -> T?, examples: () -> Collection<String>) {
register(listOf(name), needsLabel, fromString, examples)
}
@JvmStatic
@JvmOverloads
fun <T : CustomPokemonProperty> register(aliases: Iterable<String>, needsLabel: Boolean = true, fromString: (String?) -> T?, examples: () -> Collection<String>) {
properties.add(
object : CustomPokemonPropertyType<T> {
@@ -54,7 +48,6 @@ interface CustomPokemonProperty {
this.triggerSyncAttempt()
}
@JvmStatic
fun unregister(property: CustomPokemonPropertyType<*>) {
properties.remove(property)
}
@@ -59,12 +59,10 @@ interface Observable<T> {
companion object {
/** Creates a completed [Observable] with the given values. This [Observable] cannot receive new values. */
@JvmStatic
fun <T> just(vararg values: T): Observable<T> {
return SingularObservable<T>().also { it.emit(*values) }
}
@JvmStatic
fun <T> of(future: CompletableFuture<T>): Observable<T> {
val observable = SingularObservable<T>()
future.thenAccept { observable.emit(it) }
@@ -72,28 +70,20 @@ interface Observable<T> {
}
/** Gets a [TakeFirstTransform] */
@JvmStatic
fun <T> takeFirst(amount: Int = 1) = TakeFirstTransform<T>(amount)
/** Gets a [IgnoreFirstTransform] */
@JvmStatic
fun <T> ignoreFirst(amount: Int = 1) = IgnoreFirstTransform<T>(amount)
/** Gets a [FilterTransform] */
@JvmStatic
fun <T> filter(predicate: (T) -> Boolean) = FilterTransform(predicate)
/** Gets a [MapTransform] */
@JvmStatic
fun <T, O> map(mapping: (T) -> O) = MapTransform(mapping)
/** Gets a [EmitWhileTransform] */
@JvmStatic
fun <T> emitWhile(predicate: (T) -> Boolean) = EmitWhileTransform(predicate)
/** Gets a [StopAfterTransform] */
@JvmStatic
fun <T> stopAfter(predicate: (T) -> Boolean) = StopAfterTransform(predicate)
/** Gets a transform which will take values until the given predicate is met. */
@JvmStatic
fun <T> emitUntil(predicate: (T) -> Boolean) = EmitWhileTransform<T> { !predicate(it) }
/** Gets a transform which does not change the value but lets you access the value at this stage of the pipe. */
@JvmStatic
fun <T> tap(handler: (T) -> Unit) = map<T, T> { handler(it); return@map it }
}
}
@@ -29,9 +29,7 @@ enum class RidingStat(
JUMP(Flavour.BITTER);
companion object {
@JvmStatic
fun getByName(name: String) = RidingStat.entries.firstOrNull { it.name.equals(name, ignoreCase = true) }
@JvmStatic
fun getByFlavour(flavour: Flavour) = RidingStat.entries.firstOrNull { it.flavour == flavour }
}
@@ -72,7 +72,6 @@ class BedrockParticle(
// kill plane maybe
companion object {
@JvmField
val EXPRESSION_SET_CODEC = RecordCodecBuilder.create<ExpressionSet> { instance ->
instance.group(
EXPRESSION_CODEC.fieldOf("sizeX").forGetter { it.sizeX },
@@ -84,7 +83,6 @@ class BedrockParticle(
).apply(instance, ::ExpressionSet)
}
@JvmField
val EVENT_SET_CODEC = RecordCodecBuilder.create<EventSet> { instance ->
instance.group(
SimpleEventTrigger.CODEC.listOf().fieldOf("creationEvents").forGetter { it.creationEvents },
@@ -93,7 +91,6 @@ class BedrockParticle(
).apply(instance, ::EventSet)
}
@JvmField
val CODEC: Codec<BedrockParticle> = RecordCodecBuilder.create { instance ->
instance.group(
ResourceLocation.CODEC.fieldOf("texture").forGetter { it.texture },
@@ -36,7 +36,6 @@ class BedrockParticleOptions(
var events: MutableMap<String, ParticleEvent> = mutableMapOf()
) {
companion object {
@JvmField
val CODEC: Codec<BedrockParticleOptions> = RecordCodecBuilder.create { instance ->
instance.group(
ResourceLocation.CODEC.fieldOf("id").forGetter { it.id },
@@ -39,7 +39,6 @@ class BedrockParticleEmitter(
var loopingTravelDistanceEvents: MutableList<LoopingTravelDistanceEventTrigger> = mutableListOf()
) {
companion object {
@JvmField
val CODEC: Codec<BedrockParticleEmitter> = RecordCodecBuilder.create { instance ->
instance.group(
EXPRESSION_CODEC.listOf().fieldOf("startExpressions").forGetter { it.startExpressions },
@@ -20,7 +20,6 @@ class EmitterSpace(
var scaling: ScalingMode = ScalingMode.WORLD
) {
companion object {
@JvmField
val CODEC: Codec<EmitterSpace> = RecordCodecBuilder.create { instance ->
instance.group(
Codec.STRING.optionalFieldOfWithDefault("scaling", "world").forGetter { it.scaling.toString() }
@@ -66,7 +66,6 @@ class LinearMoLangCurve(
var nodes: List<Double> = emptyList()
) : MoLangCurve {
companion object {
@JvmField
val CODEC: Codec<LinearMoLangCurve> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -128,7 +127,6 @@ class CatmullRomMoLangCurve(
}
companion object {
@JvmField
val CODEC: Codec<CatmullRomMoLangCurve> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -204,7 +202,6 @@ class BezierChainMoLangCurve(
}
companion object {
@JvmField
val CODEC = RecordCodecBuilder.create<BezierChainNode> { instance ->
instance.group(
PrimitiveCodec.DOUBLE.fieldOf("value").forGetter { it.value },
@@ -233,7 +230,6 @@ class BezierChainMoLangCurve(
class BezierChainPointData(val time: Double, val value: Double, val slope: Double)
companion object {
@JvmField
val CODEC: Codec<BezierChainMoLangCurve> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -284,7 +280,6 @@ class BezierMoLangCurve(
}
companion object {
@JvmField
val CODEC: Codec<BezierMoLangCurve> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -67,7 +67,6 @@ interface ParticleCameraMode : CodecMapped {
class RotateXYZCameraMode : ParticleCameraMode {
companion object {
@JvmField
val CODEC: Codec<RotateXYZCameraMode> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
@@ -102,7 +101,6 @@ class RotateXYZCameraMode : ParticleCameraMode {
class RotateYCameraMode : ParticleCameraMode {
companion object {
@JvmField
val CODEC: Codec<RotateYCameraMode> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
@@ -138,7 +136,6 @@ class RotateYCameraMode : ParticleCameraMode {
class LookAtXYZ : ParticleCameraMode {
companion object {
@JvmField
val CODEC: Codec<LookAtXYZ> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
@@ -175,7 +172,6 @@ class LookAtXYZ : ParticleCameraMode {
class LookAtY : ParticleCameraMode {
override val type: ParticleCameraModeType = ParticleCameraModeType.LOOK_AT_Y
companion object {
@JvmField
val CODEC: Codec<LookAtY> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
@@ -207,7 +203,6 @@ class LookAtY : ParticleCameraMode {
class DirectionZ : ParticleCameraMode {
override val type: ParticleCameraModeType = ParticleCameraModeType.DIRECTION_Z
companion object {
@JvmField
val CODEC: Codec<DirectionZ> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
@@ -243,7 +238,6 @@ class DirectionZ : ParticleCameraMode {
class EmitterYZPlane : ParticleCameraMode {
override val type: ParticleCameraModeType = ParticleCameraModeType.EMITTER_YZ_PLANE
companion object {
@JvmField
val CODEC: Codec<EmitterYZPlane> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
@@ -283,7 +277,6 @@ class EmitterYZPlane : ParticleCameraMode {
class EmitterXZPlane : ParticleCameraMode {
override val type: ParticleCameraModeType = ParticleCameraModeType.EMITTER_XZ_PLANE
companion object {
@JvmField
val CODEC: Codec<EmitterXZPlane> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
@@ -322,7 +315,6 @@ class EmitterXZPlane : ParticleCameraMode {
class EmitterXYPlane : ParticleCameraMode {
override val type: ParticleCameraModeType = ParticleCameraModeType.EMITTER_XY_PLANE
companion object {
@JvmField
val CODEC: Codec<EmitterXYPlane> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
@@ -361,7 +353,6 @@ class EmitterXYPlane : ParticleCameraMode {
class DirectionY : ParticleCameraMode {
override val type: ParticleCameraModeType = ParticleCameraModeType.DIRECTION_Y
companion object {
@JvmField
val CODEC: Codec<DirectionY> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
@@ -397,7 +388,6 @@ class DirectionY : ParticleCameraMode {
class DirectionX : ParticleCameraMode {
override val type: ParticleCameraModeType = ParticleCameraModeType.DIRECTION_X
companion object {
@JvmField
val CODEC: Codec<DirectionX> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
@@ -456,7 +446,6 @@ class DirectionX : ParticleCameraMode {
class LookAtDirection : ParticleCameraMode {
override val type: ParticleCameraModeType = ParticleCameraModeType.LOOK_AT_DIRECTION
companion object {
@JvmField
val CODEC: Codec<LookAtDirection> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
@@ -28,7 +28,6 @@ class ParticleCollision(
var expiresOnContact: Boolean = false
) {
companion object {
@JvmField
val CODEC: Codec<ParticleCollision> = RecordCodecBuilder.create { instance ->
instance.group(
EXPRESSION_CODEC.fieldOf("enabled").forGetter { it.enabled },
@@ -41,7 +41,6 @@ interface ParticleEmitterLifetime : CodecMapped {
class OnceEmitterLifetime(var activeTime: Expression = 1.0.asExpression()) : ParticleEmitterLifetime {
companion object {
@JvmField
val CODEC: Codec<OnceEmitterLifetime> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -74,7 +73,6 @@ class OnceEmitterLifetime(var activeTime: Expression = 1.0.asExpression()) : Par
class ExpressionEmitterLifetime(var activation: Expression = NumberExpression(0.0), var expiration: Expression = NumberExpression(0.0)) : ParticleEmitterLifetime {
companion object {
@JvmField
val CODEC: Codec<ExpressionEmitterLifetime> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -116,7 +114,6 @@ class ExpressionEmitterLifetime(var activation: Expression = NumberExpression(0.
class LoopingEmitterLifetime(var activeTime: Expression = 1.0.asExpression(), var sleepTime: Expression = 1.0.asExpression()) : ParticleEmitterLifetime {
companion object {
@JvmField
val CODEC: Codec<LoopingEmitterLifetime> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -48,7 +48,6 @@ enum class ParticleEmitterRateType {
class InstantParticleEmitterRate(var amount: Expression = "1".asExpression()) : ParticleEmitterRate {
companion object {
@JvmField
val CODEC: Codec<InstantParticleEmitterRate> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -85,7 +84,6 @@ class SteadyParticleEmitterRate(
var time = System.currentTimeMillis()
companion object {
@JvmField
val CODEC: Codec<SteadyParticleEmitterRate> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -86,7 +86,6 @@ class SphereParticleEmitterShape(
val pAttachmentOptions: Map<AttachedType, Boolean>? = null
) : ParticleEmitterShape {
companion object {
@JvmField
val CODEC: Codec<SphereParticleEmitterShape> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -154,7 +153,6 @@ class PointParticleEmitterShape(
val pAttachmentOptions: Map<AttachedType, Boolean>? = null
): ParticleEmitterShape {
companion object {
@JvmField
val CODEC: Codec<PointParticleEmitterShape> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -212,7 +210,6 @@ class BoxParticleEmitterShape(
val pAttachmentOptions: Map<AttachedType, Boolean>? = null
) : ParticleEmitterShape {
companion object {
@JvmField
val CODEC: Codec<BoxParticleEmitterShape> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -335,7 +332,6 @@ class DiscParticleEmitterShape(
val pAttachmentOptions: Map<AttachedType, Boolean>? = null
): ParticleEmitterShape {
companion object {
@JvmField
val CODEC: Codec<DiscParticleEmitterShape> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -422,7 +418,6 @@ class EntityBoundingBoxParticleEmitterShape(
var surfaceOnly: Boolean = true
): ParticleEmitterShape {
companion object {
@JvmField
val CODEC: Codec<EntityBoundingBoxParticleEmitterShape> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -41,7 +41,6 @@ class ParticleEvent(
var expression: ExpressionLike? = null
): Encodable, Decodable {
companion object {
@JvmField
val CODEC: Codec<ParticleEvent> = RecordCodecBuilder.create { instance ->
instance.group(
EventParticleOptions.CODEC.optionalFieldOf("particle_effect", null).forGetter { it.particleEffect },
@@ -172,7 +171,6 @@ class EventParticleOptions(
val expression: ExpressionLike? = null
) {
companion object {
@JvmField
val CODEC = RecordCodecBuilder.create<EventParticleOptions> { instance ->
instance.group(
ResourceLocation.CODEC.fieldOf("effect").forGetter { it.effect },
@@ -207,7 +205,6 @@ class EventSoundEffect(
val sound: ResourceLocation,
) {
companion object {
@JvmField
val CODEC = RecordCodecBuilder.create<EventSoundEffect> { instance ->
instance.group(
ResourceLocation.CODEC.fieldOf("sound").forGetter { it.sound }
@@ -31,7 +31,6 @@ import net.minecraft.network.RegistryFriendlyByteBuf
*/
class SimpleEventTrigger(var event: String): Encodable, Decodable {
companion object {
@JvmField
val CODEC = RecordCodecBuilder.create<SimpleEventTrigger> { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("event").forGetter { it.event }
@@ -62,7 +61,6 @@ class SimpleEventTrigger(var event: String): Encodable, Decodable {
*/
class EventTriggerTimeline(var map: MutableMap<Double, MutableList<String>>): Encodable, Decodable {
companion object {
@JvmField
val CODEC = RecordCodecBuilder.create<EventTriggerTimeline> { instance ->
instance.group(
UnboundedMapCodec(PrimitiveCodec.DOUBLE, PrimitiveCodec.STRING.listOf()).fieldOf("map").forGetter { it.map }
@@ -96,7 +94,6 @@ class EventTriggerTimeline(var map: MutableMap<Double, MutableList<String>>): En
*/
class LoopingTravelDistanceEventTrigger(var distance: Double, var events: MutableList<String>): Encodable, Decodable {
companion object {
@JvmField
val CODEC = RecordCodecBuilder.create<LoopingTravelDistanceEventTrigger> { instance ->
instance.group(
PrimitiveCodec.DOUBLE.fieldOf("distance").forGetter { it.distance },
@@ -64,7 +64,6 @@ class ParametricParticleMotion(
)
) : ParticleMotion {
companion object {
@JvmField
val CODEC: Codec<ParametricParticleMotion> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -128,7 +127,6 @@ class DynamicParticleMotion(
override val type = ParticleMotionType.DYNAMIC
companion object {
@JvmField
val CODEC: Codec<DynamicParticleMotion> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -205,7 +203,6 @@ interface ParticleMotionDirection : CodecMapped {
class InwardsMotionDirection : ParticleMotionDirection {
companion object {
@JvmField
val CODEC: Codec<InwardsMotionDirection> = RecordCodecBuilder.create { instance ->
instance.group(PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name })
.apply(instance) { InwardsMotionDirection() }
@@ -231,7 +228,6 @@ class InwardsMotionDirection : ParticleMotionDirection {
class OutwardsMotionDirection : ParticleMotionDirection {
companion object {
@JvmField
val CODEC: Codec<OutwardsMotionDirection> = RecordCodecBuilder.create { instance ->
instance.group(PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name })
.apply(instance) { OutwardsMotionDirection() }
@@ -264,7 +260,6 @@ class CustomMotionDirection(
)
) : ParticleMotionDirection {
companion object {
@JvmField
val CODEC: Codec<CustomMotionDirection> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -310,7 +305,6 @@ enum class ParticleMotionDirectionType {
class StaticParticleMotion : ParticleMotion {
companion object {
@JvmField
val CODEC: Codec<StaticParticleMotion> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
@@ -47,7 +47,6 @@ interface ParticleRotation : CodecMapped {
class ParametricParticleRotation(var expression: Expression = NumberExpression(0.0)): ParticleRotation {
companion object {
@JvmField
val CODEC: Codec<ParametricParticleRotation> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -80,7 +79,6 @@ class DynamicParticleRotation(
var drag: Expression = NumberExpression(0.0)
): ParticleRotation {
companion object {
@JvmField
val CODEC: Codec<DynamicParticleRotation> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
@@ -25,7 +25,6 @@ class ParticleSpace(
var localVelocity: Boolean = false
) {
companion object {
@JvmField
val CODEC: Codec<ParticleSpace> = RecordCodecBuilder.create { instance ->
instance.group(
PrimitiveCodec.BOOL.fieldOf("localPosition").forGetter { it.localPosition },

Some files were not shown because too many files have changed in this diff Show More