Skip to content

Commit

Permalink
working 1.20.6
Browse files Browse the repository at this point in the history
  • Loading branch information
duplexsystem committed Sep 17, 2024
1 parent 7304728 commit 664d1a3
Show file tree
Hide file tree
Showing 33 changed files with 167 additions and 119 deletions.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ allprojects {
tasks.withType<JavaCompile>().configureEach {
options.isFork = true
options.isIncremental = true
options.release.set(21)
}

tasks.withType<Test>().configureEach {
Expand Down Expand Up @@ -44,7 +45,7 @@ afterEvaluate {
}
project(":platforms:bukkit:common").configureDistribution()
forSubProjects(":common:addons") {
apply(plugin = "com.github.johnrengelman.shadow")
apply(plugin = "com.gradleup.shadow")

tasks.named("build") {
finalizedBy(tasks.named("shadowJar"))
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ repositories {

dependencies {
//TODO Allow pulling from Versions.kt
implementation("com.github.johnrengelman", "shadow", "8.1.1")
implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "1.7.1")
implementation("com.gradleup.shadow", "shadow-gradle-plugin", "8.3.1")
implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "1.7.2")

implementation("org.ow2.asm", "asm", "9.7")
implementation("org.ow2.asm", "asm-tree", "9.7")
implementation("com.dfsek.tectonic", "common", "4.2.1")
implementation("org.yaml", "snakeyaml", "2.2")
implementation("org.yaml", "snakeyaml", "2.3")
}
3 changes: 3 additions & 0 deletions buildSrc/src/main/kotlin/DependencyConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ fun Project.configureDependencies() {
maven("https://jitpack.io") {
name = "JitPack"
}
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") {
name = "Sonatype Snapshots"
}
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/DistributionConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import kotlin.io.path.exists


fun Project.configureDistribution() {
apply(plugin = "com.github.johnrengelman.shadow")
apply(plugin = "com.gradleup.shadow")

val downloadDefaultPacks = tasks.create("downloadDefaultPacks") {
group = "terra"
Expand Down
34 changes: 17 additions & 17 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ object Versions {
const val paralithic = "0.7.1"
const val strata = "1.3.2"

const val cloud = "2.0.0-rc.2"
const val cloudPaper = "2.0.0-beta.9"
const val cloudFabric = "2.0.0-beta.7"
const val cloud = "2.0.0"
const val cloudPaper = "2.0.0-beta.10"
const val cloudFabric = "2.0.0-beta.9"

const val caffeine = "3.1.8"

const val slf4j = "2.0.13"
const val slf4j = "2.0.16"

object Internal {
const val shadow = "8.1.1"
const val shadow = "8.3.1"
const val apacheText = "1.12.0"
const val apacheIO = "2.16.1"
const val guava = "33.1.0-jre"
const val guava = "33.3.0-jre"
const val asm = "9.7"
const val snakeYml = "2.2"
const val snakeYml = "2.3"
const val jetBrainsAnnotations = "24.1.0"
const val junit = "5.10.2"
const val junit = "5.11.0"
}
}

Expand All @@ -38,14 +38,14 @@ object Versions {
// }

object Mod {
const val mixin = "0.12.5+mixin.0.8.5"
const val mixin = "0.15.3+mixin.0.8.7"

const val minecraft = "1.20.6"
const val yarn = "$minecraft+build.1"
const val fabricLoader = "0.15.10"
const val fabricLoader = "0.16.5"

const val architecuryLoom = "1.6.395"
const val architecturyPlugin = "3.4.155"
const val architecuryLoom = "1.7.413"
const val architecturyPlugin = "3.4.159"
}
//
// object Forge {
Expand All @@ -54,14 +54,14 @@ object Versions {
// }

object Bukkit {
const val minecraft = "1.21"
const val paperBuild = "$minecraft-R0.1-SNAPSHOT"
const val minecraft = "1.21.1"
const val paperBuild = "$minecraft-R0.1-20240917.151311-80"
const val paper = paperBuild
const val paperLib = "1.0.8"
const val reflectionRemapper = "0.1.1"
const val paperDevBundle = paperBuild
const val runPaper = "2.3.0"
const val paperWeight = "1.7.1"
const val runPaper = "2.3.1"
const val paperWeight = "1.7.2"
}

//
Expand All @@ -73,6 +73,6 @@ object Versions {
//
object CLI {
const val nbt = "6.1"
const val logback = "1.4.14"
const val logback = "1.5.8"
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionSha256Sum=1541fa36599e12857140465f3c91a97409b4512501c26f9631fb113e392c5bd1
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
6 changes: 0 additions & 6 deletions platforms/bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ plugins {
id("xyz.jpenilla.run-paper") version Versions.Bukkit.runPaper
}

repositories {
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") {
name = "Sonatype"
}
}

dependencies {
shaded(project(":platforms:bukkit:common"))
shaded(project(":platforms:bukkit:nms:v1_21", configuration = "reobf"))
Expand Down
4 changes: 0 additions & 4 deletions platforms/bukkit/nms/v1_21/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
apply(plugin = "io.papermc.paperweight.userdev")

repositories {
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}

dependencies {
api(project(":platforms:bukkit:common"))
paperDevBundle(Versions.Bukkit.paperDevBundle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.biome.Biome;
import org.bukkit.NamespacedKey;
import org.slf4j.Logger;
Expand Down
10 changes: 0 additions & 10 deletions platforms/fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ architectury {
loader("fabric")
}

repositories {
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") {
name = "Sonatype Snapshots"
}
}

dependencies {
shadedApi(project(":common:implementation:base"))

Expand Down Expand Up @@ -51,10 +45,6 @@ loom {
addonDir(project.file("./run/config/Terra/addons"), tasks.named("configureLaunch").get())

tasks {
compileJava {
options.release.set(17)
}

remapJar {
dependsOn("installAddons")

Expand Down
6 changes: 3 additions & 3 deletions platforms/fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"terra.common.mixins.json"
],
"depends": {
"fabricloader": ">=0.15.1",
"java": ">=17",
"minecraft": ">=1.20.4",
"fabricloader": ">=0.16.5",
"java": ">=21",
"minecraft": ">=1.20.6",
"fabric": "*"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "com.dfsek.terra.fabric.mixin",
"compatibilityLevel": "JAVA_17",
"compatibilityLevel": "JAVA_21",
"mixins": [
],
"client": [
Expand Down
2 changes: 1 addition & 1 deletion platforms/forge/src/main/resources/terra.forge.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "com.dfsek.terra.forge.mixin",
"compatibilityLevel": "JAVA_17",
"compatibilityLevel": "JAVA_21",
"mixins": [
"lifecycle.NoiseConfigMixin"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.RegistryWrapper.Impl;
import net.minecraft.util.Identifier;

import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import com.dfsek.terra.api.handle.ItemHandle;
import com.dfsek.terra.api.inventory.Item;
Expand All @@ -43,8 +46,13 @@ public Item createItem(String data) {
try {
return (Item) new ItemStackArgumentType(new CommandRegistryAccess() {
@Override
public <T> RegistryWrapper<T> createWrapper(RegistryKey<? extends Registry<T>> registryRef) {
return CommonPlatform.get().getServer().getRegistryManager().getWrapperOrThrow(registryRef);
public Stream<RegistryKey<? extends Registry<?>>> streamAllRegistryKeys() {
return CommonPlatform.get().getServer().getRegistryManager().streamAllRegistryKeys();
}

@Override
public <T> Optional<Impl<T>> getOptionalWrapper(RegistryKey<? extends Registry<? extends T>> registryRef) {
return Optional.of(CommonPlatform.get().getServer().getRegistryManager().getWrapperOrThrow(registryRef));
}
}).parse(new StringReader(data)).getItem();
} catch(CommandSyntaxException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private MobSpawnerBlockEntityMixin(BlockEntityType<?> type, BlockPos pos, BlockS
public abstract MobSpawnerLogic getLogic();

@Shadow
public abstract void setEntityType(net.minecraft.entity.EntityType<?> entityType, Random random);
public abstract void method_46408(net.minecraft.entity.EntityType<?> entityType, Random random);

public EntityType terra$getSpawnedType() {
return (EntityType) Registries.ENTITY_TYPE.get(
Expand All @@ -64,7 +64,7 @@ private MobSpawnerBlockEntityMixin(BlockEntityType<?> type, BlockPos pos, BlockS
} else {
rand = Random.create();
}
setEntityType((net.minecraft.entity.EntityType<?>) creatureType, rand);
method_46408((net.minecraft.entity.EntityType<?>) creatureType, rand);
}

public int terra$getDelay() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
@Implements(@Interface(iface = com.dfsek.terra.api.inventory.Item.class, prefix = "terra$"))
public abstract class ItemMixin {
@Shadow
public abstract int getMaxDamage();
public abstract net.minecraft.item.ItemStack getDefaultStack();

@SuppressWarnings("ConstantConditions")
public ItemStack terra$newItemStack(int amount) {
return (ItemStack) (Object) new net.minecraft.item.ItemStack((Item) (Object) this, amount);
}

public double terra$getMaxDurability() {
return getMaxDamage();
//TODO verify this is correct
return getDefaultStack().getMaxDamage();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@

package com.dfsek.terra.mod.mixin.implementations.terra.inventory.item;

import net.minecraft.component.Component;
import net.minecraft.component.ComponentChanges;
import net.minecraft.component.ComponentMap;
import net.minecraft.component.ComponentMapImpl;
import net.minecraft.component.DataComponentType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
import org.spongepowered.asm.mixin.Intrinsic;
Expand All @@ -46,7 +52,11 @@ public abstract class ItemStackMixin {
public abstract boolean isDamageable();

@Shadow
public abstract void setNbt(@Nullable NbtCompound tag);
public abstract ComponentMap getComponents();

@Shadow
@Final
private ComponentMapImpl components;

public int terra$getAmount() {
return getCount();
Expand All @@ -66,7 +76,13 @@ public abstract class ItemStackMixin {

@SuppressWarnings("ConstantConditions")
public void terra$setItemMeta(ItemMeta meta) {
setNbt(((ItemStack) (Object) meta).getNbt());
ComponentChanges.Builder builder = ComponentChanges.builder();
this.getComponents().getTypes().forEach(builder::remove);

ComponentMap components = ((ItemStack) (Object) meta).getComponents();
components.forEach(builder::add);

this.components.applyChanges(builder.build());
}

@Intrinsic
Expand Down
Loading

0 comments on commit 664d1a3

Please sign in to comment.