Skip to content

Commit

Permalink
ported to ModDev
Browse files Browse the repository at this point in the history
  • Loading branch information
pietro-lopes committed Jul 21, 2024
1 parent a44d171 commit 7a6e9fa
Show file tree
Hide file tree
Showing 8 changed files with 267 additions and 248 deletions.
73 changes: 41 additions & 32 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id 'base'
id 'java'
id 'maven-publish'
id "dev.architectury.loom" version "1.6-SNAPSHOT"
id 'net.neoforged.moddev' version "1.0.14"
id "me.shedaniel.unified-publishing" version "0.1.+"
}

Expand All @@ -15,28 +15,49 @@ version = "${mod_version}-${isLocal ? "local.${Instant.now().epochSecond}" : "bu
group = project.maven_group
base.archivesBaseName = project.archives_base_name

loom {
silentMojangMappingsLicense()

accessWidenerPath = file("src/main/resources/kubejs.accesswidener")
interfaceInjection {
interfaceInjectionSourceSets.add sourceSets.main
}
neoForge {
version = project.neoforge_version
interfaceInjectionData = files("interfaces.json")

runs {
configureEach {
logLevel = org.slf4j.event.Level.INFO
}
client {
client()
if (ENV.MC_CLIENT_ARGS) {
programArgs ENV.MC_CLIENT_ARGS.split(' ')
programArguments.addAll(ENV.MC_CLIENT_ARGS.split(' '))
}

vmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition")
runDir = 'run'
jvmArguments.addAll("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition")
gameDirectory = file 'run'
}
client2 {
client()
programArguments.addAll('--username', 'Dev2')
if (ENV.MC_CLIENT_ARGS) {
programArguments.addAll(ENV.MC_CLIENT_ARGS.split(' '))
}
jvmArguments.addAll("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition")
gameDirectory = file 'run'
}

server {
runDir = 'run_server'
server()
programArgument("--nogui")
gameDirectory = file 'run_server'
}
}

mods {
kubejs {
sourceSet sourceSets.main
}
}

parchment {
minecraftVersion = minecraft_version
mappingsVersion = parchment_version
}
}

compileJava {
Expand Down Expand Up @@ -95,21 +116,12 @@ repositories {
}

dependencies {
minecraft "com.mojang:minecraft:$minecraft_version"
//mappings loom.officialMojangMappings()
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-1.21:$parchment_version@zip")
}
api ("dev.latvian.mods:rhino:$rhino_version") { transitive(false) }

neoForge("net.neoforged:neoforge:$neoforge_version")

modApi("dev.latvian.mods:rhino:$rhino_version") { transitive(false) }

modCompileOnly("dev.architectury:architectury-neoforge:$architectury_version")
modCompileOnly("mezz.jei:jei-1.21-neoforge:$jei_version")
modCompileOnly("me.shedaniel:RoughlyEnoughItems-neoforge:$rei_version")
modCompileOnly("dev.emi:emi-neoforge:$emi_version:api")
compileOnly("dev.architectury:architectury-neoforge:$architectury_version")
compileOnly("mezz.jei:jei-1.21-neoforge:$jei_version")
compileOnly("me.shedaniel:RoughlyEnoughItems-neoforge:$rei_version")
compileOnly("dev.emi:emi-neoforge:$emi_version:api")
}

processResources {
Expand Down Expand Up @@ -140,10 +152,6 @@ jar {
}
}

remapJar {
atAccessWideners.add "kubejs.accesswidener"
}

unifiedPublishing {
project {
releaseType = "${ENV.RELEASE_TYPE ?: 'release'}"
Expand All @@ -153,7 +161,8 @@ unifiedPublishing {
gameLoaders = ["neoforge"]
displayName = "$mod_name NeoForge $project.version"
changelog = "https://kubejs.com/changelog?mc=${project.minecraft_version}"
mainPublication remapJar
// FIXME this is a guess, it was loom's remapJar
mainPublication jar

relations {
depends {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
loom.platform=neoforge
# loom.platform=neoforge

mod_id=kubejs
archives_base_name=kubejs
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
83 changes: 83 additions & 0 deletions interfaces.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"net/minecraft/server/MinecraftServer": [
"dev/latvian/mods/kubejs/core/MinecraftServerKJS"
],
"net/minecraft/client/Minecraft": [
"dev/latvian/mods/kubejs/core/MinecraftClientKJS"
],
"net/minecraft/world/level/block/Block": [
"dev/latvian/mods/kubejs/core/BlockKJS"
],
"net/minecraft/world/level/block/state/BlockBehaviour": [
"dev/latvian/mods/kubejs/core/BlockBehaviourKJS"
],
"net/minecraft/world/level/block/state/BlockState": [
"dev/latvian/mods/kubejs/core/BlockStateKJS"
],
"net/minecraft/world/item/Item": [
"dev/latvian/mods/kubejs/core/ItemKJS"
],
"net/minecraft/world/item/ItemStack": [
"dev/latvian/mods/kubejs/core/ItemStackKJS"
],
"net/minecraft/network/chat/MutableComponent": [
"dev/latvian/mods/kubejs/core/ComponentKJS"
],
"net/minecraft/world/level/Level": [
"dev/latvian/mods/kubejs/core/LevelKJS"
],
"net/minecraft/client/multiplayer/ClientLevel": [
"dev/latvian/mods/kubejs/core/ClientLevelKJS"
],
"net/minecraft/server/level/ServerLevel": [
"dev/latvian/mods/kubejs/core/ServerLevelKJS"
],
"net/minecraft/world/entity/player/Player": [
"dev/latvian/mods/kubejs/core/PlayerKJS"
],
"net/minecraft/client/player/AbstractClientPlayer": [
"dev/latvian/mods/kubejs/core/ClientPlayerKJS"
],
"net/minecraft/server/level/ServerPlayer": [
"dev/latvian/mods/kubejs/core/ServerPlayerKJS"
],
"net/minecraft/world/entity/Entity": [
"dev/latvian/mods/kubejs/core/EntityKJS"
],
"net/minecraft/world/entity/LivingEntity": [
"dev/latvian/mods/kubejs/core/LivingEntityKJS"
],
"net/minecraft/world/item/crafting/Ingredient": [
"dev/latvian/mods/kubejs/core/IngredientKJS"
],
"net/minecraft/world/entity/item/ItemEntity": [
"dev/latvian/mods/kubejs/core/ItemEntityKJS"
],
"net/minecraft/world/entity/decoration/ItemFrame": [
"dev/latvian/mods/kubejs/core/ItemFrameEntityKJS"
],
"net/minecraft/world/Container": [
"dev/latvian/mods/kubejs/core/ContainerKJS"
],
"net/minecraft/world/item/crafting/RecipeHolder": [
"dev/latvian/mods/kubejs/core/RecipeHolderKJS"
],
"net/minecraft/server/ReloadableServerResources": [
"dev/latvian/mods/kubejs/core/ReloadableServerResourcesKJS"
],
"net/minecraft/world/item/crafting/RecipeManager": [
"dev/latvian/mods/kubejs/core/RecipeManagerKJS"
],
"net/minecraft/tags/TagManager": [
"dev/latvian/mods/kubejs/core/TagManagerKJS"
],
"net/minecraft/world/level/material/Fluid": [
"dev/latvian/mods/kubejs/core/FluidKJS"
],
"net/minecraft/world/inventory/MenuType": [
"dev/latvian/mods/kubejs/core/MenuTypeKJS"
],
"net/minecraft/world/entity/EntityType": [
"dev/latvian/mods/kubejs/core/EntityTypeKJS"
]
}
16 changes: 14 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url "https://maven.creeperhost.net/" }
maven { url "https://maven.architectury.dev/" }
// maven { url "https://maven.architectury.dev/" }
maven { url "https://maven.minecraftforge.net/" }
gradlePluginPortal()
maven {
name = "NeoForged"
url = 'https://maven.neoforged.net/releases'
content {
includeGroup "net.neoforged"
}
}
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}

rootProject.name = 'KubeJS-1.21'
127 changes: 127 additions & 0 deletions src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
public net.minecraft.server.MinecraftServer$ReloadableResources
public net.minecraft.world.item.Item$Properties COMPONENT_INTERNER # Lcom.google.common.collect.Interner;

# nbt related
public net.minecraft.nbt.CompoundTag tags # Ljava.util.Map;
public net.minecraft.nbt.CompoundTag readNamedTagData(Lnet.minecraft.nbt.TagType;Ljava.lang.String;Ljava.io.DataInput;Lnet.minecraft.nbt.NbtAccounter;)Lnet.minecraft.nbt.Tag;
public net.minecraft.nbt.ListTag <init>(Ljava.util.List;B)V

# tag-related
public net.minecraft.tags.TagBuilder entries # Ljava.util.List;
public net.minecraft.tags.TagEntry elementOrTag()Lnet.minecraft.util.ExtraCodecs$TagOrElementLocation;
public net.minecraft.util.ExtraCodecs$TagOrElementLocation decoratedId()Ljava.lang.String;
public net.minecraft.tags.TagEntry id # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.tags.TagEntry required # Z
public net.minecraft.tags.TagEntry tag # Z

public net.minecraft.world.item.crafting.ShapelessRecipe$Serializer CODEC # Lcom.mojang.serialization.MapCodec;
# public net.minecraft.world.item.crafting.ShapedRecipe$Serializer CODEC Lcom.mojang.serialization.MapCodec;
# public net.minecraft.world.item.crafting.ShapedRecipePattern symmetrical # Z
public-f net.minecraft.world.item.crafting.ShapedRecipePattern symmetrical # Z

# attributes
public net.minecraft.world.effect.MobEffect$AttributeTemplate
public net.minecraft.world.effect.MobEffect attributeModifiers # Ljava.util.Map;
public net.minecraft.world.effect.MobEffect$AttributeTemplate <init>(Lnet.minecraft.resources.ResourceLocation;DLnet.minecraft.world.entity.ai.attributes.AttributeModifier$Operation;)V
# public net.minecraft.world.item.ArmorItem defaultModifiers # Ljava.util.function.Supplier;
public-f net.minecraft.world.item.ArmorItem defaultModifiers # Ljava.util.function.Supplier;

# public net.minecraft.world.item.TieredItem tier # Lnet.minecraft.world.item.Tier;
public-f net.minecraft.world.item.TieredItem tier # Lnet.minecraft.world.item.Tier;

public net.minecraft.world.level.block.state.BlockBehaviour$Properties <init>()V

# public net.minecraft.world.entity.ai.village.poi.PoiType <init>(Ljava.lang.String;Ljava.util.Set;II)V
# public net.minecraft.world.entity.npc.VillagerType <init>(Ljava.lang.String;)V
# public net.minecraft.world.entity.npc.VillagerProfession <init>(Ljava.lang.String;Lnet.minecraft.world.entity.ai.village.poi.PoiType;Lcom.google.common.collect.ImmutableSet;Lcom.google.common.collect.ImmutableSet;Lnet.minecraft.sounds.SoundEvent;)V

public net.minecraft.server.packs.resources.MultiPackResourceManager namespacedManagers # Ljava.util.Map;
public net.minecraft.server.packs.resources.MultiPackResourceManager packs # Ljava.util.List;
public net.minecraft.resources.RegistryDataLoader$Loader
public net.minecraft.resources.RegistryDataLoader$LoadingFunction

public net.minecraft.commands.Commands$CommandSelection includeIntegrated # Z
public net.minecraft.commands.Commands$CommandSelection includeDedicated # Z
public net.minecraft.commands.synchronization.ArgumentTypeInfos BY_CLASS # Ljava.util.Map;
public net.minecraft.world.level.GameRules$Value deserialize(Ljava.lang.String;)V
public net.minecraft.world.level.GameRules$BooleanValue deserialize(Ljava.lang.String;)V
public net.minecraft.world.level.GameRules$IntegerValue deserialize(Ljava.lang.String;)V
public net.minecraft.world.level.GameRules$Value onChanged(Lnet.minecraft.server.MinecraftServer;)V

public net.minecraft.world.inventory.TransientCraftingContainer menu # Lnet.minecraft.world.inventory.AbstractContainerMenu;
public net.minecraft.world.inventory.CraftingMenu player # Lnet.minecraft.world.entity.player.Player;
public net.minecraft.world.inventory.InventoryMenu owner # Lnet.minecraft.world.entity.player.Player;
public net.minecraft.world.item.CreativeModeTabs CACHED_PARAMETERS # Lnet.minecraft.world.item.CreativeModeTab$ItemDisplayParameters;

# recipes
public net.minecraft.world.item.crafting.ShapelessRecipe ingredients # Lnet.minecraft.core.NonNullList;
public net.minecraft.world.item.crafting.ShapelessRecipe group # Ljava.lang.String;
public net.minecraft.world.item.crafting.ShapelessRecipe result # Lnet.minecraft.world.item.ItemStack;
public-f net.minecraft.world.item.crafting.Ingredient
public net.minecraft.world.item.crafting.Ingredient <init>(Ljava.util.stream.Stream;)V
# public net.minecraft.world.item.crafting.Ingredient values # [Lnet.minecraft.world.item.crafting.Ingredient$Value;
public-f net.minecraft.world.item.crafting.Ingredient values # [Lnet.minecraft.world.item.crafting.Ingredient$Value;
public net.minecraft.world.item.crafting.Ingredient itemStacks # [Lnet.minecraft.world.item.ItemStack;
public net.minecraft.world.item.crafting.Ingredient stackingIds # Lit.unimi.dsi.fastutil.ints.IntList;
public-f net.minecraft.world.item.crafting.Ingredient$Value

public net.minecraft.world.item.crafting.ShapedRecipe pattern # Lnet.minecraft.world.item.crafting.ShapedRecipePattern;
public net.minecraft.world.item.crafting.ShapedRecipe result # Lnet.minecraft.world.item.ItemStack;
public net.minecraft.world.item.crafting.ShapedRecipe showNotification # Z
# public net.minecraft.world.item.crafting.ShapedRecipePattern matches(Lnet.minecraft.world.inventory.CraftingContainer;IIZ)Z

public net.minecraft.server.level.ServerPlayerGameMode isDestroyingBlock # Z
public net.minecraft.server.commands.TeleportCommand performTeleport(Lnet.minecraft.commands.CommandSourceStack;Lnet.minecraft.world.entity.Entity;Lnet.minecraft.server.level.ServerLevel;DDDLjava.util.Set;FFLnet.minecraft.server.commands.TeleportCommand$LookAt;)V
public net.minecraft.commands.arguments.selector.EntitySelector contextFreePredicates # Ljava.util.List;
public net.minecraft.world.level.storage.loot.LootContext$EntityTarget name # Ljava.lang.String;
public net.minecraft.world.level.storage.loot.LootDataType codec # Lcom.mojang.serialization.Codec;
public net.minecraft.world.level.storage.loot.functions.SetComponentsFunction <init>(Ljava.util.List;Lnet.minecraft.core.component.DataComponentPatch;)V
public net.minecraft.world.level.storage.loot.functions.LootItemConditionalFunction simpleBuilder(Ljava.util.function.Function;)Lnet.minecraft.world.level.storage.loot.functions.LootItemConditionalFunction$Builder;

public net.minecraft.world.entity.npc.VillagerType <init>(Ljava.lang.String;)V
public net.minecraft.world.entity.item.ItemEntity LIFETIME # I
public net.minecraft.world.entity.item.ItemEntity age # I
# public net.minecraft.world.level.Explosion radius # F
public-f net.minecraft.world.level.Explosion radius # F

# client stuff
public net.minecraft.client.gui.components.AbstractSelectionList$Entry
public net.minecraft.client.gui.components.ImageButton sprites # Lnet.minecraft.client.gui.components.WidgetSprites;
public net.minecraft.client.Minecraft$GameLoadCookie
public net.minecraft.client.gui.screens.Screen narratables # Ljava.util.List;
public net.minecraft.client.renderer.RenderType$OutlineProperty

# smithing table text components and icons
public net.minecraft.world.item.SmithingTemplateItem APPLIES_TO_TITLE # Lnet.minecraft.network.chat.Component;
public net.minecraft.world.item.SmithingTemplateItem INGREDIENTS_TITLE # Lnet.minecraft.network.chat.Component;
public net.minecraft.world.item.SmithingTemplateItem ARMOR_TRIM_ADDITIONS_SLOT_DESCRIPTION # Lnet.minecraft.network.chat.Component;
public net.minecraft.world.item.SmithingTemplateItem ARMOR_TRIM_BASE_SLOT_DESCRIPTION # Lnet.minecraft.network.chat.Component;
public net.minecraft.world.item.SmithingTemplateItem ARMOR_TRIM_INGREDIENTS # Lnet.minecraft.network.chat.Component;
public net.minecraft.world.item.SmithingTemplateItem ARMOR_TRIM_APPLIES_TO # Lnet.minecraft.network.chat.Component;
public net.minecraft.world.item.SmithingTemplateItem NETHERITE_UPGRADE # Lnet.minecraft.network.chat.Component;
public net.minecraft.world.item.SmithingTemplateItem NETHERITE_UPGRADE_APPLIES_TO # Lnet.minecraft.network.chat.Component;
public net.minecraft.world.item.SmithingTemplateItem NETHERITE_UPGRADE_ADDITIONS_SLOT_DESCRIPTION # Lnet.minecraft.network.chat.Component;
public net.minecraft.world.item.SmithingTemplateItem NETHERITE_UPGRADE_BASE_SLOT_DESCRIPTION # Lnet.minecraft.network.chat.Component;
public net.minecraft.world.item.SmithingTemplateItem NETHERITE_UPGRADE_INGREDIENTS # Lnet.minecraft.network.chat.Component;
public net.minecraft.world.item.SmithingTemplateItem createTrimmableArmorIconList()Ljava.util.List;
public net.minecraft.world.item.SmithingTemplateItem createNetheriteUpgradeIconList()Ljava.util.List;
public net.minecraft.world.item.SmithingTemplateItem createTrimmableMaterialIconList()Ljava.util.List;
public net.minecraft.world.item.SmithingTemplateItem createNetheriteUpgradeMaterialList()Ljava.util.List;
public net.minecraft.world.item.SmithingTemplateItem EMPTY_SLOT_HELMET # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.world.item.SmithingTemplateItem EMPTY_SLOT_CHESTPLATE # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.world.item.SmithingTemplateItem EMPTY_SLOT_LEGGINGS # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.world.item.SmithingTemplateItem EMPTY_SLOT_BOOTS # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.world.item.SmithingTemplateItem EMPTY_SLOT_HOE # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.world.item.SmithingTemplateItem EMPTY_SLOT_AXE # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.world.item.SmithingTemplateItem EMPTY_SLOT_SWORD # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.world.item.SmithingTemplateItem EMPTY_SLOT_SHOVEL # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.world.item.SmithingTemplateItem EMPTY_SLOT_PICKAXE # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.world.item.SmithingTemplateItem EMPTY_SLOT_INGOT # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.world.item.SmithingTemplateItem EMPTY_SLOT_REDSTONE_DUST # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.world.item.SmithingTemplateItem EMPTY_SLOT_QUARTZ # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.world.item.SmithingTemplateItem EMPTY_SLOT_EMERALD # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.world.item.SmithingTemplateItem EMPTY_SLOT_DIAMOND # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.world.item.SmithingTemplateItem EMPTY_SLOT_LAPIS_LAZULI # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.world.item.SmithingTemplateItem EMPTY_SLOT_AMETHYST_SHARD # Lnet.minecraft.resources.ResourceLocation;
public net.minecraft.world.item.SmithingTemplateItem DESCRIPTION_FORMAT # Lnet.minecraft.ChatFormatting;
public net.minecraft.world.item.SmithingTemplateItem TITLE_FORMAT # Lnet.minecraft.ChatFormatting;
Loading

0 comments on commit 7a6e9fa

Please sign in to comment.