Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94978bff20 | ||
|
|
cccc71a64b | ||
|
|
23ce272813 | ||
|
|
e271613257 |
No files matched your search
@@ -33,7 +33,7 @@ public class SimpleBlockFeatureMixin {
|
|||||||
if (!(blockState.getBlock() instanceof HeartyGrainsBlock)) {
|
if (!(blockState.getBlock() instanceof HeartyGrainsBlock)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (blockState.getValue(HeartyGrainsBlock.Companion.getAGE()) <= HeartyGrainsBlock.AGE_AFTER_HARVEST) {
|
if (blockState.getValue(HeartyGrainsBlock.AGE) <= HeartyGrainsBlock.AGE_AFTER_HARVEST) {
|
||||||
return; //block is too young to be double
|
return; //block is too young to be double
|
||||||
}
|
}
|
||||||
if (!worldGenLevel.isEmptyBlock(blockPos.above())) {
|
if (!worldGenLevel.isEmptyBlock(blockPos.above())) {
|
||||||
@@ -43,4 +43,4 @@ public class SimpleBlockFeatureMixin {
|
|||||||
DoublePlantBlock.placeAt(worldGenLevel, blockState, blockPos, Block.UPDATE_CLIENTS);
|
DoublePlantBlock.placeAt(worldGenLevel, blockState, blockPos, Block.UPDATE_CLIENTS);
|
||||||
cir.setReturnValue(true);
|
cir.setReturnValue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ object Cobblemon {
|
|||||||
|
|
||||||
val statistics: CobblemonStats = CobblemonStats
|
val statistics: CobblemonStats = CobblemonStats
|
||||||
|
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val builtinPacks = listOf<CobblemonPack>(
|
val builtinPacks = listOf<CobblemonPack>(
|
||||||
CobblemonPack(id = "adorncompatibility", name = "Adorn Compatibility", packType = PackType.CLIENT_RESOURCES, activationBehaviour = ResourcePackActivationBehaviour.ALWAYS_ENABLED, neededMods = setOf("adorn")),
|
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 = "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))
|
this.implementation.registerCommandArgument(cobblemonResource("model_part"), ModelPartArgumentType::class, SingletonArgumentInfo.contextFree(ModelPartArgumentType::modelPart))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+2
-1
@@ -23,6 +23,7 @@ class AspectCriterion(
|
|||||||
): SimpleCriterionCondition<MutableMap<ResourceLocation, MutableSet<String>>>(playerCtx) {
|
): SimpleCriterionCondition<MutableMap<ResourceLocation, MutableSet<String>>>(playerCtx) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<AspectCriterion> = RecordCodecBuilder.create { it.group(
|
val CODEC: Codec<AspectCriterion> = RecordCodecBuilder.create { it.group(
|
||||||
//All three of these codecs used to use Codecs.createStrictOptionalFieldCodec, that no longer exists
|
//All three of these codecs used to use Codecs.createStrictOptionalFieldCodec, that no longer exists
|
||||||
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(AspectCriterion::playerCtx),
|
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(AspectCriterion::playerCtx),
|
||||||
@@ -35,4 +36,4 @@ class AspectCriterion(
|
|||||||
val caughtAspects = context.getOrDefault(species, mutableSetOf())
|
val caughtAspects = context.getOrDefault(species, mutableSetOf())
|
||||||
return this.aspects.all { it in caughtAspects }
|
return this.aspects.all { it in caughtAspects }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
@@ -25,6 +25,7 @@ class BattleCountableCriterion(
|
|||||||
): CountableCriterion<BattleCountableContext>(playerCtx, count) {
|
): CountableCriterion<BattleCountableContext>(playerCtx, count) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<BattleCountableCriterion> = RecordCodecBuilder.create { it.group(
|
val CODEC: Codec<BattleCountableCriterion> = RecordCodecBuilder.create { it.group(
|
||||||
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(BattleCountableCriterion::playerCtx),
|
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(BattleCountableCriterion::playerCtx),
|
||||||
Codec.STRING.listOf().optionalFieldOf("battle_types", listOf("any")).forGetter(BattleCountableCriterion::battleTypes),
|
Codec.STRING.listOf().optionalFieldOf("battle_types", listOf("any")).forGetter(BattleCountableCriterion::battleTypes),
|
||||||
|
|||||||
+2
-1
@@ -25,6 +25,7 @@ class CastPokeRodCriterionCondition(
|
|||||||
): SimpleCriterionCondition<CastPokeRodContext>(playerCtx) {
|
): SimpleCriterionCondition<CastPokeRodContext>(playerCtx) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<CastPokeRodCriterionCondition> = RecordCodecBuilder.create { it.group(
|
val CODEC: Codec<CastPokeRodCriterionCondition> = RecordCodecBuilder.create { it.group(
|
||||||
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(CastPokeRodCriterionCondition::playerCtx),
|
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(CastPokeRodCriterionCondition::playerCtx),
|
||||||
Codec.STRING.optionalFieldOf("baitId", "empty_bait").forGetter(CastPokeRodCriterionCondition::baitId)
|
Codec.STRING.optionalFieldOf("baitId", "empty_bait").forGetter(CastPokeRodCriterionCondition::baitId)
|
||||||
@@ -34,4 +35,4 @@ class CastPokeRodCriterionCondition(
|
|||||||
override fun matches(player: ServerPlayer, context: CastPokeRodContext): Boolean {
|
override fun matches(player: ServerPlayer, context: CastPokeRodContext): Boolean {
|
||||||
return (context.baitId == this.baitId.asIdentifierDefaultingNamespace() || this.baitId == "empty_bait")
|
return (context.baitId == this.baitId.asIdentifierDefaultingNamespace() || this.baitId == "empty_bait")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -31,6 +31,7 @@ class CaughtPokemonCriterion(
|
|||||||
): CountableCriterion<CountablePokemonTypeContext>(playerCtx, count) {
|
): CountableCriterion<CountablePokemonTypeContext>(playerCtx, count) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<CaughtPokemonCriterion> = RecordCodecBuilder.create { it.group(
|
val CODEC: Codec<CaughtPokemonCriterion> = RecordCodecBuilder.create { it.group(
|
||||||
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(CaughtPokemonCriterion::playerCtx),
|
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(CaughtPokemonCriterion::playerCtx),
|
||||||
Codec.STRING.optionalFieldOf("type", "any").forGetter(CaughtPokemonCriterion::type),
|
Codec.STRING.optionalFieldOf("type", "any").forGetter(CaughtPokemonCriterion::type),
|
||||||
@@ -42,4 +43,4 @@ class CaughtPokemonCriterion(
|
|||||||
override fun matches(player: ServerPlayer, context: CountablePokemonTypeContext): Boolean {
|
override fun matches(player: ServerPlayer, context: CountablePokemonTypeContext): Boolean {
|
||||||
return super.matches(player, context) && (context.type == type || type == "any")// && (context.species == species || species == "any")
|
return super.matches(player, context) && (context.type == type || type == "any")// && (context.species == species || species == "any")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
@@ -23,6 +23,7 @@ open class CountableCriterion<T : CountableContext>(
|
|||||||
): SimpleCriterionCondition<T>(playerCtx) {
|
): SimpleCriterionCondition<T>(playerCtx) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<CountableCriterion<CountableContext>> = RecordCodecBuilder.create { it.group(
|
val CODEC: Codec<CountableCriterion<CountableContext>> = RecordCodecBuilder.create { it.group(
|
||||||
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(CountableCriterion<CountableContext>::playerCtx),
|
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(CountableCriterion<CountableContext>::playerCtx),
|
||||||
Codec.INT.optionalFieldOf("count", 0).forGetter(CountableCriterion<CountableContext>::count)
|
Codec.INT.optionalFieldOf("count", 0).forGetter(CountableCriterion<CountableContext>::count)
|
||||||
|
|||||||
+1
@@ -26,6 +26,7 @@ class EvolvePokemonCriterion(
|
|||||||
): CountableCriterion<EvolvePokemonContext>(playerCtx, count) {
|
): CountableCriterion<EvolvePokemonContext>(playerCtx, count) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<EvolvePokemonCriterion> = RecordCodecBuilder.create { it.group(
|
val CODEC: Codec<EvolvePokemonCriterion> = RecordCodecBuilder.create { it.group(
|
||||||
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(EvolvePokemonCriterion::playerCtx),
|
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(EvolvePokemonCriterion::playerCtx),
|
||||||
Codec.STRING.optionalFieldOf("species", "any").forGetter(EvolvePokemonCriterion::species),
|
Codec.STRING.optionalFieldOf("species", "any").forGetter(EvolvePokemonCriterion::species),
|
||||||
|
|||||||
+2
-1
@@ -25,6 +25,7 @@ class LevelUpCriterion(
|
|||||||
): SimpleCriterionCondition<LevelUpContext>(playerCtx) {
|
): SimpleCriterionCondition<LevelUpContext>(playerCtx) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<LevelUpCriterion> = RecordCodecBuilder.create { it.group(
|
val CODEC: Codec<LevelUpCriterion> = RecordCodecBuilder.create { it.group(
|
||||||
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(LevelUpCriterion::playerCtx),
|
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(LevelUpCriterion::playerCtx),
|
||||||
Codec.INT.optionalFieldOf("level", 0).forGetter(LevelUpCriterion::level),
|
Codec.INT.optionalFieldOf("level", 0).forGetter(LevelUpCriterion::level),
|
||||||
@@ -42,4 +43,4 @@ class LevelUpCriterion(
|
|||||||
return level == context.level && evolutionCheck == evolved
|
return level == context.level && evolutionCheck == evolved
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+2
-1
@@ -24,6 +24,7 @@ class PartyCheckCriterion(
|
|||||||
): SimpleCriterionCondition<PlayerPartyStore>(playerCtx) {
|
): SimpleCriterionCondition<PlayerPartyStore>(playerCtx) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<PartyCheckCriterion> = RecordCodecBuilder.create { it.group(
|
val CODEC: Codec<PartyCheckCriterion> = RecordCodecBuilder.create { it.group(
|
||||||
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(PartyCheckCriterion::playerCtx),
|
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(PartyCheckCriterion::playerCtx),
|
||||||
ResourceLocation.CODEC.listOf().optionalFieldOf("party", listOf()).forGetter(PartyCheckCriterion::party)
|
ResourceLocation.CODEC.listOf().optionalFieldOf("party", listOf()).forGetter(PartyCheckCriterion::party)
|
||||||
@@ -47,4 +48,4 @@ class PartyCheckCriterion(
|
|||||||
}
|
}
|
||||||
return matches.containsAll(party) && matches.size == party.size
|
return matches.containsAll(party) && matches.size == party.size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
@@ -23,6 +23,7 @@ class PlantTumblestoneCriterion(
|
|||||||
): SimpleCriterionCondition<PlantTumblestoneContext>(playerCtx) {
|
): SimpleCriterionCondition<PlantTumblestoneContext>(playerCtx) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<PlantTumblestoneCriterion> = RecordCodecBuilder.create { it.group(
|
val CODEC: Codec<PlantTumblestoneCriterion> = RecordCodecBuilder.create { it.group(
|
||||||
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(PlantTumblestoneCriterion::playerCtx)
|
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(PlantTumblestoneCriterion::playerCtx)
|
||||||
).apply(it, ::PlantTumblestoneCriterion) }
|
).apply(it, ::PlantTumblestoneCriterion) }
|
||||||
|
|||||||
+2
-1
@@ -24,6 +24,7 @@ class PokemonCriterion(
|
|||||||
): SimpleCriterionCondition<Pokemon>(playerCtx) {
|
): SimpleCriterionCondition<Pokemon>(playerCtx) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<PokemonCriterion> = RecordCodecBuilder.create { it.group(
|
val CODEC: Codec<PokemonCriterion> = RecordCodecBuilder.create { it.group(
|
||||||
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(PokemonCriterion::playerCtx),
|
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(PokemonCriterion::playerCtx),
|
||||||
Codec.STRING.optionalFieldOf("species", "any").forGetter(PokemonCriterion::species),
|
Codec.STRING.optionalFieldOf("species", "any").forGetter(PokemonCriterion::species),
|
||||||
@@ -35,4 +36,4 @@ class PokemonCriterion(
|
|||||||
var speciesCheck = (species.equals(context.species.resourceIdentifier.path) || species.equals(context.species.resourceIdentifier.toString())) || species.equals("any")
|
var speciesCheck = (species.equals(context.species.resourceIdentifier.path) || species.equals(context.species.resourceIdentifier.toString())) || species.equals("any")
|
||||||
return speciesCheck && properties.matches(context)
|
return speciesCheck && properties.matches(context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -25,6 +25,7 @@ class PokemonInteractCriterion(
|
|||||||
val item: String
|
val item: String
|
||||||
): SimpleCriterionCondition<PokemonInteractContext>(playerCtx) {
|
): SimpleCriterionCondition<PokemonInteractContext>(playerCtx) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<PokemonInteractCriterion> = RecordCodecBuilder.create { it.group(
|
val CODEC: Codec<PokemonInteractCriterion> = RecordCodecBuilder.create { it.group(
|
||||||
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(PokemonInteractCriterion::playerCtx),
|
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(PokemonInteractCriterion::playerCtx),
|
||||||
Codec.STRING.optionalFieldOf("species", "any").forGetter(PokemonInteractCriterion::species),
|
Codec.STRING.optionalFieldOf("species", "any").forGetter(PokemonInteractCriterion::species),
|
||||||
@@ -35,4 +36,4 @@ class PokemonInteractCriterion(
|
|||||||
override fun matches(player: ServerPlayer, context: PokemonInteractContext): Boolean {
|
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")
|
return (context.species == this.species.asIdentifierDefaultingNamespace() || this.species == "any") && (context.item == this.item.asIdentifierDefaultingNamespace() || this.item == "any")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -26,6 +26,7 @@ class ReelInPokemonCriterionCondition(
|
|||||||
) : SimpleCriterionCondition<ReelInPokemonContext>(playerCtx) {
|
) : SimpleCriterionCondition<ReelInPokemonContext>(playerCtx) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<ReelInPokemonCriterionCondition> = RecordCodecBuilder.create { it.group(
|
val CODEC: Codec<ReelInPokemonCriterionCondition> = RecordCodecBuilder.create { it.group(
|
||||||
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter { it.playerCtx },
|
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter { it.playerCtx },
|
||||||
Codec.STRING.optionalFieldOf("species", "any").forGetter { it.species },
|
Codec.STRING.optionalFieldOf("species", "any").forGetter { it.species },
|
||||||
@@ -37,4 +38,4 @@ class ReelInPokemonCriterionCondition(
|
|||||||
return (context.species == this.species.asIdentifierDefaultingNamespace() || this.species == "any")
|
return (context.species == this.species.asIdentifierDefaultingNamespace() || this.species == "any")
|
||||||
&& (context.baitId == this.baitId.asIdentifierDefaultingNamespace() || this.baitId == "any" || this.baitId == "empty_bait")
|
&& (context.baitId == this.baitId.asIdentifierDefaultingNamespace() || this.baitId == "any" || this.baitId == "empty_bait")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
@@ -28,6 +28,7 @@ class TradePokemonCriterion(
|
|||||||
): SimpleCriterionCondition<TradePokemonContext>(playerCtx) {
|
): SimpleCriterionCondition<TradePokemonContext>(playerCtx) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<TradePokemonCriterion> = RecordCodecBuilder.create { it.group(
|
val CODEC: Codec<TradePokemonCriterion> = RecordCodecBuilder.create { it.group(
|
||||||
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(TradePokemonCriterion::playerCtx),
|
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(TradePokemonCriterion::playerCtx),
|
||||||
Codec.STRING.optionalFieldOf("traded", "any").forGetter(TradePokemonCriterion::traded),
|
Codec.STRING.optionalFieldOf("traded", "any").forGetter(TradePokemonCriterion::traded),
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ import net.minecraft.resources.ResourceKey
|
|||||||
|
|
||||||
object CobblemonEntitySubPredicates : PlatformRegistry<Registry<MapCodec<out EntitySubPredicate>>, ResourceKey<Registry<MapCodec<out EntitySubPredicate>>>, MapCodec<out EntitySubPredicate>>() {
|
object CobblemonEntitySubPredicates : PlatformRegistry<Registry<MapCodec<out EntitySubPredicate>>, ResourceKey<Registry<MapCodec<out EntitySubPredicate>>>, MapCodec<out EntitySubPredicate>>() {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val POKE_POBBER = this.create("poke_bobber", FishingBobberPredicate.CODEC)
|
val POKE_POBBER = this.create("poke_bobber", FishingBobberPredicate.CODEC)
|
||||||
|
|
||||||
override val registry: Registry<MapCodec<out EntitySubPredicate>> = BuiltInRegistries.ENTITY_SUB_PREDICATE_TYPE
|
override val registry: Registry<MapCodec<out EntitySubPredicate>> = BuiltInRegistries.ENTITY_SUB_PREDICATE_TYPE
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ class FishingBobberPredicate(val inOpenWater: Boolean) : EntitySubPredicate {
|
|||||||
return (entity as? PokeRodFishingBobberEntity)?.inOpenWater == this.inOpenWater
|
return (entity as? PokeRodFishingBobberEntity)?.inOpenWater == this.inOpenWater
|
||||||
}
|
}
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val CODEC: MapCodec<FishingBobberPredicate> = RecordCodecBuilder.mapCodec { instance ->
|
val CODEC: MapCodec<FishingBobberPredicate> = RecordCodecBuilder.mapCodec { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
Codec.BOOL.fieldOf("in_open_water").forGetter(FishingBobberPredicate::inOpenWater)
|
Codec.BOOL.fieldOf("in_open_water").forGetter(FishingBobberPredicate::inOpenWater)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ enum class Priority : StringRepresentable {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val CODEC: Codec<Priority> = StringRepresentable.fromEnum(Priority::values)
|
val CODEC: Codec<Priority> = StringRepresentable.fromEnum(Priority::values)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ open class Ability internal constructor(var template: AbilityTemplate, forced: B
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val CODEC: Codec<Ability> = RecordCodecBuilder.create {
|
val CODEC: Codec<Ability> = RecordCodecBuilder.create {
|
||||||
it.group(
|
it.group(
|
||||||
AbilityTemplate.CODEC.fieldOf(DataKeys.POKEMON_ABILITY_NAME).forGetter(Ability::template),
|
AbilityTemplate.CODEC.fieldOf(DataKeys.POKEMON_ABILITY_NAME).forGetter(Ability::template),
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class AbilityTemplate(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val CODEC: Codec<AbilityTemplate> = CodecUtils.createByStringCodec(
|
val CODEC: Codec<AbilityTemplate> = CodecUtils.createByStringCodec(
|
||||||
Abilities::getOrDummy,
|
Abilities::getOrDummy,
|
||||||
AbilityTemplate::name
|
AbilityTemplate::name
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ interface PotentialAbility {
|
|||||||
val type: PotentialAbilityType<*>
|
val type: PotentialAbilityType<*>
|
||||||
fun isSatisfiedBy(aspects: Set<String>): Boolean
|
fun isSatisfiedBy(aspects: Set<String>): Boolean
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val types = mutableListOf<PotentialAbilityType<*>>()
|
val types = mutableListOf<PotentialAbilityType<*>>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,5 +52,4 @@ open class CommonAbility(override val template: AbilityTemplate) : PotentialAbil
|
|||||||
override val priority = Priority.LOWEST
|
override val priority = Priority.LOWEST
|
||||||
override val type = CommonAbilityType
|
override val type = CommonAbilityType
|
||||||
override fun isSatisfiedBy(aspects: Set<String>) = true
|
override fun isSatisfiedBy(aspects: Set<String>) = true
|
||||||
}
|
}
|
||||||
|
|
||||||
+2
-1
@@ -26,8 +26,9 @@ class AttackHostileMobsTaskConfig : SingleTaskConfig {
|
|||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
return AttackHostileMobsTask.create()
|
return AttackHostileMobsTask.create()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<AttackHostileMobsTaskConfig> = Codec.unit(AttackHostileMobsTaskConfig())
|
val CODEC: Codec<AttackHostileMobsTaskConfig> = Codec.unit(AttackHostileMobsTaskConfig())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,6 +99,7 @@ enum class Apricorn : StringRepresentable {
|
|||||||
override fun getSerializedName() = this.name.lowercase()
|
override fun getSerializedName() = this.name.lowercase()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<Apricorn> = StringRepresentable.fromValues(::values)
|
val CODEC: Codec<Apricorn> = StringRepresentable.fromValues(::values)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -24,6 +24,7 @@ class AllBiomeCondition(val minGroveSize: Int, val maxGroveSize: Int) : BerrySpa
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val ID = cobblemonResource("all_biome")
|
val ID = cobblemonResource("all_biome")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -26,6 +26,7 @@ class PreferredBiomeCondition(val minGroveSize: Int, val maxGroveSize: Int) : Be
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val ID = cobblemonResource("preferred_biome")
|
val ID = cobblemonResource("preferred_biome")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
@@ -24,6 +24,7 @@ class SpecificBiomeCondition : BerrySpawnCondition {
|
|||||||
override fun getGroveSize(random: RandomSource) = random.nextIntBetweenInclusive(minGroveSize, maxGroveSize)
|
override fun getGroveSize(random: RandomSource) = random.nextIntBetweenInclusive(minGroveSize, maxGroveSize)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val ID = cobblemonResource("specific_biome")
|
val ID = cobblemonResource("specific_biome")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,6 +27,7 @@ enum class Flavour(val colour: Int): StringRepresentable {
|
|||||||
|
|
||||||
override fun getSerializedName() = name
|
override fun getSerializedName() = name
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC = StringRepresentable.fromEnum<Flavour> { Flavour.entries.toTypedArray() }
|
val CODEC = StringRepresentable.fromEnum<Flavour> { Flavour.entries.toTypedArray() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,7 @@ data class Food(
|
|||||||
val saturation: Float = 0f,
|
val saturation: Float = 0f,
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<Food> = RecordCodecBuilder.create { builder ->
|
val CODEC: Codec<Food> = RecordCodecBuilder.create { builder ->
|
||||||
builder.group(
|
builder.group(
|
||||||
Codec.INT.optionalFieldOf("hunger", 0).forGetter { it.hunger },
|
Codec.INT.optionalFieldOf("hunger", 0).forGetter { it.hunger },
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ data class Seasoning(
|
|||||||
val mobEffects: List<SerializableMobEffectInstance>? = null
|
val mobEffects: List<SerializableMobEffectInstance>? = null
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<Seasoning> = RecordCodecBuilder.create { builder ->
|
val CODEC: Codec<Seasoning> = RecordCodecBuilder.create { builder ->
|
||||||
builder.group(
|
builder.group(
|
||||||
ITEM_REGISTRY_LIKE_CODEC.fieldOf("ingredient").forGetter { it.ingredient },
|
ITEM_REGISTRY_LIKE_CODEC.fieldOf("ingredient").forGetter { it.ingredient },
|
||||||
@@ -58,6 +59,7 @@ data class Seasoning(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmField
|
||||||
val STREAM_CODEC: StreamCodec<ByteBuf, Seasoning> = ByteBufCodecs.fromCodec(CODEC)
|
val STREAM_CODEC: StreamCodec<ByteBuf, Seasoning> = ByteBufCodecs.fromCodec(CODEC)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -31,6 +31,7 @@ data class SerializableMobEffectInstance(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<SerializableMobEffectInstance> = RecordCodecBuilder.create { builder ->
|
val CODEC: Codec<SerializableMobEffectInstance> = RecordCodecBuilder.create { builder ->
|
||||||
builder.group(
|
builder.group(
|
||||||
ResourceLocation.CODEC.fieldOf("effect").forGetter { it.effect },
|
ResourceLocation.CODEC.fieldOf("effect").forGetter { it.effect },
|
||||||
@@ -42,4 +43,4 @@ data class SerializableMobEffectInstance(
|
|||||||
).apply(builder, ::SerializableMobEffectInstance)
|
).apply(builder, ::SerializableMobEffectInstance)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,9 +26,11 @@ class Dialogue(
|
|||||||
val initializationAction: DialogueAction = FunctionDialogueAction { _, _ -> }
|
val initializationAction: DialogueAction = FunctionDialogueAction { _, _ -> }
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val DEFAULT_BACKGROUND = cobblemonResource("textures/gui/dialogue/dialogue_box.png")
|
val DEFAULT_BACKGROUND = cobblemonResource("textures/gui/dialogue/dialogue_box.png")
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
|
@JvmStatic
|
||||||
fun of(
|
fun of(
|
||||||
pages: Iterable<DialoguePage>,
|
pages: Iterable<DialoguePage>,
|
||||||
background: ResourceLocation = DEFAULT_BACKGROUND,
|
background: ResourceLocation = DEFAULT_BACKGROUND,
|
||||||
@@ -44,6 +46,7 @@ class Dialogue(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
|
@JvmStatic
|
||||||
fun of(
|
fun of(
|
||||||
pages: Iterable<DialoguePage>,
|
pages: Iterable<DialoguePage>,
|
||||||
background: ResourceLocation = DEFAULT_BACKGROUND,
|
background: ResourceLocation = DEFAULT_BACKGROUND,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import com.cobblemon.mod.common.util.resolve
|
|||||||
*/
|
*/
|
||||||
interface DialogueAction {
|
interface DialogueAction {
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val types = mutableMapOf<String, Class<out DialogueAction>>()
|
val types = mutableMapOf<String, Class<out DialogueAction>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ sealed interface DialogueFaceProvider {
|
|||||||
val isLeftSide: Boolean
|
val isLeftSide: Boolean
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val types = mutableMapOf(
|
val types = mutableMapOf(
|
||||||
"artificial" to ArtificialDialogueFaceProvider::class.java,
|
"artificial" to ArtificialDialogueFaceProvider::class.java,
|
||||||
"player" to PlayerDialogueFaceProvider::class.java,
|
"player" to PlayerDialogueFaceProvider::class.java,
|
||||||
|
|||||||
@@ -58,4 +58,9 @@ object DialogueManager {
|
|||||||
DialogueClosedPacket(activeDialogue.dialogueId).sendToPlayer(playerEntity)
|
DialogueClosedPacket(activeDialogue.dialogueId).sendToPlayer(playerEntity)
|
||||||
activeDialogues.remove(playerEntity.uuid)
|
activeDialogues.remove(playerEntity.uuid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun getDialogue(playerEntity: ServerPlayer): ActiveDialogue? {
|
||||||
|
return activeDialogues[playerEntity.uuid]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -38,6 +38,7 @@ class DialoguePage(
|
|||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
|
@JvmStatic
|
||||||
fun of(
|
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. */
|
/** 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 = "",
|
id: String = "",
|
||||||
@@ -78,4 +79,4 @@ class DialoguePage(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,7 @@ import com.cobblemon.mod.common.util.resolveBoolean
|
|||||||
*/
|
*/
|
||||||
interface DialoguePredicate {
|
interface DialoguePredicate {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val types = mutableMapOf<String, Class<out DialoguePredicate>>()
|
val types = mutableMapOf<String, Class<out DialoguePredicate>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import net.minecraft.network.chat.MutableComponent
|
|||||||
*/
|
*/
|
||||||
interface DialogueText {
|
interface DialogueText {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val types = mutableMapOf<String, Class<out DialogueText>>(
|
val types = mutableMapOf<String, Class<out DialogueText>>(
|
||||||
"expression" to ExpressionLikeDialogueText::class.java,
|
"expression" to ExpressionLikeDialogueText::class.java,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ interface DropEntry {
|
|||||||
companion object {
|
companion object {
|
||||||
val entryTypes = mutableMapOf<String, Class<out DropEntry>>()
|
val entryTypes = mutableMapOf<String, Class<out DropEntry>>()
|
||||||
var defaultType: Class<out DropEntry>? = null
|
var defaultType: Class<out DropEntry>? = null
|
||||||
|
@JvmStatic
|
||||||
fun getByName(name: String) = entryTypes[name]
|
fun getByName(name: String) = entryTypes[name]
|
||||||
|
@JvmOverloads
|
||||||
|
@JvmStatic
|
||||||
fun <T : DropEntry> register(name: String, clazz: Class<T>, isDefault: Boolean = false) {
|
fun <T : DropEntry> register(name: String, clazz: Class<T>, isDefault: Boolean = false) {
|
||||||
entryTypes[name] = clazz
|
entryTypes[name] = clazz
|
||||||
if (isDefault) {
|
if (isDefault) {
|
||||||
|
|||||||
@@ -63,13 +63,16 @@ interface EntityEffect {
|
|||||||
register(TransformEffect.ID, TransformEffect::class, ::TransformEffect)
|
register(TransformEffect.ID, TransformEffect::class, ::TransformEffect)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun <T : EntityEffect> register(id: String, type: KClass<T>, default: () -> T) {
|
fun <T : EntityEffect> register(id: String, type: KClass<T>, default: () -> T) {
|
||||||
effects[id] = type
|
effects[id] = type
|
||||||
defaults[id] = default
|
defaults[id] = default
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun createDefault(id: String): EntityEffect? = defaults[id]?.invoke()
|
fun createDefault(id: String): EntityEffect? = defaults[id]?.invoke()
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun loadFromNbt(nbt: CompoundTag, registryLookup: HolderLookup.Provider): EntityEffect? {
|
fun loadFromNbt(nbt: CompoundTag, registryLookup: HolderLookup.Provider): EntityEffect? {
|
||||||
if (nbt.contains(DataKeys.ENTITY_EFFECT_ID)) {
|
if (nbt.contains(DataKeys.ENTITY_EFFECT_ID)) {
|
||||||
val id = nbt.getString(DataKeys.ENTITY_EFFECT_ID)
|
val id = nbt.getString(DataKeys.ENTITY_EFFECT_ID)
|
||||||
@@ -100,4 +103,4 @@ interface MocKEffect : PhysicalEffect {
|
|||||||
|
|
||||||
val exposedBall: PokeBall?
|
val exposedBall: PokeBall?
|
||||||
get() = this.mock.pokeball?.let { PokeBalls.getPokeBall(it.asIdentifierDefaultingNamespace()) }
|
get() = this.mock.pokeball?.let { PokeBalls.getPokeBall(it.asIdentifierDefaultingNamespace()) }
|
||||||
}
|
}
|
||||||
+5
-5
@@ -8,12 +8,10 @@
|
|||||||
|
|
||||||
package com.cobblemon.mod.common.api.events.battles.instruction
|
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.bedrockk.molang.runtime.value.StringValue
|
||||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
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.battles.model.actor.ActorType
|
||||||
import com.cobblemon.mod.common.api.events.battles.BattleEvent
|
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.battles.pokemon.BattlePokemon
|
||||||
import com.cobblemon.mod.common.util.asArrayValue
|
import com.cobblemon.mod.common.util.asArrayValue
|
||||||
|
|
||||||
@@ -25,7 +23,8 @@ import com.cobblemon.mod.common.util.asArrayValue
|
|||||||
data class FormeChangeEvent(
|
data class FormeChangeEvent(
|
||||||
override val battle: PokemonBattle,
|
override val battle: PokemonBattle,
|
||||||
val pokemon: BattlePokemon,
|
val pokemon: BattlePokemon,
|
||||||
val formeName: String
|
val formeName: String,
|
||||||
|
val pnx: String
|
||||||
) : BattleEvent {
|
) : BattleEvent {
|
||||||
val context = mutableMapOf(
|
val context = mutableMapOf(
|
||||||
"battle" to battle.struct,
|
"battle" to battle.struct,
|
||||||
@@ -33,6 +32,7 @@ data class FormeChangeEvent(
|
|||||||
"npcs" to battle.actors.filter { it.type == ActorType.NPC }.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 },
|
"wild_pokemon" to battle.actors.filter { it.type == ActorType.WILD }.asArrayValue { it.struct },
|
||||||
"pokemon" to pokemon.struct,
|
"pokemon" to pokemon.struct,
|
||||||
"forme" to StringValue(formeName)
|
"forme" to StringValue(formeName),
|
||||||
|
"pnx" to StringValue(pnx)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -35,6 +35,7 @@ class SpawnBait(
|
|||||||
constructor(type: ResourceLocation, subcategory: Optional<ResourceLocation>, chance: Double, value: Double) : this(type, subcategory.orElse(null), chance, value)
|
constructor(type: ResourceLocation, subcategory: Optional<ResourceLocation>, chance: Double, value: Double) : this(type, subcategory.orElse(null), chance, value)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC = RecordCodecBuilder.create<Effect> { instance ->
|
val CODEC = RecordCodecBuilder.create<Effect> { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
ResourceLocation.CODEC.fieldOf("type").forGetter { it.type },
|
ResourceLocation.CODEC.fieldOf("type").forGetter { it.type },
|
||||||
@@ -47,6 +48,7 @@ class SpawnBait(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC = RecordCodecBuilder.create<SpawnBait> { instance ->
|
val CODEC = RecordCodecBuilder.create<SpawnBait> { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
ITEM_REGISTRY_LIKE_CODEC.fieldOf("item").forGetter { it.item },
|
ITEM_REGISTRY_LIKE_CODEC.fieldOf("item").forGetter { it.item },
|
||||||
@@ -54,6 +56,7 @@ class SpawnBait(
|
|||||||
).apply(instance, ::SpawnBait)
|
).apply(instance, ::SpawnBait)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmField
|
||||||
val STREAM_CODEC = ByteBufCodecs.fromCodec(CODEC)
|
val STREAM_CODEC = ByteBufCodecs.fromCodec(CODEC)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,6 +99,4 @@ class SpawnBait(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -223,6 +223,7 @@ abstract class RequestManager<T : ServerPlayerActionRequest> {
|
|||||||
companion object {
|
companion object {
|
||||||
private val managers = mutableListOf<RequestManager<*>>()
|
private val managers = mutableListOf<RequestManager<*>>()
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun register(manager: RequestManager<*>) = managers.add(manager)
|
fun register(manager: RequestManager<*>) = managers.add(manager)
|
||||||
|
|
||||||
fun onLogoff(player: ServerPlayer) = managers.forEach { it.onLogoff(player) }
|
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.
|
* While this can be used in custom data scenarios this functions most "game-like" if the Pokémon only has 2 common abilities.
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val COMMON_ABILITY: AbilityChanger<CommonAbility> = AbilityTypeChanger(CommonAbilityType) { other -> other == CommonAbilityType }
|
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.
|
* While this can be used in custom data scenarios this functions most "game-like" if the Pokémon only has 1 hidden ability.
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val HIDDEN_ABILITY: AbilityChanger<HiddenAbility> = AbilityTypeChanger(HiddenAbilityType) { other -> other == CommonAbilityType || other == HiddenAbilityType }
|
val HIDDEN_ABILITY: AbilityChanger<HiddenAbility> = AbilityTypeChanger(HiddenAbilityType) { other -> other == CommonAbilityType || other == HiddenAbilityType }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,10 +35,11 @@ interface ExpressionLike {
|
|||||||
fun resolveObject(runtime: MoLangRuntime) = resolve(runtime) as ObjectValue<*>
|
fun resolveObject(runtime: MoLangRuntime) = resolve(runtime) as ObjectValue<*>
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<ExpressionLike> = Codec.STRING.xmap({
|
val CODEC: Codec<ExpressionLike> = Codec.STRING.xmap({
|
||||||
it.asExpressionLike()
|
it.asExpressionLike()
|
||||||
}) {
|
}) {
|
||||||
it.getString()
|
it.getString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ class BenchedMoves : Iterable<BenchedMove> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val CODEC: Codec<BenchedMoves> = Codec.list(BenchedMove.CODEC)
|
val CODEC: Codec<BenchedMoves> = Codec.list(BenchedMove.CODEC)
|
||||||
.xmap(
|
.xmap(
|
||||||
{ moveList ->
|
{ moveList ->
|
||||||
@@ -144,6 +144,7 @@ data class BenchedMove(val moveTemplate: MoveTemplate, val ppRaisedStages: Int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
fun loadFromNBT(nbt: CompoundTag): BenchedMove {
|
fun loadFromNBT(nbt: CompoundTag): BenchedMove {
|
||||||
val name = nbt.getString(DataKeys.POKEMON_MOVESET_MOVENAME)
|
val name = nbt.getString(DataKeys.POKEMON_MOVESET_MOVENAME)
|
||||||
return BenchedMove(
|
return BenchedMove(
|
||||||
@@ -152,6 +153,7 @@ data class BenchedMove(val moveTemplate: MoveTemplate, val ppRaisedStages: Int)
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun loadFromJSON(json: JsonObject): BenchedMove {
|
fun loadFromJSON(json: JsonObject): BenchedMove {
|
||||||
val name = json.get(DataKeys.POKEMON_MOVESET_MOVENAME).asString
|
val name = json.get(DataKeys.POKEMON_MOVESET_MOVENAME).asString
|
||||||
return BenchedMove(
|
return BenchedMove(
|
||||||
@@ -160,6 +162,7 @@ data class BenchedMove(val moveTemplate: MoveTemplate, val ppRaisedStages: Int)
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun loadFromBuffer(buffer: RegistryFriendlyByteBuf): BenchedMove {
|
fun loadFromBuffer(buffer: RegistryFriendlyByteBuf): BenchedMove {
|
||||||
val name = buffer.readString()
|
val name = buffer.readString()
|
||||||
return BenchedMove(
|
return BenchedMove(
|
||||||
@@ -168,7 +171,7 @@ data class BenchedMove(val moveTemplate: MoveTemplate, val ppRaisedStages: Int)
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val CODEC: Codec<BenchedMove> = RecordCodecBuilder.create { it.group(
|
val CODEC: Codec<BenchedMove> = RecordCodecBuilder.create { it.group(
|
||||||
MoveTemplate.BY_STRING_CODEC.fieldOf(DataKeys.POKEMON_MOVESET_MOVENAME).forGetter(BenchedMove::moveTemplate),
|
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)
|
Codec.intRange(0, 3).fieldOf(DataKeys.POKEMON_MOVESET_RAISED_PP_STAGES).forGetter(BenchedMove::ppRaisedStages)
|
||||||
|
|||||||
@@ -149,12 +149,14 @@ open class Move(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
fun loadFromNBT(nbt: CompoundTag): Move {
|
fun loadFromNBT(nbt: CompoundTag): Move {
|
||||||
val moveName = nbt.getString(DataKeys.POKEMON_MOVESET_MOVENAME)
|
val moveName = nbt.getString(DataKeys.POKEMON_MOVESET_MOVENAME)
|
||||||
val template = Moves.getByNameOrDummy(moveName)
|
val template = Moves.getByNameOrDummy(moveName)
|
||||||
return template.create(nbt.getInt(DataKeys.POKEMON_MOVESET_MOVEPP), nbt.getInt(DataKeys.POKEMON_MOVESET_RAISED_PP_STAGES))
|
return template.create(nbt.getInt(DataKeys.POKEMON_MOVESET_MOVEPP), nbt.getInt(DataKeys.POKEMON_MOVESET_RAISED_PP_STAGES))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun loadFromJSON(json: JsonObject): Move {
|
fun loadFromJSON(json: JsonObject): Move {
|
||||||
val moveName = json.get(DataKeys.POKEMON_MOVESET_MOVENAME).asString
|
val moveName = json.get(DataKeys.POKEMON_MOVESET_MOVENAME).asString
|
||||||
val template = Moves.getByNameOrDummy(moveName)
|
val template = Moves.getByNameOrDummy(moveName)
|
||||||
@@ -163,6 +165,7 @@ open class Move(
|
|||||||
return Move(template, currentPp, raisedPpStages)
|
return Move(template, currentPp, raisedPpStages)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun loadFromBuffer(buffer: RegistryFriendlyByteBuf): Move {
|
fun loadFromBuffer(buffer: RegistryFriendlyByteBuf): Move {
|
||||||
val moveName = buffer.readString()
|
val moveName = buffer.readString()
|
||||||
val currentPp = buffer.readSizedInt(IntSize.U_BYTE)
|
val currentPp = buffer.readSizedInt(IntSize.U_BYTE)
|
||||||
@@ -171,7 +174,7 @@ open class Move(
|
|||||||
return template.create(currentPp, raisedPpStages)
|
return template.create(currentPp, raisedPpStages)
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val CODEC: Codec<Move> = RecordCodecBuilder.create { it.group(
|
val CODEC: Codec<Move> = RecordCodecBuilder.create { it.group(
|
||||||
MoveTemplate.BY_STRING_CODEC.fieldOf(DataKeys.POKEMON_MOVESET_MOVENAME).forGetter(Move::template),
|
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),
|
Codec.intRange(0, Int.MAX_VALUE).fieldOf(DataKeys.POKEMON_MOVESET_MOVEPP).forGetter(Move::currentPp),
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ class MoveSet : Iterable<Move> {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val MOVE_COUNT = 4
|
const val MOVE_COUNT = 4
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val CODEC: Codec<MoveSet> = Codec.list(Move.CODEC, 0, MOVE_COUNT)
|
val CODEC: Codec<MoveSet> = Codec.list(Move.CODEC, 0, MOVE_COUNT)
|
||||||
.xmap(
|
.xmap(
|
||||||
{ moveList ->
|
{ moveList ->
|
||||||
|
|||||||
@@ -90,9 +90,10 @@ open class MoveTemplate(
|
|||||||
)
|
)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
fun dummy(name: String) = Dummy(name)
|
fun dummy(name: String) = Dummy(name)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val BY_STRING_CODEC: Codec<MoveTemplate> = CodecUtils.createByStringCodec(
|
val BY_STRING_CODEC: Codec<MoveTemplate> = CodecUtils.createByStringCodec(
|
||||||
Moves::getByNameOrDummy,
|
Moves::getByNameOrDummy,
|
||||||
MoveTemplate::name
|
MoveTemplate::name
|
||||||
@@ -157,4 +158,4 @@ open class MoveTemplate(
|
|||||||
}
|
}
|
||||||
return this.elementalType
|
return this.elementalType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -32,6 +32,7 @@ class ActionEffectTimeline(
|
|||||||
val condition: ExpressionLike = "true".asExpressionLike()
|
val condition: ExpressionLike = "true".asExpressionLike()
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val NONE = ActionEffectTimeline()
|
val NONE = ActionEffectTimeline()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,4 +99,4 @@ interface EntityProvider {
|
|||||||
// val sound: ResourceLocation? = null,
|
// val sound: ResourceLocation? = null,
|
||||||
// val animation: List<AnimationWithMoments> = listOf(),
|
// val animation: List<AnimationWithMoments> = listOf(),
|
||||||
// val effects: List<ActionEffect> = listOf()
|
// val effects: List<ActionEffect> = listOf()
|
||||||
//)
|
//)
|
||||||
+3
-1
@@ -21,8 +21,10 @@ import java.util.concurrent.CompletableFuture
|
|||||||
*/
|
*/
|
||||||
interface ActionEffectKeyframe {
|
interface ActionEffectKeyframe {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val types = mutableMapOf<String, Class<out ActionEffectKeyframe>>()
|
val types = mutableMapOf<String, Class<out ActionEffectKeyframe>>()
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
inline fun <reified T : ActionEffectKeyframe> register(type: String) {
|
inline fun <reified T : ActionEffectKeyframe> register(type: String) {
|
||||||
types[type] = T::class.java
|
types[type] = T::class.java
|
||||||
}
|
}
|
||||||
@@ -31,4 +33,4 @@ interface ActionEffectKeyframe {
|
|||||||
fun play(context: ActionEffectContext): CompletableFuture<Unit>
|
fun play(context: ActionEffectContext): CompletableFuture<Unit>
|
||||||
fun interrupt(context: ActionEffectContext) {}
|
fun interrupt(context: ActionEffectContext) {}
|
||||||
fun skip(): CompletableFuture<Unit> = CompletableFuture.completedFuture(Unit)
|
fun skip(): CompletableFuture<Unit> = CompletableFuture.completedFuture(Unit)
|
||||||
}
|
}
|
||||||
@@ -32,4 +32,4 @@ enum class MulchVariant(val duration: Int = -1) : StringRepresentable {
|
|||||||
companion object {
|
companion object {
|
||||||
const val GROWTH_TIME_MULTIPLIER = 0.5
|
const val GROWTH_TIME_MULTIPLIER = 0.5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,6 +109,7 @@ object NPCClasses : JsonDataRegistry<NPCClass> {
|
|||||||
* @param name The path of the NPC class asset.
|
* @param name The path of the NPC class asset.
|
||||||
* @return The [NPCClass] if existing.
|
* @return The [NPCClass] if existing.
|
||||||
*/
|
*/
|
||||||
|
@JvmStatic
|
||||||
fun getByName(name: String) = this.getByIdentifier(cobblemonResource(name))
|
fun getByName(name: String) = this.getByIdentifier(cobblemonResource(name))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import net.minecraft.server.level.ServerPlayer
|
|||||||
*/
|
*/
|
||||||
interface NPCPartyProvider {
|
interface NPCPartyProvider {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val types = mutableMapOf<String, (String) -> NPCPartyProvider>(
|
val types = mutableMapOf<String, (String) -> NPCPartyProvider>(
|
||||||
SimplePartyProvider.TYPE to { SimplePartyProvider() },
|
SimplePartyProvider.TYPE to { SimplePartyProvider() },
|
||||||
PoolPartyProvider.TYPE to { PoolPartyProvider() },
|
PoolPartyProvider.TYPE to { PoolPartyProvider() },
|
||||||
|
|||||||
+1
@@ -34,6 +34,7 @@ interface NPCInteractConfiguration {
|
|||||||
companion object {
|
companion object {
|
||||||
val types = mutableMapOf<String, NPCInteractConfigurationType<out NPCInteractConfiguration>>()
|
val types = mutableMapOf<String, NPCInteractConfigurationType<out NPCInteractConfiguration>>()
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun register(type: String, displayName: MutableComponent, clazz: Class<out NPCInteractConfiguration>) {
|
fun register(type: String, displayName: MutableComponent, clazz: Class<out NPCInteractConfiguration>) {
|
||||||
types[type] = NPCInteractConfigurationType(displayName, clazz)
|
types[type] = NPCInteractConfigurationType(displayName, clazz)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -34,6 +34,7 @@ interface NPCVariationProvider {
|
|||||||
"random" to RandomNPCVariationProvider::class.java
|
"random" to RandomNPCVariationProvider::class.java
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun register(type: String, clazz: Class<out NPCVariationProvider>) {
|
fun register(type: String, clazz: Class<out NPCVariationProvider>) {
|
||||||
types[type] = clazz
|
types[type] = clazz
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -23,8 +23,11 @@ import kotlin.math.sign
|
|||||||
open class OrientationController(val entity: LivingEntity) {
|
open class OrientationController(val entity: LivingEntity) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val FORWARDS: Vector3f = Vector3f(0.0f, 0.0f, -1.0f)
|
val FORWARDS: Vector3f = Vector3f(0.0f, 0.0f, -1.0f)
|
||||||
|
@JvmField
|
||||||
val UP: Vector3f = Vector3f(0.0f, 1.0f, 0.0f)
|
val UP: Vector3f = Vector3f(0.0f, 1.0f, 0.0f)
|
||||||
|
@JvmField
|
||||||
val LEFT: Vector3f = Vector3f(-1.0f, 0.0f, 0.0f)
|
val LEFT: Vector3f = Vector3f(-1.0f, 0.0f, 0.0f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,4 +132,4 @@ open class OrientationController(val entity: LivingEntity) {
|
|||||||
return@updateOrientation Matrix3f().set(resultQuat)
|
return@updateOrientation Matrix3f().set(resultQuat)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,7 @@ enum class PermissionLevel(val numericalValue: Int) {
|
|||||||
ALL_COMMANDS(4);
|
ALL_COMMANDS(4);
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
fun byNumericValue(value: Int): PermissionLevel {
|
fun byNumericValue(value: Int): PermissionLevel {
|
||||||
return entries.first { it.numericalValue == value }
|
return entries.first { it.numericalValue == value }
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -23,6 +23,8 @@ data class CaptureContext(
|
|||||||
* @param critical If the capture is a critical capture, defaults to false.
|
* @param critical If the capture is a critical capture, defaults to false.
|
||||||
* @return The generated [CaptureContext].
|
* @return The generated [CaptureContext].
|
||||||
*/
|
*/
|
||||||
|
@JvmOverloads
|
||||||
|
@JvmStatic
|
||||||
fun successful(critical: Boolean = false): CaptureContext {
|
fun successful(critical: Boolean = false): CaptureContext {
|
||||||
if (critical) {
|
if (critical) {
|
||||||
return CaptureContext(numberOfShakes = 1, isSuccessfulCapture = true, isCriticalCapture = true)
|
return CaptureContext(numberOfShakes = 1, isSuccessfulCapture = true, isCriticalCapture = true)
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import net.minecraft.network.RegistryFriendlyByteBuf
|
|||||||
*/
|
*/
|
||||||
class FormDexRecord {
|
class FormDexRecord {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<FormDexRecord> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<FormDexRecord> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
ListCodec(Codec.STRING, 0, 3).fieldOf("genders").forGetter { it.genders.map { it.name } },
|
ListCodec(Codec.STRING, 0, 3).fieldOf("genders").forGetter { it.genders.map { it.name } },
|
||||||
|
|||||||
@@ -26,10 +26,11 @@ enum class PokedexEntryProgress : StringRepresentable, Comparable<PokedexEntryPr
|
|||||||
|
|
||||||
override fun getSerializedName() = this.name
|
override fun getSerializedName() = this.name
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<PokedexEntryProgress> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<PokedexEntryProgress> = RecordCodecBuilder.create { instance ->
|
||||||
instance.map ({
|
instance.map ({
|
||||||
PokedexEntryProgress.valueOf(it)
|
PokedexEntryProgress.valueOf(it)
|
||||||
}, PrimitiveCodec.STRING.fieldOf("name").forGetter { it.name })
|
}, PrimitiveCodec.STRING.fieldOf("name").forGetter { it.name })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,6 +70,7 @@ class PokedexManager(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC = RecordCodecBuilder.create<PokedexManager> { instance ->
|
val CODEC = RecordCodecBuilder.create<PokedexManager> { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("uuid").forGetter { it.uuid.toString() },
|
PrimitiveCodec.STRING.fieldOf("uuid").forGetter { it.uuid.toString() },
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import net.minecraft.resources.ResourceLocation
|
|||||||
*/
|
*/
|
||||||
class SpeciesDexRecord {
|
class SpeciesDexRecord {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<SpeciesDexRecord> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<SpeciesDexRecord> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
ListCodec(PrimitiveCodec.STRING, 0, 512).fieldOf("aspects").forGetter { it.aspects.toList() },
|
ListCodec(PrimitiveCodec.STRING, 0, 512).fieldOf("aspects").forGetter { it.aspects.toList() },
|
||||||
|
|||||||
@@ -76,7 +76,9 @@ class AggregatePokedexDef(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val ID = cobblemonResource("aggregate_pokedex_def")
|
val ID = cobblemonResource("aggregate_pokedex_def")
|
||||||
|
@JvmField
|
||||||
val CODEC: MapCodec<AggregatePokedexDef> = RecordCodecBuilder.mapCodec { instance ->
|
val CODEC: MapCodec<AggregatePokedexDef> = RecordCodecBuilder.mapCodec { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
ResourceLocation.CODEC.fieldOf("id").forGetter { it.id },
|
ResourceLocation.CODEC.fieldOf("id").forGetter { it.id },
|
||||||
|
|||||||
@@ -34,9 +34,12 @@ abstract class PokedexDef: ClientDataSynchronizer<PokedexDef> {
|
|||||||
abstract fun getEntries(): List<PokedexEntry>
|
abstract fun getEntries(): List<PokedexEntry>
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<PokedexDef> = ResourceLocation.CODEC.dispatch("type", PokedexDef::typeId, PokedexDef::getCodecById)
|
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)
|
val PACKET_CODEC: StreamCodec<ByteBuf, PokedexDef> = ResourceLocation.STREAM_CODEC.dispatch({ it.typeId }, ::getPacketCodecById)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun getPacketCodecById(id: ResourceLocation): StreamCodec<ByteBuf, out PokedexDef> {
|
fun getPacketCodecById(id: ResourceLocation): StreamCodec<ByteBuf, out PokedexDef> {
|
||||||
return when (id) {
|
return when (id) {
|
||||||
SimplePokedexDef.ID -> SimplePokedexDef.PACKET_CODEC
|
SimplePokedexDef.ID -> SimplePokedexDef.PACKET_CODEC
|
||||||
@@ -45,6 +48,7 @@ abstract class PokedexDef: ClientDataSynchronizer<PokedexDef> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun getCodecById(id: ResourceLocation): MapCodec<out PokedexDef> {
|
fun getCodecById(id: ResourceLocation): MapCodec<out PokedexDef> {
|
||||||
return when (id) {
|
return when (id) {
|
||||||
SimplePokedexDef.ID -> SimplePokedexDef.CODEC
|
SimplePokedexDef.ID -> SimplePokedexDef.CODEC
|
||||||
|
|||||||
@@ -64,7 +64,9 @@ class SimplePokedexDef(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val ID = cobblemonResource("simple_pokedex_def")
|
val ID = cobblemonResource("simple_pokedex_def")
|
||||||
|
@JvmField
|
||||||
val CODEC: MapCodec<SimplePokedexDef> = RecordCodecBuilder.mapCodec { instance ->
|
val CODEC: MapCodec<SimplePokedexDef> = RecordCodecBuilder.mapCodec { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
ResourceLocation.CODEC.fieldOf("id").forGetter { it.id },
|
ResourceLocation.CODEC.fieldOf("id").forGetter { it.id },
|
||||||
@@ -78,6 +80,7 @@ class SimplePokedexDef(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmField
|
||||||
val PACKET_CODEC: StreamCodec<ByteBuf, SimplePokedexDef> = StreamCodec.composite(
|
val PACKET_CODEC: StreamCodec<ByteBuf, SimplePokedexDef> = StreamCodec.composite(
|
||||||
ResourceLocation.STREAM_CODEC, SimplePokedexDef::id,
|
ResourceLocation.STREAM_CODEC, SimplePokedexDef::id,
|
||||||
ByteBufCodecs.INT, SimplePokedexDef::sortOrder,
|
ByteBufCodecs.INT, SimplePokedexDef::sortOrder,
|
||||||
|
|||||||
@@ -82,13 +82,13 @@ import kotlin.jvm.optionals.getOrNull
|
|||||||
open class PokemonProperties {
|
open class PokemonProperties {
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val CODEC: Codec<PokemonProperties> = Codec.STRING.xmap(
|
val CODEC: Codec<PokemonProperties> = Codec.STRING.xmap(
|
||||||
{ parse(it) },
|
{ parse(it) },
|
||||||
{ it.asString() }
|
{ it.asString() }
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val CUSTOM_PROPERTIES_CODEC: Codec<MutableList<CustomPokemonProperty>> = Codec.list(Codec.STRING)
|
val CUSTOM_PROPERTIES_CODEC: Codec<MutableList<CustomPokemonProperty>> = Codec.list(Codec.STRING)
|
||||||
.xmap(
|
.xmap(
|
||||||
{ string -> parse(string.joinToString(" ")).customProperties },
|
{ string -> parse(string.joinToString(" ")).customProperties },
|
||||||
@@ -96,6 +96,7 @@ open class PokemonProperties {
|
|||||||
)
|
)
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
|
@JvmStatic
|
||||||
fun parse(string: String, delimiter: String = " ", assigner: String = "="): PokemonProperties {
|
fun parse(string: String, delimiter: String = " ", assigner: String = "="): PokemonProperties {
|
||||||
val props = PokemonProperties()
|
val props = PokemonProperties()
|
||||||
props.originalString = string
|
props.originalString = string
|
||||||
|
|||||||
@@ -22,10 +22,14 @@ import com.cobblemon.mod.common.pokemon.Pokemon
|
|||||||
interface AspectProvider {
|
interface AspectProvider {
|
||||||
companion object {
|
companion object {
|
||||||
val providers = mutableListOf<AspectProvider>()
|
val providers = mutableListOf<AspectProvider>()
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun register(provider: AspectProvider): AspectProvider {
|
fun register(provider: AspectProvider): AspectProvider {
|
||||||
providers.add(provider)
|
providers.add(provider)
|
||||||
return provider
|
return provider
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun unregister(provider: AspectProvider) {
|
fun unregister(provider: AspectProvider) {
|
||||||
providers.remove(provider)
|
providers.remove(provider)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -21,6 +21,7 @@ import com.cobblemon.mod.common.pokemon.Pokemon
|
|||||||
*/
|
*/
|
||||||
interface SingleConditionalAspectProvider : AspectProvider {
|
interface SingleConditionalAspectProvider : AspectProvider {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
fun getForFeature(name: String): SingleConditionalAspectProvider {
|
fun getForFeature(name: String): SingleConditionalAspectProvider {
|
||||||
return object : SingleConditionalAspectProvider {
|
return object : SingleConditionalAspectProvider {
|
||||||
override val aspect: String = name
|
override val aspect: String = name
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ enum class EggGroup(val showdownID: String) {
|
|||||||
it.showdownID.lowercase().replace(" ", "_").replace("-", "_")
|
it.showdownID.lowercase().replace(" ", "_").replace("-", "_")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun fromIdentifier(identifier: String): EggGroup? {
|
fun fromIdentifier(identifier: String): EggGroup? {
|
||||||
val key = identifier.lowercase().replace(" ", "_").replace("-", "_")
|
val key = identifier.lowercase().replace(" ", "_").replace("-", "_")
|
||||||
return identifierMap[key]
|
return identifierMap[key]
|
||||||
|
|||||||
+2
-2
@@ -26,9 +26,9 @@ interface PreEvolution {
|
|||||||
val form: FormData
|
val form: FormData
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmOverloads
|
||||||
|
@JvmStatic
|
||||||
fun of(species: Species, form: FormData = species.standardForm): PreEvolution = StandardPreEvolution(species, form)
|
fun of(species: Species, form: FormData = species.standardForm): PreEvolution = StandardPreEvolution(species, form)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+5
-5
@@ -25,15 +25,15 @@ object EvolutionProgressTypes {
|
|||||||
ResourceKey.createRegistryKey(cobblemonResource("evolution_progress")), Lifecycle.stable()
|
ResourceKey.createRegistryKey(cobblemonResource("evolution_progress")), Lifecycle.stable()
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val DAMAGE_TAKEN = this.registerType(DamageTakenEvolutionProgress.ID, EvolutionProgressType(DamageTakenEvolutionProgress.CODEC))
|
val DAMAGE_TAKEN = this.registerType(DamageTakenEvolutionProgress.ID, EvolutionProgressType(DamageTakenEvolutionProgress.CODEC))
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val DEFEAT = this.registerType(DefeatEvolutionProgress.ID, EvolutionProgressType(DefeatEvolutionProgress.CODEC))
|
val DEFEAT = this.registerType(DefeatEvolutionProgress.ID, EvolutionProgressType(DefeatEvolutionProgress.CODEC))
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val LAST_BATTLE_CRITICAL_HITS = this.registerType(LastBattleCriticalHitsEvolutionProgress.ID, EvolutionProgressType(LastBattleCriticalHitsEvolutionProgress.CODEC))
|
val LAST_BATTLE_CRITICAL_HITS = this.registerType(LastBattleCriticalHitsEvolutionProgress.ID, EvolutionProgressType(LastBattleCriticalHitsEvolutionProgress.CODEC))
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val RECOIL = this.registerType(RecoilEvolutionProgress.ID, EvolutionProgressType(RecoilEvolutionProgress.CODEC))
|
val RECOIL = this.registerType(RecoilEvolutionProgress.ID, EvolutionProgressType(RecoilEvolutionProgress.CODEC))
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val USE_MOVE = this.registerType(UseMoveEvolutionProgress.ID, EvolutionProgressType(UseMoveEvolutionProgress.CODEC))
|
val USE_MOVE = this.registerType(UseMoveEvolutionProgress.ID, EvolutionProgressType(UseMoveEvolutionProgress.CODEC))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -102,6 +102,12 @@ object SpeciesFeatures : JsonDataRegistry<SpeciesFeatureProvider<*>> {
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun register(name: String, provider: SpeciesFeatureProvider<*>) = register(name, provider, isCoded = true)
|
fun register(name: String, provider: SpeciesFeatureProvider<*>) = register(name, provider, isCoded = true)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun registerType(key: String, clazz: Class<out SpeciesFeatureProvider<*>>) {
|
||||||
|
types[key] = clazz
|
||||||
|
}
|
||||||
|
|
||||||
private fun registerFromAssets(identifier: ResourceLocation, provider: SpeciesFeatureProvider<*>) = register(identifier.path, provider, isCoded = false)
|
private fun registerFromAssets(identifier: ResourceLocation, provider: SpeciesFeatureProvider<*>) = register(identifier.path, provider, isCoded = false)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|||||||
+1
@@ -34,6 +34,7 @@ fun interface FriendshipMutationCalculator {
|
|||||||
* For more information see this [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Friendship#Generation_VIII) entry.
|
* 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.
|
* 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 ->
|
val SWORD_AND_SHIELD_LEVEL_UP = FriendshipMutationCalculator { pokemon ->
|
||||||
when {
|
when {
|
||||||
pokemon.friendship <= 99 -> 3
|
pokemon.friendship <= 99 -> 3
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ open class Learnset : ClientDataSynchronizer<Learnset> {
|
|||||||
val loadMove: (JsonElement, Learnset) -> Boolean
|
val loadMove: (JsonElement, Learnset) -> Boolean
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
fun parseFromPrefixIntoList(prefix: String, list: (Learnset) -> MutableList<MoveTemplate>): Interpreter {
|
fun parseFromPrefixIntoList(prefix: String, list: (Learnset) -> MutableList<MoveTemplate>): Interpreter {
|
||||||
return Interpreter { element, learnset ->
|
return Interpreter { element, learnset ->
|
||||||
val str = element.takeIf { it.isJsonPrimitive }?.asString ?: return@Interpreter false
|
val str = element.takeIf { it.isJsonPrimitive }?.asString ?: return@Interpreter false
|
||||||
@@ -40,12 +41,19 @@ open class Learnset : ClientDataSynchronizer<Learnset> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val tmInterpreter = Interpreter.parseFromPrefixIntoList("tm") { it.tmMoves }
|
val tmInterpreter = Interpreter.parseFromPrefixIntoList("tm") { it.tmMoves }
|
||||||
|
@JvmField
|
||||||
val eggInterpreter = Interpreter.parseFromPrefixIntoList("egg") { it.eggMoves }
|
val eggInterpreter = Interpreter.parseFromPrefixIntoList("egg") { it.eggMoves }
|
||||||
|
@JvmField
|
||||||
val tutorInterpreter = Interpreter.parseFromPrefixIntoList("tutor") { it.tutorMoves }
|
val tutorInterpreter = Interpreter.parseFromPrefixIntoList("tutor") { it.tutorMoves }
|
||||||
|
@JvmField
|
||||||
val legacyInterpreter = Interpreter.parseFromPrefixIntoList("legacy") { it.legacyMoves }
|
val legacyInterpreter = Interpreter.parseFromPrefixIntoList("legacy") { it.legacyMoves }
|
||||||
|
@JvmField
|
||||||
val specialInterpreter = Interpreter.parseFromPrefixIntoList("special") { it.specialMoves }
|
val specialInterpreter = Interpreter.parseFromPrefixIntoList("special") { it.specialMoves }
|
||||||
|
@JvmField
|
||||||
val formChangeInterpreter = Interpreter.parseFromPrefixIntoList("form_change") { it.formChangeMoves }
|
val formChangeInterpreter = Interpreter.parseFromPrefixIntoList("form_change") { it.formChangeMoves }
|
||||||
|
@JvmField
|
||||||
val levelUpInterpreter = Interpreter { element, learnset ->
|
val levelUpInterpreter = Interpreter { element, learnset ->
|
||||||
val str = element.takeIf { it.isJsonPrimitive }?.asString ?: return@Interpreter false
|
val str = element.takeIf { it.isJsonPrimitive }?.asString ?: return@Interpreter false
|
||||||
val splits = str.split(":")
|
val splits = str.split(":")
|
||||||
@@ -68,6 +76,7 @@ open class Learnset : ClientDataSynchronizer<Learnset> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmField
|
||||||
val interpreters = mutableListOf(
|
val interpreters = mutableListOf(
|
||||||
tmInterpreter,
|
tmInterpreter,
|
||||||
eggInterpreter,
|
eggInterpreter,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ fun interface LearnsetQuery {
|
|||||||
fun canLearn(move: MoveTemplate, learnset: Learnset): Boolean
|
fun canLearn(move: MoveTemplate, learnset: Learnset): Boolean
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val ANY = LearnsetQuery { move, learnset ->
|
val ANY = LearnsetQuery { move, learnset ->
|
||||||
learnset.levelUpMoves.values.any { it.contains(move) }
|
learnset.levelUpMoves.values.any { it.contains(move) }
|
||||||
|| learnset.eggMoves.contains(move)
|
|| learnset.eggMoves.contains(move)
|
||||||
@@ -34,6 +34,7 @@ fun interface LearnsetQuery {
|
|||||||
|| learnset.specialMoves.contains(move)
|
|| learnset.specialMoves.contains(move)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmField
|
||||||
val LEGAL = LearnsetQuery { move, learnset ->
|
val LEGAL = LearnsetQuery { move, learnset ->
|
||||||
learnset.levelUpMoves.values.any { it.contains(move) }
|
learnset.levelUpMoves.values.any { it.contains(move) }
|
||||||
|| learnset.eggMoves.contains(move)
|
|| learnset.eggMoves.contains(move)
|
||||||
@@ -43,22 +44,31 @@ fun interface LearnsetQuery {
|
|||||||
|| learnset.evolutionMoves.contains(move)
|
|| learnset.evolutionMoves.contains(move)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun level(level: Int) = LearnsetQuery { move, learnset -> learnset.getLevelUpMovesUpTo(level).contains(move) }
|
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) } }
|
val ANY_LEVEL = LearnsetQuery { move, learnset -> learnset.levelUpMoves.values.any { it.contains(move) } }
|
||||||
|
|
||||||
|
@JvmField
|
||||||
val EGG_MOVE = LearnsetQuery { move, learnset -> learnset.eggMoves.contains(move) }
|
val EGG_MOVE = LearnsetQuery { move, learnset -> learnset.eggMoves.contains(move) }
|
||||||
|
|
||||||
|
@JvmField
|
||||||
val TUTOR_MOVES = LearnsetQuery { move, learnset -> learnset.tutorMoves.contains(move) }
|
val TUTOR_MOVES = LearnsetQuery { move, learnset -> learnset.tutorMoves.contains(move) }
|
||||||
|
|
||||||
|
@JvmField
|
||||||
val TM_MOVE = LearnsetQuery { move, learnset -> learnset.tmMoves.contains(move) }
|
val TM_MOVE = LearnsetQuery { move, learnset -> learnset.tmMoves.contains(move) }
|
||||||
|
|
||||||
|
@JvmField
|
||||||
val FORM_CHANGE = LearnsetQuery { move, learnset -> learnset.formChangeMoves.contains(move) }
|
val FORM_CHANGE = LearnsetQuery { move, learnset -> learnset.formChangeMoves.contains(move) }
|
||||||
|
|
||||||
|
@JvmField
|
||||||
val EVOLUTION = LearnsetQuery { move, learnset -> learnset.evolutionMoves.contains(move) }
|
val EVOLUTION = LearnsetQuery { move, learnset -> learnset.evolutionMoves.contains(move) }
|
||||||
|
|
||||||
|
@JvmField
|
||||||
val LEGACY_MOVES = LearnsetQuery { move, learnset -> learnset.legacyMoves.contains(move) }
|
val LEGACY_MOVES = LearnsetQuery { move, learnset -> learnset.legacyMoves.contains(move) }
|
||||||
|
|
||||||
|
@JvmField
|
||||||
val SPECIAL_MOVES = LearnsetQuery { move, learnset -> learnset.specialMoves.contains(move) }
|
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].
|
* A [Codec] for [Stat] without filtering the [Stat.Type].
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val ALL_CODEC: Codec<Stat> = CodecUtils.createByIdentifierCodec(
|
val ALL_CODEC: Codec<Stat> = CodecUtils.createByIdentifierCodec(
|
||||||
Cobblemon.statProvider::fromIdentifier,
|
Cobblemon.statProvider::fromIdentifier,
|
||||||
Stat::identifier
|
Stat::identifier
|
||||||
@@ -79,7 +79,7 @@ interface Stat {
|
|||||||
/**
|
/**
|
||||||
* A [Codec] for [Stat] with the [Stat.Type.PERMANENT].
|
* A [Codec] for [Stat] with the [Stat.Type.PERMANENT].
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val PERMANENT_ONLY_CODEC: Codec<Stat> = ALL_CODEC.comapFlatMap(
|
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 -> if (stat.type == Type.PERMANENT) DataResult.success(stat) else DataResult.error { "${stat.identifier} is not of type ${Type.PERMANENT}" } },
|
||||||
{ stat -> stat }
|
{ stat -> stat }
|
||||||
@@ -88,7 +88,7 @@ interface Stat {
|
|||||||
/**
|
/**
|
||||||
* A [Codec] for [Stat] with the [Stat.Type.BATTLE_ONLY].
|
* A [Codec] for [Stat] with the [Stat.Type.BATTLE_ONLY].
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val BATTLE_ONLY_CODEC: Codec<Stat> = ALL_CODEC.comapFlatMap(
|
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 -> if (stat.type == Type.BATTLE_ONLY) DataResult.success(stat) else DataResult.error { "${stat.identifier} is not of type ${Type.BATTLE_ONLY}" } },
|
||||||
{ stat -> stat }
|
{ stat -> stat }
|
||||||
|
|||||||
@@ -35,21 +35,25 @@ enum class Stats(override val identifier: ResourceLocation, override val display
|
|||||||
* All the stats, an alternative to [values].
|
* All the stats, an alternative to [values].
|
||||||
* Using [StatProvider.all] is recommended instead for maximum addon compatibility.
|
* Using [StatProvider.all] is recommended instead for maximum addon compatibility.
|
||||||
*/
|
*/
|
||||||
|
@JvmField
|
||||||
val ALL: Set<Stat> = EnumSet.allOf(Stats::class.java)
|
val ALL: Set<Stat> = EnumSet.allOf(Stats::class.java)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All the stats with type of [Stat.Type.PERMANENT].
|
* All the stats with type of [Stat.Type.PERMANENT].
|
||||||
* Using [StatProvider.ofType] with type [Stat.Type.PERMANENT] is recommended instead for maximum addon compatibility.
|
* 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)
|
val PERMANENT: Set<Stat> = EnumSet.of(HP, ATTACK, DEFENCE, SPECIAL_ATTACK, SPECIAL_DEFENCE, SPEED)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All the stats with type of [Stat.Type.BATTLE_ONLY].
|
* 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.
|
* 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)
|
val BATTLE_ONLY: Set<Stat> = EnumSet.of(EVASION, ACCURACY)
|
||||||
|
|
||||||
/** Gets the [Stat] from the respective Showdown id. */
|
/** Gets the [Stat] from the respective Showdown id. */
|
||||||
|
@JvmStatic
|
||||||
fun getStat(statKey: String) = when(statKey.lowercase()) {
|
fun getStat(statKey: String) = when(statKey.lowercase()) {
|
||||||
"hp" -> HP
|
"hp" -> HP
|
||||||
"atk", "attack" -> ATTACK // Hyper Cutter states the full stat name "Attack"
|
"atk", "attack" -> ATTACK // Hyper Cutter states the full stat name "Attack"
|
||||||
@@ -62,6 +66,7 @@ enum class Stats(override val identifier: ResourceLocation, override val display
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the severity lang key from the respective boost/unboost stage. */
|
/** Gets the severity lang key from the respective boost/unboost stage. */
|
||||||
|
@JvmStatic
|
||||||
fun getSeverity(stages: Int) = when(stages) {
|
fun getSeverity(stages: Int) = when(stages) {
|
||||||
0 -> "cap.single"
|
0 -> "cap.single"
|
||||||
1 -> "slight"
|
1 -> "slight"
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ open class Status(
|
|||||||
/**
|
/**
|
||||||
* A [Codec] for [Status].
|
* A [Codec] for [Status].
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmField
|
||||||
val CODEC: Codec<Status> = CodecUtils.createByIdentifierCodec(
|
val CODEC: Codec<Status> = CodecUtils.createByIdentifierCodec(
|
||||||
Statuses::getStatus,
|
Statuses::getStatus,
|
||||||
Status::name
|
Status::name
|
||||||
|
|||||||
+7
@@ -25,17 +25,23 @@ import com.cobblemon.mod.common.util.server
|
|||||||
interface CustomPokemonProperty {
|
interface CustomPokemonProperty {
|
||||||
companion object {
|
companion object {
|
||||||
/** A list of all the registered [CustomPokemonPropertyType]s. */
|
/** A list of all the registered [CustomPokemonPropertyType]s. */
|
||||||
|
@JvmField
|
||||||
val properties = mutableListOf<CustomPokemonPropertyType<*>>()
|
val properties = mutableListOf<CustomPokemonPropertyType<*>>()
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun <T: CustomPokemonProperty> register(propertyType: CustomPokemonPropertyType<T>) {
|
fun <T: CustomPokemonProperty> register(propertyType: CustomPokemonPropertyType<T>) {
|
||||||
properties.add(propertyType)
|
properties.add(propertyType)
|
||||||
this.triggerSyncAttempt()
|
this.triggerSyncAttempt()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@JvmOverloads
|
||||||
fun <T : CustomPokemonProperty> register(name: String, needsLabel: Boolean = true, fromString: (String?) -> T?, examples: () -> Collection<String>) {
|
fun <T : CustomPokemonProperty> register(name: String, needsLabel: Boolean = true, fromString: (String?) -> T?, examples: () -> Collection<String>) {
|
||||||
register(listOf(name), needsLabel, fromString, examples)
|
register(listOf(name), needsLabel, fromString, examples)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@JvmOverloads
|
||||||
fun <T : CustomPokemonProperty> register(aliases: Iterable<String>, needsLabel: Boolean = true, fromString: (String?) -> T?, examples: () -> Collection<String>) {
|
fun <T : CustomPokemonProperty> register(aliases: Iterable<String>, needsLabel: Boolean = true, fromString: (String?) -> T?, examples: () -> Collection<String>) {
|
||||||
properties.add(
|
properties.add(
|
||||||
object : CustomPokemonPropertyType<T> {
|
object : CustomPokemonPropertyType<T> {
|
||||||
@@ -48,6 +54,7 @@ interface CustomPokemonProperty {
|
|||||||
this.triggerSyncAttempt()
|
this.triggerSyncAttempt()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun unregister(property: CustomPokemonPropertyType<*>) {
|
fun unregister(property: CustomPokemonPropertyType<*>) {
|
||||||
properties.remove(property)
|
properties.remove(property)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ package com.cobblemon.mod.common.api.reactive
|
|||||||
import com.cobblemon.mod.common.api.events.Cancelable
|
import com.cobblemon.mod.common.api.events.Cancelable
|
||||||
|
|
||||||
open class EventObservable<T> : SimpleObservable<T>() {
|
open class EventObservable<T> : SimpleObservable<T>() {
|
||||||
|
@JvmOverloads
|
||||||
inline fun post(vararg events: T, then: (T) -> Unit = {}) {
|
inline fun post(vararg events: T, then: (T) -> Unit = {}) {
|
||||||
// Issuing generic-typed pass-throughs to varargs doesn't work
|
// Issuing generic-typed pass-throughs to varargs doesn't work
|
||||||
// properly unless the source is a vararg as well, complicated story.
|
// properly unless the source is a vararg as well, complicated story.
|
||||||
|
|||||||
@@ -59,10 +59,12 @@ interface Observable<T> {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
/** Creates a completed [Observable] with the given values. This [Observable] cannot receive new values. */
|
/** Creates a completed [Observable] with the given values. This [Observable] cannot receive new values. */
|
||||||
|
@JvmStatic
|
||||||
fun <T> just(vararg values: T): Observable<T> {
|
fun <T> just(vararg values: T): Observable<T> {
|
||||||
return SingularObservable<T>().also { it.emit(*values) }
|
return SingularObservable<T>().also { it.emit(*values) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun <T> of(future: CompletableFuture<T>): Observable<T> {
|
fun <T> of(future: CompletableFuture<T>): Observable<T> {
|
||||||
val observable = SingularObservable<T>()
|
val observable = SingularObservable<T>()
|
||||||
future.thenAccept { observable.emit(it) }
|
future.thenAccept { observable.emit(it) }
|
||||||
@@ -70,20 +72,28 @@ interface Observable<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a [TakeFirstTransform] */
|
/** Gets a [TakeFirstTransform] */
|
||||||
|
@JvmStatic
|
||||||
fun <T> takeFirst(amount: Int = 1) = TakeFirstTransform<T>(amount)
|
fun <T> takeFirst(amount: Int = 1) = TakeFirstTransform<T>(amount)
|
||||||
/** Gets a [IgnoreFirstTransform] */
|
/** Gets a [IgnoreFirstTransform] */
|
||||||
|
@JvmStatic
|
||||||
fun <T> ignoreFirst(amount: Int = 1) = IgnoreFirstTransform<T>(amount)
|
fun <T> ignoreFirst(amount: Int = 1) = IgnoreFirstTransform<T>(amount)
|
||||||
/** Gets a [FilterTransform] */
|
/** Gets a [FilterTransform] */
|
||||||
|
@JvmStatic
|
||||||
fun <T> filter(predicate: (T) -> Boolean) = FilterTransform(predicate)
|
fun <T> filter(predicate: (T) -> Boolean) = FilterTransform(predicate)
|
||||||
/** Gets a [MapTransform] */
|
/** Gets a [MapTransform] */
|
||||||
|
@JvmStatic
|
||||||
fun <T, O> map(mapping: (T) -> O) = MapTransform(mapping)
|
fun <T, O> map(mapping: (T) -> O) = MapTransform(mapping)
|
||||||
/** Gets a [EmitWhileTransform] */
|
/** Gets a [EmitWhileTransform] */
|
||||||
|
@JvmStatic
|
||||||
fun <T> emitWhile(predicate: (T) -> Boolean) = EmitWhileTransform(predicate)
|
fun <T> emitWhile(predicate: (T) -> Boolean) = EmitWhileTransform(predicate)
|
||||||
/** Gets a [StopAfterTransform] */
|
/** Gets a [StopAfterTransform] */
|
||||||
|
@JvmStatic
|
||||||
fun <T> stopAfter(predicate: (T) -> Boolean) = StopAfterTransform(predicate)
|
fun <T> stopAfter(predicate: (T) -> Boolean) = StopAfterTransform(predicate)
|
||||||
/** Gets a transform which will take values until the given predicate is met. */
|
/** Gets a transform which will take values until the given predicate is met. */
|
||||||
|
@JvmStatic
|
||||||
fun <T> emitUntil(predicate: (T) -> Boolean) = EmitWhileTransform<T> { !predicate(it) }
|
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. */
|
/** 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 }
|
fun <T> tap(handler: (T) -> Unit) = map<T, T> { handler(it); return@map it }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,9 @@ enum class RidingStat(
|
|||||||
JUMP(Flavour.BITTER);
|
JUMP(Flavour.BITTER);
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
fun getByName(name: String) = RidingStat.entries.firstOrNull { it.name.equals(name, ignoreCase = true) }
|
fun getByName(name: String) = RidingStat.entries.firstOrNull { it.name.equals(name, ignoreCase = true) }
|
||||||
|
@JvmStatic
|
||||||
fun getByFlavour(flavour: Flavour) = RidingStat.entries.firstOrNull { it.flavour == flavour }
|
fun getByFlavour(flavour: Flavour) = RidingStat.entries.firstOrNull { it.flavour == flavour }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ class BedrockParticle(
|
|||||||
|
|
||||||
// kill plane maybe
|
// kill plane maybe
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val EXPRESSION_SET_CODEC = RecordCodecBuilder.create<ExpressionSet> { instance ->
|
val EXPRESSION_SET_CODEC = RecordCodecBuilder.create<ExpressionSet> { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
EXPRESSION_CODEC.fieldOf("sizeX").forGetter { it.sizeX },
|
EXPRESSION_CODEC.fieldOf("sizeX").forGetter { it.sizeX },
|
||||||
@@ -83,6 +84,7 @@ class BedrockParticle(
|
|||||||
).apply(instance, ::ExpressionSet)
|
).apply(instance, ::ExpressionSet)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmField
|
||||||
val EVENT_SET_CODEC = RecordCodecBuilder.create<EventSet> { instance ->
|
val EVENT_SET_CODEC = RecordCodecBuilder.create<EventSet> { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
SimpleEventTrigger.CODEC.listOf().fieldOf("creationEvents").forGetter { it.creationEvents },
|
SimpleEventTrigger.CODEC.listOf().fieldOf("creationEvents").forGetter { it.creationEvents },
|
||||||
@@ -91,6 +93,7 @@ class BedrockParticle(
|
|||||||
).apply(instance, ::EventSet)
|
).apply(instance, ::EventSet)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<BedrockParticle> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<BedrockParticle> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
ResourceLocation.CODEC.fieldOf("texture").forGetter { it.texture },
|
ResourceLocation.CODEC.fieldOf("texture").forGetter { it.texture },
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class BedrockParticleOptions(
|
|||||||
var events: MutableMap<String, ParticleEvent> = mutableMapOf()
|
var events: MutableMap<String, ParticleEvent> = mutableMapOf()
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<BedrockParticleOptions> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<BedrockParticleOptions> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
ResourceLocation.CODEC.fieldOf("id").forGetter { it.id },
|
ResourceLocation.CODEC.fieldOf("id").forGetter { it.id },
|
||||||
|
|||||||
+1
@@ -39,6 +39,7 @@ class BedrockParticleEmitter(
|
|||||||
var loopingTravelDistanceEvents: MutableList<LoopingTravelDistanceEventTrigger> = mutableListOf()
|
var loopingTravelDistanceEvents: MutableList<LoopingTravelDistanceEventTrigger> = mutableListOf()
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<BedrockParticleEmitter> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<BedrockParticleEmitter> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
EXPRESSION_CODEC.listOf().fieldOf("startExpressions").forGetter { it.startExpressions },
|
EXPRESSION_CODEC.listOf().fieldOf("startExpressions").forGetter { it.startExpressions },
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class EmitterSpace(
|
|||||||
var scaling: ScalingMode = ScalingMode.WORLD
|
var scaling: ScalingMode = ScalingMode.WORLD
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<EmitterSpace> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<EmitterSpace> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
Codec.STRING.optionalFieldOfWithDefault("scaling", "world").forGetter { it.scaling.toString() }
|
Codec.STRING.optionalFieldOfWithDefault("scaling", "world").forGetter { it.scaling.toString() }
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ class LinearMoLangCurve(
|
|||||||
var nodes: List<Double> = emptyList()
|
var nodes: List<Double> = emptyList()
|
||||||
) : MoLangCurve {
|
) : MoLangCurve {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<LinearMoLangCurve> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<LinearMoLangCurve> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -127,6 +128,7 @@ class CatmullRomMoLangCurve(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<CatmullRomMoLangCurve> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<CatmullRomMoLangCurve> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -202,6 +204,7 @@ class BezierChainMoLangCurve(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC = RecordCodecBuilder.create<BezierChainNode> { instance ->
|
val CODEC = RecordCodecBuilder.create<BezierChainNode> { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.DOUBLE.fieldOf("value").forGetter { it.value },
|
PrimitiveCodec.DOUBLE.fieldOf("value").forGetter { it.value },
|
||||||
@@ -230,6 +233,7 @@ class BezierChainMoLangCurve(
|
|||||||
class BezierChainPointData(val time: Double, val value: Double, val slope: Double)
|
class BezierChainPointData(val time: Double, val value: Double, val slope: Double)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<BezierChainMoLangCurve> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<BezierChainMoLangCurve> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -280,6 +284,7 @@ class BezierMoLangCurve(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<BezierMoLangCurve> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<BezierMoLangCurve> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ interface ParticleCameraMode : CodecMapped {
|
|||||||
|
|
||||||
class RotateXYZCameraMode : ParticleCameraMode {
|
class RotateXYZCameraMode : ParticleCameraMode {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<RotateXYZCameraMode> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<RotateXYZCameraMode> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
||||||
@@ -101,6 +102,7 @@ class RotateXYZCameraMode : ParticleCameraMode {
|
|||||||
|
|
||||||
class RotateYCameraMode : ParticleCameraMode {
|
class RotateYCameraMode : ParticleCameraMode {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<RotateYCameraMode> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<RotateYCameraMode> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
||||||
@@ -136,6 +138,7 @@ class RotateYCameraMode : ParticleCameraMode {
|
|||||||
|
|
||||||
class LookAtXYZ : ParticleCameraMode {
|
class LookAtXYZ : ParticleCameraMode {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<LookAtXYZ> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<LookAtXYZ> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
||||||
@@ -172,6 +175,7 @@ class LookAtXYZ : ParticleCameraMode {
|
|||||||
class LookAtY : ParticleCameraMode {
|
class LookAtY : ParticleCameraMode {
|
||||||
override val type: ParticleCameraModeType = ParticleCameraModeType.LOOK_AT_Y
|
override val type: ParticleCameraModeType = ParticleCameraModeType.LOOK_AT_Y
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<LookAtY> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<LookAtY> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
||||||
@@ -203,6 +207,7 @@ class LookAtY : ParticleCameraMode {
|
|||||||
class DirectionZ : ParticleCameraMode {
|
class DirectionZ : ParticleCameraMode {
|
||||||
override val type: ParticleCameraModeType = ParticleCameraModeType.DIRECTION_Z
|
override val type: ParticleCameraModeType = ParticleCameraModeType.DIRECTION_Z
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<DirectionZ> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<DirectionZ> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
||||||
@@ -238,6 +243,7 @@ class DirectionZ : ParticleCameraMode {
|
|||||||
class EmitterYZPlane : ParticleCameraMode {
|
class EmitterYZPlane : ParticleCameraMode {
|
||||||
override val type: ParticleCameraModeType = ParticleCameraModeType.EMITTER_YZ_PLANE
|
override val type: ParticleCameraModeType = ParticleCameraModeType.EMITTER_YZ_PLANE
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<EmitterYZPlane> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<EmitterYZPlane> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
||||||
@@ -277,6 +283,7 @@ class EmitterYZPlane : ParticleCameraMode {
|
|||||||
class EmitterXZPlane : ParticleCameraMode {
|
class EmitterXZPlane : ParticleCameraMode {
|
||||||
override val type: ParticleCameraModeType = ParticleCameraModeType.EMITTER_XZ_PLANE
|
override val type: ParticleCameraModeType = ParticleCameraModeType.EMITTER_XZ_PLANE
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<EmitterXZPlane> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<EmitterXZPlane> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
||||||
@@ -315,6 +322,7 @@ class EmitterXZPlane : ParticleCameraMode {
|
|||||||
class EmitterXYPlane : ParticleCameraMode {
|
class EmitterXYPlane : ParticleCameraMode {
|
||||||
override val type: ParticleCameraModeType = ParticleCameraModeType.EMITTER_XY_PLANE
|
override val type: ParticleCameraModeType = ParticleCameraModeType.EMITTER_XY_PLANE
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<EmitterXYPlane> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<EmitterXYPlane> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
||||||
@@ -353,6 +361,7 @@ class EmitterXYPlane : ParticleCameraMode {
|
|||||||
class DirectionY : ParticleCameraMode {
|
class DirectionY : ParticleCameraMode {
|
||||||
override val type: ParticleCameraModeType = ParticleCameraModeType.DIRECTION_Y
|
override val type: ParticleCameraModeType = ParticleCameraModeType.DIRECTION_Y
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<DirectionY> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<DirectionY> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
||||||
@@ -388,6 +397,7 @@ class DirectionY : ParticleCameraMode {
|
|||||||
class DirectionX : ParticleCameraMode {
|
class DirectionX : ParticleCameraMode {
|
||||||
override val type: ParticleCameraModeType = ParticleCameraModeType.DIRECTION_X
|
override val type: ParticleCameraModeType = ParticleCameraModeType.DIRECTION_X
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<DirectionX> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<DirectionX> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
||||||
@@ -446,6 +456,7 @@ class DirectionX : ParticleCameraMode {
|
|||||||
class LookAtDirection : ParticleCameraMode {
|
class LookAtDirection : ParticleCameraMode {
|
||||||
override val type: ParticleCameraModeType = ParticleCameraModeType.LOOK_AT_DIRECTION
|
override val type: ParticleCameraModeType = ParticleCameraModeType.LOOK_AT_DIRECTION
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<LookAtDirection> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<LookAtDirection> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class ParticleCollision(
|
|||||||
var expiresOnContact: Boolean = false
|
var expiresOnContact: Boolean = false
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<ParticleCollision> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<ParticleCollision> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
EXPRESSION_CODEC.fieldOf("enabled").forGetter { it.enabled },
|
EXPRESSION_CODEC.fieldOf("enabled").forGetter { it.enabled },
|
||||||
|
|||||||
+3
@@ -41,6 +41,7 @@ interface ParticleEmitterLifetime : CodecMapped {
|
|||||||
|
|
||||||
class OnceEmitterLifetime(var activeTime: Expression = 1.0.asExpression()) : ParticleEmitterLifetime {
|
class OnceEmitterLifetime(var activeTime: Expression = 1.0.asExpression()) : ParticleEmitterLifetime {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<OnceEmitterLifetime> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<OnceEmitterLifetime> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -73,6 +74,7 @@ class OnceEmitterLifetime(var activeTime: Expression = 1.0.asExpression()) : Par
|
|||||||
|
|
||||||
class ExpressionEmitterLifetime(var activation: Expression = NumberExpression(0.0), var expiration: Expression = NumberExpression(0.0)) : ParticleEmitterLifetime {
|
class ExpressionEmitterLifetime(var activation: Expression = NumberExpression(0.0), var expiration: Expression = NumberExpression(0.0)) : ParticleEmitterLifetime {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<ExpressionEmitterLifetime> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<ExpressionEmitterLifetime> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -114,6 +116,7 @@ class ExpressionEmitterLifetime(var activation: Expression = NumberExpression(0.
|
|||||||
|
|
||||||
class LoopingEmitterLifetime(var activeTime: Expression = 1.0.asExpression(), var sleepTime: Expression = 1.0.asExpression()) : ParticleEmitterLifetime {
|
class LoopingEmitterLifetime(var activeTime: Expression = 1.0.asExpression(), var sleepTime: Expression = 1.0.asExpression()) : ParticleEmitterLifetime {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<LoopingEmitterLifetime> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<LoopingEmitterLifetime> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ enum class ParticleEmitterRateType {
|
|||||||
|
|
||||||
class InstantParticleEmitterRate(var amount: Expression = "1".asExpression()) : ParticleEmitterRate {
|
class InstantParticleEmitterRate(var amount: Expression = "1".asExpression()) : ParticleEmitterRate {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<InstantParticleEmitterRate> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<InstantParticleEmitterRate> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -84,6 +85,7 @@ class SteadyParticleEmitterRate(
|
|||||||
var time = System.currentTimeMillis()
|
var time = System.currentTimeMillis()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<SteadyParticleEmitterRate> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<SteadyParticleEmitterRate> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ class SphereParticleEmitterShape(
|
|||||||
val pAttachmentOptions: Map<AttachedType, Boolean>? = null
|
val pAttachmentOptions: Map<AttachedType, Boolean>? = null
|
||||||
) : ParticleEmitterShape {
|
) : ParticleEmitterShape {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<SphereParticleEmitterShape> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<SphereParticleEmitterShape> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -153,6 +154,7 @@ class PointParticleEmitterShape(
|
|||||||
val pAttachmentOptions: Map<AttachedType, Boolean>? = null
|
val pAttachmentOptions: Map<AttachedType, Boolean>? = null
|
||||||
): ParticleEmitterShape {
|
): ParticleEmitterShape {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<PointParticleEmitterShape> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<PointParticleEmitterShape> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -210,6 +212,7 @@ class BoxParticleEmitterShape(
|
|||||||
val pAttachmentOptions: Map<AttachedType, Boolean>? = null
|
val pAttachmentOptions: Map<AttachedType, Boolean>? = null
|
||||||
) : ParticleEmitterShape {
|
) : ParticleEmitterShape {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<BoxParticleEmitterShape> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<BoxParticleEmitterShape> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -332,6 +335,7 @@ class DiscParticleEmitterShape(
|
|||||||
val pAttachmentOptions: Map<AttachedType, Boolean>? = null
|
val pAttachmentOptions: Map<AttachedType, Boolean>? = null
|
||||||
): ParticleEmitterShape {
|
): ParticleEmitterShape {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<DiscParticleEmitterShape> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<DiscParticleEmitterShape> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -418,6 +422,7 @@ class EntityBoundingBoxParticleEmitterShape(
|
|||||||
var surfaceOnly: Boolean = true
|
var surfaceOnly: Boolean = true
|
||||||
): ParticleEmitterShape {
|
): ParticleEmitterShape {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<EntityBoundingBoxParticleEmitterShape> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<EntityBoundingBoxParticleEmitterShape> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class ParticleEvent(
|
|||||||
var expression: ExpressionLike? = null
|
var expression: ExpressionLike? = null
|
||||||
): Encodable, Decodable {
|
): Encodable, Decodable {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<ParticleEvent> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<ParticleEvent> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
EventParticleOptions.CODEC.optionalFieldOf("particle_effect", null).forGetter { it.particleEffect },
|
EventParticleOptions.CODEC.optionalFieldOf("particle_effect", null).forGetter { it.particleEffect },
|
||||||
@@ -171,6 +172,7 @@ class EventParticleOptions(
|
|||||||
val expression: ExpressionLike? = null
|
val expression: ExpressionLike? = null
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC = RecordCodecBuilder.create<EventParticleOptions> { instance ->
|
val CODEC = RecordCodecBuilder.create<EventParticleOptions> { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
ResourceLocation.CODEC.fieldOf("effect").forGetter { it.effect },
|
ResourceLocation.CODEC.fieldOf("effect").forGetter { it.effect },
|
||||||
@@ -205,6 +207,7 @@ class EventSoundEffect(
|
|||||||
val sound: ResourceLocation,
|
val sound: ResourceLocation,
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC = RecordCodecBuilder.create<EventSoundEffect> { instance ->
|
val CODEC = RecordCodecBuilder.create<EventSoundEffect> { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
ResourceLocation.CODEC.fieldOf("sound").forGetter { it.sound }
|
ResourceLocation.CODEC.fieldOf("sound").forGetter { it.sound }
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import net.minecraft.network.RegistryFriendlyByteBuf
|
|||||||
*/
|
*/
|
||||||
class SimpleEventTrigger(var event: String): Encodable, Decodable {
|
class SimpleEventTrigger(var event: String): Encodable, Decodable {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC = RecordCodecBuilder.create<SimpleEventTrigger> { instance ->
|
val CODEC = RecordCodecBuilder.create<SimpleEventTrigger> { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("event").forGetter { it.event }
|
PrimitiveCodec.STRING.fieldOf("event").forGetter { it.event }
|
||||||
@@ -61,6 +62,7 @@ class SimpleEventTrigger(var event: String): Encodable, Decodable {
|
|||||||
*/
|
*/
|
||||||
class EventTriggerTimeline(var map: MutableMap<Double, MutableList<String>>): Encodable, Decodable {
|
class EventTriggerTimeline(var map: MutableMap<Double, MutableList<String>>): Encodable, Decodable {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC = RecordCodecBuilder.create<EventTriggerTimeline> { instance ->
|
val CODEC = RecordCodecBuilder.create<EventTriggerTimeline> { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
UnboundedMapCodec(PrimitiveCodec.DOUBLE, PrimitiveCodec.STRING.listOf()).fieldOf("map").forGetter { it.map }
|
UnboundedMapCodec(PrimitiveCodec.DOUBLE, PrimitiveCodec.STRING.listOf()).fieldOf("map").forGetter { it.map }
|
||||||
@@ -94,6 +96,7 @@ class EventTriggerTimeline(var map: MutableMap<Double, MutableList<String>>): En
|
|||||||
*/
|
*/
|
||||||
class LoopingTravelDistanceEventTrigger(var distance: Double, var events: MutableList<String>): Encodable, Decodable {
|
class LoopingTravelDistanceEventTrigger(var distance: Double, var events: MutableList<String>): Encodable, Decodable {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC = RecordCodecBuilder.create<LoopingTravelDistanceEventTrigger> { instance ->
|
val CODEC = RecordCodecBuilder.create<LoopingTravelDistanceEventTrigger> { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.DOUBLE.fieldOf("distance").forGetter { it.distance },
|
PrimitiveCodec.DOUBLE.fieldOf("distance").forGetter { it.distance },
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ class ParametricParticleMotion(
|
|||||||
)
|
)
|
||||||
) : ParticleMotion {
|
) : ParticleMotion {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<ParametricParticleMotion> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<ParametricParticleMotion> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -127,6 +128,7 @@ class DynamicParticleMotion(
|
|||||||
override val type = ParticleMotionType.DYNAMIC
|
override val type = ParticleMotionType.DYNAMIC
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<DynamicParticleMotion> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<DynamicParticleMotion> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -203,6 +205,7 @@ interface ParticleMotionDirection : CodecMapped {
|
|||||||
|
|
||||||
class InwardsMotionDirection : ParticleMotionDirection {
|
class InwardsMotionDirection : ParticleMotionDirection {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<InwardsMotionDirection> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<InwardsMotionDirection> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name })
|
instance.group(PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name })
|
||||||
.apply(instance) { InwardsMotionDirection() }
|
.apply(instance) { InwardsMotionDirection() }
|
||||||
@@ -228,6 +231,7 @@ class InwardsMotionDirection : ParticleMotionDirection {
|
|||||||
|
|
||||||
class OutwardsMotionDirection : ParticleMotionDirection {
|
class OutwardsMotionDirection : ParticleMotionDirection {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<OutwardsMotionDirection> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<OutwardsMotionDirection> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name })
|
instance.group(PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name })
|
||||||
.apply(instance) { OutwardsMotionDirection() }
|
.apply(instance) { OutwardsMotionDirection() }
|
||||||
@@ -260,6 +264,7 @@ class CustomMotionDirection(
|
|||||||
)
|
)
|
||||||
) : ParticleMotionDirection {
|
) : ParticleMotionDirection {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<CustomMotionDirection> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<CustomMotionDirection> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -305,6 +310,7 @@ enum class ParticleMotionDirectionType {
|
|||||||
|
|
||||||
class StaticParticleMotion : ParticleMotion {
|
class StaticParticleMotion : ParticleMotion {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<StaticParticleMotion> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<StaticParticleMotion> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name }
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ interface ParticleRotation : CodecMapped {
|
|||||||
|
|
||||||
class ParametricParticleRotation(var expression: Expression = NumberExpression(0.0)): ParticleRotation {
|
class ParametricParticleRotation(var expression: Expression = NumberExpression(0.0)): ParticleRotation {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<ParametricParticleRotation> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<ParametricParticleRotation> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -79,6 +80,7 @@ class DynamicParticleRotation(
|
|||||||
var drag: Expression = NumberExpression(0.0)
|
var drag: Expression = NumberExpression(0.0)
|
||||||
): ParticleRotation {
|
): ParticleRotation {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<DynamicParticleRotation> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<DynamicParticleRotation> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class ParticleSpace(
|
|||||||
var localVelocity: Boolean = false
|
var localVelocity: Boolean = false
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<ParticleSpace> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<ParticleSpace> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.BOOL.fieldOf("localPosition").forGetter { it.localPosition },
|
PrimitiveCodec.BOOL.fieldOf("localPosition").forGetter { it.localPosition },
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ class ExpressionParticleTinting(
|
|||||||
var alpha: Expression = NumberExpression(1.0)
|
var alpha: Expression = NumberExpression(1.0)
|
||||||
) : ParticleTinting {
|
) : ParticleTinting {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<ExpressionParticleTinting> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<ExpressionParticleTinting> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -98,6 +99,7 @@ class GradientParticleTinting(
|
|||||||
) : ParticleTinting {
|
) : ParticleTinting {
|
||||||
class GradientEntry(val key: Double, val colour: Vector4f) {
|
class GradientEntry(val key: Double, val colour: Vector4f) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<GradientEntry> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<GradientEntry> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.DOUBLE.fieldOf("key").forGetter { it.key },
|
PrimitiveCodec.DOUBLE.fieldOf("key").forGetter { it.key },
|
||||||
@@ -113,6 +115,7 @@ class GradientParticleTinting(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<GradientParticleTinting> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<GradientParticleTinting> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ class AnimatedParticleUVMode(
|
|||||||
override val type = ParticleUVModeType.ANIMATED
|
override val type = ParticleUVModeType.ANIMATED
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<AnimatedParticleUVMode> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<AnimatedParticleUVMode> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -174,6 +175,7 @@ class StaticParticleUVMode(
|
|||||||
override val type = ParticleUVModeType.STATIC
|
override val type = ParticleUVModeType.STATIC
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<StaticParticleUVMode> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<StaticParticleUVMode> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
|
|||||||
+3
-1
@@ -45,6 +45,7 @@ interface ParticleViewDirection : CodecMapped {
|
|||||||
|
|
||||||
class FromMotionViewDirection(var minSpeed: Double = 0.01) : ParticleViewDirection {
|
class FromMotionViewDirection(var minSpeed: Double = 0.01) : ParticleViewDirection {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<FromMotionViewDirection> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<FromMotionViewDirection> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -74,6 +75,7 @@ class FromMotionViewDirection(var minSpeed: Double = 0.01) : ParticleViewDirecti
|
|||||||
|
|
||||||
class CustomViewDirection(var direction: Triple<Expression, Expression, Expression>) : ParticleViewDirection {
|
class CustomViewDirection(var direction: Triple<Expression, Expression, Expression>) : ParticleViewDirection {
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmField
|
||||||
val CODEC: Codec<CustomViewDirection> = RecordCodecBuilder.create { instance ->
|
val CODEC: Codec<CustomViewDirection> = RecordCodecBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
|
||||||
@@ -107,4 +109,4 @@ class CustomViewDirection(var direction: Triple<Expression, Expression, Expressi
|
|||||||
enum class ParticleViewDirectionType {
|
enum class ParticleViewDirectionType {
|
||||||
CUSTOM,
|
CUSTOM,
|
||||||
FROM_MOTION
|
FROM_MOTION
|
||||||
}
|
}
|
||||||
Loaded 100 of 206 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user