Skip to content

Commit

Permalink
feat: update to 1.20 (#120)
Browse files Browse the repository at this point in the history
* chore: update mdk to 1.20

* fix: level access

* fix: property mapping

* fix: remaining compiler errors

* chore: move ru_ru to correct folder

* chore: update discord link
  • Loading branch information
klikli-dev authored Jun 9, 2023
1 parent eea6e8b commit ebab77a
Show file tree
Hide file tree
Showing 24 changed files with 176 additions and 112 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/build_and_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ jobs:
with:
arguments: build
env:
VERSION: ${{ steps.get_mc_version.outputs.result }}-${{ steps.get_version.outputs.result }}
MOD_VERSION: ${{ steps.get_version.outputs.result }}
MINECRAFT_VERSION: ${{ steps.get_mc_version.outputs.result }}
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
- name: Publish
uses: gradle/gradle-build-action@v2
Expand All @@ -57,7 +58,8 @@ jobs:
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
VERSION: ${{ steps.get_mc_version.outputs.result }}-${{ steps.get_version.outputs.result }}
MOD_VERSION: ${{ steps.get_version.outputs.result }}
MINECRAFT_VERSION: ${{ steps.get_mc_version.outputs.result }}
- name: Update CHANGELOG
id: changelog
uses: klikli-dev/changelog-action@main
Expand All @@ -81,7 +83,7 @@ jobs:
uses: stefanzweifel/git-auto-commit-action@v4
if: ${{ steps.get_release_type.outputs.result != 'test' }}
with:
branch: version/1.19.4
branch: version/1.20.0
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
file_pattern: CHANGELOG.md
- name: Upload to Curseforge
Expand All @@ -98,7 +100,7 @@ jobs:
${{ steps.changelog.outputs.changes }}
Find changes for all versions at https://github.com/klikli-dev/theurgy/releases
game_versions: Forge,Minecraft 1.19:${{ steps.get_mc_version.outputs.result }}
game_versions: Forge,Minecraft 1.20:${{ steps.get_mc_version.outputs.result }}
display_name: theurgy-${{ steps.get_mc_version.outputs.result }}-${{ steps.get_version.outputs.result }}.jar
release_type: ${{ steps.get_release_type.outputs.result }}
relations: modonomicon:requiredDependency,jei:optionalDependency
86 changes: 62 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
plugins {
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '5.1.+'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
}

if (System.getenv('VERSION') != null) {
version = System.getenv('VERSION')
} else {
version = "${mc_version}-${mod_version}"
if (System.getenv('MOD_VERSION') != null) {
mod_version = System.getenv('MOD_VERSION')
}
if (System.getenv('MINECRAFT_VERSION') != null) {
minecraft_version = System.getenv('MINECRAFT_VERSION')
}
version = "${minecraft_version}-${mod_version}"

group = 'com.klikli_dev' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'theurgy'
group = mod_group_id

base {
archivesName = mod_id
}
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.withSourcesJar()
Expand All @@ -22,7 +26,8 @@ println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty '
minecraft {
mappings channel: mapping_channel, version: mapping_version

accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Currently, this location cannot be changed from the default.

// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
Expand All @@ -46,7 +51,7 @@ minecraft {
property 'forge.enabledGameTestNamespaces', 'theurgy'

mods {
theurgy {
"${mod_id}" {
source sourceSets.main
}
}
Expand All @@ -62,7 +67,7 @@ minecraft {
property 'forge.enabledGameTestNamespaces', 'theurgy'

mods {
theurgy {
"${mod_id}" {
source sourceSets.main
}
}
Expand All @@ -81,7 +86,7 @@ minecraft {
property 'forge.enabledGameTestNamespaces', 'theurgy'

mods {
theurgy {
"${mod_id}" {
source sourceSets.main
}
}
Expand All @@ -98,7 +103,7 @@ minecraft {
args '--mod', 'theurgy', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')

mods {
theurgy {
"${mod_id}" {
source sourceSets.main
}
}
Expand Down Expand Up @@ -133,26 +138,59 @@ dependencies {
minecraft "net.minecraftforge:forge:${forge_version}"

//Jei
compileOnly fg.deobf("mezz.jei:jei-${jei_mc_version}-common-api:${jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${jei_mc_version}-common:${jei_version}") //we're using the vanilla recipe category rendering constants
compileOnly fg.deobf("mezz.jei:jei-${jei_mc_version}-forge-api:${jei_version}")
runtimeOnly fg.deobf("mezz.jei:jei-${jei_mc_version}-forge:${jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}-common:${jei_version}")
//we're using the vanilla recipe category rendering constants
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}")
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}")

compileOnly fg.deobf("com.klikli_dev:modonomicon:${modonomicon_mc_version}-${modonomicon_version}") //we build against full jar because we NEED IT ALL
runtimeOnly fg.deobf("com.klikli_dev:modonomicon:${modonomicon_mc_version}-${modonomicon_version}")
compileOnly fg.deobf("com.klikli_dev:modonomicon:${minecraft_version}-${modonomicon_version}")
//we build against full jar because we NEED IT ALL
runtimeOnly fg.deobf("com.klikli_dev:modonomicon:${minecraft_version}-${modonomicon_version}")

}


// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta']
def replaceProperties = [
minecraft_version : minecraft_version,
minecraft_version_range : minecraft_version_range,
forge_version : forge_version,
forge_version_range : forge_version_range,
loader_version_range : loader_version_range,
mod_id : mod_id,
mod_name : mod_name,
mod_license : mod_license,
mod_version : mod_version,
mod_authors : mod_authors,
mod_description : mod_description,
jei_version_range : jei_version_range,
modonomicon_version_range: modonomicon_version_range,
]
processResources {
inputs.properties replaceProperties
replaceProperties.put 'project', project

filesMatching(resourceTargets) {
expand replaceProperties
}
}


// Example for how to get properties into the manifest for reading at runtime.
jar {
manifest {
attributes([
"Specification-Title" : "Theurgy",
"Specification-Vendor" : "Kli Kli",
"Specification-Title" : mod_id,
"Specification-Vendor" : mod_authors,
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : "Kli Kli",
"Implementation-Version" : mod_version,
"Implementation-Vendor" : mod_authors,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
Expand All @@ -167,12 +205,12 @@ jar.finalizedBy('reobfJar')
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'theurgy'
artifactId = mod_id
artifact jar
artifact sourcesJar

pom {
name = 'Theurgy'
name = mod_name
description = 'An open-source magic mod built around classical alchemy to replicate and transmute matter, and create magical artifacts.'
url = 'https://github.com/klikli-dev/theurgy'
licenses {
Expand Down
37 changes: 29 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,38 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=1.3.4
mc_version=1.19.4
## Environment Properties

forge_version=1.19.4-45.0.57
# The Minecraft version must agree with the Forge version to get a valid artifact
minecraft_version=1.20
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.20,1.21)
# The Forge version must agree with the Minecraft version to get a valid artifact
forge_version=1.20-46.0.1
# The Forge version range can use any version of Forge as bounds or match the loader version range
forge_version_range=[46,)
# The loader version range can only use the major version of Forge/FML as bounds
loader_version_range=[46,)

mapping_channel=parchment
#postfix is target mc version, optional prefix is source parchment mc version
mapping_version=1.19.3-2023.03.12-1.19.4
mapping_version=1.19.3-2023.03.12-1.20

jei_mc_version=1.19.4
jei_version=13.1.0.7
## Mod Properties

modonomicon_mc_version=1.19.4
modonomicon_version=1.32.1
mod_id=theurgy
mod_name=Theurgy
mod_license=MIT AND CC-BY-4.0
mod_version=1.3.5
mod_group_id=com.klikli_dev
mod_authors=Kli Kli
mod_description=An open-source magic mod built around classical alchemy to replicate and transmute matter, and create magical artifacts.

## Dependency Properties

jei_version=14.0.0.4
jei_version_range=[14.0.0.4,)
modonomicon_version=1.32.2
modonomicon_version_range=[1.32.2,)
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
9 changes: 3 additions & 6 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# SPDX-FileCopyrightText: 2022 klikli-dev
#
# SPDX-License-Identifier: MIT

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
4 changes: 4 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ pluginManagement {
}
maven { url = 'https://maven.parchmentmc.org' }
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.19.4 2023-03-24T12:16:26.3108537 Books: theurgy
// 1.20 2023-06-09T13:47:31.4714189 Books: theurgy
ead61475fc866f8eb903a6d99236808a0383fd5a data/theurgy/modonomicon/books/the_hermetica/book.json
3a4b111882abf1b08df5ba3159faf2cab89f3c3e data/theurgy/modonomicon/books/the_hermetica/categories/getting_started.json
28ae6dbc76158bf163aa0d3ca564f6158642ef69 data/theurgy/modonomicon/books/the_hermetica/entries/getting_started/about_mod.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// 1.19.4 2023-03-24T12:16:26.3158551 Recipes
// 1.20 2023-06-09T13:47:31.4744188 Recipes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.19.4 2023-03-24T12:16:26.3168543 Languages: en_us
c4aafb954b9115b0e09bc0089c008b1ee741dc94 assets/theurgy/lang/en_us.json
// 1.20 2023-06-09T13:54:31.9602036 Languages: en_us
55a5390d759ca580b7f994f67afd8175953d2113 assets/theurgy/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.19.4 2023-03-24T12:16:26.3138507 Item Models: theurgy
// 1.20 2023-06-09T13:47:31.4734194 Item Models: theurgy
e0f7b66a84e6588f01abbbce75b1803ffe5d46e2 assets/theurgy/models/item/alchemical_sulfur.json
14a2ccdc5007ad52d74e22c1018a1a2d767df32f assets/theurgy/models/item/divination_rod_t1.json
56cbd2e62794dbad75babc62f07448c34813b99c assets/theurgy/models/item/divination_rod_t1_0.json
Expand Down
2 changes: 1 addition & 1 deletion src/generated/resources/assets/theurgy/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"book.theurgy.the_hermetica.getting_started.divination_rod.usage.text": "- **Shift-Click** a block to attune the rod to it.\n- **Right-Click and hold** to let the rod search for blocks.\n- **\"Right-Click without holding**: after a successful search to let the rod show the last found block without consuming durability.\n",
"book.theurgy.the_hermetica.getting_started.divination_rod.usage.title": "Usage",
"book.theurgy.the_hermetica.getting_started.intro.description": "About using The Hermetica",
"book.theurgy.the_hermetica.getting_started.intro.help.text": "If the reader finds themselves in trouble of any kind, prompt assistance will be provided at the Council of Alchemists, known also as Kli Kli's Discord Server.\n\\\n\\\n[To get help, join us at https://invite.gg/klikli](https://invite.gg/klikli)\n",
"book.theurgy.the_hermetica.getting_started.intro.help.text": "If the reader finds themselves in trouble of any kind, prompt assistance will be provided at the Council of Alchemists, known also as Kli Kli's Discord Server.\n\\\n\\\n[To get help, join us at https://dsc.gg/klikli](https://discord.gg/trE4SHRXvb)\n",
"book.theurgy.the_hermetica.getting_started.intro.help.title": "Seeking Counsel",
"book.theurgy.the_hermetica.getting_started.intro.intro.text": "The following pages will lead the novice alchemist on their journey through the noble art of the transformation of matter and mind. This humble author will share their experiences, thoughts and research notes to guide the valued reader in as safe a manner as the subject matter allows.\n",
"book.theurgy.the_hermetica.getting_started.intro.intro.title": "About this Work",
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/klikli_dev/theurgy/Theurgy.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public Theurgy() {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();

ItemRegistry.ITEMS.register(modEventBus);
CreativeModeTabRegistry.CREATIVE_MODE_TABS.register(modEventBus);
EntityRegistry.ENTITIES.register(modEventBus);
EntityDataSerializerRegistry.ENTITY_DATA_SERIALIZERS.register(modEventBus);
ParticleRegistry.PARTICLES.register(modEventBus);
Expand All @@ -55,7 +56,6 @@ public Theurgy() {
modEventBus.addListener(this::onServerSetup);

modEventBus.addListener(DataGenerators::gatherData);
modEventBus.addListener(ItemRegistry::onRegisterCreativeModeTabs);

MinecraftForge.EVENT_BUS.addListener(TooltipHandler::onItemTooltipEvent);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void reset() {
}

public void scan(Consumer<BlockPos> resultConsumer) {
Level level = this.player.level;
Level level = this.player.level();
for (int i = 0; i < this.blocksPerTick; i++) {
//move to next block
if (!this.nextBlock(level)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private BookEntryModel.Builder makeIntroEntry(BookLangHelper helper, LanguagePro
If the reader finds themselves in trouble of any kind, prompt assistance will be provided at the Council of Alchemists, known also as Kli Kli's Discord Server.
\\
\\
[To get help, join us at https://invite.gg/klikli](https://invite.gg/klikli)
[To get help, join us at https://dsc.gg/klikli](https://discord.gg/trE4SHRXvb)
""");


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected void defineSynchedData() {

@Nullable
protected EntityHitResult findHitEntity(Vec3 pStartVec, Vec3 pEndVec) {
return ProjectileUtil.getEntityHitResult(this.level, this, pStartVec, pEndVec, this.getBoundingBox().expandTowards(this.getDeltaMovement()).inflate(1.0D), this::canHitEntity);
return ProjectileUtil.getEntityHitResult(this.level(), this, pStartVec, pEndVec, this.getBoundingBox().expandTowards(this.getDeltaMovement()).inflate(1.0D), this::canHitEntity);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ public void tick() {

if (Math.sqrt(this.position().distanceToSqr(dest)) < 1 || this.age > 1000 ||
Math.sqrt(this.position().distanceToSqr(dest)) > this.entityData.get(DESPAWN)) {
if (this.level.isClientSide && this.entityData.get(SPAWN_TOUCH)) {
ParticleRegistry.spawnTouch((ClientLevel) this.level, this.getOnPos(), new ParticleColor(this.entityData.get(RED), this.entityData.get(GREEN), this.entityData.get(BLUE)));
if (this.level().isClientSide && this.entityData.get(SPAWN_TOUCH)) {
ParticleRegistry.spawnTouch((ClientLevel) this.level(), this.getOnPos(), new ParticleColor(this.entityData.get(RED), this.entityData.get(GREEN), this.entityData.get(BLUE)));
}
this.remove(RemovalReason.DISCARDED);
return;
Expand Down Expand Up @@ -147,15 +147,15 @@ public void tick() {
var speed = 1.0f; //entity speed
this.setDeltaMovement(this.getDeltaMovement().scale(speed));

if (this.level.isClientSide && this.age > 1) {
if (this.level().isClientSide && this.age > 1) {
int particleAge = 50; //increase to make tracing the particle easier
double deltaX = this.getX() - this.xOld;
double deltaY = this.getY() - this.yOld;
double deltaZ = this.getZ() - this.zOld;
float dist = (float) (Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ) * 8.0f);
for (double i = 0.0; i <= dist; i++) {
double coeff = (i / dist);
this.level.addParticle(GlowParticleData.createData(new ParticleColor(this.entityData.get(RED), this.entityData.get(GREEN), this.entityData.get(BLUE)), 0.25f, 0.75f, particleAge),
this.level().addParticle(GlowParticleData.createData(new ParticleColor(this.entityData.get(RED), this.entityData.get(GREEN), this.entityData.get(BLUE)), 0.25f, 0.75f, particleAge),
(this.getX() + deltaX * coeff), (this.getY() + deltaY * coeff), (this.getZ() + deltaZ * coeff),
0.0125f * (this.random.nextFloat() - 0.5f), 0.0125f * (this.random.nextFloat() - 0.5f), 0.0125f * (this.random.nextFloat() - 0.5f));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ public int getMaxDamage(ItemStack stack) {
}

@Override
public void onUsingTick(ItemStack stack, LivingEntity entityLiving, int count) {
if (entityLiving.level.isClientSide && entityLiving instanceof Player) {
ScanManager.get().updateScan((Player) entityLiving, false);
public void onUseTick(Level pLevel, LivingEntity pLivingEntity, ItemStack pStack, int pRemainingUseDuration) {
if (pLivingEntity.level().isClientSide && pLivingEntity instanceof Player player) {
ScanManager.get().updateScan(player, false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static <T extends Message> void handle(T message, Supplier<NetworkEvent.C
}

public static <T extends Message> void handleServer(T message, Supplier<NetworkEvent.Context> ctx) {
MinecraftServer server = ctx.get().getSender().level.getServer();
MinecraftServer server = ctx.get().getSender().level().getServer();
message.onServerReceived(server, ctx.get().getSender(), ctx.get());
}

Expand Down
Loading

0 comments on commit ebab77a

Please sign in to comment.