├── kore └── src │ ├── test │ ├── kotlin │ │ └── io │ │ │ └── github │ │ │ └── ayfri │ │ │ └── kore │ │ │ ├── arguments │ │ │ ├── chatcomponents │ │ │ │ └── ChatComponentTests.kt │ │ │ ├── arguments.kt │ │ │ └── ComponentsRemovables.kt │ │ │ ├── assertions │ │ │ └── utils.kt │ │ │ ├── commands │ │ │ ├── TriggerCommand.kt │ │ │ ├── TagCommand.kt │ │ │ ├── TimeCommand.kt │ │ │ ├── RideCommand.kt │ │ │ ├── TransferCommand.kt │ │ │ ├── SpreadPlayersCommand.kt │ │ │ ├── TellrawCommand.kt │ │ │ └── EffectCommand.kt │ │ │ ├── helpers │ │ │ ├── dp.kt │ │ │ └── SchedulerTests.kt │ │ │ └── features │ │ │ ├── BannerPatternTests.kt │ │ │ └── worldgen │ │ │ └── NoiseTests.kt │ └── resources │ │ └── kore_icon.png │ └── main │ └── kotlin │ └── io │ └── github │ └── ayfri │ └── kore │ ├── annotations │ └── FunctionsHolder.kt │ ├── features │ ├── recipes │ │ ├── Recipes.kt │ │ └── types │ │ │ ├── CookingRecipe.kt │ │ │ ├── IngredientsRecipe.kt │ │ │ ├── Recipe.kt │ │ │ └── CraftingTransmuteCategory.kt │ ├── dialogs │ │ ├── DialogContainer.kt │ │ ├── control │ │ │ ├── ControlContainer.kt │ │ │ └── DialogControl.kt │ │ └── body │ │ │ ├── BodyContainer.kt │ │ │ └── DialogBody.kt │ ├── worldgen │ │ ├── ruletest │ │ │ ├── AlwaysTrue.kt │ │ │ ├── BlockMatch.kt │ │ │ ├── TagMatch.kt │ │ │ ├── RandomBlockMatch.kt │ │ │ ├── RuleTest.kt │ │ │ └── BlockStateMatch.kt │ │ ├── structures │ │ │ ├── StructuresBuilder.kt │ │ │ ├── types │ │ │ │ └── jigsaw │ │ │ │ │ ├── Direct.kt │ │ │ │ │ ├── Random.kt │ │ │ │ │ ├── RandomGroup.kt │ │ │ │ │ ├── PoolAlias.kt │ │ │ │ │ └── LiquidSettings.kt │ │ │ ├── MineshaftType.kt │ │ │ ├── BiomeTemperature.kt │ │ │ ├── TerrainAdaptation.kt │ │ │ └── RuinedPortalPlacement.kt │ │ ├── densityfunction │ │ │ └── types │ │ │ │ ├── Beardifier.kt │ │ │ │ ├── BlendAlpha.kt │ │ │ │ ├── EndIslands.kt │ │ │ │ ├── BlendOffset.kt │ │ │ │ ├── Shift.kt │ │ │ │ ├── ShiftA.kt │ │ │ │ ├── ShiftB.kt │ │ │ │ └── DensityFunctionType.kt │ │ ├── configuredfeature │ │ │ ├── configurations │ │ │ │ ├── Kelp.kt │ │ │ │ ├── NoOp.kt │ │ │ │ ├── BlueIce.kt │ │ │ │ ├── Vines.kt │ │ │ │ ├── CoralClaw.kt │ │ │ │ ├── CoralTree.kt │ │ │ │ ├── EndIsland.kt │ │ │ │ ├── IceSpike.kt │ │ │ │ ├── BasaltPillar.kt │ │ │ │ ├── BonusChest.kt │ │ │ │ ├── ChorusPlant.kt │ │ │ │ ├── DesertWell.kt │ │ │ │ ├── EndPlatform.kt │ │ │ │ ├── MonsterRoom.kt │ │ │ │ ├── WeepingVines.kt │ │ │ │ ├── CoralMushroom.kt │ │ │ │ ├── FreezeTopLayer.kt │ │ │ │ ├── GlowstoneBlob.kt │ │ │ │ ├── VoidStartPlatform.kt │ │ │ │ ├── Bamboo.kt │ │ │ │ ├── Seagrass.kt │ │ │ │ ├── tree │ │ │ │ │ ├── treedecorator │ │ │ │ │ │ ├── TrunkVine.kt │ │ │ │ │ │ ├── Cocoa.kt │ │ │ │ │ │ ├── Beehive.kt │ │ │ │ │ │ ├── LeaveVine.kt │ │ │ │ │ │ └── TreeDecorator.kt │ │ │ │ │ ├── layersfeaturesize │ │ │ │ │ │ └── LayersFeatureSize.kt │ │ │ │ │ └── trunkplacer │ │ │ │ │ │ └── TrunkPlacer.kt │ │ │ │ ├── Iceberg.kt │ │ │ │ ├── ForestRock.kt │ │ │ │ ├── EndGateway.kt │ │ │ │ ├── SeaPickle.kt │ │ │ │ ├── FeatureConfig.kt │ │ │ │ ├── FillLayer.kt │ │ │ │ ├── Lake.kt │ │ │ │ ├── TwistingVines.kt │ │ │ │ ├── ReplaceSingleBlock.kt │ │ │ │ ├── RandomSelector.kt │ │ │ │ ├── RandomBooleanSelector.kt │ │ │ │ └── BlockPile.kt │ │ │ ├── Direction.kt │ │ │ └── blockstateprovider │ │ │ │ ├── RotatedBlockProvider.kt │ │ │ │ └── BlockStateProvider.kt │ │ ├── noisesettings │ │ │ ├── rules │ │ │ │ ├── conditions │ │ │ │ │ ├── Hole.kt │ │ │ │ │ ├── Steep.kt │ │ │ │ │ ├── Temperature.kt │ │ │ │ │ ├── AbovePreliminarySurface.kt │ │ │ │ │ ├── Not.kt │ │ │ │ │ ├── Biome.kt │ │ │ │ │ ├── SurfaceRuleCondition.kt │ │ │ │ │ ├── VerticalGradient.kt │ │ │ │ │ └── Water.kt │ │ │ │ ├── Bandlands.kt │ │ │ │ └── SurfaceRule.kt │ │ │ └── NoiseOptions.kt │ │ ├── dimension │ │ │ ├── biomesource │ │ │ │ ├── TheEnd.kt │ │ │ │ ├── Fixed.kt │ │ │ │ └── BiomeSource.kt │ │ │ └── generator │ │ │ │ ├── Debug.kt │ │ │ │ ├── Generator.kt │ │ │ │ └── Flat.kt │ │ ├── biome │ │ │ └── types │ │ │ │ ├── SpawnCost.kt │ │ │ │ ├── AdditionalSound.kt │ │ │ │ ├── MoodSound.kt │ │ │ │ ├── Particle.kt │ │ │ │ ├── Music.kt │ │ │ │ ├── TemperatureModifier.kt │ │ │ │ └── GrassColorModifier.kt │ │ ├── processorlist │ │ │ └── types │ │ │ │ ├── rule │ │ │ │ ├── blockentitymodifier │ │ │ │ │ ├── Clear.kt │ │ │ │ │ ├── Passthrough.kt │ │ │ │ │ ├── AppendLoot.kt │ │ │ │ │ └── BlockEntityModifier.kt │ │ │ │ └── positionpredicate │ │ │ │ │ ├── AlwaysTrue.kt │ │ │ │ │ └── PositionPredicate.kt │ │ │ │ ├── BlockIgnore.kt │ │ │ │ ├── Nop.kt │ │ │ │ ├── BlackStoneReplace.kt │ │ │ │ ├── JigsawReplacement.kt │ │ │ │ ├── LavaSubmergedBlock.kt │ │ │ │ ├── BlockAge.kt │ │ │ │ ├── Gravity.kt │ │ │ │ ├── ProtectedBlocks.kt │ │ │ │ └── ProcessorType.kt │ │ ├── blockpredicate │ │ │ ├── Solid.kt │ │ │ ├── True.kt │ │ │ ├── Replaceable.kt │ │ │ ├── BlockPredicate.kt │ │ │ ├── Offset.kt │ │ │ └── InsideWorldBounds.kt │ │ ├── intproviders │ │ │ ├── ConstantIntProvider.kt │ │ │ ├── UniformIntProvider.kt │ │ │ ├── BiasedToBottomIntProvider.kt │ │ │ ├── ClampedIntProvider.kt │ │ │ ├── ClampedNormalIntProvider.kt │ │ │ ├── WeightedListIntProvider.kt │ │ │ └── IntProvider.kt │ │ ├── structureset │ │ │ ├── ExclusionZone.kt │ │ │ ├── Structure.kt │ │ │ ├── SpreadType.kt │ │ │ └── FrequencyReductionMethod.kt │ │ ├── templatepool │ │ │ ├── TemplatePoolEntry.kt │ │ │ ├── Projection.kt │ │ │ └── elements │ │ │ │ ├── EmptyPoolElement.kt │ │ │ │ └── TemplatePoolElement.kt │ │ ├── placedfeature │ │ │ └── modifiers │ │ │ │ ├── Biome.kt │ │ │ │ ├── InSquare.kt │ │ │ │ ├── RarityFilter.kt │ │ │ │ ├── HeightMap.kt │ │ │ │ ├── SurfaceWaterDepthFilter.kt │ │ │ │ ├── PlacementModifier.kt │ │ │ │ └── Count.kt │ │ ├── configuredcarver │ │ │ ├── DebugSettings.kt │ │ │ └── Config.kt │ │ ├── floatproviders │ │ │ ├── ConstantFloatProvider.kt │ │ │ ├── FloatProvider.kt │ │ │ ├── TrapezoidFloatProvider.kt │ │ │ └── UniformFloatProvider.kt │ │ ├── heightproviders │ │ │ └── HeightProvider.kt │ │ └── HeightMap.kt │ ├── enchantments │ │ ├── providers │ │ │ ├── EnchantmentProviders.kt │ │ │ └── types │ │ │ │ └── EnchantmentProviderType.kt │ │ ├── effects │ │ │ ├── builders │ │ │ │ ├── EmptyEffectBuilder.kt │ │ │ │ └── EffectBuilder.kt │ │ │ ├── entity │ │ │ │ ├── AllOf.kt │ │ │ │ ├── RunFunction.kt │ │ │ │ ├── spawnparticles │ │ │ │ │ ├── ParticleVelocity.kt │ │ │ │ │ ├── types │ │ │ │ │ │ └── SimpleParticleType.kt │ │ │ │ │ └── ParticlePositionType.kt │ │ │ │ ├── Ignite.kt │ │ │ │ ├── DamageItem.kt │ │ │ │ └── SummonEntity.kt │ │ │ └── value │ │ │ │ ├── AllOf.kt │ │ │ │ ├── Add.kt │ │ │ │ ├── Set.kt │ │ │ │ ├── Multiply.kt │ │ │ │ ├── RemoveBinomial.kt │ │ │ │ └── ValueEffect.kt │ │ └── values │ │ │ ├── LevelsSquared.kt │ │ │ ├── Linear.kt │ │ │ ├── LevelBased.kt │ │ │ ├── Clamped.kt │ │ │ ├── Lookup.kt │ │ │ └── Constant.kt │ ├── testenvironments │ │ ├── types │ │ │ ├── TimeOfDay.kt │ │ │ ├── Weather.kt │ │ │ ├── AllOf.kt │ │ │ ├── Function.kt │ │ │ └── GameRules.kt │ │ └── enums │ │ │ └── Weather.kt │ ├── itemmodifiers │ │ ├── formulas │ │ │ ├── Formula.kt │ │ │ ├── OreDrops.kt │ │ │ ├── UniformBonusCount.kt │ │ │ └── BinomialWithBonusCount.kt │ │ └── types │ │ │ └── Mode.kt │ ├── predicates │ │ ├── conditions │ │ │ ├── SurvivesExplosion.kt │ │ │ ├── KilledByPlayer.kt │ │ │ ├── EnchantmentActiveCheck.kt │ │ │ ├── Inverted.kt │ │ │ ├── AnyOf.kt │ │ │ ├── WeatherCheck.kt │ │ │ ├── AllOf.kt │ │ │ ├── DamageSourceProperties.kt │ │ │ ├── PredicateConditionSurrogate.kt │ │ │ └── MatchTool.kt │ │ ├── sub │ │ │ ├── item │ │ │ │ └── Damage.kt │ │ │ ├── entityspecific │ │ │ │ ├── Sheep.kt │ │ │ │ ├── FishingHook.kt │ │ │ │ ├── EntityTypeSpecific.kt │ │ │ │ ├── Raider.kt │ │ │ │ └── Slime.kt │ │ │ ├── Effect.kt │ │ │ ├── Position.kt │ │ │ ├── Slots.kt │ │ │ └── Equipment.kt │ │ └── types │ │ │ └── EntityType.kt │ ├── pigvariants │ │ └── PigModel.kt │ ├── cowvariants │ │ └── CowModel.kt │ ├── chickenvariants │ │ └── ChickenModel.kt │ ├── damagetypes │ │ └── types │ │ │ ├── Scaling.kt │ │ │ ├── Effects.kt │ │ │ └── DeathMessageType.kt │ ├── chattypes │ │ ├── ChatTypeParameter.kt │ │ ├── ChatTypeStyle.kt │ │ └── ChatTypeDecoration.kt │ ├── trimmaterial │ │ └── ArmorMaterial.kt │ └── loottables │ │ └── entries │ │ └── Empty.kt │ ├── serializers │ ├── PathSerializer.kt │ └── JsonSerialName.kt │ ├── arguments │ ├── chatcomponents │ │ ├── SimpleComponent.kt │ │ ├── hover │ │ │ ├── Contents.kt │ │ │ ├── ContentsEntityUUID.kt │ │ │ └── ContentsItem.kt │ │ └── ChatComponentType.kt │ ├── colors │ │ └── NamedColor.kt │ ├── components │ │ ├── consumable │ │ │ ├── ConsumeEffects.kt │ │ │ ├── ClearAllEffects.kt │ │ │ ├── TeleportRandomly.kt │ │ │ ├── PlaySound.kt │ │ │ ├── RemoveEffects.kt │ │ │ ├── ApplyEffects.kt │ │ │ └── ConsumeEffect.kt │ │ ├── EmptyComponent.kt │ │ ├── Components.kt │ │ ├── data │ │ │ ├── BlockPredicate.kt │ │ │ └── EquipmentSlot.kt │ │ └── item │ │ │ ├── GliderComponent.kt │ │ │ ├── UnbreakableComponent.kt │ │ │ ├── EnchantableComponent.kt │ │ │ ├── IntangibleProjectileComponent.kt │ │ │ ├── UseRemainder.kt │ │ │ └── CustomDataComponent.kt │ ├── types │ │ ├── ItemOrTagArgument.kt │ │ ├── PossessorArgument.kt │ │ ├── BlockOrTagArgument.kt │ │ ├── ScoreHolderArgument.kt │ │ ├── FunctionOrTagArgument.kt │ │ ├── EntityArgument.kt │ │ ├── literals │ │ │ ├── TimeArgument.kt │ │ │ ├── AllArgument.kt │ │ │ ├── CompoundArgument.kt │ │ │ └── IntArgument.kt │ │ ├── ContainerArgument.kt │ │ └── resources │ │ │ ├── TagArgument.kt │ │ │ ├── SoundArgument.kt │ │ │ ├── BossBarArgument.kt │ │ │ ├── StatisticArgument.kt │ │ │ ├── RandomSequenceArgument.kt │ │ │ └── StatisticTypeArgument.kt │ ├── numbers │ │ ├── ranges │ │ │ └── Range.kt │ │ └── _Double.kt │ ├── actions │ │ ├── OpenUrl.kt │ │ ├── CopyToClipboard.kt │ │ ├── ChangePage.kt │ │ ├── ShowDialog.kt │ │ └── Action.kt │ ├── Argument.kt │ ├── enums │ │ ├── Axis.kt │ │ ├── FoxVariants.kt │ │ ├── Difficulty.kt │ │ ├── ExperienceType.kt │ │ ├── Gamemode.kt │ │ ├── SalmonSizes.kt │ │ ├── DataType.kt │ │ ├── LlamaVariants.kt │ │ ├── MooshroomVariants.kt │ │ ├── HeightMap.kt │ │ ├── AxolotlVariants.kt │ │ ├── ParrotVariants.kt │ │ ├── HorseVariants.kt │ │ ├── RabbitVariants.kt │ │ ├── VillagerVariants.kt │ │ └── TropicalFishPatterns.kt │ ├── EquipmentSlot.kt │ ├── maths │ │ └── Coordinate.kt │ └── selector │ │ └── functions.kt │ ├── utils │ ├── console.kt │ └── SerializationUtils.kt │ ├── generation │ ├── dataPackJarGenerationFiles.kt │ ├── DataPackJarGenerationOptions.kt │ ├── fabric │ │ └── FabricAuthor.kt │ └── tomlSerializer.kt │ ├── data │ ├── spawncondition │ │ ├── types │ │ │ ├── MoonBrightness.kt │ │ │ ├── Biome.kt │ │ │ ├── Structure.kt │ │ │ └── VariantCondition.kt │ │ └── VariantSpawnEntry.kt │ └── item │ │ └── BannerPattern.kt │ ├── commands │ ├── scoreboard │ │ └── RenderType.kt │ ├── Transfer.kt │ ├── particle │ │ └── types │ │ │ └── ParticleData.kt │ └── Command.kt │ ├── pack │ ├── FilteredBlock.kt │ ├── PackMCMeta.kt │ └── Features.kt │ └── helpers │ └── displays │ ├── entities │ ├── TextAlignment.kt │ └── ItemDisplayModelMode.kt │ └── maths │ └── _Numbers.kt ├── kore typography 1200x600.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── website ├── src │ └── jsMain │ │ ├── resources │ │ └── public │ │ │ ├── logo.png │ │ │ ├── favicon.ico │ │ │ ├── monogram.png │ │ │ └── doc │ │ │ └── chat-components │ │ │ ├── entity.png │ │ │ ├── hover.png │ │ │ ├── score.png │ │ │ ├── keybind.png │ │ │ ├── hello-world.png │ │ │ ├── hover-item.png │ │ │ ├── nbt-health.png │ │ │ ├── translation.png │ │ │ └── combined-hello-world.png │ │ └── kotlin │ │ └── io │ │ └── github │ │ └── ayfri │ │ └── kore │ │ └── website │ │ ├── utils │ │ └── RuntimeAdditions.kt │ │ ├── components │ │ ├── updates │ │ │ └── GitHubService.kt │ │ ├── doc │ │ │ └── DocArticle.kt │ │ └── common │ │ │ └── CodeBlock.kt │ │ └── constants.kt └── .kobweb │ └── conf.yaml ├── bindings └── src │ ├── test │ ├── resources │ │ └── vanilla-data-1.21.8.zip │ └── kotlin │ │ └── io │ │ └── github │ │ └── ayfri │ │ └── kore │ │ └── bindings │ │ ├── Main.kt │ │ ├── testUtils.kt │ │ ├── dungeonsAndTaverns.kt │ │ └── vanillaTests.kt │ └── main │ └── kotlin │ └── io │ └── github │ └── ayfri │ └── kore │ └── bindings │ ├── logging.kt │ ├── _Path.kt │ ├── entities.kt │ └── generation │ └── _String.kt ├── oop └── src │ └── main │ └── kotlin │ └── io │ └── github │ └── ayfri │ └── kore │ ├── selectors │ ├── utils.kt │ └── SingleSelector.kt │ └── entities │ └── Player.kt ├── generation ├── src │ └── main │ │ └── kotlin │ │ ├── _Collection.kt │ │ ├── generators │ │ ├── Datapacks.kt │ │ └── minecraftVersion.kt │ │ └── _KotlinPoet.kt └── build.gradle.kts ├── .gitignore ├── gradle.properties └── CONTRIBUTING.md /kore/src/test/kotlin/io/github/ayfri/kore/arguments/chatcomponents/ChatComponentTests.kt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /kore typography 1200x600.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayfri/Kore/HEAD/kore typography 1200x600.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayfri/Kore/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /kore/src/test/resources/kore_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayfri/Kore/HEAD/kore/src/test/resources/kore_icon.png -------------------------------------------------------------------------------- /website/src/jsMain/resources/public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayfri/Kore/HEAD/website/src/jsMain/resources/public/logo.png -------------------------------------------------------------------------------- /website/src/jsMain/resources/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayfri/Kore/HEAD/website/src/jsMain/resources/public/favicon.ico -------------------------------------------------------------------------------- /website/src/jsMain/resources/public/monogram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayfri/Kore/HEAD/website/src/jsMain/resources/public/monogram.png -------------------------------------------------------------------------------- /bindings/src/test/resources/vanilla-data-1.21.8.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayfri/Kore/HEAD/bindings/src/test/resources/vanilla-data-1.21.8.zip -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/annotations/FunctionsHolder.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.annotations 2 | 3 | @DslMarker 4 | annotation class FunctionsHolder 5 | -------------------------------------------------------------------------------- /website/src/jsMain/resources/public/doc/chat-components/entity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayfri/Kore/HEAD/website/src/jsMain/resources/public/doc/chat-components/entity.png -------------------------------------------------------------------------------- /website/src/jsMain/resources/public/doc/chat-components/hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayfri/Kore/HEAD/website/src/jsMain/resources/public/doc/chat-components/hover.png -------------------------------------------------------------------------------- /website/src/jsMain/resources/public/doc/chat-components/score.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayfri/Kore/HEAD/website/src/jsMain/resources/public/doc/chat-components/score.png -------------------------------------------------------------------------------- /website/src/jsMain/resources/public/doc/chat-components/keybind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayfri/Kore/HEAD/website/src/jsMain/resources/public/doc/chat-components/keybind.png -------------------------------------------------------------------------------- /website/src/jsMain/resources/public/doc/chat-components/hello-world.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayfri/Kore/HEAD/website/src/jsMain/resources/public/doc/chat-components/hello-world.png -------------------------------------------------------------------------------- /website/src/jsMain/resources/public/doc/chat-components/hover-item.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayfri/Kore/HEAD/website/src/jsMain/resources/public/doc/chat-components/hover-item.png -------------------------------------------------------------------------------- /website/src/jsMain/resources/public/doc/chat-components/nbt-health.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayfri/Kore/HEAD/website/src/jsMain/resources/public/doc/chat-components/nbt-health.png -------------------------------------------------------------------------------- /website/src/jsMain/resources/public/doc/chat-components/translation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayfri/Kore/HEAD/website/src/jsMain/resources/public/doc/chat-components/translation.png -------------------------------------------------------------------------------- /website/src/jsMain/resources/public/doc/chat-components/combined-hello-world.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayfri/Kore/HEAD/website/src/jsMain/resources/public/doc/chat-components/combined-hello-world.png -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/recipes/Recipes.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.recipes 2 | 3 | import io.github.ayfri.kore.DataPack 4 | 5 | data class Recipes(val dp: DataPack) 6 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/serializers/PathSerializer.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.serializers 2 | 3 | import kotlinx.io.files.Path 4 | 5 | data object PathSerializer : ToStringSerializer() 6 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/dialogs/DialogContainer.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.dialogs 2 | 3 | import io.github.ayfri.kore.DataPack 4 | 5 | data class DialogContainer(val dp: DataPack) 6 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/chatcomponents/SimpleComponent.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.chatcomponents 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | sealed interface SimpleComponent 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/ruletest/AlwaysTrue.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.ruletest 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object AlwaysTrue : RuleTest() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/structures/StructuresBuilder.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.structures 2 | 3 | import io.github.ayfri.kore.DataPack 4 | 5 | data class StructuresBuilder(val dp: DataPack) 6 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/providers/EnchantmentProviders.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.providers 2 | 3 | import io.github.ayfri.kore.DataPack 4 | 5 | data class EnchantmentProviders(var dp: DataPack) 6 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/utils/console.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.utils 2 | 3 | internal const val yellow = "\u001B[33m" 4 | internal const val reset = "\u001B[0m" 5 | internal fun warn(message: String) = println("$yellow$message$reset") 6 | -------------------------------------------------------------------------------- /bindings/src/main/kotlin/io/github/ayfri/kore/bindings/logging.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.bindings 2 | 3 | internal const val yellow = "\u001B[33m" 4 | internal const val reset = "\u001B[0m" 5 | 6 | internal fun warn(message: String) = println("$yellow$message$reset") 7 | -------------------------------------------------------------------------------- /oop/src/main/kotlin/io/github/ayfri/kore/selectors/utils.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.selectors 2 | 3 | import io.github.ayfri.kore.arguments.selector.SelectorType 4 | 5 | val SelectorType.isSingle get() = this == SelectorType.NEAREST_PLAYER || this == SelectorType.RANDOM_PLAYER 6 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/densityfunction/types/Beardifier.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.densityfunction.types 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object Beardifier : DensityFunctionType() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/densityfunction/types/BlendAlpha.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.densityfunction.types 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object BlendAlpha : DensityFunctionType() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/densityfunction/types/EndIslands.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.densityfunction.types 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object EndIslands : DensityFunctionType() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/testenvironments/types/TimeOfDay.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.testenvironments.types 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class TimeOfDay( 7 | val time: Int 8 | ) : TestEnvironment() 9 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/Kelp.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object Kelp : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/NoOp.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object NoOp : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/densityfunction/types/BlendOffset.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.densityfunction.types 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object BlendOffset : DensityFunctionType() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/dialogs/control/ControlContainer.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.dialogs.control 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class ControlContainer(var controls: List = emptyList()) 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/effects/builders/EmptyEffectBuilder.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.effects.builders 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object EmptyEffectBuilder : EffectBuilder() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/BlueIce.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object BlueIce : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/Vines.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object Vines : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/noisesettings/rules/conditions/Hole.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.noisesettings.rules.conditions 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object Hole : SurfaceRuleCondition() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/noisesettings/rules/conditions/Steep.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.noisesettings.rules.conditions 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object Steep : SurfaceRuleCondition() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/itemmodifiers/formulas/Formula.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.itemmodifiers.formulas 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** Marker interface for `apply_bonus` formulas. */ 6 | @Serializable 7 | sealed interface Formula 8 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/CoralClaw.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object CoralClaw : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/CoralTree.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object CoralTree : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/EndIsland.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object EndIsland : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/IceSpike.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object IceSpike : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/dimension/biomesource/TheEnd.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.dimension.biomesource 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object TheEnd : BiomeSource() 7 | 8 | fun theEnd() = TheEnd 9 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/BasaltPillar.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object BasaltPillar : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/BonusChest.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object BonusChest : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/ChorusPlant.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object ChorusPlant : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/DesertWell.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object DesertWell : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/EndPlatform.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object EndPlatform : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/MonsterRoom.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object MonsterRoom : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/WeepingVines.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object WeepingVines : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/colors/NamedColor.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.colors 2 | 3 | /** 4 | * Marker for named colors (e.g., [FormattingColor], [BossBarColor]). 5 | * See documentation: https://kore.ayfri.com/docs/colors 6 | */ 7 | sealed interface NamedColor : Color 8 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/biome/types/SpawnCost.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.biome.types 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class SpawnCost( 7 | var energyBudget: Float, 8 | var charge: Float, 9 | ) 10 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/CoralMushroom.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object CoralMushroom : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/FreezeTopLayer.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object FreezeTopLayer : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/GlowstoneBlob.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object GlowstoneBlob : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/noisesettings/rules/conditions/Temperature.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.noisesettings.rules.conditions 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object Temperature : SurfaceRuleCondition() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/generation/dataPackJarGenerationFiles.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.generation 2 | 3 | fun DataPackGenerator.generateAdditionalJarFiles() { 4 | if (options !is DataPackJarGenerationOptions) return 5 | val jarOptions = options as DataPackJarGenerationOptions 6 | } 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/consumable/ConsumeEffects.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components.consumable 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class ConsumeEffects( 7 | var effects: List = emptyList(), 8 | ) 9 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/VoidStartPlatform.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object VoidStartPlatform : FeatureConfig() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/effects/entity/AllOf.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.effects.entity 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class AllOf( 7 | var effects: List = emptyList(), 8 | ) : EntityEffect() 9 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/effects/value/AllOf.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.effects.value 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class AllOf( 7 | var effects: List = emptyList(), 8 | ) : ValueEffect() 9 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/processorlist/types/rule/blockentitymodifier/Clear.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.processorlist.types.rule.blockentitymodifier 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object Clear : BlockEntityModifier() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/processorlist/types/rule/positionpredicate/AlwaysTrue.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.processorlist.types.rule.positionpredicate 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object AlwaysTrue : PositionPredicate() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/chatcomponents/hover/Contents.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.chatcomponents.hover 2 | 3 | import net.benwoodworth.knbt.NbtTag 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | sealed interface Contents { 8 | fun toNbtTag(): NbtTag 9 | } 10 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/ItemOrTagArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = Argument.ArgumentSerializer::class) 7 | interface ItemOrTagArgument : Argument 8 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/PossessorArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = Argument.ArgumentSerializer::class) 7 | interface PossessorArgument : Argument 8 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/numbers/ranges/Range.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.numbers.ranges 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = Argument.ArgumentSerializer::class) 7 | sealed interface Range : Argument 8 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/BlockOrTagArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = Argument.ArgumentSerializer::class) 7 | interface BlockOrTagArgument : Argument 8 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/ScoreHolderArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = Argument.ArgumentSerializer::class) 7 | interface ScoreHolderArgument : Argument 8 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/processorlist/types/rule/blockentitymodifier/Passthrough.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.processorlist.types.rule.blockentitymodifier 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object Passthrough : BlockEntityModifier() 7 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/FunctionOrTagArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = Argument.ArgumentSerializer::class) 7 | interface FunctionOrTagArgument : Argument 8 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/itemmodifiers/formulas/OreDrops.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.itemmodifiers.formulas 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** `apply_bonus` formula specific to ore drops. Mirrors vanilla `ore_drops`. */ 6 | @Serializable 7 | data object OreDrops : Formula 8 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/dialogs/body/BodyContainer.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.dialogs.body 2 | 3 | import io.github.ayfri.kore.serializers.InlinableList 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class BodyContainer(var bodies: InlinableList = emptyList()) 8 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/blockpredicate/Solid.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.blockpredicate 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object Solid : BlockPredicate() 7 | 8 | fun MutableList.solid() { 9 | this += Solid 10 | } 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/noisesettings/rules/Bandlands.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.noisesettings.rules 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** 6 | * Represents a bandlands surface rule. 7 | */ 8 | @Serializable 9 | data object Bandlands : SurfaceRule() 10 | -------------------------------------------------------------------------------- /kore/src/test/kotlin/io/github/ayfri/kore/arguments/arguments.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments 2 | 3 | fun argumentsTests() { 4 | componentsMatchersTests() 5 | componentsPatchsTests() 6 | entityComponentsTests() 7 | itemComponentsTests() 8 | itemPredicatesTests() 9 | itemSlotTests() 10 | resourceLiteralsTests() 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/EntityArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = Argument.ArgumentSerializer::class) 7 | interface EntityArgument : DataArgument, ContainerArgument 8 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/blockpredicate/True.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.blockpredicate 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object True : BlockPredicate() 7 | 8 | fun MutableList.trueBlockPredicate() { 9 | this += True 10 | } 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/consumable/ClearAllEffects.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components.consumable 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object ClearAllEffects : ConsumeEffect() 7 | 8 | fun ConsumeEffects.clearAllEffects() = apply { effects += ClearAllEffects } 9 | -------------------------------------------------------------------------------- /website/src/jsMain/kotlin/io/github/ayfri/kore/website/utils/RuntimeAdditions.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.website.utils 2 | 3 | import androidx.compose.runtime.Composable 4 | import androidx.compose.runtime.LaunchedEffect 5 | 6 | @Composable 7 | fun loadPrism() = LaunchedEffect(Unit) { 8 | js("window.Prism.highlightAll()").unsafeCast() 9 | } 10 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/values/LevelsSquared.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.values 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class LevelsSquared( 7 | var added: Int, 8 | ) : LevelBased() 9 | 10 | fun levelsSquaredLevelBased(added: Int) = LevelsSquared(added) 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/blockpredicate/Replaceable.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.blockpredicate 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object Replaceable : BlockPredicate() 7 | 8 | fun MutableList.replaceable() { 9 | this += Replaceable 10 | } 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/intproviders/ConstantIntProvider.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.intproviders 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | @SerialName("minecraft:constant") 8 | data class ConstantIntProvider(val value: Int) : IntProvider 9 | -------------------------------------------------------------------------------- /generation/src/main/kotlin/_Collection.kt: -------------------------------------------------------------------------------- 1 | fun Collection.removeSuffix(suffix: String) = map { it.substringBeforeLast(suffix) } 2 | fun Collection.removePrefix(prefix: String) = map { it.substringAfter(prefix) } 3 | 4 | fun Collection.removeMinecraftPrefix() = removePrefix("minecraft:") 5 | fun Collection.removeJSONSuffix() = removeSuffix(".json") 6 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/numbers/_Double.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.numbers 2 | 3 | internal val Double.str 4 | get() = when { 5 | this.rem(1) == 0.0 -> this.toInt().toString() 6 | else -> toString() 7 | } 8 | 9 | internal val Double.strUnlessZero 10 | get() = when { 11 | this == 0.0 -> "" 12 | else -> str 13 | } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/data/spawncondition/types/MoonBrightness.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.data.spawncondition.types 2 | 3 | import io.github.ayfri.kore.arguments.numbers.ranges.serializers.FloatRangeOrFloatJson 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class MoonBrightness(var range: FloatRangeOrFloatJson) : VariantCondition 8 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/testenvironments/types/Weather.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.testenvironments.types 2 | 3 | import io.github.ayfri.kore.features.testenvironments.enums.Weather as WeatherEnum 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Weather( 8 | val weather: WeatherEnum 9 | ) : TestEnvironment() 10 | -------------------------------------------------------------------------------- /kore/src/test/kotlin/io/github/ayfri/kore/assertions/utils.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.assertions 2 | 3 | fun printStackTraceAndDiff(difference: String, stackIndex: Int) { 4 | val stack = Thread.currentThread().stackTrace 5 | with(stack[stackIndex]) { 6 | System.err.println("\nat $className.$methodName($fileName:$lineNumber)") 7 | } 8 | System.err.println(difference) 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### Intellij 2 | .idea 3 | 4 | ### Gradle 5 | .gradle 6 | build 7 | 8 | ### Kotlin 9 | .kotlin 10 | 11 | ### Tests 12 | out 13 | 14 | ### Auto-Generation 15 | **/generated/**/*.kt 16 | 17 | ### Tests configurations 18 | **/test/**/resources/**.env 19 | 20 | ### Website 21 | website/.kobweb/* 22 | !website/.kobweb/conf.yaml 23 | 24 | ### Environment variables 25 | **/.env 26 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/data/spawncondition/VariantSpawnEntry.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.data.spawncondition 2 | 3 | import io.github.ayfri.kore.data.spawncondition.types.VariantCondition 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class VariantSpawnEntry( 8 | var priority: Int, 9 | var condition: VariantCondition? = null 10 | ) 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/biome/types/AdditionalSound.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.biome.types 2 | 3 | import io.github.ayfri.kore.arguments.types.resources.SoundArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class AdditionalSound( 8 | var sound: SoundArgument, 9 | var tickChance: Float 10 | ) 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/processorlist/types/BlockIgnore.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.processorlist.types 2 | 3 | import io.github.ayfri.kore.data.block.BlockState 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class BlockIgnore( 8 | var blocks: List = emptyList(), 9 | ) : ProcessorType() 10 | -------------------------------------------------------------------------------- /generation/src/main/kotlin/generators/Datapacks.kt: -------------------------------------------------------------------------------- 1 | package generators 2 | 3 | import generateEnum 4 | import getFromCacheOrDownloadTxt 5 | import url 6 | 7 | suspend fun downloadDataPacks() { 8 | val url = url("custom-generated/lists/datapacks.txt") 9 | val values = getFromCacheOrDownloadTxt("datapacks.txt", url).lines() + "vanilla" 10 | 11 | generateEnum(values, "DataPacks", url) 12 | } 13 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | 3 | # Kotlin version 4 | kotlin.version=2.2.0 5 | 6 | # Minecraft version 7 | minecraft.version=1.21.8 8 | 9 | # Gradle optimization flags 10 | org.gradle.caching=true 11 | org.gradle.configuration-cache=true 12 | org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 13 | org.gradle.parallel=true 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/effects/entity/RunFunction.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.effects.entity 2 | 3 | import io.github.ayfri.kore.arguments.types.resources.FunctionArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class RunFunction( 8 | var function: FunctionArgument, 9 | ) : EntityEffect() 10 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/testenvironments/types/AllOf.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.testenvironments.types 2 | 3 | import io.github.ayfri.kore.generated.arguments.types.TestEnvironmentArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class AllOf( 8 | val definitions: List 9 | ) : TestEnvironment() 10 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/itemmodifiers/formulas/UniformBonusCount.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.itemmodifiers.formulas 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** `apply_bonus` formula: uniform distribution from 0 to (level * bonusMultiplier). */ 6 | @Serializable 7 | data class UniformBonusCount( 8 | var bonusMultiplier: Float, 9 | ) : Formula 10 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/Bamboo.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class Bamboo( 7 | var probability: Double = 0.0, 8 | ) : FeatureConfig() 9 | 10 | fun bamboo(probability: Double) = Bamboo(probability) 11 | -------------------------------------------------------------------------------- /bindings/src/test/kotlin/io/github/ayfri/kore/bindings/Main.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.bindings 2 | 3 | import io.github.ayfri.kore.bindings.api.apiTests 4 | 5 | fun main() { 6 | println("Running bindings module tests...") 7 | importingTests() 8 | importingVanilla() 9 | apiTests() 10 | dungeonsAndTavernsTests() 11 | tagsTests() 12 | downloadTests() 13 | println("All tests passed!") 14 | } 15 | -------------------------------------------------------------------------------- /bindings/src/test/kotlin/io/github/ayfri/kore/bindings/testUtils.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.bindings 2 | 3 | infix fun T.assertsIs(expected: T) { 4 | if (this != expected) { 5 | error("Expected '$expected' but got '$this'") 6 | } 7 | } 8 | 9 | infix fun String.assertsIs(expected: String) { 10 | if (this != expected) { 11 | error("Expected:\n$expected\n\nBut got:\n$this") 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/dimension/generator/Debug.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.dimension.generator 2 | 3 | import io.github.ayfri.kore.features.worldgen.dimension.Dimension 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data object Debug : Generator() 8 | 9 | fun Dimension.debugGenerator() { 10 | generator = Debug 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/processorlist/types/Nop.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.processorlist.types 2 | 3 | import io.github.ayfri.kore.features.worldgen.processorlist.ProcessorList 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data object Nop : ProcessorType() 8 | 9 | fun ProcessorList.nop() { 10 | processors += Nop 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/serializers/JsonSerialName.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.serializers 2 | 3 | import kotlinx.serialization.ExperimentalSerializationApi 4 | import kotlinx.serialization.SerialInfo 5 | 6 | @OptIn(ExperimentalSerializationApi::class) 7 | @SerialInfo 8 | @Target(AnnotationTarget.CLASS, AnnotationTarget.PROPERTY) 9 | annotation class JsonSerialName(val name: String) 10 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/values/Linear.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.values 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class Linear( 7 | var base: Int, 8 | var perLevelAboveFirst: Int, 9 | ) : LevelBased() 10 | 11 | fun linearLevelBased(base: Int, perLevelAboveFirst: Int) = Linear(base, perLevelAboveFirst) 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/Seagrass.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class Seagrass( 7 | var probability: Double = 0.0, 8 | ) : FeatureConfig() 9 | 10 | fun seagrass(probability: Double = 0.0) = Seagrass(probability) 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/structureset/ExclusionZone.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.structureset 2 | 3 | import io.github.ayfri.kore.generated.arguments.worldgen.types.StructureSetArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class ExclusionZone( 8 | var otherSet: StructureSetArgument, 9 | var chunkCount: Int = 1, 10 | ) 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/actions/OpenUrl.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.actions 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class OpenUrl( 7 | var url: String, 8 | ) : Action(), ClickEvent, DialogAction 9 | 10 | /** Opens the given url in the default browser. */ 11 | fun ActionWrapper<*>.openUrl(url: String) = apply { action = OpenUrl(url) } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/consumable/TeleportRandomly.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components.consumable 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class TeleportRandomly( 7 | var diameter: Float, 8 | ) : ConsumeEffect() 9 | 10 | fun ConsumeEffects.teleportRandomly(diameter: Float) = apply { effects += TeleportRandomly(diameter) } 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/data/spawncondition/types/Biome.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.data.spawncondition.types 2 | 3 | import io.github.ayfri.kore.generated.arguments.worldgen.BiomeOrTagArgument 4 | import io.github.ayfri.kore.serializers.InlinableList 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class Biome(var biomes: InlinableList) : VariantCondition 9 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/intproviders/UniformIntProvider.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.intproviders 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | @SerialName("minecraft:uniform") 8 | data class UniformIntProvider( 9 | var minInclusive: Int, 10 | var maxInclusive: Int, 11 | ) : IntProvider 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/structureset/Structure.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.structureset 2 | 3 | import io.github.ayfri.kore.generated.arguments.worldgen.types.ConfiguredStructureArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Structure( 8 | var structure: ConfiguredStructureArgument, 9 | var weight: Int = 1, 10 | ) 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/Argument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments 2 | 3 | import io.github.ayfri.kore.serializers.ToStringSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(Argument.ArgumentSerializer::class) 7 | interface Argument { 8 | fun asString(): String 9 | 10 | data object ArgumentSerializer : ToStringSerializer({ asString() } ) 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/tree/treedecorator/TrunkVine.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations.tree.treedecorator 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data object TrunkVine : TreeDecorator() 7 | 8 | fun MutableList.trunkVine() { 9 | this += TrunkVine 10 | } 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/ruletest/BlockMatch.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.ruletest 2 | 3 | import io.github.ayfri.kore.arguments.types.resources.BlockArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class BlockMatch( 8 | var block: BlockArgument, 9 | ) : RuleTest() 10 | 11 | fun blockMatch(block: BlockArgument) = BlockMatch(block) 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/templatepool/TemplatePoolEntry.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.templatepool 2 | 3 | import io.github.ayfri.kore.features.worldgen.templatepool.elements.TemplatePoolElement 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class TemplatePoolEntry( 8 | var weight: Int = 0, 9 | var element: TemplatePoolElement, 10 | ) 11 | -------------------------------------------------------------------------------- /kore/src/test/kotlin/io/github/ayfri/kore/commands/TriggerCommand.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.commands 2 | 3 | import io.github.ayfri.kore.assertions.assertsIs 4 | import io.github.ayfri.kore.functions.Function 5 | 6 | fun Function.triggerTests() { 7 | trigger("test") { 8 | add(1) assertsIs "trigger test add 1" 9 | set(1) assertsIs "trigger test set 1" 10 | remove(1) assertsIs "trigger test add -1" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/EmptyComponent.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components 2 | 3 | import io.github.ayfri.kore.arguments.components.item.CustomComponent 4 | import io.github.ayfri.kore.utils.nbt 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable(with = CustomComponent.Companion.CustomComponentSerializer::class) 8 | data object EmptyComponent : CustomComponent(nbt {}) 9 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/testenvironments/types/Function.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.testenvironments.types 2 | 3 | import io.github.ayfri.kore.arguments.types.resources.FunctionArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Function( 8 | val setup: FunctionArgument? = null, 9 | val teardown: FunctionArgument? = null 10 | ) : TestEnvironment() 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/dimension/biomesource/Fixed.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.dimension.biomesource 2 | 3 | import io.github.ayfri.kore.generated.arguments.worldgen.types.BiomeArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Fixed(var biome: BiomeArgument) : BiomeSource() 8 | 9 | fun fixed(biome: BiomeArgument) = Fixed(biome) 10 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/ruletest/TagMatch.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.ruletest 2 | 3 | import io.github.ayfri.kore.arguments.types.resources.tagged.BlockTagArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class TagMatch( 8 | var tag: BlockTagArgument, 9 | ) : RuleTest() 10 | 11 | fun tagMatch(tag: BlockTagArgument) = TagMatch(tag) 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/utils/SerializationUtils.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.utils 2 | 3 | import kotlinx.serialization.Serializable 4 | import kotlinx.serialization.json.Json 5 | import kotlinx.serialization.json.encodeToJsonElement 6 | import kotlinx.serialization.json.jsonPrimitive 7 | 8 | internal inline fun T.asArg() = Json.encodeToJsonElement(this@asArg).jsonPrimitive.content 9 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/data/item/BannerPattern.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.data.item 2 | 3 | import io.github.ayfri.kore.arguments.colors.FormattingColor 4 | import io.github.ayfri.kore.generated.arguments.types.BannerPatternArgument 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class BannerPattern( 9 | val pattern: BannerPatternArgument, 10 | val color: FormattingColor, 11 | ) 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/noisesettings/rules/conditions/AbovePreliminarySurface.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.noisesettings.rules.conditions 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** 6 | * Represents a condition that checks if an entity is above a preliminary surface. 7 | */ 8 | @Serializable 9 | data object AbovePreliminarySurface : SurfaceRuleCondition() 10 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/placedfeature/modifiers/Biome.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.placedfeature.modifiers 2 | 3 | import io.github.ayfri.kore.features.worldgen.placedfeature.PlacedFeature 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data object Biome : PlacementModifier() 8 | 9 | fun PlacedFeature.biome() { 10 | placementModifiers += Biome 11 | } 12 | -------------------------------------------------------------------------------- /website/.kobweb/conf.yaml: -------------------------------------------------------------------------------- 1 | site: 2 | title: "Kore Website" 3 | 4 | server: 5 | files: 6 | dev: 7 | contentRoot: "build/processedResources/js/main/public" 8 | script: "build/kotlin-webpack/js/developmentExecutable/website.js" 9 | api: "build/libs/website.jar" 10 | prod: 11 | script: "build/kotlin-webpack/js/productionExecutable/website.js" 12 | siteRoot: ".kobweb/site" 13 | 14 | port: 8080 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/conditions/SurvivesExplosion.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.conditions 2 | 3 | import io.github.ayfri.kore.features.predicates.Predicate 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data object SurvivesExplosion : PredicateCondition() 8 | 9 | fun Predicate.survivesExplosion() { 10 | predicateConditions += SurvivesExplosion 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/intproviders/BiasedToBottomIntProvider.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.intproviders 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | @SerialName("minecraft:biased_to_bottom") 8 | data class BiasedToBottomIntProvider( 9 | var minInclusive: Int, 10 | var maxInclusive: Int, 11 | ) : IntProvider 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/placedfeature/modifiers/InSquare.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.placedfeature.modifiers 2 | 3 | import io.github.ayfri.kore.features.worldgen.placedfeature.PlacedFeature 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data object InSquare : PlacementModifier() 8 | 9 | fun PlacedFeature.inSquare() { 10 | placementModifiers += InSquare 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/structures/types/jigsaw/Direct.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.structures.types.jigsaw 2 | 3 | import io.github.ayfri.kore.generated.arguments.worldgen.types.TemplatePoolArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Direct( 8 | var alias: TemplatePoolArgument, 9 | var target: TemplatePoolArgument, 10 | ) : PoolAlias() 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/enums/Axis.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(Axis.Companion.AxisSerializer::class) 7 | enum class Axis { 8 | X, 9 | Y, 10 | Z; 11 | 12 | companion object { 13 | data object AxisSerializer : LowercaseSerializer(entries) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/intproviders/ClampedIntProvider.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.intproviders 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | @SerialName("minecraft:clamped") 8 | data class ClampedIntProvider( 9 | var minInclusive: Int, 10 | var maxInclusive: Int, 11 | var source: IntProvider 12 | ) : IntProvider 13 | -------------------------------------------------------------------------------- /kore/src/test/kotlin/io/github/ayfri/kore/helpers/dp.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.helpers 2 | 3 | import io.github.ayfri.kore.dataPack 4 | import io.github.ayfri.kore.functions.load 5 | import io.github.ayfri.kore.setTestPath 6 | 7 | fun helpersTests() = dataPack("helpers_tests") { 8 | setTestPath() 9 | schedulerTest() 10 | 11 | load { 12 | displayTests() 13 | inventoryManagerTests() 14 | scoreboardTests() 15 | } 16 | }.generate() 17 | -------------------------------------------------------------------------------- /website/src/jsMain/kotlin/io/github/ayfri/kore/website/components/updates/GitHubService.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.website.components.updates 2 | 3 | import io.github.ayfri.kore.website.gitHubReleases 4 | 5 | data object GitHubService { 6 | fun getLatestReleases(perPage: Int = 10) = gitHubReleases.take(perPage) 7 | fun getReleases() = gitHubReleases 8 | fun getRelease(tagName: String) = gitHubReleases.find { it.tagName == tagName } 9 | } 10 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/actions/CopyToClipboard.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.actions 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class CopyToClipboard( 7 | var value: String, 8 | ) : Action(), ClickEvent, DialogAction 9 | 10 | /** Copy the given value to the clipboard. */ 11 | fun ActionWrapper<*>.copyToClipboard(value: String) = apply { action = CopyToClipboard(value) } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/actions/ChangePage.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.actions 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class ChangePage( 7 | var page: Int, 8 | ) : Action(), ClickEvent, DialogAction 9 | 10 | /** Change the current page of an open book, does nothing if no book is open. */ 11 | fun ActionWrapper<*>.changePage(page: Int) = apply { action = ChangePage(page) } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/Components.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable(with = ComponentsSerializer::class) 6 | class Components(components: MutableMap = mutableMapOf()) : ComponentsScope(components) { 7 | /** Convert the components to a [ComponentsPatch]. */ 8 | fun toPatch() = ComponentsPatch(components) 9 | } 10 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/data/spawncondition/types/Structure.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.data.spawncondition.types 2 | 3 | import io.github.ayfri.kore.generated.arguments.worldgen.ConfiguredStructureOrTagArgument 4 | import io.github.ayfri.kore.serializers.InlinableList 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class Structure(var structures: InlinableList) : VariantCondition 9 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/effects/entity/spawnparticles/ParticleVelocity.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.effects.entity.spawnparticles 2 | 3 | import io.github.ayfri.kore.features.worldgen.floatproviders.FloatProvider 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class ParticleVelocity( 8 | var base: FloatProvider? = null, 9 | var movementScale: Float? = null, 10 | ) 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/biome/types/MoodSound.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.biome.types 2 | 3 | import io.github.ayfri.kore.arguments.types.resources.SoundArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class MoodSound( 8 | var sound: SoundArgument? = null, 9 | var tickDelay: Int = 6000, 10 | var blockSearchExtent: Int = 8, 11 | var offset: Float = 2f, 12 | ) 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/densityfunction/types/Shift.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.densityfunction.types 2 | 3 | import io.github.ayfri.kore.generated.arguments.worldgen.types.NoiseArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Shift( 8 | var argument: NoiseArgument, 9 | ) : DensityFunctionType() 10 | 11 | fun shift(argument: NoiseArgument) = Shift(argument) 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/densityfunction/types/ShiftA.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.densityfunction.types 2 | 3 | import io.github.ayfri.kore.generated.arguments.worldgen.types.NoiseArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class ShiftA( 8 | var argument: NoiseArgument, 9 | ) : DensityFunctionType() 10 | 11 | fun shiftA(argument: NoiseArgument) = ShiftA(argument) 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/densityfunction/types/ShiftB.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.densityfunction.types 2 | 3 | import io.github.ayfri.kore.generated.arguments.worldgen.types.NoiseArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class ShiftB( 8 | var argument: NoiseArgument, 9 | ) : DensityFunctionType() 10 | 11 | fun shiftB(argument: NoiseArgument) = ShiftB(argument) 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/processorlist/types/BlackStoneReplace.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.processorlist.types 2 | 3 | import io.github.ayfri.kore.features.worldgen.processorlist.ProcessorList 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data object BlackStoneReplace : ProcessorType() 8 | 9 | fun ProcessorList.blackStoneReplace() { 10 | processors += BlackStoneReplace 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/processorlist/types/JigsawReplacement.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.processorlist.types 2 | 3 | import io.github.ayfri.kore.features.worldgen.processorlist.ProcessorList 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data object JigsawReplacement : ProcessorType() 8 | 9 | fun ProcessorList.jigsawReplacement() { 10 | processors += JigsawReplacement 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/processorlist/types/LavaSubmergedBlock.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.processorlist.types 2 | 3 | import io.github.ayfri.kore.features.worldgen.processorlist.ProcessorList 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data object LavaSubmergedBlock : ProcessorType() 8 | 9 | fun ProcessorList.lavaSubmergedBlock() { 10 | processors += LavaSubmergedBlock 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/structures/types/jigsaw/Random.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.structures.types.jigsaw 2 | 3 | import io.github.ayfri.kore.generated.arguments.worldgen.types.TemplatePoolArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Random( 8 | var alias: TemplatePoolArgument, 9 | var targets: List = emptyList(), 10 | ) : PoolAlias() 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/structures/types/jigsaw/RandomGroup.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.structures.types.jigsaw 2 | 3 | import io.github.ayfri.kore.generated.arguments.worldgen.types.TemplatePoolArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class RandomGroup( 8 | var alias: TemplatePoolArgument, 9 | var groups: List = emptyList(), 10 | ) : PoolAlias() 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/effects/value/Add.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.effects.value 2 | 3 | import io.github.ayfri.kore.features.enchantments.values.LevelBased 4 | import io.github.ayfri.kore.features.enchantments.values.constantLevelBased 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class Add( 9 | var value: LevelBased = constantLevelBased(0), 10 | ) : ValueEffect() 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/effects/value/Set.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.effects.value 2 | 3 | import io.github.ayfri.kore.features.enchantments.values.LevelBased 4 | import io.github.ayfri.kore.features.enchantments.values.constantLevelBased 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class Set( 9 | var value: LevelBased = constantLevelBased(0), 10 | ) : ValueEffect() 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/noisesettings/rules/conditions/Not.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.noisesettings.rules.conditions 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class Not( 7 | var invert: SurfaceRuleCondition, 8 | ) : SurfaceRuleCondition() 9 | 10 | fun not(invert: SurfaceRuleCondition) = Not(invert) 11 | 12 | fun not(invert: () -> SurfaceRuleCondition) = Not(invert()) 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/effects/value/Multiply.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.effects.value 2 | 3 | import io.github.ayfri.kore.features.enchantments.values.LevelBased 4 | import io.github.ayfri.kore.features.enchantments.values.constantLevelBased 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class Multiply( 9 | var factor: LevelBased = constantLevelBased(0), 10 | ) : ValueEffect() 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/recipes/types/CookingRecipe.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.recipes.types 2 | 3 | import io.github.ayfri.kore.arguments.types.ItemOrTagArgument 4 | import io.github.ayfri.kore.serializers.InlinableList 5 | 6 | interface CookingRecipe : IngredientsRecipe, ResultedRecipe { 7 | override var ingredient: InlinableList 8 | var group: String? 9 | var experience: Double? 10 | var cookingTime: Int? 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/consumable/PlaySound.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components.consumable 2 | 3 | import io.github.ayfri.kore.generated.arguments.types.SoundEventArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class PlaySound( 8 | var sound: SoundEventArgument, 9 | ) : ConsumeEffect() 10 | 11 | fun ConsumeEffects.playSound(sound: SoundEventArgument) = apply { effects += PlaySound(sound) } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/enums/FoxVariants.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = FoxVariants.Companion.FoxVariantSerializer::class) 7 | enum class FoxVariants { 8 | RED, 9 | SNOW; 10 | 11 | companion object { 12 | data object FoxVariantSerializer : LowercaseSerializer(entries) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/effects/value/RemoveBinomial.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.effects.value 2 | 3 | import io.github.ayfri.kore.features.enchantments.values.LevelBased 4 | import io.github.ayfri.kore.features.enchantments.values.constantLevelBased 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class RemoveBinomial( 9 | var chance: LevelBased = constantLevelBased(0), 10 | ) : ValueEffect() 11 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/pigvariants/PigModel.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.pigvariants 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = PigModel.Companion.PigModelSerializer::class) 7 | enum class PigModel { 8 | NORMAL, 9 | COLD; 10 | 11 | companion object { 12 | data object PigModelSerializer : LowercaseSerializer(entries) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/biome/types/Particle.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.biome.types 2 | 3 | import io.github.ayfri.kore.generated.arguments.types.ParticleTypeArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Particle( 8 | var options: ParticleOptions, 9 | var probability: Float 10 | ) 11 | 12 | @Serializable 13 | data class ParticleOptions( 14 | var type: ParticleTypeArgument 15 | ) 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/intproviders/ClampedNormalIntProvider.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.intproviders 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | @SerialName("minecraft:clamped_normal") 8 | data class ClampedNormalIntProvider( 9 | var minInclusive: Int, 10 | var maxInclusive: Int, 11 | var mean: Float, 12 | var deviation: Float, 13 | ) : IntProvider 14 | -------------------------------------------------------------------------------- /kore/src/test/kotlin/io/github/ayfri/kore/commands/TagCommand.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.commands 2 | 3 | import io.github.ayfri.kore.arguments.types.literals.allPlayers 4 | import io.github.ayfri.kore.assertions.assertsIs 5 | import io.github.ayfri.kore.functions.Function 6 | 7 | fun Function.tagTests() { 8 | tag(allPlayers()) { 9 | add("test") assertsIs "tag @a add test" 10 | list() assertsIs "tag @a list" 11 | remove("test") assertsIs "tag @a remove test" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/commands/scoreboard/RenderType.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.commands.scoreboard 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(RenderType.Companion.RenderTypeSerializer::class) 7 | enum class RenderType { 8 | HEARTS, 9 | INTEGER; 10 | 11 | companion object { 12 | data object RenderTypeSerializer : LowercaseSerializer(entries) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/sub/item/Damage.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.sub.item 2 | 3 | import io.github.ayfri.kore.arguments.numbers.ranges.serializers.IntRangeOrIntJson 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Damage( 8 | var durability: IntRangeOrIntJson? = null, 9 | var damage: IntRangeOrIntJson? = null, 10 | ) 11 | 12 | fun damage(init: Damage.() -> Unit = {}) = Damage().apply(init) 13 | -------------------------------------------------------------------------------- /website/src/jsMain/kotlin/io/github/ayfri/kore/website/components/doc/DocArticle.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.website.components.doc 2 | 3 | data class DocArticle( 4 | val path: String, 5 | val date: String, 6 | val title: String, 7 | val desc: String, 8 | val navTitle: String, 9 | val keywords: List, 10 | val dateModified: String, 11 | val slugs: List, 12 | val position: Int? = null, 13 | ) 14 | 15 | val DocArticle.middleSlugs get() = slugs.drop(1).dropLast(1) 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/cowvariants/CowModel.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.cowvariants 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = CowModel.Companion.CowModelSerializer::class) 7 | enum class CowModel { 8 | COLD, 9 | NORMAL, 10 | WARM; 11 | 12 | companion object { 13 | data object CowModelSerializer : LowercaseSerializer(entries) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /website/src/jsMain/kotlin/io/github/ayfri/kore/website/constants.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.website 2 | 3 | const val GITHUB_LINK = "https://github.com/Ayfri/Kore" 4 | const val PUBLIC_URL = "https://kore.ayfri.com/" 5 | const val WEBSITE_GITHUB_LINK = "$GITHUB_LINK/blob/master/website" 6 | 7 | const val GLOBAL_DESCRIPTION = """ 8 | Kore is a Kotlin library for making Datapacks. It's designed to be easy to use and to provide a lot of features to make the creation of Datapacks easier. 9 | """ 10 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/actions/ShowDialog.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.actions 2 | 3 | import io.github.ayfri.kore.generated.arguments.types.DialogArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class ShowDialog( 8 | var dialog: DialogArgument, 9 | ) : Action(), ClickEvent, DialogAction 10 | 11 | /** Shows a dialog. */ 12 | fun ActionWrapper<*>.showDialog(dialog: DialogArgument) = apply { action = ShowDialog(dialog) } 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/dialogs/body/DialogBody.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.dialogs.body 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = DialogBody.Companion.DialogBodySerializer::class) 7 | sealed class DialogBody { 8 | companion object { 9 | data object DialogBodySerializer : NamespacedPolymorphicSerializer(DialogBody::class) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/conditions/KilledByPlayer.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.conditions 2 | 3 | import io.github.ayfri.kore.features.predicates.Predicate 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class KilledByPlayer( 8 | var inverse: Boolean? = null, 9 | ) : PredicateCondition() 10 | 11 | fun Predicate.killedByPlayer(inverse: Boolean? = null) { 12 | predicateConditions += KilledByPlayer(inverse) 13 | } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/processorlist/types/BlockAge.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.processorlist.types 2 | 3 | import io.github.ayfri.kore.features.worldgen.processorlist.ProcessorList 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class BlockAge( 8 | var mossiness: Double = 0.0, 9 | ) : ProcessorType() 10 | 11 | fun ProcessorList.blockAge(mossiness: Double = 0.0) { 12 | processors += BlockAge(mossiness) 13 | } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/pack/FilteredBlock.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.pack 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** 6 | * Represents a filtered block. 7 | * 8 | * @param namespace The namespace of the filtered block, can be a Regex or a string. 9 | * @param path The path of the filtered block, can be a Regex or a string. 10 | */ 11 | @Serializable 12 | data class FilteredBlock( 13 | var namespace: String? = null, 14 | var path: String? = null, 15 | ) 16 | -------------------------------------------------------------------------------- /generation/src/main/kotlin/_KotlinPoet.kt: -------------------------------------------------------------------------------- 1 | import com.squareup.kotlinpoet.FunSpec 2 | import com.squareup.kotlinpoet.KModifier 3 | import com.squareup.kotlinpoet.PropertySpec 4 | import com.squareup.kotlinpoet.TypeSpec 5 | 6 | fun TypeSpec.Builder.setSealed() = apply { 7 | addModifiers(KModifier.SEALED) 8 | } 9 | 10 | fun FunSpec.Builder.overrides() = apply { 11 | addModifiers(KModifier.OVERRIDE) 12 | } 13 | 14 | fun PropertySpec.Builder.overrides() = apply { 15 | addModifiers(KModifier.OVERRIDE) 16 | } 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/enums/Difficulty.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(Difficulty.Companion.DifficultySerializer::class) 7 | enum class Difficulty { 8 | PEACEFUL, 9 | EASY, 10 | NORMAL, 11 | HARD; 12 | 13 | companion object { 14 | data object DifficultySerializer : LowercaseSerializer(entries) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/enums/ExperienceType.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(ExperienceType.Companion.ExperienceTypeSerializer::class) 7 | enum class ExperienceType { 8 | LEVELS, 9 | POINTS; 10 | 11 | companion object { 12 | data object ExperienceTypeSerializer : LowercaseSerializer(entries) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/enums/Gamemode.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(Gamemode.Companion.GamemodeSerializer::class) 7 | enum class Gamemode { 8 | SURVIVAL, 9 | CREATIVE, 10 | ADVENTURE, 11 | SPECTATOR; 12 | 13 | companion object { 14 | data object GamemodeSerializer : LowercaseSerializer(entries) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/enums/SalmonSizes.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = SalmonSizes.Companion.SalmonSizeSerializer::class) 7 | enum class SalmonSizes { 8 | LARGE, 9 | MEDIUM, 10 | SMALL; 11 | 12 | companion object { 13 | data object SalmonSizeSerializer : LowercaseSerializer(entries) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/test/kotlin/io/github/ayfri/kore/commands/TimeCommand.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.commands 2 | 3 | import io.github.ayfri.kore.arguments.numbers.TimeType 4 | import io.github.ayfri.kore.assertions.assertsIs 5 | import io.github.ayfri.kore.functions.Function 6 | 7 | fun Function.timeTests() { 8 | time { 9 | add(1) assertsIs "time add 1" 10 | query(TimeType.DAYS) assertsIs "time query day" 11 | set(1) assertsIs "time set 1" 12 | set(TimePeriod.DAY) assertsIs "time set day" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/consumable/RemoveEffects.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components.consumable 2 | 3 | import io.github.ayfri.kore.arguments.components.item.Effect 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class RemoveEffects( 8 | var effects: List = emptyList(), 9 | ) : ConsumeEffect() 10 | 11 | fun ConsumeEffects.removeEffects(vararg effects: Effect) = apply { this.effects += RemoveEffects(effects.toList()) } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/enums/DataType.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(DataType.Companion.DataTypeSerializer::class) 7 | enum class DataType { 8 | BYTE, 9 | SHORT, 10 | INT, 11 | LONG, 12 | FLOAT, 13 | DOUBLE; 14 | 15 | companion object { 16 | data object DataTypeSerializer : LowercaseSerializer(entries) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/commands/Transfer.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.commands 2 | 3 | import io.github.ayfri.kore.arguments.types.EntityArgument 4 | import io.github.ayfri.kore.arguments.types.literals.int 5 | import io.github.ayfri.kore.arguments.types.literals.literal 6 | import io.github.ayfri.kore.functions.Function 7 | 8 | fun Function.transfer(hostname: String, port: Int? = null, players: EntityArgument? = null) = 9 | addLine(command("transfer", literal(hostname), int(port), players)) 10 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/chickenvariants/ChickenModel.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.chickenvariants 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = ChickenModel.Companion.ChickenModelSerializer::class) 7 | enum class ChickenModel { 8 | COLD, 9 | NORMAL; 10 | 11 | companion object { 12 | data object ChickenModelSerializer : LowercaseSerializer(entries) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/values/LevelBased.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.values 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = LevelBased.Companion.LevelBasedSerializer::class) 7 | sealed class LevelBased { 8 | companion object { 9 | data object LevelBasedSerializer : NamespacedPolymorphicSerializer(LevelBased::class) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/conditions/EnchantmentActiveCheck.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.conditions 2 | 3 | import io.github.ayfri.kore.features.predicates.Predicate 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class EnchantmentActiveCheck( 8 | var active: Boolean, 9 | ) : PredicateCondition() 10 | 11 | fun Predicate.enchantmentActiveCheck(active: Boolean) { 12 | predicateConditions += EnchantmentActiveCheck(active) 13 | } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/placedfeature/modifiers/RarityFilter.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.placedfeature.modifiers 2 | 3 | import io.github.ayfri.kore.features.worldgen.placedfeature.PlacedFeature 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class RarityFilter( 8 | var chance: Int = 0, 9 | ) : PlacementModifier() 10 | 11 | fun PlacedFeature.rarityFilter(chance: Int = 0) { 12 | placementModifiers += RarityFilter(chance) 13 | } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/structureset/SpreadType.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.structureset 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(SpreadType.Companion.SpreadTypeSerializer::class) 7 | enum class SpreadType { 8 | LINEAR, 9 | TRIANGULAR; 10 | 11 | companion object { 12 | data object SpreadTypeSerializer : LowercaseSerializer(entries) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/test/kotlin/io/github/ayfri/kore/arguments/ComponentsRemovables.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments 2 | 3 | import io.github.ayfri.kore.assertions.assertsIs 4 | import io.github.ayfri.kore.generated.ItemComponentTypes 5 | import io.github.ayfri.kore.generated.Items 6 | 7 | fun componentsPatchsTests() { 8 | Items.DIRT { 9 | remove("foo") 10 | !"bar" 11 | remove(ItemComponentTypes.FOOD, ItemComponentTypes.BANNER_PATTERNS) 12 | } assertsIs "minecraft:dirt[!foo,!bar,!food,!banner_patterns]" 13 | } 14 | -------------------------------------------------------------------------------- /bindings/src/test/kotlin/io/github/ayfri/kore/bindings/dungeonsAndTaverns.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.bindings 2 | 3 | import io.github.ayfri.kore.bindings.* 4 | import io.github.ayfri.kore.bindings.api.importDatapacks 5 | 6 | fun dungeonsAndTavernsTests() = newTest("dungeonsAndTaverns") { 7 | importDatapacks { 8 | configuration { 9 | outputPath(srcDir()) 10 | } 11 | 12 | url("https://cdn.modrinth.com/data/tpehi7ww/versions/xjVWiPK3/Dungeons%20and%20Taverns%20v4.7.3.zip") 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /generation/src/main/kotlin/generators/minecraftVersion.kt: -------------------------------------------------------------------------------- 1 | package generators 2 | 3 | import com.squareup.kotlinpoet.KModifier 4 | import com.squareup.kotlinpoet.PropertySpec 5 | import generateFile 6 | import minecraftVersion 7 | 8 | fun writeMinecraftVersion() { 9 | generateFile("minecraftVersion") { 10 | addProperty( 11 | PropertySpec 12 | .builder("MINECRAFT_VERSION", String::class) 13 | .initializer("\"$minecraftVersion\"") 14 | .addModifiers(KModifier.CONST) 15 | .build() 16 | ) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/sub/entityspecific/Sheep.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.sub.entityspecific 2 | 3 | import io.github.ayfri.kore.features.predicates.sub.Entity 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Sheep(val sheared: Boolean? = null) : EntityTypeSpecific() 8 | 9 | fun Entity.sheepTypeSpecific(sheared: Boolean? = null, block: Sheep.() -> Unit = {}) = apply { 10 | typeSpecific = Sheep(sheared).apply(block) 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredcarver/DebugSettings.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredcarver 2 | 3 | import io.github.ayfri.kore.data.block.BlockState 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class DebugSettings( 8 | var debugMode: Boolean? = null, 9 | var airState: BlockState? = null, 10 | var waterState: BlockState? = null, 11 | var lavaState: BlockState? = null, 12 | var barrierState: BlockState? = null, 13 | ) 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/enums/LlamaVariants.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = LlamaVariants.Companion.LlamaVariantSerializer::class) 7 | enum class LlamaVariants { 8 | BROWN, 9 | CREAMY, 10 | GRAY, 11 | WHITE; 12 | 13 | companion object { 14 | data object LlamaVariantSerializer : LowercaseSerializer(entries) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/enums/MooshroomVariants.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = MooshroomVariants.Companion.MooshroomVariantSerializer::class) 7 | enum class MooshroomVariants { 8 | BROWN, 9 | RED; 10 | 11 | companion object { 12 | data object MooshroomVariantSerializer : LowercaseSerializer(entries) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/conditions/Inverted.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.conditions 2 | 3 | import io.github.ayfri.kore.features.predicates.Predicate 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Inverted( 8 | var term: PredicateCondition, 9 | ) : PredicateCondition() 10 | 11 | fun Predicate.inverted(term: Predicate.() -> Unit) { 12 | predicateConditions += Inverted(Predicate().apply(term).predicateConditions.first()) 13 | } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/dimension/generator/Generator.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.dimension.generator 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = Generator.Companion.GeneratorSerializer::class) 7 | sealed class Generator { 8 | companion object { 9 | data object GeneratorSerializer : NamespacedPolymorphicSerializer(Generator::class) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/floatproviders/ConstantFloatProvider.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.floatproviders 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | @SerialName("minecraft:constant") 8 | data class ConstantFloatProvider(val value: Float) : FloatProvider 9 | 10 | fun constant(value: Float) = ConstantFloatProvider(value) 11 | fun constantFloatProvider(value: Float) = ConstantFloatProvider(value) 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/ruletest/RandomBlockMatch.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.ruletest 2 | 3 | import io.github.ayfri.kore.arguments.types.resources.BlockArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class RandomBlockMatch( 8 | var block: BlockArgument, 9 | var probability: Double = 0.0, 10 | ) : RuleTest() 11 | 12 | fun randomBlockMatch(block: BlockArgument, probability: Double = 0.0) = RandomBlockMatch(block, probability) 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/templatepool/Projection.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.templatepool 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = Projection.Companion.ProjectionSerializer::class) 7 | enum class Projection { 8 | RIGID, 9 | TERRAIN_MATCHING; 10 | 11 | companion object { 12 | data object ProjectionSerializer : LowercaseSerializer(entries) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/damagetypes/types/Scaling.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.damagetypes.types 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = Scaling.Companion.ScalingSerializer::class) 7 | enum class Scaling { 8 | ALWAYS, 9 | NEVER, 10 | WHEN_CAUSED_BY_LIVING_NON_PLAYER; 11 | 12 | companion object { 13 | data object ScalingSerializer : LowercaseSerializer(entries) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredcarver/Config.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredcarver 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = Config.Companion.ConfigSerializer::class) 7 | sealed class Config { 8 | companion object { 9 | data object ConfigSerializer : NamespacedPolymorphicSerializer(Config::class, moveIntoProperty = "config") 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/processorlist/types/rule/blockentitymodifier/AppendLoot.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.processorlist.types.rule.blockentitymodifier 2 | 3 | import io.github.ayfri.kore.generated.arguments.types.LootTableArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class AppendLoot( 8 | var lootTable: LootTableArgument, 9 | ) : BlockEntityModifier() 10 | 11 | fun appendLoot(lootTable: LootTableArgument) = AppendLoot(lootTable) 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/ruletest/RuleTest.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.ruletest 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = RuleTest.Companion.RuleTestSerializer::class) 7 | sealed class RuleTest { 8 | companion object { 9 | data object RuleTestSerializer : NamespacedPolymorphicSerializer(RuleTest::class, outputName = "predicate_type") 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/structures/MineshaftType.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.structures 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = MineshaftType.Companion.MineshaftTypeSerializer::class) 7 | enum class MineshaftType { 8 | MESA, 9 | NORMAL; 10 | 11 | companion object { 12 | data object MineshaftTypeSerializer : LowercaseSerializer(entries) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/helpers/displays/entities/TextAlignment.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.helpers.displays.entities 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(TextAlignment.Companion.TextAlignmentSerializer::class) 7 | enum class TextAlignment { 8 | LEFT, 9 | CENTER, 10 | RIGHT; 11 | 12 | companion object { 13 | data object TextAlignmentSerializer : LowercaseSerializer(entries) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/values/Clamped.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.values 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class Clamped( 7 | var value: LevelBased, 8 | var min: Double, 9 | var max: Double, 10 | ) : LevelBased() 11 | 12 | fun clampedLevelBased(value: Int, min: Double, max: Double) = Clamped(Constant(value), min, max) 13 | 14 | fun clampedLevelBased(value: LevelBased, min: Double, max: Double) = Clamped(value, min, max) 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/structures/types/jigsaw/PoolAlias.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.structures.types.jigsaw 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = PoolAlias.Companion.PoolAliasSerializer::class) 7 | sealed class PoolAlias { 8 | companion object { 9 | data object PoolAliasSerializer : NamespacedPolymorphicSerializer(PoolAlias::class) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/test/kotlin/io/github/ayfri/kore/commands/RideCommand.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.commands 2 | 3 | import io.github.ayfri.kore.arguments.types.literals.allEntities 4 | import io.github.ayfri.kore.arguments.types.literals.self 5 | import io.github.ayfri.kore.assertions.assertsIs 6 | import io.github.ayfri.kore.functions.Function 7 | 8 | fun Function.rideTests() { 9 | ride(allEntities(true)) { 10 | mount(self()) assertsIs "ride @e[limit=1] mount @s" 11 | dismount() assertsIs "ride @e[limit=1] dismount" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/enums/HeightMap.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(HeightMap.Companion.HeightMapSerializer::class) 7 | enum class HeightMap { 8 | MOTION_BLOCKING, 9 | MOTION_BLOCKING_NO_LEAVES, 10 | OCEAN_FLOOR, 11 | WORLD_SURFACE; 12 | 13 | companion object { 14 | data object HeightMapSerializer : LowercaseSerializer(entries) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/literals/TimeArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types.literals 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import io.github.ayfri.kore.arguments.numbers.TimeNumber 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable(with = Argument.ArgumentSerializer::class) 8 | data class TimeArgument(val value: TimeNumber) : Argument { 9 | override fun asString() = value.toString() 10 | } 11 | 12 | fun time(value: TimeNumber) = TimeArgument(value) 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/commands/particle/types/ParticleData.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.commands.particle.types 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = ParticleData.Companion.ParticleDataSerializer::class) 7 | sealed class ParticleData { 8 | companion object { 9 | data object ParticleDataSerializer : NamespacedPolymorphicSerializer(ParticleData::class, skipOutputName = true) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/effects/entity/spawnparticles/types/SimpleParticleType.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.effects.entity.spawnparticles.types 2 | 3 | import io.github.ayfri.kore.generated.arguments.types.ParticleTypeArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class SimpleParticleType( 8 | override var type: ParticleTypeArgument, 9 | ) : ParticleType() 10 | 11 | fun particleType(type: ParticleTypeArgument) = SimpleParticleType(type) 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/Iceberg.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import io.github.ayfri.kore.data.block.BlockState 4 | import io.github.ayfri.kore.data.block.blockStateStone 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class Iceberg( 9 | var state: BlockState = blockStateStone(), 10 | ) : FeatureConfig() 11 | 12 | fun iceberg(state: BlockState = blockStateStone()) = Iceberg(state) 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/noisesettings/rules/SurfaceRule.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.noisesettings.rules 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = SurfaceRule.Companion.SurfaceRuleSerializer::class) 7 | sealed class SurfaceRule { 8 | companion object { 9 | data object SurfaceRuleSerializer : NamespacedPolymorphicSerializer(SurfaceRule::class) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/test/kotlin/io/github/ayfri/kore/commands/TransferCommand.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.commands 2 | 3 | import io.github.ayfri.kore.arguments.types.literals.allPlayers 4 | import io.github.ayfri.kore.assertions.assertsIs 5 | import io.github.ayfri.kore.functions.Function 6 | 7 | fun Function.transferTests() { 8 | transfer("localhost") assertsIs "transfer localhost" 9 | transfer("localhost", 25565) assertsIs "transfer localhost 25565" 10 | transfer("localhost", players = allPlayers()) assertsIs "transfer localhost @a" 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/enums/AxolotlVariants.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = AxolotlVariants.Companion.AxolotlVariantSerializer::class) 7 | enum class AxolotlVariants { 8 | LUCY, 9 | WILD, 10 | GOLD, 11 | CYAN, 12 | BLUE; 13 | 14 | companion object { 15 | data object AxolotlVariantSerializer : LowercaseSerializer(entries) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/types/EntityType.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.types 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = EntityType.Companion.EntitySerializer::class) 7 | enum class EntityType { 8 | ATTACKER, 9 | ATTACKING_PLAYER, 10 | DIRECT_ATTACKER, 11 | THIS; 12 | 13 | companion object { 14 | data object EntitySerializer : LowercaseSerializer(entries) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/dimension/biomesource/BiomeSource.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.dimension.biomesource 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = BiomeSource.Companion.BiomeSourceSerializer::class) 7 | sealed class BiomeSource { 8 | companion object { 9 | data object BiomeSourceSerializer : NamespacedPolymorphicSerializer(BiomeSource::class) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/structures/BiomeTemperature.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.structures 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = BiomeTemperature.Companion.BiomeTemperatureSerializer::class) 7 | enum class BiomeTemperature { 8 | COLD, 9 | WARM; 10 | 11 | companion object { 12 | data object BiomeTemperatureSerializer : LowercaseSerializer(entries) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/chattypes/ChatTypeParameter.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.chattypes 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = ChatTypeParameter.Companion.ChatTypeParameterSerializer::class) 7 | enum class ChatTypeParameter { 8 | TARGET, 9 | SENDER, 10 | CONTENT; 11 | 12 | companion object { 13 | data object ChatTypeParameterSerializer : LowercaseSerializer(entries) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/damagetypes/types/Effects.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.damagetypes.types 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = Effects.Companion.EffectsSerializer::class) 7 | enum class Effects { 8 | HURT, 9 | THORNS, 10 | DROWNING, 11 | BURNING, 12 | POKING, 13 | FREEZING; 14 | 15 | companion object { 16 | data object EffectsSerializer : LowercaseSerializer(entries) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/sub/Effect.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.sub 2 | 3 | import io.github.ayfri.kore.arguments.numbers.ranges.serializers.IntRangeOrIntJson 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Effect( 8 | var ambiant: Boolean? = null, 9 | var amplifier: IntRangeOrIntJson? = null, 10 | var duration: IntRangeOrIntJson? = null, 11 | var visible: Boolean? = null, 12 | ) 13 | 14 | fun effect(init: Effect.() -> Unit = {}) = Effect().apply(init) 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/blockpredicate/BlockPredicate.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.blockpredicate 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = BlockPredicate.Companion.BlockProviderSerializer::class) 7 | sealed class BlockPredicate { 8 | companion object { 9 | data object BlockProviderSerializer : NamespacedPolymorphicSerializer(BlockPredicate::class) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/ForestRock.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import io.github.ayfri.kore.data.block.BlockState 4 | import io.github.ayfri.kore.data.block.blockStateStone 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class ForestRock( 9 | var state: BlockState = blockStateStone(), 10 | ) : FeatureConfig() 11 | 12 | fun forestRock(state: BlockState = blockStateStone()) = ForestRock(state) 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/data/BlockPredicate.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components.data 2 | 3 | import io.github.ayfri.kore.arguments.types.BlockOrTagArgument 4 | import io.github.ayfri.kore.serializers.InlinableList 5 | import net.benwoodworth.knbt.NbtCompound 6 | import kotlinx.serialization.Serializable 7 | 8 | @Serializable 9 | data class BlockPredicate( 10 | val blocks: InlinableList, 11 | val nbt: NbtCompound? = null, 12 | val state: MutableMap? = null, 13 | ) 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/enums/ParrotVariants.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = ParrotVariants.Companion.ParrotVariantSerializer::class) 7 | enum class ParrotVariants { 8 | BLUE, 9 | GRAY, 10 | GREEN, 11 | RED_BLUE, 12 | YELLOW_BLUE; 13 | 14 | companion object { 15 | data object ParrotVariantSerializer : LowercaseSerializer(entries) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/data/spawncondition/types/VariantCondition.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.data.spawncondition.types 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = VariantCondition.Companion.VariantConditionSerializer::class) 7 | sealed interface VariantCondition { 8 | companion object { 9 | data object VariantConditionSerializer : NamespacedPolymorphicSerializer(VariantCondition::class) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/biome/types/Music.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.biome.types 2 | 3 | import io.github.ayfri.kore.arguments.types.resources.SoundArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Music( 8 | var sound: SoundArgument, 9 | var minDelay: Int = 0, 10 | var maxDelay: Int = 0, 11 | var replaceCurrentMusic: Boolean = false, 12 | ) 13 | 14 | @Serializable 15 | data class WeightedMusic( 16 | var data: Music, 17 | var weight: Int = 1, 18 | ) 19 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/tree/treedecorator/Cocoa.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations.tree.treedecorator 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class Cocoa( 7 | var probability: Double = 0.0, 8 | ) : TreeDecorator() 9 | 10 | fun cocoa(probability: Double = 0.0) = Cocoa(probability) 11 | 12 | fun MutableList.cocoa(probability: Double = 0.0) { 13 | this += Cocoa(probability) 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/consumable/ApplyEffects.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components.consumable 2 | 3 | import io.github.ayfri.kore.arguments.components.item.Effect 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class ApplyEffects( 8 | var effects: List, 9 | var probability: Float, 10 | ) : ConsumeEffect() 11 | 12 | fun ConsumeEffects.applyEffects(probability: Float, vararg effects: Effect) = 13 | apply { this.effects += ApplyEffects(effects.toList(), probability) } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/item/GliderComponent.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components.item 2 | 3 | import io.github.ayfri.kore.arguments.components.Component 4 | import io.github.ayfri.kore.arguments.components.ComponentsScope 5 | import io.github.ayfri.kore.generated.ItemComponentTypes 6 | import kotlinx.serialization.Serializable 7 | 8 | @Serializable 9 | data object GliderComponent : Component() 10 | 11 | fun ComponentsScope.glider() = apply { 12 | this[ItemComponentTypes.GLIDER] = GliderComponent 13 | } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/intproviders/WeightedListIntProvider.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.intproviders 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | @SerialName("minecraft:weighted_list") 8 | data class WeightedListIntProvider( 9 | val distribution: MutableList 10 | ) : IntProvider 11 | 12 | @Serializable 13 | data class WeightedEntryIntProvider( 14 | var weight: Int, 15 | var data: IntProvider 16 | ) 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/EquipmentSlot.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(EquipmentSlot.Companion.EquipmentSlotSerializer::class) 7 | enum class EquipmentSlot { 8 | HEAD, 9 | CHEST, 10 | LEGS, 11 | FEET, 12 | BODY, 13 | MAINHAND, 14 | SADDLE, 15 | OFFHAND; 16 | 17 | companion object { 18 | data object EquipmentSlotSerializer : LowercaseSerializer(entries) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/consumable/ConsumeEffect.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components.consumable 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = ConsumeEffect.Companion.ConsumeEffectSerializer::class) 7 | sealed class ConsumeEffect { 8 | companion object { 9 | data object ConsumeEffectSerializer : NamespacedPolymorphicSerializer(ConsumeEffect::class, skipOutputName = true) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/damagetypes/types/DeathMessageType.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.damagetypes.types 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = DeathMessageType.Companion.EffectsSerializer::class) 7 | enum class DeathMessageType { 8 | DEFAULT, 9 | FALL_VARIANTS, 10 | INTENTIONAL_GAME_DESIGN; 11 | 12 | companion object { 13 | data object EffectsSerializer : LowercaseSerializer(entries) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/dialogs/control/DialogControl.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.dialogs.control 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = DialogControl.Companion.DialogControlSerializer::class) 7 | sealed class DialogControl { 8 | abstract var key: String 9 | 10 | companion object { 11 | data object DialogControlSerializer : NamespacedPolymorphicSerializer(DialogControl::class) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/values/Lookup.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.values 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class Lookup( 7 | var values: List = emptyList(), 8 | var fallback: LevelBased = Constant(0), 9 | ) : LevelBased() 10 | 11 | fun lookupLevelBased(vararg values: Int, fallback: LevelBased = Constant(0)) = Lookup(values.toList(), fallback) 12 | fun lookupLevelBased(vararg values: Int, fallback: Int) = Lookup(values.toList(), Constant(fallback)) 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/conditions/AnyOf.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.conditions 2 | 3 | import io.github.ayfri.kore.features.predicates.Predicate 4 | import io.github.ayfri.kore.features.predicates.PredicateAsList 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class AnyOf( 9 | var terms: PredicateAsList? = null, 10 | ) : PredicateCondition() 11 | 12 | fun Predicate.anyOf(terms: Predicate.() -> Unit = {}) { 13 | predicateConditions += AnyOf(Predicate().apply(terms)) 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/sub/entityspecific/FishingHook.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.sub.entityspecific 2 | 3 | import io.github.ayfri.kore.features.predicates.sub.Entity 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class FishingHook(var inOpenWater: Boolean? = null) : EntityTypeSpecific() 8 | 9 | fun Entity.fishingHookTypeSpecific(inOpenWater: Boolean? = null, block: FishingHook.() -> Unit = {}) = apply { 10 | typeSpecific = FishingHook(inOpenWater).apply(block) 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/biome/types/TemperatureModifier.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.biome.types 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = TemperatureModifier.Companion.TemperatureModifierSerializer::class) 7 | enum class TemperatureModifier { 8 | NONE, 9 | FROZEN; 10 | 11 | companion object { 12 | data object TemperatureModifierSerializer : LowercaseSerializer(entries) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/blockpredicate/Offset.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.blockpredicate 2 | 3 | import io.github.ayfri.kore.serializers.TripleAsArray 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Offset( 8 | var offset: TripleAsArray? = null, 9 | ) : BlockPredicate() 10 | 11 | fun offset(x: Int, y: Int, z: Int) = Offset(Triple(x, y, z)) 12 | 13 | fun MutableList.offset(x: Int, y: Int, z: Int) { 14 | this += Offset(Triple(x, y, z)) 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/Direction.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = Direction.Companion.DirectionSerializer::class) 7 | enum class Direction { 8 | UP, 9 | DOWN, 10 | NORTH, 11 | EAST, 12 | SOUTH, 13 | WEST; 14 | 15 | companion object { 16 | data object DirectionSerializer : LowercaseSerializer(entries) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/tree/treedecorator/Beehive.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations.tree.treedecorator 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class Beehive( 7 | var probability: Double = 0.0, 8 | ) : TreeDecorator() 9 | 10 | fun beehive(probability: Double = 0.0) = Beehive(probability) 11 | 12 | fun MutableList.beehive(probability: Double = 0.0) { 13 | this += Beehive(probability) 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/helpers/displays/maths/_Numbers.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.helpers.displays.maths 2 | 3 | import kotlin.math.acos 4 | 5 | const val PI_f = Math.PI.toFloat() 6 | 7 | fun invsqrt(x: Float): Float { 8 | val xhalf = 0.5f * x 9 | var i = java.lang.Float.floatToIntBits(x) 10 | i = 0x5f3759df - (i shr 1) 11 | var y = java.lang.Float.intBitsToFloat(i) 12 | y *= (1.5f - xhalf * y * y) 13 | return y 14 | } 15 | 16 | fun safeAcos(v: Float) = if (v < -1.0f) PI_f else if (v > +1.0f) 0.0f else acos(v.toDouble()).toFloat() 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/chattypes/ChatTypeStyle.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.chattypes 2 | 3 | import io.github.ayfri.kore.arguments.colors.Color 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class ChatTypeStyle( 8 | var color: Color? = null, 9 | var font: String? = null, 10 | var bold: Boolean? = null, 11 | var italic: Boolean? = null, 12 | var underlined: Boolean? = null, 13 | var strikethrough: Boolean? = null, 14 | var obfuscated: Boolean? = null, 15 | var insertion: String? = null, 16 | ) 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/effects/entity/Ignite.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.effects.entity 2 | 3 | import io.github.ayfri.kore.features.enchantments.values.LevelBased 4 | import io.github.ayfri.kore.features.enchantments.values.constantLevelBased 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class Ignite( 9 | var duration: LevelBased = constantLevelBased(0), 10 | ) : EntityEffect() 11 | 12 | fun Ignite.duration(value: Int) { 13 | duration = constantLevelBased(value) 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/values/Constant.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.values 2 | 3 | import io.github.ayfri.kore.serializers.InlineAutoSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = Constant.Companion.ConstantSerializer::class) 7 | data class Constant(var value: Int) : LevelBased() { 8 | companion object { 9 | data object ConstantSerializer : InlineAutoSerializer(Constant::class) 10 | } 11 | } 12 | 13 | fun constantLevelBased(value: Int) = Constant(value) 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/EndGateway.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import io.github.ayfri.kore.serializers.TripleAsArray 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class EndGateway( 8 | var exact: Boolean = false, 9 | var exit: TripleAsArray? = null, 10 | ) : FeatureConfig() 11 | 12 | fun endGateway(exact: Boolean = false, exit: TripleAsArray? = null) = EndGateway(exact, exit) 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/SeaPickle.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import io.github.ayfri.kore.features.worldgen.intproviders.IntProvider 4 | import io.github.ayfri.kore.features.worldgen.intproviders.constant 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class SeaPickle( 9 | var count: IntProvider = constant(0), 10 | ) : FeatureConfig() 11 | 12 | fun seaPickle(count: IntProvider = constant(0)) = SeaPickle(count) 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/placedfeature/modifiers/HeightMap.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.placedfeature.modifiers 2 | 3 | import io.github.ayfri.kore.features.worldgen.HeightMap 4 | import io.github.ayfri.kore.features.worldgen.placedfeature.PlacedFeature 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class HeightMap( 9 | var heightmap: HeightMap, 10 | ) : PlacementModifier() 11 | 12 | fun PlacedFeature.heightMap(height: HeightMap) { 13 | placementModifiers += HeightMap(height) 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/item/UnbreakableComponent.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components.item 2 | 3 | import io.github.ayfri.kore.arguments.components.Component 4 | import io.github.ayfri.kore.arguments.components.ComponentsScope 5 | import io.github.ayfri.kore.generated.ItemComponentTypes 6 | import kotlinx.serialization.Serializable 7 | 8 | @Serializable 9 | data object UnbreakableComponent : Component() 10 | 11 | fun ComponentsScope.unbreakable() = apply { this[ItemComponentTypes.UNBREAKABLE] = UnbreakableComponent } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/enums/HorseVariants.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = HorseVariants.Companion.HorseVariantSerializer::class) 7 | enum class HorseVariants { 8 | BLACK, 9 | BROWN, 10 | CHESTNUT, 11 | CREAMY, 12 | DARK_BROWN, 13 | GRAY, 14 | WHITE; 15 | 16 | companion object { 17 | data object HorseVariantSerializer : LowercaseSerializer(entries) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/effects/entity/DamageItem.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.effects.entity 2 | 3 | import io.github.ayfri.kore.features.enchantments.values.LevelBased 4 | import io.github.ayfri.kore.features.enchantments.values.constantLevelBased 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class DamageItem( 9 | var amount: LevelBased = constantLevelBased(0), 10 | ) : EntityEffect() 11 | 12 | fun DamageItem.amount(value: Int) { 13 | amount = constantLevelBased(value) 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/conditions/WeatherCheck.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.conditions 2 | 3 | import io.github.ayfri.kore.features.predicates.Predicate 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class WeatherCheck( 8 | var raining: Boolean? = null, 9 | var thundering: Boolean? = null, 10 | ) : PredicateCondition() 11 | 12 | fun Predicate.weatherCheck(raining: Boolean? = null, thundering: Boolean? = null) { 13 | predicateConditions += WeatherCheck(raining, thundering) 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/sub/Position.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.sub 2 | 3 | import io.github.ayfri.kore.arguments.numbers.ranges.serializers.IntRangeOrIntJson 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Position( 8 | var x: IntRangeOrIntJson? = null, 9 | var y: IntRangeOrIntJson? = null, 10 | var z: IntRangeOrIntJson? = null, 11 | ) 12 | 13 | fun position(x: IntRangeOrIntJson? = null, y: IntRangeOrIntJson? = null, z: IntRangeOrIntJson? = null) = 14 | Position(x, y, z) 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/tree/treedecorator/LeaveVine.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations.tree.treedecorator 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class LeaveVine( 7 | var probability: Double = 0.0, 8 | ) : TreeDecorator() 9 | 10 | fun leaveVine(probability: Double = 0.0) = LeaveVine(probability) 11 | 12 | fun MutableList.leaveVine(probability: Double = 0.0) { 13 | this += LeaveVine(probability) 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/enums/RabbitVariants.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = RabbitVariants.Companion.RabbitVariantSerializer::class) 7 | enum class RabbitVariants { 8 | BLACK, 9 | BROWN, 10 | EVIL, 11 | GOLD, 12 | SALT, 13 | WHITE, 14 | WHITE_SPLOTCHED; 15 | 16 | companion object { 17 | data object RabbitVariantSerializer : LowercaseSerializer(entries) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/effects/builders/EffectBuilder.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.effects.builders 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = EffectBuilder.Companion.EffectBuilderSerializer::class) 7 | sealed class EffectBuilder { 8 | companion object { 9 | data object EffectBuilderSerializer : NamespacedPolymorphicSerializer(EffectBuilder::class, skipOutputName = true) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/biome/types/GrassColorModifier.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.biome.types 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = GrassColorModifier.Companion.GrassColorModifierSerializer::class) 7 | enum class GrassColorModifier { 8 | NONE, 9 | DARK_FOREST, 10 | SWAMP; 11 | 12 | companion object { 13 | data object GrassColorModifierSerializer : LowercaseSerializer(entries) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/placedfeature/modifiers/SurfaceWaterDepthFilter.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.placedfeature.modifiers 2 | 3 | import io.github.ayfri.kore.features.worldgen.placedfeature.PlacedFeature 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class SurfaceWaterDepthFilter( 8 | var maxWaterDepth: Int = 0, 9 | ) : PlacementModifier() 10 | 11 | fun PlacedFeature.surfaceWaterDepthFilter(maxWaterDepth: Int = 0) { 12 | placementModifiers += SurfaceWaterDepthFilter(maxWaterDepth) 13 | } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/ContainerArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import io.github.ayfri.kore.arguments.maths.Vec3 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable(with = Argument.ArgumentSerializer::class) 8 | interface ContainerArgument : Argument 9 | 10 | val ContainerArgument.literalName 11 | get() = when (this) { 12 | is Vec3 -> "block" 13 | is EntityArgument -> "entity" 14 | else -> error("Unknown container argument type: $this") 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/itemmodifiers/types/Mode.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.itemmodifiers.types 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | /** List-operation mode controlling how values are applied. */ 7 | @Serializable(with = Mode.Companion.ModeSerializer::class) 8 | enum class Mode { 9 | REPLACE_ALL, 10 | REPLACE_SECTION, 11 | INSERT, 12 | APPEND; 13 | 14 | companion object { 15 | data object ModeSerializer : LowercaseSerializer(entries) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/recipes/types/IngredientsRecipe.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.recipes.types 2 | 3 | import io.github.ayfri.kore.arguments.types.ItemOrTagArgument 4 | import io.github.ayfri.kore.arguments.types.resources.tagged.ItemTagArgument 5 | 6 | interface IngredientsRecipe { 7 | var ingredient: List 8 | } 9 | 10 | fun IngredientsRecipe.ingredient(vararg items: ItemOrTagArgument) = apply { ingredient = items.toList() } 11 | fun IngredientsRecipe.ingredient(tag: ItemTagArgument) = apply { ingredient = listOf(tag) } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/structures/TerrainAdaptation.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.structures 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = TerrainAdaptation.Companion.TerrainAdaptationSerializer::class) 7 | enum class TerrainAdaptation { 8 | NONE, 9 | BEARD_THIN, 10 | BEARD_BOX, 11 | BURY; 12 | 13 | companion object { 14 | data object TerrainAdaptationSerializer : LowercaseSerializer(entries) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /kore/src/test/kotlin/io/github/ayfri/kore/features/BannerPatternTests.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features 2 | 3 | import io.github.ayfri.kore.DataPack 4 | import io.github.ayfri.kore.assertions.assertsIs 5 | import io.github.ayfri.kore.features.bannerpatterns.bannerPattern 6 | 7 | fun DataPack.bannerPatternTests() { 8 | bannerPattern("banner_pattern_test", "banner_pattern.test", "minecraft", "test") 9 | 10 | bannerPatterns.last() assertsIs """ 11 | { 12 | "asset_id": "minecraft:test", 13 | "translation_key": "banner_pattern.test" 14 | } 15 | """.trimIndent() 16 | } 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/enums/VillagerVariants.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = VillagerVariants.Companion.VillagerVariantSerializer::class) 7 | enum class VillagerVariants { 8 | DESERT, 9 | JUNGLE, 10 | PLAINS, 11 | SAVANNA, 12 | SNOW, 13 | SWAMP, 14 | TAIGA; 15 | 16 | companion object { 17 | data object VillagerVariantSerializer : LowercaseSerializer(entries) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/literals/AllArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types.literals 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import io.github.ayfri.kore.arguments.types.PossessorArgument 5 | import io.github.ayfri.kore.arguments.types.ScoreHolderArgument 6 | import kotlinx.serialization.Serializable 7 | 8 | @Serializable(with = Argument.ArgumentSerializer::class) 9 | data object AllArgument : Argument, PossessorArgument, ScoreHolderArgument { 10 | override fun asString() = "*" 11 | } 12 | 13 | fun all() = AllArgument 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/conditions/AllOf.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.conditions 2 | 3 | import io.github.ayfri.kore.features.predicates.Predicate 4 | import io.github.ayfri.kore.features.predicates.PredicateAsList 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class AllOf( 9 | var terms: PredicateAsList? = null, 10 | ) : PredicateCondition() 11 | 12 | fun Predicate.allOf(terms: Predicate.() -> Unit = {}) { 13 | predicateConditions += AllOf( 14 | Predicate() 15 | .apply(terms) 16 | ) 17 | } 18 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/sub/entityspecific/EntityTypeSpecific.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.sub.entityspecific 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = EntityTypeSpecific.Companion.EntityTypeSpecificSerializer::class) 7 | sealed class EntityTypeSpecific { 8 | companion object { 9 | data object EntityTypeSpecificSerializer : NamespacedPolymorphicSerializer(EntityTypeSpecific::class) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/intproviders/IntProvider.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.intproviders 2 | 3 | import io.github.ayfri.kore.serializers.ProviderSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | typealias IntProvider = @Serializable(IntProviderSurrogate.Companion.IntProviderSerializer::class) IntProviderSurrogate 7 | 8 | @Serializable 9 | sealed interface IntProviderSurrogate { 10 | companion object { 11 | data object IntProviderSerializer : ProviderSerializer(serializer()) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/placedfeature/modifiers/PlacementModifier.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.placedfeature.modifiers 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = PlacementModifier.Companion.PlacementModifierSerializer::class) 7 | sealed class PlacementModifier { 8 | companion object { 9 | data object PlacementModifierSerializer : NamespacedPolymorphicSerializer(PlacementModifier::class) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/structures/types/jigsaw/LiquidSettings.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.structures.types.jigsaw 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = LiquidSettings.Companion.LiquidSettingsSerializer::class) 7 | enum class LiquidSettings { 8 | APPLY_WATERLOGGING, 9 | IGNORE_WATERLOGGING; 10 | 11 | companion object { 12 | data object LiquidSettingsSerializer : LowercaseSerializer(entries) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /bindings/src/main/kotlin/io/github/ayfri/kore/bindings/_Path.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.bindings 2 | 3 | import java.nio.file.Path 4 | import kotlin.io.path.invariantSeparatorsPathString 5 | import kotlin.io.path.isDirectory 6 | import kotlin.io.path.pathString 7 | 8 | fun Path.isZipFormat() = !isDirectory() && toFile().extension == "zip" 9 | 10 | fun Path.matches(regex: Regex) = pathString.matches(regex) 11 | 12 | // Normalize path for cross-platform consistency, removing leading slashes from ZIP entries 13 | val Path.pathInvariant get() = invariantSeparatorsPathString.trimStart('/') 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/FeatureConfig.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = FeatureConfig.Companion.FeatureSerializer::class) 7 | sealed class FeatureConfig { 8 | companion object { 9 | data object FeatureSerializer : NamespacedPolymorphicSerializer(FeatureConfig::class, moveIntoProperty = "config") 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/templatepool/elements/EmptyPoolElement.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.templatepool.elements 2 | 3 | import io.github.ayfri.kore.features.worldgen.templatepool.TemplatePoolEntry 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data object EmptyPoolElement : TemplatePoolElement() 8 | 9 | fun MutableList.empty(weight: Int = 0) = run { this += TemplatePoolEntry(weight, EmptyPoolElement) } 10 | 11 | fun MutableList.empty() = run { this += EmptyPoolElement } 12 | -------------------------------------------------------------------------------- /kore/src/test/kotlin/io/github/ayfri/kore/commands/SpreadPlayersCommand.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.commands 2 | 3 | import io.github.ayfri.kore.arguments.maths.vec2 4 | import io.github.ayfri.kore.arguments.types.literals.allEntities 5 | import io.github.ayfri.kore.assertions.assertsIs 6 | import io.github.ayfri.kore.functions.Function 7 | 8 | fun Function.spreadPlayersTests() { 9 | spreadPlayers(vec2(), 0.0, 0.0, false, allEntities()) assertsIs "spreadplayers ~ ~ 0 0 false @e" 10 | spreadPlayers(vec2(), 0.0, 0.0, 0, true, allEntities()) assertsIs "spreadplayers ~ ~ 0 0 0 true @e" 11 | } 12 | -------------------------------------------------------------------------------- /generation/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | kotlin("plugin.serialization") 4 | application 5 | } 6 | 7 | repositories { 8 | mavenCentral() 9 | } 10 | 11 | dependencies { 12 | implementation(libs.ktor.client.core) 13 | implementation(libs.ktor.client.cio) 14 | implementation(libs.ktor.client.content.negotiation) 15 | implementation(libs.ktor.serialization) 16 | implementation(libs.ktor.serialization.kotlinx.json) 17 | 18 | implementation(libs.kotlinpoet) 19 | } 20 | 21 | kotlin { 22 | jvmToolchain(17) 23 | } 24 | 25 | application { 26 | mainClass.set("MainKt") 27 | } 28 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/FillLayer.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import io.github.ayfri.kore.data.block.BlockState 4 | import io.github.ayfri.kore.data.block.blockStateStone 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class FillLayer( 9 | var state: BlockState = blockStateStone(), 10 | var height: Int = 0, 11 | ) : FeatureConfig() 12 | 13 | fun fillLayer(state: BlockState = blockStateStone(), height: Int = 0) = FillLayer(state, height) 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/densityfunction/types/DensityFunctionType.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.densityfunction.types 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = DensityFunctionType.Companion.DensityFunctionTypeSerializer::class) 7 | sealed class DensityFunctionType { 8 | companion object { 9 | data object DensityFunctionTypeSerializer : NamespacedPolymorphicSerializer(DensityFunctionType::class) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/noisesettings/rules/conditions/Biome.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.noisesettings.rules.conditions 2 | 3 | import io.github.ayfri.kore.generated.arguments.worldgen.types.BiomeArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Biome( 8 | var biomeIs: List = listOf(), 9 | ) : SurfaceRuleCondition() 10 | 11 | fun biomes(block: MutableList.() -> Unit) = Biome(buildList(block)) 12 | fun biomes(vararg biome: BiomeArgument): Biome = Biome(biome.toList()) 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/processorlist/types/Gravity.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.processorlist.types 2 | 3 | import io.github.ayfri.kore.features.worldgen.HeightMap 4 | import io.github.ayfri.kore.features.worldgen.processorlist.ProcessorList 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class Gravity( 9 | var heightmap: HeightMap, 10 | var offset: Int = 0, 11 | ) : ProcessorType() 12 | 13 | fun ProcessorList.gravity(heightmap: HeightMap, offset: Int = 0) { 14 | processors += Gravity(heightmap, offset) 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/chatcomponents/ChatComponentType.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.chatcomponents 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = ChatComponentType.Companion.ChatComponentTypeSerializer::class) 7 | enum class ChatComponentType { 8 | KEYBIND, 9 | NBT, 10 | SCORE, 11 | SELECTOR, 12 | TEXT, 13 | TRANSLATABLE; 14 | 15 | companion object { 16 | data object ChatComponentTypeSerializer : LowercaseSerializer(entries) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/commands/Command.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.commands 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | 5 | data class Command(val name: String, var hasMacro: Boolean = false) { 6 | private val macroPrefix get() = if (hasMacro) "$" else "" 7 | val arguments = mutableListOf() 8 | override fun toString() = "$macroPrefix$name ${arguments.joinToString(" ", transform = Argument::asString)}".trim() 9 | } 10 | 11 | fun command(name: String, vararg arguments: Argument?) = Command(name).apply { this.arguments.addAll(arguments.filterNotNull()) } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/sub/Slots.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.sub 2 | 3 | import io.github.ayfri.kore.arguments.numbers.ranges.serializers.IntRangeOrIntJson 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Slots( 8 | var empty: IntRangeOrIntJson? = null, 9 | var full: IntRangeOrIntJson? = null, 10 | var occupied: IntRangeOrIntJson? = null, 11 | ) 12 | 13 | fun slots(empty: IntRangeOrIntJson? = null, full: IntRangeOrIntJson? = null, occupied: IntRangeOrIntJson? = null) = 14 | Slots(empty, full, occupied) 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/blockstateprovider/RotatedBlockProvider.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.blockstateprovider 2 | 3 | import io.github.ayfri.kore.data.block.BlockState 4 | import io.github.ayfri.kore.data.block.blockStateStone 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class RotatedBlockProvider( 9 | var state: BlockState = blockStateStone(), 10 | ) : BlockStateProvider() 11 | 12 | fun rotatedBlockProvider(state: BlockState = blockStateStone()) = RotatedBlockProvider(state) 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/processorlist/types/ProtectedBlocks.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.processorlist.types 2 | 3 | import io.github.ayfri.kore.arguments.types.resources.tagged.BlockTagArgument 4 | import io.github.ayfri.kore.features.worldgen.processorlist.ProcessorList 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class ProtectedBlocks( 9 | var value: BlockTagArgument, 10 | ) : ProcessorType() 11 | 12 | fun ProcessorList.protectedBlocks(value: BlockTagArgument) { 13 | processors += ProtectedBlocks(value) 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/recipes/types/Recipe.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.recipes.types 2 | 3 | import io.github.ayfri.kore.features.recipes.RecipeType 4 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable(with = Recipe.Companion.RecipeSerializer::class) 8 | sealed class Recipe { 9 | abstract val type: RecipeType 10 | abstract var group: String? 11 | 12 | companion object { 13 | data object RecipeSerializer : NamespacedPolymorphicSerializer(Recipe::class) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/processorlist/types/ProcessorType.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.processorlist.types 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = ProcessorType.Companion.ProcessorTypeSerializer::class) 7 | sealed class ProcessorType { 8 | companion object { 9 | data object ProcessorTypeSerializer : NamespacedPolymorphicSerializer( 10 | ProcessorType::class, 11 | outputName = "processor_type" 12 | ) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/pack/PackMCMeta.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.pack 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** 6 | * Represents the metadata of a Minecraft pack. 7 | * 8 | * @property pack The details of the pack. 9 | * @property features The features of the pack. 10 | * @property filter The pack.filter applied to the pack, if any. 11 | * 12 | * JSON format reference: https://minecraft.wiki/w/Pack.mcmeta 13 | */ 14 | @Serializable 15 | data class PackMCMeta( 16 | val pack: Pack, 17 | val features: Features? = null, 18 | val filter: Filter? = null, 19 | ) 20 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/sub/entityspecific/Raider.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.sub.entityspecific 2 | 3 | import io.github.ayfri.kore.features.predicates.sub.Entity 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Raider( 8 | var hasRaid: Boolean? = null, 9 | var isCaptain: Boolean? = null, 10 | ) : EntityTypeSpecific() 11 | 12 | fun Entity.raiderTypeSpecific(hasRaid: Boolean? = null, isCaptain: Boolean? = null, block: Raider.() -> Unit = {}) = apply { 13 | typeSpecific = Raider(hasRaid, isCaptain).apply(block) 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/testenvironments/types/GameRules.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.testenvironments.types 2 | 3 | import io.github.ayfri.kore.generated.Gamerules 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class GameRuleEntry(val rule: String, val value: Boolean) 8 | 9 | @Serializable 10 | data class GameRuleIntEntry(val rule: String, val value: Int) 11 | 12 | @Serializable 13 | data class GameRules( 14 | val boolRules: List = emptyList(), 15 | val intRules: List = emptyList() 16 | ) : TestEnvironment() 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/floatproviders/FloatProvider.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.floatproviders 2 | 3 | import io.github.ayfri.kore.serializers.ProviderSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | typealias FloatProvider = @Serializable(with = FloatProviderSurrogate.Companion.FloatProviderSerializer::class) FloatProviderSurrogate 7 | 8 | @Serializable 9 | sealed interface FloatProviderSurrogate { 10 | companion object { 11 | data object FloatProviderSerializer : ProviderSerializer(serializer()) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/heightproviders/HeightProvider.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.heightproviders 2 | 3 | import io.github.ayfri.kore.serializers.ProviderSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | typealias HeightProvider = @Serializable(with = HeightProviderSurrogate.Companion.HeightProviderSerializer::class) HeightProviderSurrogate 7 | 8 | @Serializable 9 | sealed interface HeightProviderSurrogate { 10 | companion object { 11 | data object HeightProviderSerializer : ProviderSerializer(serializer()) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/ruletest/BlockStateMatch.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.ruletest 2 | 3 | import io.github.ayfri.kore.data.block.BlockState 4 | import io.github.ayfri.kore.data.block.blockStateStone 5 | import kotlinx.serialization.SerialName 6 | import kotlinx.serialization.Serializable 7 | 8 | @Serializable 9 | @SerialName("blockstate_match") 10 | data class BlockStateMatch( 11 | var blockState: BlockState = blockStateStone(), 12 | ) : RuleTest() 13 | 14 | fun blockStateMatch(blockState: BlockState = blockStateStone()) = BlockStateMatch(blockState) 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/data/EquipmentSlot.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components.data 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(EquipmentSlot.Companion.EquipmentSlotSerializer::class) 7 | enum class EquipmentSlot { 8 | ANY, 9 | MAINHAND, 10 | OFFHAND, 11 | HAND, 12 | HEAD, 13 | CHEST, 14 | LEGS, 15 | FEET, 16 | ARMOR, 17 | BODY; 18 | 19 | companion object { 20 | data object EquipmentSlotSerializer : LowercaseSerializer(entries) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/item/EnchantableComponent.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components.item 2 | 3 | import io.github.ayfri.kore.arguments.components.Component 4 | import io.github.ayfri.kore.arguments.components.ComponentsScope 5 | import io.github.ayfri.kore.generated.ItemComponentTypes 6 | import kotlinx.serialization.Serializable 7 | 8 | @Serializable 9 | data class EnchantableComponent( 10 | var value: Int, 11 | ) : Component() 12 | 13 | fun ComponentsScope.enchantable(value: Int) = apply { this[ItemComponentTypes.ENCHANTABLE] = EnchantableComponent(value) } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/item/IntangibleProjectileComponent.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components.item 2 | 3 | import io.github.ayfri.kore.arguments.components.Component 4 | import io.github.ayfri.kore.arguments.components.ComponentsScope 5 | import io.github.ayfri.kore.generated.ItemComponentTypes 6 | import kotlinx.serialization.Serializable 7 | 8 | @Serializable 9 | data object IntangibleProjectileComponent : Component() 10 | 11 | fun ComponentsScope.intangibleProjectile() = apply { this[ItemComponentTypes.INTANGIBLE_PROJECTILE] = IntangibleProjectileComponent } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/chattypes/ChatTypeDecoration.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.chattypes 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class ChatTypeDecoration( 7 | var translationKey: String, 8 | var parameters: MutableList = mutableListOf(), 9 | var style: ChatTypeStyle? = null, 10 | ) 11 | 12 | fun ChatTypeDecoration.parameters(vararg parameter: ChatTypeParameter) = parameters.addAll(parameter) 13 | 14 | fun ChatTypeDecoration.style(block: ChatTypeStyle.() -> Unit) { 15 | style = ChatTypeStyle().apply(block) 16 | } 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/sub/entityspecific/Slime.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.sub.entityspecific 2 | 3 | import io.github.ayfri.kore.arguments.numbers.ranges.serializers.IntRangeOrIntJson 4 | import io.github.ayfri.kore.features.predicates.sub.Entity 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class Slime(var size: IntRangeOrIntJson? = null) : EntityTypeSpecific() 9 | 10 | fun Entity.slimeTypeSpecific(size: IntRangeOrIntJson? = null, block: Slime.() -> Unit = {}) = apply { 11 | typeSpecific = Slime(size).apply(block) 12 | } 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/tree/treedecorator/TreeDecorator.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations.tree.treedecorator 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = TreeDecorator.Companion.TreeDecoratorSerializer::class) 7 | sealed class TreeDecorator { 8 | companion object { 9 | data object TreeDecoratorSerializer : NamespacedPolymorphicSerializer(TreeDecorator::class) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/test/kotlin/io/github/ayfri/kore/features/worldgen/NoiseTests.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen 2 | 3 | import io.github.ayfri.kore.DataPack 4 | import io.github.ayfri.kore.assertions.assertsIs 5 | import io.github.ayfri.kore.features.worldgen.noise.noise 6 | 7 | fun DataPack.noiseTests() { 8 | noise("noise_test") { 9 | firstOctave = 0 10 | amplitudes = listOf(1.0, 1.0, 1.0, 1.0) 11 | } 12 | 13 | noises.last() assertsIs """ 14 | { 15 | "firstOctave": 0, 16 | "amplitudes": [ 17 | 1.0, 18 | 1.0, 19 | 1.0, 20 | 1.0 21 | ] 22 | } 23 | """.trimIndent() 24 | } 25 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/providers/types/EnchantmentProviderType.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.providers.types 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = EnchantmentProviderType.Companion.EnchantmentProviderTypeSerializer::class) 7 | sealed class EnchantmentProviderType { 8 | companion object { 9 | data object EnchantmentProviderTypeSerializer : NamespacedPolymorphicSerializer(EnchantmentProviderType::class) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/recipes/types/CraftingTransmuteCategory.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.recipes.types 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = CraftingTransmuteCategory.Companion.CraftingTransmuteCategorySerializer::class) 7 | enum class CraftingTransmuteCategory { 8 | BUILDING, 9 | REDSTONE, 10 | EQUIPMENT, 11 | MISC; 12 | 13 | companion object { 14 | data object CraftingTransmuteCategorySerializer : LowercaseSerializer(entries) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/HeightMap.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen 2 | 3 | import io.github.ayfri.kore.serializers.UppercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = HeightMap.Companion.ProjectStartToHeightmapSerializer::class) 7 | enum class HeightMap { 8 | MOTION_BLOCKING, 9 | MOTION_BLOCKING_NO_LEAVES, 10 | OCEAN_FLOOR, 11 | OCEAN_FLOOR_WG, 12 | WORLD_SURFACE, 13 | WORLD_SURFACE_WG; 14 | 15 | companion object { 16 | data object ProjectStartToHeightmapSerializer : UppercaseSerializer(entries) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/blockstateprovider/BlockStateProvider.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.blockstateprovider 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = BlockStateProvider.Companion.BlockStateProviderSerializer::class) 7 | sealed class BlockStateProvider { 8 | companion object { 9 | data object BlockStateProviderSerializer : NamespacedPolymorphicSerializer(BlockStateProvider::class) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/noisesettings/rules/conditions/SurfaceRuleCondition.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.noisesettings.rules.conditions 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = SurfaceRuleCondition.Companion.SurfaceRuleConditionSerializer::class) 7 | sealed class SurfaceRuleCondition { 8 | companion object { 9 | data object SurfaceRuleConditionSerializer : NamespacedPolymorphicSerializer(SurfaceRuleCondition::class) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /website/src/jsMain/kotlin/io/github/ayfri/kore/website/components/common/CodeBlock.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.website.components.common 2 | 3 | import androidx.compose.runtime.Composable 4 | import org.jetbrains.compose.web.dom.Code 5 | import org.jetbrains.compose.web.dom.Pre 6 | import org.jetbrains.compose.web.dom.Text 7 | 8 | @Composable 9 | fun CodeBlock(text: String, lang: String? = null, vararg classes: String) { 10 | Pre({ 11 | classes(*classes) 12 | }) { 13 | Code(attrs = { 14 | classes(lang?.let { "language-$it" } ?: "nohighlight", "line-numbers") 15 | }) { 16 | Text(text) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/Lake.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import io.github.ayfri.kore.data.block.BlockState 4 | import io.github.ayfri.kore.data.block.blockStateStone 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class Lake( 9 | var fluid: BlockState = blockStateStone(), 10 | var barrier: BlockState = blockStateStone(), 11 | ) : FeatureConfig() 12 | 13 | fun lake(fluid: BlockState = blockStateStone(), barrier: BlockState = blockStateStone()) = Lake(fluid, barrier) 14 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution guidelines 2 | 3 | ## How to contribute 4 | 5 | 1. Fork the repository 6 | 2. Create a new branch 7 | 3. Make your changes 8 | 4. Commit your changes 9 | 5. Push your changes 10 | 6. Submit a pull request 11 | 12 | ## How to write a commit message 13 | 14 | We follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) specification. 15 | 16 | ## How to write a pull request 17 | 18 | We also follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) specification for the title of the pull request. 19 | 20 | And write a description of the changes you made. 21 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/effects/entity/spawnparticles/ParticlePositionType.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.effects.entity.spawnparticles 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = ParticlePositionType.Companion.ParticlePositionTypeSerializer::class) 7 | enum class ParticlePositionType { 8 | ENTITY_POSITION, 9 | IN_BOUNDING_BOX; 10 | 11 | companion object { 12 | data object ParticlePositionTypeSerializer : LowercaseSerializer(entries) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/effects/value/ValueEffect.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.effects.value 2 | 3 | import io.github.ayfri.kore.features.enchantments.effects.EnchantmentEffect 4 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable(with = ValueEffect.Companion.ValueEffectSerializer::class) 8 | sealed class ValueEffect : EnchantmentEffect { 9 | companion object { 10 | data object ValueEffectSerializer : NamespacedPolymorphicSerializer(ValueEffect::class) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/conditions/DamageSourceProperties.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.conditions 2 | 3 | import io.github.ayfri.kore.features.predicates.Predicate 4 | import io.github.ayfri.kore.features.predicates.sub.DamageSource 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class DamageSourceProperties( 9 | var predicate: DamageSource, 10 | ) : PredicateCondition() 11 | 12 | fun Predicate.damageSourceProperties(block: DamageSource.() -> Unit = {}) { 13 | predicateConditions += DamageSourceProperties(DamageSource().apply(block)) 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/conditions/PredicateConditionSurrogate.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.conditions 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = PredicateCondition.Companion.PredicateConditionSerializer::class) 7 | sealed class PredicateCondition { 8 | companion object { 9 | data object PredicateConditionSerializer : NamespacedPolymorphicSerializer( 10 | PredicateCondition::class, 11 | outputName = "condition" 12 | ) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/sub/Equipment.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.sub 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Equipment( 8 | @SerialName("mainhand") 9 | var mainHand: ItemStack? = null, 10 | @SerialName("offhand") 11 | var offHand: ItemStack? = null, 12 | var head: ItemStack? = null, 13 | var chest: ItemStack? = null, 14 | var legs: ItemStack? = null, 15 | var feet: ItemStack? = null, 16 | ) 17 | 18 | fun equipment(init: Equipment.() -> Unit = {}) = Equipment().apply(init) 19 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/TwistingVines.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class TwistingVines( 7 | var spreadWidth: Int = 0, 8 | var spreadHeight: Int = 0, 9 | var maxHeight: Int = 0, 10 | ) : FeatureConfig() 11 | 12 | fun twistingVines( 13 | spreadWidth: Int = 0, 14 | spreadHeight: Int = 0, 15 | maxHeight: Int = 0, 16 | block: TwistingVines.() -> Unit = {}, 17 | ) = TwistingVines(spreadWidth, spreadHeight, maxHeight).apply(block) 18 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/dimension/generator/Flat.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.dimension.generator 2 | 3 | import io.github.ayfri.kore.features.worldgen.dimension.Dimension 4 | import io.github.ayfri.kore.generated.arguments.worldgen.types.BiomeArgument 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class Flat( 9 | var settings: FlatGeneratorSettings 10 | ) : Generator() 11 | 12 | fun Dimension.flatGenerator(biome: BiomeArgument, block: FlatGeneratorSettings.() -> Unit) = 13 | Flat(FlatGeneratorSettings(biome).apply(block)).also { generator = it } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/generation/DataPackJarGenerationOptions.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.generation 2 | 3 | import io.github.ayfri.kore.DataPack 4 | import kotlinx.io.files.Path 5 | 6 | abstract class DataPackJarGenerationProvider { 7 | abstract fun generateAdditionalFiles(generator: DataPackGenerator, options: DataPackJarGenerationOptions) 8 | } 9 | 10 | data class DataPackJarGenerationOptions( 11 | internal val datapack: DataPack, 12 | override var mergeWithPacks: List = emptyList(), 13 | var providers: List = emptyList(), 14 | ) : DataPackGenerationCommonOptions() 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/enchantments/effects/entity/SummonEntity.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.enchantments.effects.entity 2 | 3 | import io.github.ayfri.kore.generated.arguments.EntityTypeOrTagArgument 4 | import io.github.ayfri.kore.serializers.InlinableList 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class SummonEntity( 9 | var entity: InlinableList = emptyList(), 10 | var joinTeam: Boolean? = null, 11 | ) : EntityEffect() 12 | 13 | fun SummonEntity.entity(vararg entity: EntityTypeOrTagArgument) { 14 | this.entity = entity.toList() 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/ReplaceSingleBlock.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import io.github.ayfri.kore.features.worldgen.configuredfeature.Target 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class ReplaceSingleBlock( 8 | var targets: List = emptyList(), 9 | ) : FeatureConfig() 10 | 11 | fun replaceSingleBlock(targets: List = emptyList()) = ReplaceSingleBlock(targets) 12 | 13 | fun replaceSingleBlock(vararg targets: Target) = ReplaceSingleBlock(targets.toList()) 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/noisesettings/rules/conditions/VerticalGradient.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.noisesettings.rules.conditions 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class VerticalGradient( 7 | var randomName: String, 8 | var trueAtAndBelow: HeightConstant, 9 | var falseAtAndAbove: HeightConstant, 10 | ) : SurfaceRuleCondition() 11 | 12 | fun verticalGradient( 13 | randomName: String, 14 | trueAtAndBelow: HeightConstant, 15 | falseAtAndAbove: HeightConstant, 16 | ) = VerticalGradient(randomName, trueAtAndBelow, falseAtAndAbove) 17 | -------------------------------------------------------------------------------- /oop/src/main/kotlin/io/github/ayfri/kore/selectors/SingleSelector.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.selectors 2 | 3 | import io.github.ayfri.kore.arguments.selector.SelectorArguments 4 | import io.github.ayfri.kore.arguments.selector.SelectorType 5 | import io.github.ayfri.kore.entities.Entity 6 | import io.github.ayfri.kore.entities.toEntity 7 | 8 | class SingleSelector(val base: SelectorType, val nbtData: SelectorArguments) { 9 | init { 10 | if (!base.isSingle && nbtData.limit != 1) { 11 | nbtData.limit = 1 12 | } 13 | } 14 | 15 | inline fun toEntity() = Entity(nbtData).toEntity() 16 | } 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/processorlist/types/rule/blockentitymodifier/BlockEntityModifier.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.processorlist.types.rule.blockentitymodifier 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = BlockEntityModifier.Companion.BlockEntityModifierSerializer::class) 7 | sealed class BlockEntityModifier { 8 | companion object { 9 | data object BlockEntityModifierSerializer : NamespacedPolymorphicSerializer(BlockEntityModifier::class) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/structureset/FrequencyReductionMethod.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.structureset 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(FrequencyReductionMethod.Companion.FrequencyReductionMethodSerializer::class) 7 | enum class FrequencyReductionMethod { 8 | DEFAULT, 9 | LEGACY_TYPE_1, 10 | LEGACY_TYPE_2, 11 | LEGACY_TYPE_3; 12 | 13 | companion object { 14 | data object FrequencyReductionMethodSerializer : LowercaseSerializer(entries) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/generation/fabric/FabricAuthor.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.generation.fabric 2 | 3 | import io.github.ayfri.kore.serializers.SinglePropertySimplifierSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = FabricAuthor.Companion.AuthorSerializer::class) 7 | data class FabricAuthor( 8 | var name: String, 9 | var contact: FabricContact? = null, 10 | ) { 11 | companion object { 12 | data object AuthorSerializer : SinglePropertySimplifierSerializer( 13 | kClass = FabricAuthor::class, 14 | property = FabricAuthor::name, 15 | ) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/actions/Action.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.actions 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | sealed interface ActionType 8 | 9 | @Serializable(with = Action.Companion.ActionSerializer::class) 10 | sealed class Action : ActionType { 11 | companion object { 12 | data object ActionSerializer : NamespacedPolymorphicSerializer(Action::class) 13 | } 14 | } 15 | 16 | sealed class ActionWrapper { 17 | abstract var action: @UnsafeVariance T? 18 | } 19 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/resources/TagArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types.resources 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import io.github.ayfri.kore.arguments.types.ResourceLocationArgument 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable(with = Argument.ArgumentSerializer::class) 8 | interface TagArgument : ResourceLocationArgument { 9 | companion object { 10 | operator fun invoke(name: String, namespace: String = "minecraft") = object : TagArgument { 11 | override val name = name 12 | override val namespace = namespace 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/trimmaterial/ArmorMaterial.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.trimmaterial 2 | 3 | import io.github.ayfri.kore.serializers.ToStringSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = ArmorMaterial.Companion.ArmorMaterialSerializer::class) 7 | enum class ArmorMaterial { 8 | LEATHER, 9 | CHAINMAIL, 10 | IRON, 11 | GOLD, 12 | DIAMOND, 13 | NETHERITE, 14 | TURTLE; 15 | 16 | override fun toString() = "minecraft:${name.lowercase()}" 17 | 18 | companion object { 19 | data object ArmorMaterialSerializer : ToStringSerializer() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /bindings/src/main/kotlin/io/github/ayfri/kore/bindings/entities.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.bindings 2 | 3 | import io.github.ayfri.kore.pack.PackMCMeta 4 | import java.nio.file.Path 5 | 6 | data class Function( 7 | val id: String, 8 | val macroArguments: List, 9 | ) 10 | 11 | data class Resource( 12 | val id: String, 13 | val type: String, 14 | ) 15 | 16 | data class Datapack( 17 | val name: String, 18 | val path: Path, 19 | val functions: List = emptyList(), 20 | val resources: Map> = emptyMap(), 21 | val features: Map> = emptyMap(), 22 | val pack: PackMCMeta? = null, 23 | ) 24 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/resources/SoundArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types.resources 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import io.github.ayfri.kore.arguments.types.ResourceLocationArgument 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable(with = Argument.ArgumentSerializer::class) 8 | interface SoundArgument : ResourceLocationArgument { 9 | companion object { 10 | operator fun invoke(name: String, namespace: String = "minecraft") = object : SoundArgument { 11 | override val name = name 12 | override val namespace = namespace 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/templatepool/elements/TemplatePoolElement.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.templatepool.elements 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = TemplatePoolElement.Companion.TemplatePoolElementSerializer::class) 7 | sealed class TemplatePoolElement { 8 | companion object { 9 | data object TemplatePoolElementSerializer : NamespacedPolymorphicSerializer( 10 | TemplatePoolElement::class, 11 | outputName = "element_type" 12 | ) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/test/kotlin/io/github/ayfri/kore/commands/TellrawCommand.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.commands 2 | 3 | import io.github.ayfri.kore.arguments.chatcomponents.textComponent 4 | import io.github.ayfri.kore.arguments.colors.Color 5 | import io.github.ayfri.kore.arguments.types.literals.allPlayers 6 | import io.github.ayfri.kore.assertions.assertsIs 7 | import io.github.ayfri.kore.functions.Function 8 | 9 | fun Function.tellrawTests() { 10 | tellraw(allPlayers(), textComponent("test")) assertsIs "tellraw @a \"test\"" 11 | tellraw(allPlayers(), "test", color = Color.RED) assertsIs "tellraw @a {type:\"text\",color:\"red\",text:\"test\"}" 12 | } 13 | -------------------------------------------------------------------------------- /bindings/src/test/kotlin/io/github/ayfri/kore/bindings/vanillaTests.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.bindings 2 | 3 | import io.github.ayfri.kore.bindings.api.importDatapacks 4 | 5 | const val vanillaDatapackName = "vanilla-data-1.21.8.zip" 6 | 7 | fun importingVanilla() = newTest("vanilla") { 8 | importDatapacks { 9 | configuration { 10 | debug = true 11 | outputPath(srcDir()) 12 | } 13 | 14 | val resourceUrl = Thread.currentThread().contextClassLoader 15 | .getResource(vanillaDatapackName) ?: error("Vanilla datapack resource not found") 16 | 17 | url(resourceUrl) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/literals/CompoundArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types.literals 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import net.benwoodworth.knbt.NbtCompound 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable(with = Argument.ArgumentSerializer::class) 8 | data class CompoundArgument(val value: NbtCompound) : Argument { 9 | override fun asString() = value.toString() 10 | } 11 | 12 | @JvmName("compoundNullable") 13 | internal fun compound(value: NbtCompound?) = value?.let { CompoundArgument(it) } 14 | fun compound(value: NbtCompound) = CompoundArgument(value) 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/literals/IntArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types.literals 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = Argument.ArgumentSerializer::class) 7 | data class IntArgument(val value: Long) : Argument { 8 | override fun asString() = value.toString() 9 | } 10 | 11 | fun int(value: Long) = IntArgument(value) 12 | fun int(value: Int) = IntArgument(value.toLong()) 13 | internal fun int(value: Int?) = value?.let { IntArgument(it.toLong()) } 14 | internal fun int(value: Long?) = value?.let { IntArgument(it) } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/resources/BossBarArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types.resources 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import io.github.ayfri.kore.arguments.types.ResourceLocationArgument 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable(with = Argument.ArgumentSerializer::class) 8 | interface BossBarArgument : ResourceLocationArgument { 9 | companion object { 10 | operator fun invoke(name: String, namespace: String = "minecraft") = object : BossBarArgument { 11 | override val name = name 12 | override val namespace = namespace 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/blockpredicate/InsideWorldBounds.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.blockpredicate 2 | 3 | import io.github.ayfri.kore.serializers.TripleAsArray 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class InsideWorldBounds( 8 | var offset: TripleAsArray? = null, 9 | ) : BlockPredicate() 10 | 11 | fun insideWorldBounds(offset: TripleAsArray? = null) = InsideWorldBounds(offset) 12 | 13 | fun MutableList.insideWorldBounds(offset: TripleAsArray? = null) { 14 | this += InsideWorldBounds(offset) 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/RandomSelector.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import io.github.ayfri.kore.generated.arguments.worldgen.types.PlacedFeatureArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class RandomSelector( 8 | var features: List = emptyList(), 9 | var default: PlacedFeatureArgument? = null, 10 | ) : FeatureConfig() 11 | 12 | @Serializable 13 | data class RandomSelectorFeature( 14 | var chance: Float? = null, 15 | var feature: PlacedFeatureArgument, 16 | ) 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/resources/StatisticArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types.resources 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import io.github.ayfri.kore.arguments.types.ResourceLocationArgument 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable(with = Argument.ArgumentSerializer::class) 8 | interface StatisticArgument : ResourceLocationArgument { 9 | companion object { 10 | operator fun invoke(name: String, namespace: String = "minecraft") = object : StatisticArgument { 11 | override val name = name 12 | override val namespace = namespace 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/maths/Coordinate.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.maths 2 | 3 | import io.github.ayfri.kore.arguments.numbers.PosNumber 4 | import io.github.ayfri.kore.arguments.numbers.pos 5 | 6 | typealias Coordinate = Vec3 7 | 8 | fun coordinate(x: Number = 0, y: Number = 0, z: Number = 0) = Vec3(x.pos, y.pos, z.pos) 9 | fun coordinate(x: PosNumber, y: PosNumber, z: PosNumber) = Vec3(x, y, z) 10 | fun coordinate(x: PosNumber.Type, y: PosNumber.Type, z: PosNumber.Type) = Vec3(pos(type = x), pos(type = y), pos(type = z)) 11 | fun coordinate(type: PosNumber.Type) = Vec3(pos(type = type), pos(type = type), pos(type = type)) 12 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/floatproviders/TrapezoidFloatProvider.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.floatproviders 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | @SerialName("minecraft:trapezoid") 8 | data class TrapezoidFloatProvider( 9 | var min: Float, 10 | var max: Float, 11 | var plateau: Float, 12 | ) : FloatProvider 13 | 14 | fun trapezoid(min: Float, max: Float, plateau: Float) = TrapezoidFloatProvider(min, max, plateau) 15 | fun trapezoidFloatProvider(min: Float, max: Float, plateau: Float) = TrapezoidFloatProvider(min, max, plateau) 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/floatproviders/UniformFloatProvider.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.floatproviders 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | @SerialName("minecraft:uniform") 8 | data class UniformFloatProvider( 9 | var minInclusive: Float, 10 | var maxExclusive: Float, 11 | ) : FloatProvider 12 | 13 | fun uniform(minInclusive: Float, maxExclusive: Float) = UniformFloatProvider(minInclusive, maxExclusive) 14 | fun uniformFloatProvider(minInclusive: Float, maxExclusive: Float) = UniformFloatProvider(minInclusive, maxExclusive) 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/placedfeature/modifiers/Count.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.placedfeature.modifiers 2 | 3 | import io.github.ayfri.kore.features.worldgen.intproviders.IntProvider 4 | import io.github.ayfri.kore.features.worldgen.intproviders.constant 5 | import io.github.ayfri.kore.features.worldgen.placedfeature.PlacedFeature 6 | import kotlinx.serialization.Serializable 7 | 8 | @Serializable 9 | data class Count( 10 | var count: IntProvider = constant(0), 11 | ) : PlacementModifier() 12 | 13 | fun PlacedFeature.count(count: IntProvider = constant(0)) { 14 | placementModifiers += Count(count) 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/processorlist/types/rule/positionpredicate/PositionPredicate.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.processorlist.types.rule.positionpredicate 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = PositionPredicate.Companion.PositionPredicateSerializer::class) 7 | sealed class PositionPredicate { 8 | companion object { 9 | data object PositionPredicateSerializer : NamespacedPolymorphicSerializer( 10 | PositionPredicate::class, 11 | "predicate_type" 12 | ) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/structures/RuinedPortalPlacement.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.structures 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = RuinedPortalPlacement.Companion.RuinedPortalPlacementSerializer::class) 7 | enum class RuinedPortalPlacement { 8 | ON_LAND_SURFACE, 9 | PARTLY_BURIED, 10 | ON_OCEAN_FLOOR, 11 | IN_MOUNTAIN, 12 | UNDERGROUND, 13 | IN_NETHER; 14 | 15 | companion object { 16 | data object RuinedPortalPlacementSerializer : LowercaseSerializer(entries) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /kore/src/test/kotlin/io/github/ayfri/kore/commands/EffectCommand.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.commands 2 | 3 | import io.github.ayfri.kore.arguments.types.literals.self 4 | import io.github.ayfri.kore.assertions.assertsIs 5 | import io.github.ayfri.kore.functions.Function 6 | import io.github.ayfri.kore.generated.Effects 7 | 8 | fun Function.effectTests() { 9 | effect(self()) { 10 | clear(Effects.SPEED) assertsIs "effect clear @s minecraft:speed" 11 | give(Effects.SPEED, 100, 10, true) assertsIs "effect give @s minecraft:speed 100 10 true" 12 | giveInfinite(Effects.SPEED, 10, true) assertsIs "effect give @s minecraft:speed infinite 10 true" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/noisesettings/rules/conditions/Water.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.noisesettings.rules.conditions 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class Water( 7 | var offset: Int = 0, 8 | var surfaceDepthMultiplier: Int = 0, 9 | var addStoneDepth: Boolean = false, 10 | ) : SurfaceRuleCondition() 11 | 12 | fun water( 13 | offset: Int = 0, 14 | surfaceDepthMultiplier: Int = 0, 15 | addStoneDepth: Boolean = false, 16 | ) = Water(offset, surfaceDepthMultiplier, addStoneDepth) 17 | 18 | fun water( 19 | block: Water.() -> Unit, 20 | ) = Water().apply(block) 21 | -------------------------------------------------------------------------------- /oop/src/main/kotlin/io/github/ayfri/kore/entities/Player.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.entities 2 | 3 | import io.github.ayfri.kore.arguments.selector.SelectorArguments 4 | import io.github.ayfri.kore.generated.EntityTypes 5 | 6 | class Player(name: String) : Entity() { 7 | init { 8 | selector.name = name 9 | } 10 | 11 | var name: String 12 | get() = selector.name ?: throw IllegalStateException("Player name is null") 13 | set(value) { 14 | selector.name = value 15 | } 16 | 17 | override val type = EntityTypes.PLAYER 18 | } 19 | 20 | fun player(name: String, nbtData: SelectorArguments.() -> Unit = {}) = Player(name).apply { 21 | selector.nbtData() 22 | } 23 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/selector/functions.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.selector 2 | 3 | import io.github.ayfri.kore.arguments.scores.Scores 4 | import io.github.ayfri.kore.arguments.scores.SelectorScore 5 | 6 | /** DSL helper to configure `advancements` on a `SelectorArguments`. */ 7 | fun SelectorArguments.advancements(block: AdvancementBuilder.() -> Unit) { 8 | advancements = AdvancementBuilder().apply(block).build() 9 | } 10 | 11 | /** DSL helper to configure `scores` on a `SelectorArguments`. */ 12 | fun SelectorArguments.scores(block: Scores.() -> Unit) { 13 | scores = Scores().apply(block) 14 | } 15 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/resources/RandomSequenceArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types.resources 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import io.github.ayfri.kore.arguments.types.ResourceLocationArgument 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable(with = Argument.ArgumentSerializer::class) 8 | interface RandomSequenceArgument : ResourceLocationArgument { 9 | companion object { 10 | operator fun invoke(name: String, namespace: String = "minecraft") = object : RandomSequenceArgument { 11 | override val name = name 12 | override val namespace = namespace 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/types/resources/StatisticTypeArgument.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.types.resources 2 | 3 | import io.github.ayfri.kore.arguments.Argument 4 | import io.github.ayfri.kore.arguments.types.ResourceLocationArgument 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable(with = Argument.ArgumentSerializer::class) 8 | interface StatisticTypeArgument : ResourceLocationArgument { 9 | companion object { 10 | operator fun invoke(name: String, namespace: String = "minecraft") = object : StatisticTypeArgument { 11 | override val name = name 12 | override val namespace = namespace 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/noisesettings/NoiseOptions.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.noisesettings 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** 6 | * Represents the options for generating noise. 7 | * 8 | * @property minY The minimum Y value for the noise. 9 | * @property height The overall height of the noise. 10 | * @property sizeHorizontal The horizontal size of the noise. 11 | * @property sizeVertical The vertical size of the noise. 12 | */ 13 | @Serializable 14 | data class NoiseOptions( 15 | var minY: Int, 16 | var height: Int, 17 | var sizeHorizontal: Int, 18 | var sizeVertical: Int, 19 | ) 20 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/generation/tomlSerializer.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.generation 2 | 3 | import com.akuleshov7.ktoml.Toml 4 | import com.akuleshov7.ktoml.TomlIndentation 5 | import com.akuleshov7.ktoml.TomlOutputConfig 6 | 7 | fun tomlSerializer(generator: DataPackGenerator): Toml { 8 | return Toml( 9 | outputConfig = TomlOutputConfig( 10 | indentation = when (generator.datapack.configuration.prettyPrintIndent) { 11 | "\t" -> TomlIndentation.TAB 12 | " " -> TomlIndentation.FOUR_SPACES 13 | " " -> TomlIndentation.TWO_SPACES 14 | else -> TomlIndentation.NONE 15 | }, 16 | ignoreNullValues = true, 17 | ) 18 | ) 19 | } 20 | -------------------------------------------------------------------------------- /kore/src/test/kotlin/io/github/ayfri/kore/helpers/SchedulerTests.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.helpers 2 | 3 | import io.github.ayfri.kore.DataPack 4 | import io.github.ayfri.kore.arguments.numbers.seconds 5 | 6 | fun DataPack.schedulerTest() { 7 | schedulerManager { 8 | debug = true 9 | 10 | addScheduler(1.2.seconds) { 11 | debug("Hello World deferred 1.2 second") 12 | } 13 | 14 | addScheduler(3.seconds, 1.2.seconds) { 15 | debug("Hello World deferred 3 seconds, repeating every 1.2 seconds") 16 | } 17 | 18 | addScheduler(8.seconds) { 19 | unScheduleAll() 20 | debug("Hello World deferred 8 seconds, cleared all schedulers") 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/loottables/entries/Empty.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.loottables.entries 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** 6 | * Loot entry that yields nothing; useful for weight balancing. 7 | * 8 | * Docs: https://kore.ayfri.com/docs/loot-tables 9 | * Minecraft Wiki: https://minecraft.wiki/w/Loot_table 10 | */ 11 | @Serializable 12 | data class Empty( 13 | var quality: Int? = null, 14 | var weight: Int? = null, 15 | ) : LootEntry() 16 | 17 | /** Add an Empty entry with given quality and weight. */ 18 | fun LootEntries.empty(quality: Int = 1, weight: Int = 1) { 19 | add(Empty(quality, weight)) 20 | } 21 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/predicates/conditions/MatchTool.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.predicates.conditions 2 | 3 | import io.github.ayfri.kore.features.predicates.Predicate 4 | import io.github.ayfri.kore.features.predicates.sub.ItemStack 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class MatchTool( 9 | var predicate: ItemStack, 10 | ) : PredicateCondition() 11 | 12 | fun Predicate.matchTool(predicate: ItemStack) { 13 | predicateConditions += MatchTool(predicate) 14 | } 15 | 16 | fun Predicate.matchTool(block: ItemStack.() -> Unit = {}) { 17 | predicateConditions += MatchTool(ItemStack().apply(block)) 18 | } 19 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/item/UseRemainder.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components.item 2 | 3 | import io.github.ayfri.kore.arguments.components.Component 4 | import io.github.ayfri.kore.arguments.components.ComponentsScope 5 | import io.github.ayfri.kore.data.item.ItemStack 6 | import io.github.ayfri.kore.generated.ItemComponentTypes 7 | import kotlinx.serialization.Serializable 8 | 9 | @Serializable 10 | data class UseRemainderComponent( 11 | var item: ItemStack, 12 | ) : Component() 13 | 14 | fun ComponentsScope.useRemainder(item: ItemStack) = apply { 15 | this[ItemComponentTypes.USE_REMAINDER] = UseRemainderComponent(item) 16 | } 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/itemmodifiers/formulas/BinomialWithBonusCount.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.itemmodifiers.formulas 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** 6 | * `apply_bonus` formula: 1 base item plus a binomially distributed bonus (n = level + extra, p = probability). 7 | * For example, a level 10 item with `extra = 1` and `probability = 0.5` will have a 50% chance of 8 | * receiving 1 bonus item (10 + 1 = 11 items total). 9 | * 10 | * Mirrors vanilla `binomial_with_bonus_count`. 11 | */ 12 | @Serializable 13 | data class BinomialWithBonusCount( 14 | var extra: Int, 15 | var probability: Float, 16 | ) : Formula 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/RandomBooleanSelector.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import io.github.ayfri.kore.generated.arguments.worldgen.types.PlacedFeatureArgument 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class RandomBooleanSelector( 8 | var featureFalse: PlacedFeatureArgument, 9 | var featureTrue: PlacedFeatureArgument, 10 | ) : FeatureConfig() 11 | 12 | fun randomBooleanSelector( 13 | featureFalse: PlacedFeatureArgument, 14 | featureTrue: PlacedFeatureArgument, 15 | ) = RandomBooleanSelector(featureFalse, featureTrue) 16 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/components/item/CustomDataComponent.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.components.item 2 | 3 | import io.github.ayfri.kore.arguments.components.ComponentsScope 4 | import io.github.ayfri.kore.generated.ItemComponentTypes 5 | import io.github.ayfri.kore.utils.nbt 6 | import net.benwoodworth.knbt.NbtCompoundBuilder 7 | import net.benwoodworth.knbt.NbtTag 8 | 9 | typealias CustomDataComponent = CustomComponent 10 | 11 | fun ComponentsScope.customData(nbt: NbtTag) = apply { this[ItemComponentTypes.CUSTOM_DATA] = CustomDataComponent(nbt) } 12 | fun ComponentsScope.customData(block: NbtCompoundBuilder.() -> Unit) = customData(nbt(block)) 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/enums/TropicalFishPatterns.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = TropicalFishPatterns.Companion.TropicalFishPatternSerializer::class) 7 | enum class TropicalFishPatterns { 8 | BETTY, 9 | BLOCKFISH, 10 | BRINELY, 11 | CLAYFISH, 12 | DASHER, 13 | FLOPPER, 14 | GLITTER, 15 | KOB, 16 | SNOOPER, 17 | SPOTTY, 18 | STRIPEY, 19 | SUNSTREAK; 20 | 21 | companion object { 22 | data object TropicalFishPatternSerializer : LowercaseSerializer(entries) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/BlockPile.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations 2 | 3 | import io.github.ayfri.kore.features.worldgen.configuredfeature.blockstateprovider.BlockStateProvider 4 | import io.github.ayfri.kore.features.worldgen.configuredfeature.blockstateprovider.simpleStateProvider 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class BlockPile( 9 | var stateProvider: BlockStateProvider = simpleStateProvider(), 10 | ) : FeatureConfig() 11 | 12 | fun blockPile(stateProvider: BlockStateProvider = simpleStateProvider()) = BlockPile(stateProvider) 13 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/tree/layersfeaturesize/LayersFeatureSize.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations.tree.layersfeaturesize 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = LayersFeatureSize.Companion.LayersFeatureSizeSerializer::class) 7 | sealed class LayersFeatureSize { 8 | abstract var minClippedHeight: Int? 9 | 10 | companion object { 11 | data object LayersFeatureSizeSerializer : NamespacedPolymorphicSerializer(LayersFeatureSize::class) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/pack/Features.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.pack 2 | 3 | import io.github.ayfri.kore.DataPack 4 | import io.github.ayfri.kore.generated.DataPacks 5 | import kotlinx.serialization.Serializable 6 | 7 | /** 8 | * Represents the features that are enabled in the datapack. 9 | * 10 | * JSON format reference: https://minecraft.wiki/w/Experiments#Java_Edition 11 | * @property enabled the features that are enabled 12 | */ 13 | @Serializable 14 | data class Features( 15 | var enabled: List = emptyList(), 16 | ) 17 | 18 | /** Enables the given features. */ 19 | fun DataPack.features(vararg enabled: DataPacks) { 20 | features.enabled += enabled 21 | } 22 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/testenvironments/enums/Weather.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.testenvironments.enums 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | /** 7 | * Represents weather conditions for test environments. 8 | */ 9 | @Serializable(Weather.Companion.WeatherSerializer::class) 10 | enum class Weather { 11 | /** Clear weather with no precipitation */ 12 | CLEAR, 13 | 14 | /** Rainy weather */ 15 | RAIN, 16 | 17 | /** Thunderstorm weather */ 18 | THUNDER; 19 | 20 | companion object { 21 | data object WeatherSerializer : LowercaseSerializer(entries) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/chatcomponents/hover/ContentsEntityUUID.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.chatcomponents.hover 2 | 3 | import io.github.ayfri.kore.arguments.chatcomponents.ChatComponent 4 | import io.github.ayfri.kore.utils.set 5 | import kotlinx.serialization.Serializable 6 | import net.benwoodworth.knbt.buildNbtCompound 7 | 8 | @Serializable 9 | data class ContentsEntityUUID( 10 | var id: String, 11 | var name: ChatComponent? = null, 12 | var uuid: String? = null, 13 | ) : Contents { 14 | override fun toNbtTag() = buildNbtCompound { 15 | this["id"] = id 16 | name?.let { this["name"] = it.toNbtTag() } 17 | uuid?.let { this["uuid"] = it } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/helpers/displays/entities/ItemDisplayModelMode.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.helpers.displays.entities 2 | 3 | import io.github.ayfri.kore.serializers.LowercaseSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(ItemDisplayModelMode.Companion.ItemDisplayModelModeSerializer::class) 7 | enum class ItemDisplayModelMode { 8 | NONE, 9 | THIRDPERSON_LEFTHAND, 10 | THIRDPERSON_RIGHTHAND, 11 | FIRSTPERSON_LEFTHAND, 12 | FIRSTPERSON_RIGHTHAND, 13 | HEAD, 14 | GUI, 15 | GROUND, 16 | FIXED; 17 | 18 | companion object { 19 | data object ItemDisplayModelModeSerializer : LowercaseSerializer(entries) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /bindings/src/main/kotlin/io/github/ayfri/kore/bindings/generation/_String.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.bindings.generation 2 | 3 | import java.util.* 4 | 5 | 6 | fun String.camelCase(vararg separators: String = arrayOf("_")): String { 7 | val words = lowercase().split(*separators) 8 | return words[0] + words.drop(1).joinToString("") { word -> 9 | word.replaceFirstChar { it.titlecase(Locale.ENGLISH) } 10 | } 11 | } 12 | 13 | fun String.pascalCase(vararg separators: String = arrayOf("_")) = camelCase(*separators).replaceFirstChar { it.titlecase(Locale.ENGLISH) } 14 | 15 | fun String.snakeCase() = replace(Regex("([a-z])([A-Z])"), "$1_$2").lowercase() 16 | fun String.snakeToCamelCase() = camelCase("_") 17 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/arguments/chatcomponents/hover/ContentsItem.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.arguments.chatcomponents.hover 2 | 3 | import io.github.ayfri.kore.arguments.components.ComponentsPatch 4 | import io.github.ayfri.kore.utils.set 5 | import kotlinx.serialization.Serializable 6 | import net.benwoodworth.knbt.buildNbtCompound 7 | 8 | @Serializable 9 | data class ContentsItem( 10 | var id: String, 11 | var count: Int? = null, 12 | var components: ComponentsPatch? = null, 13 | ) : Contents { 14 | override fun toNbtTag() = buildNbtCompound { 15 | this["id"] = id 16 | count?.let { this["count"] = it } 17 | components?.let { this["components"] = it.asNbt() } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /kore/src/main/kotlin/io/github/ayfri/kore/features/worldgen/configuredfeature/configurations/tree/trunkplacer/TrunkPlacer.kt: -------------------------------------------------------------------------------- 1 | package io.github.ayfri.kore.features.worldgen.configuredfeature.configurations.tree.trunkplacer 2 | 3 | import io.github.ayfri.kore.serializers.NamespacedPolymorphicSerializer 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable(with = TrunkPlacer.Companion.TrunkPlacerSerializer::class) 7 | sealed class TrunkPlacer { 8 | abstract var baseHeight: Int 9 | abstract var heightRandA: Int 10 | abstract var heightRandB: Int 11 | 12 | companion object { 13 | data object TrunkPlacerSerializer : NamespacedPolymorphicSerializer(TrunkPlacer::class) 14 | } 15 | } 16 | --------------------------------------------------------------------------------