Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/1.21.2 #470

Merged
merged 13 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ object Versions {
const val strata = "1.3.2"

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.16"

object Internal {
const val shadow = "8.3.1"
const val shadow = "8.3.3"
const val apacheText = "1.12.0"
const val apacheIO = "2.16.1"
const val guava = "33.3.0-jre"
const val asm = "9.7"
const val apacheIO = "2.17.0"
const val guava = "33.3.1-jre"
const val asm = "9.7.1"
const val snakeYml = "2.3"
const val jetBrainsAnnotations = "24.1.0"
const val junit = "5.11.0"
const val jetBrainsAnnotations = "26.0.1"
const val junit = "5.11.3"
const val nbt = "6.1"
}
}

object Fabric {
const val fabricAPI = "0.104.0+${Mod.minecraft}"
const val fabricAPI = "0.106.1+${Mod.minecraft}"
const val cloud = "2.0.0-beta.9"
duplexsystem marked this conversation as resolved.
Show resolved Hide resolved
}
//
// object Quilt {
Expand All @@ -40,12 +40,13 @@ object Versions {
object Mod {
const val mixin = "0.15.3+mixin.0.8.7"

const val minecraft = "1.21.1"
const val yarn = "$minecraft+build.3"
const val fabricLoader = "0.16.5"
const val minecraft = "1.21.3"
const val yarn = "$minecraft+build.2"
const val fabricLoader = "0.16.7"

const val architecuryLoom = "1.7.413"
const val architecturyPlugin = "3.4.159"

}
//
// object Forge {
Expand All @@ -54,14 +55,15 @@ object Versions {
// }

object Bukkit {
const val minecraft = "1.21.1"
const val paperBuild = "$minecraft-R0.1-20240917.151311-80"
const val minecraft = "1.21.3"
const val paperBuild = "$minecraft-R0.1-20241025.163321-1"
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.1"
const val paperWeight = "1.7.2"
const val cloud = "2.0.0-beta.10"
}

//
Expand All @@ -72,7 +74,6 @@ object Versions {
// }
//
object CLI {
const val nbt = "6.1"
const val logback = "1.5.8"
const val picocli = "4.7.6"
}
Expand Down
7 changes: 1 addition & 6 deletions common/addons/config-number-predicate/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,4 @@ version = version("1.0.0")
dependencies {
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
api("com.dfsek", "paralithic", Versions.Libraries.paralithic)
}


tasks.named<ShadowJar>("shadowJar") {
relocate("com.dfsek.paralithic", "com.dfsek.terra.addons.numberpredicate.lib.paralithic")
}
}
4 changes: 2 additions & 2 deletions common/addons/manifest-addon-loader/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version = version("1.0.0")

dependencies {
api("commons-io:commons-io:2.7")
implementation("com.dfsek.tectonic:yaml:${Versions.Libraries.tectonic}")
api("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO)
implementation("com.dfsek.tectonic", "yaml", Versions.Libraries.tectonic)
}

tasks.withType<Jar> {
Expand Down
8 changes: 2 additions & 6 deletions common/addons/structure-sponge-loader/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
version = version("1.0.0")

dependencies {
api("commons-io:commons-io:2.7")
api("com.github.Querz:NBT:6.1")
api("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO)
api("com.github.Querz", "NBT", Versions.Libraries.Internal.nbt)
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
}

tasks.named<ShadowJar>("shadowJar") {
relocate("org.apache.commons", "com.dfsek.terra.addons.sponge.lib.commons")
}
8 changes: 2 additions & 6 deletions common/addons/structure-terrascript-loader/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
version = version("1.2.0")

dependencies {
api("commons-io:commons-io:2.7")
api("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO)
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
}

tasks.named<ShadowJar>("shadowJar") {
relocate("org.apache.commons", "com.dfsek.terra.addons.terrascript.lib.commons")
}
}
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=1541fa36599e12857140465f3c91a97409b4512501c26f9631fb113e392c5bd1
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
2 changes: 1 addition & 1 deletion platforms/bukkit/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ dependencies {

shadedApi("com.google.guava", "guava", Versions.Libraries.Internal.guava)

shadedApi("org.incendo", "cloud-paper", Versions.Libraries.cloudPaper)
shadedApi("org.incendo", "cloud-paper", Versions.Bukkit.cloud)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import com.dfsek.terra.bukkit.world.BukkitPlatformBiome;
import com.dfsek.terra.registry.master.ConfigRegistry;
Expand All @@ -43,7 +42,7 @@ public static void registerBiomes(ConfigRegistry configRegistry) {
NamespacedKey vanillaBukkitKey = platformBiome.getHandle().getKey();
ResourceLocation vanillaMinecraftKey = ResourceLocation.fromNamespaceAndPath(vanillaBukkitKey.getNamespace(),
vanillaBukkitKey.getKey());
Biome platform = NMSBiomeInjector.createBiome(biome, Objects.requireNonNull(biomeRegistry.get(vanillaMinecraftKey)));
Biome platform = NMSBiomeInjector.createBiome(biome, biomeRegistry.get(vanillaMinecraftKey).orElseThrow().value());

ResourceKey<Biome> delegateKey = ResourceKey.create(
Registries.BIOME,
Expand All @@ -70,7 +69,7 @@ public static void registerBiomes(ConfigRegistry configRegistry) {
.getTags() // streamKeysAndEntries
.collect(HashMap::new,
(map, pair) ->
map.put(pair.getFirst(), new ArrayList<>(pair.getSecond().stream().toList())),
map.put(pair.key(), new ArrayList<>(Reflection.HOLDER_SET.invokeContents(pair).stream().toList())),
HashMap::putAll);

terraBiomeMap
Expand All @@ -91,8 +90,8 @@ public static void registerBiomes(ConfigRegistry configRegistry) {
() -> LOGGER.error("No such biome: {}", tb))),
() -> LOGGER.error("No vanilla biome: {}", vb)));

biomeRegistry.resetTags();
biomeRegistry.bindTags(ImmutableMap.copyOf(collect));
((MappedRegistry<Biome>) biomeRegistry).bindAllTagsToEmpty();
ImmutableMap.copyOf(collect).forEach(biomeRegistry::bindTag);

} catch(SecurityException | IllegalArgumentException exception) {
throw new RuntimeException(exception);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class NMSBiomeInjector {
public static <T> Optional<Holder<T>> getEntry(Registry<T> registry, ResourceLocation identifier) {
return registry.getOptional(identifier)
.flatMap(registry::getResourceKey)
.flatMap(registry::getHolder);
.flatMap(registry::get);
}

public static Biome createBiome(com.dfsek.terra.api.world.biome.Biome biome, Biome vanilla)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public NMSBiomeProvider(BiomeProvider delegate, long seed) {
protected Stream<Holder<Biome>> collectPossibleBiomes() {
return delegate.stream()
.map(biome -> RegistryFetcher.biomeRegistry()
.getHolderOrThrow(((BukkitPlatformBiome) biome.getPlatformBiome()).getContext()
.getOrThrow(((BukkitPlatformBiome) biome.getPlatformBiome()).getContext()
.get(NMSBiomeInfo.class)
.biomeKey()));
}
Expand All @@ -45,7 +45,7 @@ protected Stream<Holder<Biome>> collectPossibleBiomes() {

@Override
public @NotNull Holder<Biome> getNoiseBiome(int x, int y, int z, @NotNull Sampler sampler) {
return biomeRegistry.getHolderOrThrow(((BukkitPlatformBiome) delegate.getBiome(x << 2, y << 2, z << 2, seed)
return biomeRegistry.getOrThrow(((BukkitPlatformBiome) delegate.getBiome(x << 2, y << 2, z << 2, seed)
.getPlatformBiome()).getContext()
.get(NMSBiomeInfo.class)
.biomeKey());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.Beardifier;
import net.minecraft.world.level.levelgen.DensityFunction.SinglePointContext;
import net.minecraft.world.level.levelgen.GenerationStep.Carving;
import net.minecraft.world.level.levelgen.Heightmap.Types;
import net.minecraft.world.level.levelgen.RandomState;
import net.minecraft.world.level.levelgen.blending.Blender;
Expand Down Expand Up @@ -59,7 +58,7 @@ public NMSChunkGeneratorDelegate(ChunkGenerator vanilla, ConfigPack pack, NMSBio

@Override
public void applyCarvers(@NotNull WorldGenRegion chunkRegion, long seed, @NotNull RandomState noiseConfig, @NotNull BiomeManager world,
@NotNull StructureManager structureAccessor, @NotNull ChunkAccess chunk, @NotNull Carving carverStep) {
@NotNull StructureManager structureAccessor, @NotNull ChunkAccess chunk) {
// no-op
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ public void onWorldInit(WorldInitEvent event) {
ChunkGenerator vanilla = serverWorld.getChunkSource().getGenerator();
NMSBiomeProvider provider = new NMSBiomeProvider(pack.getBiomeProvider(), craftWorld.getSeed());
ChunkMap chunkMap = serverWorld.getChunkSource().chunkMap;
WorldGenContext worldGenContext = chunkMap.worldGenContext;
WorldGenContext worldGenContext = Reflection.CHUNKMAP.getWorldGenContext(chunkMap);
Reflection.CHUNKMAP.setWorldGenContext(chunkMap, new WorldGenContext(
worldGenContext.level(),
new NMSChunkGeneratorDelegate(vanilla, pack, provider, craftWorld.getSeed()),
worldGenContext.structureManager(),
worldGenContext.lightEngine(),
worldGenContext.mainThreadMailBox()
worldGenContext.mainThreadExecutor(),
worldGenContext.unsavedListener()
));

LOGGER.info("Successfully injected into world.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public long getSeed() {

@Override
public int getMaxHeight() {
return height.getMaxBuildHeight();
return height.getMaxY();
}

@Override
public int getMinHeight() {
return height.getMinBuildHeight();
return height.getMinY();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.core.Holder;
import net.minecraft.core.Holder.Reference;
import net.minecraft.core.HolderSet;
import net.minecraft.core.MappedRegistry;
import net.minecraft.server.level.ChunkMap;
import net.minecraft.world.level.LevelAccessor;
Expand All @@ -14,6 +15,8 @@
import xyz.jpenilla.reflectionremapper.proxy.annotation.MethodName;
import xyz.jpenilla.reflectionremapper.proxy.annotation.Proxies;

import java.util.List;


public class Reflection {
public static final MappedRegistryProxy MAPPED_REGISTRY;
Expand All @@ -22,6 +25,7 @@ public class Reflection {
public static final ReferenceProxy REFERENCE;

public static final ChunkMapProxy CHUNKMAP;
public static final HolderSetProxy HOLDER_SET;

static {
ReflectionRemapper reflectionRemapper = ReflectionRemapper.forReobfMappingsInPaperJar();
Expand All @@ -32,6 +36,7 @@ public class Reflection {
STRUCTURE_MANAGER = reflectionProxyFactory.reflectionProxy(StructureManagerProxy.class);
REFERENCE = reflectionProxyFactory.reflectionProxy(ReferenceProxy.class);
CHUNKMAP = reflectionProxyFactory.reflectionProxy(ChunkMapProxy.class);
HOLDER_SET = reflectionProxyFactory.reflectionProxy(HolderSetProxy.class);
}


Expand All @@ -57,7 +62,16 @@ public interface ReferenceProxy {

@Proxies(ChunkMap.class)
public interface ChunkMapProxy {
@FieldGetter("worldGenContext")
WorldGenContext getWorldGenContext(ChunkMap instance);

@FieldSetter("worldGenContext")
void setWorldGenContext(ChunkMap instance, WorldGenContext worldGenContext);
}

@Proxies(HolderSet.class)
public interface HolderSetProxy {
@MethodName("contents")
<T> List<Holder<T>> invokeContents(HolderSet<T> instance);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ private static <T> Registry<T> getRegistry(ResourceKey<Registry<T>> key) {
DedicatedServer dedicatedserver = craftserver.getServer();
return dedicatedserver
.registryAccess()
.registryOrThrow(key);
.get(key)
.orElseThrow()
.value();
}

public static Registry<Biome> biomeRegistry() {
Expand Down
2 changes: 1 addition & 1 deletion platforms/cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies {
shadedApi(project(":common:implementation:base"))

shadedApi("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO)
shadedApi("com.github.Querz", "NBT", Versions.CLI.nbt)
shadedApi("com.github.Querz", "NBT", Versions.Libraries.Internal.nbt)

shadedImplementation("info.picocli", "picocli", Versions.CLI.picocli)
annotationProcessor("info.picocli", "picocli-codegen", Versions.CLI.picocli)
Expand Down
4 changes: 2 additions & 2 deletions platforms/fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ dependencies {

modImplementation("net.fabricmc:fabric-loader:${Versions.Mod.fabricLoader}")

modImplementation("org.incendo", "cloud-fabric", Versions.Libraries.cloudFabric)
include("org.incendo", "cloud-fabric", Versions.Libraries.cloudFabric)
modImplementation("org.incendo", "cloud-fabric", Versions.Fabric.cloud)
include("org.incendo", "cloud-fabric", Versions.Fabric.cloud)

modRuntimeOnly("net.fabricmc.fabric-api", "fabric-api", Versions.Fabric.fabricAPI)
}
Expand Down
4 changes: 2 additions & 2 deletions platforms/fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
"terra.common.mixins.json"
],
"depends": {
"fabricloader": ">=0.16.5",
"fabricloader": ">=0.16.7",
"java": ">=21",
"minecraft": ">=1.21.1",
"minecraft": ">=1.21.3",
"fabric": "*"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public BiomeParticleConfig get() {
try {
return new BiomeParticleConfig(
ParticleEffectArgumentType.readParameters(new StringReader(particle),
(RegistryWrapper.WrapperLookup) Registries.PARTICLE_TYPE.getReadOnlyWrapper()),
(RegistryWrapper.WrapperLookup) Registries.PARTICLE_TYPE),
probability);
} catch(CommandSyntaxException e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public class EntityTypeTemplate implements ObjectTemplate<EntityType<?>> {

@Override
public EntityType<?> get() {
return Registries.ENTITY_TYPE.get(id);
return Registries.ENTITY_TYPE.getEntry(id).orElseThrow().value();
}
}
Loading
Loading