mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-04 00:45:57 +00:00
commit
04f6d18198
@ -9,27 +9,27 @@ object Versions {
|
|||||||
const val strata = "1.3.2"
|
const val strata = "1.3.2"
|
||||||
|
|
||||||
const val cloud = "2.0.0"
|
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 caffeine = "3.1.8"
|
||||||
|
|
||||||
const val slf4j = "2.0.16"
|
const val slf4j = "2.0.16"
|
||||||
|
|
||||||
object Internal {
|
object Internal {
|
||||||
const val shadow = "8.3.1"
|
const val shadow = "8.3.3"
|
||||||
const val apacheText = "1.12.0"
|
const val apacheText = "1.12.0"
|
||||||
const val apacheIO = "2.16.1"
|
const val apacheIO = "2.17.0"
|
||||||
const val guava = "33.3.0-jre"
|
const val guava = "33.3.1-jre"
|
||||||
const val asm = "9.7"
|
const val asm = "9.7.1"
|
||||||
const val snakeYml = "2.3"
|
const val snakeYml = "2.3"
|
||||||
const val jetBrainsAnnotations = "24.1.0"
|
const val jetBrainsAnnotations = "26.0.1"
|
||||||
const val junit = "5.11.0"
|
const val junit = "5.11.3"
|
||||||
|
const val nbt = "6.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object Fabric {
|
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"
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// object Quilt {
|
// object Quilt {
|
||||||
@ -40,12 +40,13 @@ object Versions {
|
|||||||
object Mod {
|
object Mod {
|
||||||
const val mixin = "0.15.3+mixin.0.8.7"
|
const val mixin = "0.15.3+mixin.0.8.7"
|
||||||
|
|
||||||
const val minecraft = "1.21.1"
|
const val minecraft = "1.21.3"
|
||||||
const val yarn = "$minecraft+build.3"
|
const val yarn = "$minecraft+build.2"
|
||||||
const val fabricLoader = "0.16.5"
|
const val fabricLoader = "0.16.7"
|
||||||
|
|
||||||
const val architecuryLoom = "1.7.413"
|
const val architecuryLoom = "1.7.413"
|
||||||
const val architecturyPlugin = "3.4.159"
|
const val architecturyPlugin = "3.4.159"
|
||||||
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// object Forge {
|
// object Forge {
|
||||||
@ -54,14 +55,15 @@ object Versions {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
object Bukkit {
|
object Bukkit {
|
||||||
const val minecraft = "1.21.1"
|
const val minecraft = "1.21.3"
|
||||||
const val paperBuild = "$minecraft-R0.1-20240917.151311-80"
|
const val paperBuild = "$minecraft-R0.1-20241025.163321-1"
|
||||||
const val paper = paperBuild
|
const val paper = paperBuild
|
||||||
const val paperLib = "1.0.8"
|
const val paperLib = "1.0.8"
|
||||||
const val reflectionRemapper = "0.1.1"
|
const val reflectionRemapper = "0.1.1"
|
||||||
const val paperDevBundle = paperBuild
|
const val paperDevBundle = paperBuild
|
||||||
const val runPaper = "2.3.1"
|
const val runPaper = "2.3.1"
|
||||||
const val paperWeight = "1.7.2"
|
const val paperWeight = "1.7.2"
|
||||||
|
const val cloud = "2.0.0-beta.10"
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -72,7 +74,6 @@ object Versions {
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
object CLI {
|
object CLI {
|
||||||
const val nbt = "6.1"
|
|
||||||
const val logback = "1.5.8"
|
const val logback = "1.5.8"
|
||||||
const val picocli = "4.7.6"
|
const val picocli = "4.7.6"
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,3 @@ dependencies {
|
|||||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||||
api("com.dfsek", "paralithic", Versions.Libraries.paralithic)
|
api("com.dfsek", "paralithic", Versions.Libraries.paralithic)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tasks.named<ShadowJar>("shadowJar") {
|
|
||||||
relocate("com.dfsek.paralithic", "com.dfsek.terra.addons.numberpredicate.lib.paralithic")
|
|
||||||
}
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
version = version("1.0.0")
|
version = version("1.0.0")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api("commons-io:commons-io:2.7")
|
api("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO)
|
||||||
implementation("com.dfsek.tectonic:yaml:${Versions.Libraries.tectonic}")
|
implementation("com.dfsek.tectonic", "yaml", Versions.Libraries.tectonic)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<Jar> {
|
tasks.withType<Jar> {
|
||||||
|
@ -3,11 +3,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|||||||
version = version("1.0.0")
|
version = version("1.0.0")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api("commons-io:commons-io:2.7")
|
api("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO)
|
||||||
api("com.github.Querz:NBT:6.1")
|
api("com.github.Querz", "NBT", Versions.Libraries.Internal.nbt)
|
||||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named<ShadowJar>("shadowJar") {
|
|
||||||
relocate("org.apache.commons", "com.dfsek.terra.addons.sponge.lib.commons")
|
|
||||||
}
|
|
@ -3,10 +3,6 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|||||||
version = version("1.2.0")
|
version = version("1.2.0")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api("commons-io:commons-io:2.7")
|
api("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO)
|
||||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named<ShadowJar>("shadowJar") {
|
|
||||||
relocate("org.apache.commons", "com.dfsek.terra.addons.terrascript.lib.commons")
|
|
||||||
}
|
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,7 +1,7 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionSha256Sum=1541fa36599e12857140465f3c91a97409b4512501c26f9631fb113e392c5bd1
|
distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
5
gradlew
vendored
5
gradlew
vendored
@ -15,6 +15,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
@ -84,7 +86,8 @@ done
|
|||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
# 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.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
2
gradlew.bat
vendored
2
gradlew.bat
vendored
@ -13,6 +13,8 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%"=="" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
@ -11,5 +11,5 @@ dependencies {
|
|||||||
|
|
||||||
shadedApi("com.google.guava", "guava", Versions.Libraries.Internal.guava)
|
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)
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import com.dfsek.terra.bukkit.world.BukkitPlatformBiome;
|
import com.dfsek.terra.bukkit.world.BukkitPlatformBiome;
|
||||||
import com.dfsek.terra.registry.master.ConfigRegistry;
|
import com.dfsek.terra.registry.master.ConfigRegistry;
|
||||||
@ -43,7 +42,7 @@ public class AwfulBukkitHacks {
|
|||||||
NamespacedKey vanillaBukkitKey = platformBiome.getHandle().getKey();
|
NamespacedKey vanillaBukkitKey = platformBiome.getHandle().getKey();
|
||||||
ResourceLocation vanillaMinecraftKey = ResourceLocation.fromNamespaceAndPath(vanillaBukkitKey.getNamespace(),
|
ResourceLocation vanillaMinecraftKey = ResourceLocation.fromNamespaceAndPath(vanillaBukkitKey.getNamespace(),
|
||||||
vanillaBukkitKey.getKey());
|
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(
|
ResourceKey<Biome> delegateKey = ResourceKey.create(
|
||||||
Registries.BIOME,
|
Registries.BIOME,
|
||||||
@ -70,7 +69,7 @@ public class AwfulBukkitHacks {
|
|||||||
.getTags() // streamKeysAndEntries
|
.getTags() // streamKeysAndEntries
|
||||||
.collect(HashMap::new,
|
.collect(HashMap::new,
|
||||||
(map, pair) ->
|
(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);
|
HashMap::putAll);
|
||||||
|
|
||||||
terraBiomeMap
|
terraBiomeMap
|
||||||
@ -91,8 +90,8 @@ public class AwfulBukkitHacks {
|
|||||||
() -> LOGGER.error("No such biome: {}", tb))),
|
() -> LOGGER.error("No such biome: {}", tb))),
|
||||||
() -> LOGGER.error("No vanilla biome: {}", vb)));
|
() -> LOGGER.error("No vanilla biome: {}", vb)));
|
||||||
|
|
||||||
biomeRegistry.resetTags();
|
((MappedRegistry<Biome>) biomeRegistry).bindAllTagsToEmpty();
|
||||||
biomeRegistry.bindTags(ImmutableMap.copyOf(collect));
|
ImmutableMap.copyOf(collect).forEach(biomeRegistry::bindTag);
|
||||||
|
|
||||||
} catch(SecurityException | IllegalArgumentException exception) {
|
} catch(SecurityException | IllegalArgumentException exception) {
|
||||||
throw new RuntimeException(exception);
|
throw new RuntimeException(exception);
|
||||||
|
@ -19,7 +19,7 @@ public class NMSBiomeInjector {
|
|||||||
public static <T> Optional<Holder<T>> getEntry(Registry<T> registry, ResourceLocation identifier) {
|
public static <T> Optional<Holder<T>> getEntry(Registry<T> registry, ResourceLocation identifier) {
|
||||||
return registry.getOptional(identifier)
|
return registry.getOptional(identifier)
|
||||||
.flatMap(registry::getResourceKey)
|
.flatMap(registry::getResourceKey)
|
||||||
.flatMap(registry::getHolder);
|
.flatMap(registry::get);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Biome createBiome(com.dfsek.terra.api.world.biome.Biome biome, Biome vanilla)
|
public static Biome createBiome(com.dfsek.terra.api.world.biome.Biome biome, Biome vanilla)
|
||||||
|
@ -29,7 +29,7 @@ public class NMSBiomeProvider extends BiomeSource {
|
|||||||
protected Stream<Holder<Biome>> collectPossibleBiomes() {
|
protected Stream<Holder<Biome>> collectPossibleBiomes() {
|
||||||
return delegate.stream()
|
return delegate.stream()
|
||||||
.map(biome -> RegistryFetcher.biomeRegistry()
|
.map(biome -> RegistryFetcher.biomeRegistry()
|
||||||
.getHolderOrThrow(((BukkitPlatformBiome) biome.getPlatformBiome()).getContext()
|
.getOrThrow(((BukkitPlatformBiome) biome.getPlatformBiome()).getContext()
|
||||||
.get(NMSBiomeInfo.class)
|
.get(NMSBiomeInfo.class)
|
||||||
.biomeKey()));
|
.biomeKey()));
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ public class NMSBiomeProvider extends BiomeSource {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Holder<Biome> getNoiseBiome(int x, int y, int z, @NotNull Sampler sampler) {
|
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()
|
.getPlatformBiome()).getContext()
|
||||||
.get(NMSBiomeInfo.class)
|
.get(NMSBiomeInfo.class)
|
||||||
.biomeKey());
|
.biomeKey());
|
||||||
|
@ -15,7 +15,6 @@ import net.minecraft.world.level.chunk.ChunkAccess;
|
|||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||||
import net.minecraft.world.level.levelgen.Beardifier;
|
import net.minecraft.world.level.levelgen.Beardifier;
|
||||||
import net.minecraft.world.level.levelgen.DensityFunction.SinglePointContext;
|
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.Heightmap.Types;
|
||||||
import net.minecraft.world.level.levelgen.RandomState;
|
import net.minecraft.world.level.levelgen.RandomState;
|
||||||
import net.minecraft.world.level.levelgen.blending.Blender;
|
import net.minecraft.world.level.levelgen.blending.Blender;
|
||||||
@ -59,7 +58,7 @@ public class NMSChunkGeneratorDelegate extends ChunkGenerator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyCarvers(@NotNull WorldGenRegion chunkRegion, long seed, @NotNull RandomState noiseConfig, @NotNull BiomeManager world,
|
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
|
// no-op
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,13 +41,14 @@ public class NMSInjectListener implements Listener {
|
|||||||
ChunkGenerator vanilla = serverWorld.getChunkSource().getGenerator();
|
ChunkGenerator vanilla = serverWorld.getChunkSource().getGenerator();
|
||||||
NMSBiomeProvider provider = new NMSBiomeProvider(pack.getBiomeProvider(), craftWorld.getSeed());
|
NMSBiomeProvider provider = new NMSBiomeProvider(pack.getBiomeProvider(), craftWorld.getSeed());
|
||||||
ChunkMap chunkMap = serverWorld.getChunkSource().chunkMap;
|
ChunkMap chunkMap = serverWorld.getChunkSource().chunkMap;
|
||||||
WorldGenContext worldGenContext = chunkMap.worldGenContext;
|
WorldGenContext worldGenContext = Reflection.CHUNKMAP.getWorldGenContext(chunkMap);
|
||||||
Reflection.CHUNKMAP.setWorldGenContext(chunkMap, new WorldGenContext(
|
Reflection.CHUNKMAP.setWorldGenContext(chunkMap, new WorldGenContext(
|
||||||
worldGenContext.level(),
|
worldGenContext.level(),
|
||||||
new NMSChunkGeneratorDelegate(vanilla, pack, provider, craftWorld.getSeed()),
|
new NMSChunkGeneratorDelegate(vanilla, pack, provider, craftWorld.getSeed()),
|
||||||
worldGenContext.structureManager(),
|
worldGenContext.structureManager(),
|
||||||
worldGenContext.lightEngine(),
|
worldGenContext.lightEngine(),
|
||||||
worldGenContext.mainThreadMailBox()
|
worldGenContext.mainThreadExecutor(),
|
||||||
|
worldGenContext.unsavedListener()
|
||||||
));
|
));
|
||||||
|
|
||||||
LOGGER.info("Successfully injected into world.");
|
LOGGER.info("Successfully injected into world.");
|
||||||
|
@ -26,11 +26,11 @@ public class NMSWorldProperties implements WorldProperties {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxHeight() {
|
public int getMaxHeight() {
|
||||||
return height.getMaxBuildHeight();
|
return height.getMaxY();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinHeight() {
|
public int getMinHeight() {
|
||||||
return height.getMinBuildHeight();
|
return height.getMinY();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.dfsek.terra.bukkit.nms.v1_21;
|
|||||||
|
|
||||||
import net.minecraft.core.Holder;
|
import net.minecraft.core.Holder;
|
||||||
import net.minecraft.core.Holder.Reference;
|
import net.minecraft.core.Holder.Reference;
|
||||||
|
import net.minecraft.core.HolderSet;
|
||||||
import net.minecraft.core.MappedRegistry;
|
import net.minecraft.core.MappedRegistry;
|
||||||
import net.minecraft.server.level.ChunkMap;
|
import net.minecraft.server.level.ChunkMap;
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
import net.minecraft.world.level.LevelAccessor;
|
||||||
@ -14,6 +15,8 @@ import xyz.jpenilla.reflectionremapper.proxy.annotation.FieldSetter;
|
|||||||
import xyz.jpenilla.reflectionremapper.proxy.annotation.MethodName;
|
import xyz.jpenilla.reflectionremapper.proxy.annotation.MethodName;
|
||||||
import xyz.jpenilla.reflectionremapper.proxy.annotation.Proxies;
|
import xyz.jpenilla.reflectionremapper.proxy.annotation.Proxies;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class Reflection {
|
public class Reflection {
|
||||||
public static final MappedRegistryProxy MAPPED_REGISTRY;
|
public static final MappedRegistryProxy MAPPED_REGISTRY;
|
||||||
@ -22,6 +25,7 @@ public class Reflection {
|
|||||||
public static final ReferenceProxy REFERENCE;
|
public static final ReferenceProxy REFERENCE;
|
||||||
|
|
||||||
public static final ChunkMapProxy CHUNKMAP;
|
public static final ChunkMapProxy CHUNKMAP;
|
||||||
|
public static final HolderSetProxy HOLDER_SET;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
ReflectionRemapper reflectionRemapper = ReflectionRemapper.forReobfMappingsInPaperJar();
|
ReflectionRemapper reflectionRemapper = ReflectionRemapper.forReobfMappingsInPaperJar();
|
||||||
@ -32,6 +36,7 @@ public class Reflection {
|
|||||||
STRUCTURE_MANAGER = reflectionProxyFactory.reflectionProxy(StructureManagerProxy.class);
|
STRUCTURE_MANAGER = reflectionProxyFactory.reflectionProxy(StructureManagerProxy.class);
|
||||||
REFERENCE = reflectionProxyFactory.reflectionProxy(ReferenceProxy.class);
|
REFERENCE = reflectionProxyFactory.reflectionProxy(ReferenceProxy.class);
|
||||||
CHUNKMAP = reflectionProxyFactory.reflectionProxy(ChunkMapProxy.class);
|
CHUNKMAP = reflectionProxyFactory.reflectionProxy(ChunkMapProxy.class);
|
||||||
|
HOLDER_SET = reflectionProxyFactory.reflectionProxy(HolderSetProxy.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -57,7 +62,16 @@ public class Reflection {
|
|||||||
|
|
||||||
@Proxies(ChunkMap.class)
|
@Proxies(ChunkMap.class)
|
||||||
public interface ChunkMapProxy {
|
public interface ChunkMapProxy {
|
||||||
|
@FieldGetter("worldGenContext")
|
||||||
|
WorldGenContext getWorldGenContext(ChunkMap instance);
|
||||||
|
|
||||||
@FieldSetter("worldGenContext")
|
@FieldSetter("worldGenContext")
|
||||||
void setWorldGenContext(ChunkMap instance, WorldGenContext worldGenContext);
|
void setWorldGenContext(ChunkMap instance, WorldGenContext worldGenContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Proxies(HolderSet.class)
|
||||||
|
public interface HolderSetProxy {
|
||||||
|
@MethodName("contents")
|
||||||
|
<T> List<Holder<T>> invokeContents(HolderSet<T> instance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,9 @@ public class RegistryFetcher {
|
|||||||
DedicatedServer dedicatedserver = craftserver.getServer();
|
DedicatedServer dedicatedserver = craftserver.getServer();
|
||||||
return dedicatedserver
|
return dedicatedserver
|
||||||
.registryAccess()
|
.registryAccess()
|
||||||
.registryOrThrow(key);
|
.get(key)
|
||||||
|
.orElseThrow()
|
||||||
|
.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Registry<Biome> biomeRegistry() {
|
public static Registry<Biome> biomeRegistry() {
|
||||||
|
@ -8,7 +8,7 @@ dependencies {
|
|||||||
shadedApi(project(":common:implementation:base"))
|
shadedApi(project(":common:implementation:base"))
|
||||||
|
|
||||||
shadedApi("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO)
|
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)
|
shadedImplementation("info.picocli", "picocli", Versions.CLI.picocli)
|
||||||
annotationProcessor("info.picocli", "picocli-codegen", Versions.CLI.picocli)
|
annotationProcessor("info.picocli", "picocli-codegen", Versions.CLI.picocli)
|
||||||
|
@ -26,8 +26,8 @@ dependencies {
|
|||||||
|
|
||||||
modImplementation("net.fabricmc:fabric-loader:${Versions.Mod.fabricLoader}")
|
modImplementation("net.fabricmc:fabric-loader:${Versions.Mod.fabricLoader}")
|
||||||
|
|
||||||
modImplementation("org.incendo", "cloud-fabric", Versions.Libraries.cloudFabric)
|
modImplementation("org.incendo", "cloud-fabric", Versions.Fabric.cloud)
|
||||||
include("org.incendo", "cloud-fabric", Versions.Libraries.cloudFabric)
|
include("org.incendo", "cloud-fabric", Versions.Fabric.cloud)
|
||||||
|
|
||||||
modRuntimeOnly("net.fabricmc.fabric-api", "fabric-api", Versions.Fabric.fabricAPI)
|
modRuntimeOnly("net.fabricmc.fabric-api", "fabric-api", Versions.Fabric.fabricAPI)
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,9 @@
|
|||||||
"terra.common.mixins.json"
|
"terra.common.mixins.json"
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.16.5",
|
"fabricloader": ">=0.16.7",
|
||||||
"java": ">=21",
|
"java": ">=21",
|
||||||
"minecraft": ">=1.21.1",
|
"minecraft": ">=1.21.3",
|
||||||
"fabric": "*"
|
"fabric": "*"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -29,7 +29,7 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeParticle
|
|||||||
try {
|
try {
|
||||||
return new BiomeParticleConfig(
|
return new BiomeParticleConfig(
|
||||||
ParticleEffectArgumentType.readParameters(new StringReader(particle),
|
ParticleEffectArgumentType.readParameters(new StringReader(particle),
|
||||||
(RegistryWrapper.WrapperLookup) Registries.PARTICLE_TYPE.getReadOnlyWrapper()),
|
(RegistryWrapper.WrapperLookup) Registries.PARTICLE_TYPE),
|
||||||
probability);
|
probability);
|
||||||
} catch(CommandSyntaxException e) {
|
} catch(CommandSyntaxException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
@ -15,6 +15,6 @@ public class EntityTypeTemplate implements ObjectTemplate<EntityType<?>> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityType<?> get() {
|
public EntityType<?> get() {
|
||||||
return Registries.ENTITY_TYPE.get(id);
|
return Registries.ENTITY_TYPE.getEntry(id).orElseThrow().value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,6 @@ public class VillagerTypeTemplate implements ObjectTemplate<VillagerType> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VillagerType get() {
|
public VillagerType get() {
|
||||||
return Registries.VILLAGER_TYPE.get(id);
|
return Registries.VILLAGER_TYPE.getEntry(id).orElseThrow().value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@ import net.minecraft.world.StructureWorldAccess;
|
|||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraft.world.biome.source.BiomeAccess;
|
import net.minecraft.world.biome.source.BiomeAccess;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.gen.GenerationStep.Carver;
|
|
||||||
import net.minecraft.world.gen.StructureAccessor;
|
import net.minecraft.world.gen.StructureAccessor;
|
||||||
import net.minecraft.world.gen.StructureWeightSampler;
|
import net.minecraft.world.gen.StructureWeightSampler;
|
||||||
import net.minecraft.world.gen.chunk.Blender;
|
import net.minecraft.world.gen.chunk.Blender;
|
||||||
@ -97,7 +96,7 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun
|
|||||||
public void populateEntities(ChunkRegion region) {
|
public void populateEntities(ChunkRegion region) {
|
||||||
if(!this.settings.value().mobGenerationDisabled()) {
|
if(!this.settings.value().mobGenerationDisabled()) {
|
||||||
ChunkPos chunkPos = region.getCenterPos();
|
ChunkPos chunkPos = region.getCenterPos();
|
||||||
RegistryEntry<Biome> registryEntry = region.getBiome(chunkPos.getStartPos().withY(region.getTopY() - 1));
|
RegistryEntry<Biome> registryEntry = region.getBiome(chunkPos.getStartPos().withY(region.getTopYInclusive() - 1));
|
||||||
ChunkRandom chunkRandom = new ChunkRandom(new CheckedRandom(RandomSeed.getSeed()));
|
ChunkRandom chunkRandom = new ChunkRandom(new CheckedRandom(RandomSeed.getSeed()));
|
||||||
chunkRandom.setPopulationSeed(region.getSeed(), chunkPos.getStartX(), chunkPos.getStartZ());
|
chunkRandom.setPopulationSeed(region.getSeed(), chunkPos.getStartX(), chunkPos.getStartZ());
|
||||||
SpawnHelper.populateEntities(region, registryEntry, chunkPos, chunkRandom);
|
SpawnHelper.populateEntities(region, registryEntry, chunkPos, chunkRandom);
|
||||||
@ -179,7 +178,7 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun
|
|||||||
WorldProperties properties = MinecraftAdapter.adapt(height, SeedHack.getSeed(noiseConfig.getMultiNoiseSampler()));
|
WorldProperties properties = MinecraftAdapter.adapt(height, SeedHack.getSeed(noiseConfig.getMultiNoiseSampler()));
|
||||||
BiomeProvider biomeProvider = pack.getBiomeProvider();
|
BiomeProvider biomeProvider = pack.getBiomeProvider();
|
||||||
int min = height.getBottomY();
|
int min = height.getBottomY();
|
||||||
for(int y = height.getTopY() - 1; y >= min; y--) {
|
for(int y = height.getTopYInclusive() - 1; y >= min; y--) {
|
||||||
if(heightmap
|
if(heightmap
|
||||||
.getBlockPredicate()
|
.getBlockPredicate()
|
||||||
.test((BlockState) delegate.getBlock(properties, x, y, z, biomeProvider))) return y + 1;
|
.test((BlockState) delegate.getBlock(properties, x, y, z, biomeProvider))) return y + 1;
|
||||||
@ -192,14 +191,14 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun
|
|||||||
BlockState[] array = new BlockState[height.getHeight()];
|
BlockState[] array = new BlockState[height.getHeight()];
|
||||||
WorldProperties properties = MinecraftAdapter.adapt(height, SeedHack.getSeed(noiseConfig.getMultiNoiseSampler()));
|
WorldProperties properties = MinecraftAdapter.adapt(height, SeedHack.getSeed(noiseConfig.getMultiNoiseSampler()));
|
||||||
BiomeProvider biomeProvider = pack.getBiomeProvider();
|
BiomeProvider biomeProvider = pack.getBiomeProvider();
|
||||||
for(int y = height.getTopY() - 1; y >= height.getBottomY(); y--) {
|
for(int y = height.getTopYInclusive() - 1; y >= height.getBottomY(); y--) {
|
||||||
array[y - height.getBottomY()] = (BlockState) delegate.getBlock(properties, x, y, z, biomeProvider);
|
array[y - height.getBottomY()] = (BlockState) delegate.getBlock(properties, x, y, z, biomeProvider);
|
||||||
}
|
}
|
||||||
return new VerticalBlockSample(height.getBottomY(), array);
|
return new VerticalBlockSample(height.getBottomY(), array);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getDebugHudText(List<String> text, NoiseConfig noiseConfig, BlockPos pos) {
|
public void appendDebugHudText(List<String> text, NoiseConfig noiseConfig, BlockPos pos) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,9 +214,10 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun
|
|||||||
logger.debug("Loading world with config pack {}", pack.getID());
|
logger.debug("Loading world with config pack {}", pack.getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void carve(ChunkRegion chunkRegion, long seed, NoiseConfig noiseConfig, BiomeAccess world, StructureAccessor structureAccessor,
|
public void carve(ChunkRegion chunkRegion, long seed, NoiseConfig noiseConfig, BiomeAccess biomeAccess,
|
||||||
Chunk chunk, Carver carverStep) {
|
StructureAccessor structureAccessor, Chunk chunk) {
|
||||||
//no op
|
//no op
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ import net.minecraft.command.argument.ItemStackArgumentType;
|
|||||||
import net.minecraft.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.registry.RegistryKey;
|
import net.minecraft.registry.RegistryKey;
|
||||||
import net.minecraft.registry.RegistryWrapper.Impl;
|
import net.minecraft.registry.RegistryWrapper.Impl;
|
||||||
|
import net.minecraft.resource.featuretoggle.FeatureSet;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -43,14 +44,19 @@ public class MinecraftItemHandle implements ItemHandle {
|
|||||||
public Item createItem(String data) {
|
public Item createItem(String data) {
|
||||||
try {
|
try {
|
||||||
return (Item) new ItemStackArgumentType(new CommandRegistryAccess() {
|
return (Item) new ItemStackArgumentType(new CommandRegistryAccess() {
|
||||||
|
@Override
|
||||||
|
public FeatureSet getEnabledFeatures() {
|
||||||
|
return FeatureSet.empty();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Stream<RegistryKey<? extends Registry<?>>> streamAllRegistryKeys() {
|
public Stream<RegistryKey<? extends Registry<?>>> streamAllRegistryKeys() {
|
||||||
return CommonPlatform.get().getServer().getRegistryManager().streamAllRegistryKeys();
|
return CommonPlatform.get().getServer().getRegistryManager().streamAllRegistryKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> Optional<Impl<T>> getOptionalWrapper(RegistryKey<? extends Registry<? extends T>> registryRef) {
|
public <T> Optional<Impl<T>> getOptional(RegistryKey<? extends Registry<? extends T>> registryRef) {
|
||||||
return Optional.of(CommonPlatform.get().getServer().getRegistryManager().getWrapperOrThrow(registryRef));
|
return Optional.of(CommonPlatform.get().getServer().getRegistryManager().getOrThrow(registryRef));
|
||||||
}
|
}
|
||||||
}).parse(new StringReader(data)).getItem();
|
}).parse(new StringReader(data)).getItem();
|
||||||
} catch(CommandSyntaxException e) {
|
} catch(CommandSyntaxException e) {
|
||||||
@ -60,7 +66,7 @@ public class MinecraftItemHandle implements ItemHandle {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enchantment getEnchantment(String id) {
|
public Enchantment getEnchantment(String id) {
|
||||||
return (Enchantment) (Object) (CommonPlatform.get().enchantmentRegistry().get(Identifier.tryParse(id)));
|
return (Enchantment) (Object) (CommonPlatform.get().enchantmentRegistry().getEntry(Identifier.tryParse(id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,7 +48,7 @@ public class MinecraftWorldHandle implements WorldHandle {
|
|||||||
". You are advised to perform this rename in your config packs as this translation will be removed in the next major " +
|
". You are advised to perform this rename in your config packs as this translation will be removed in the next major " +
|
||||||
"version of Terra.");
|
"version of Terra.");
|
||||||
}
|
}
|
||||||
net.minecraft.block.BlockState state = BlockArgumentParser.block(Registries.BLOCK.getReadOnlyWrapper(), data, true)
|
net.minecraft.block.BlockState state = BlockArgumentParser.block(Registries.BLOCK, data, true)
|
||||||
.blockState();
|
.blockState();
|
||||||
if(state == null) throw new IllegalArgumentException("Invalid data: " + data);
|
if(state == null) throw new IllegalArgumentException("Invalid data: " + data);
|
||||||
return (BlockState) state;
|
return (BlockState) state;
|
||||||
@ -76,6 +76,6 @@ public class MinecraftWorldHandle implements WorldHandle {
|
|||||||
if(!id.contains(":")) throw new IllegalArgumentException("Invalid entity identifier " + id);
|
if(!id.contains(":")) throw new IllegalArgumentException("Invalid entity identifier " + id);
|
||||||
Identifier identifier = Identifier.tryParse(id);
|
Identifier identifier = Identifier.tryParse(id);
|
||||||
if(identifier == null) identifier = Identifier.tryParse(id);
|
if(identifier == null) identifier = Identifier.tryParse(id);
|
||||||
return (EntityType) Registries.ENTITY_TYPE.get(identifier);
|
return (EntityType) Registries.ENTITY_TYPE.getEntry(identifier).orElseThrow().value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,8 +54,8 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
|||||||
public abstract void setEntityType(net.minecraft.entity.EntityType<?> entityType, Random random);
|
public abstract void setEntityType(net.minecraft.entity.EntityType<?> entityType, Random random);
|
||||||
|
|
||||||
public EntityType terra$getSpawnedType() {
|
public EntityType terra$getSpawnedType() {
|
||||||
return (EntityType) Registries.ENTITY_TYPE.get(
|
return (EntityType) Registries.ENTITY_TYPE.getEntry(
|
||||||
Identifier.tryParse(((MobSpawnerLogicAccessor) getLogic()).getSpawnEntry().getNbt().getString("id")));
|
Identifier.tryParse(((MobSpawnerLogicAccessor) getLogic()).getSpawnEntry().getNbt().getString("id"))).orElseThrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void terra$setSpawnedType(@NotNull EntityType creatureType) {
|
public void terra$setSpawnedType(@NotNull EntityType creatureType) {
|
||||||
|
@ -9,6 +9,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.dfsek.terra.api.block.state.properties.Property;
|
import com.dfsek.terra.api.block.state.properties.Property;
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ public abstract class PropertyMixin<T> {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
public abstract Collection<T> getValues();
|
public abstract List<T> getValues();
|
||||||
|
|
||||||
@Intrinsic
|
@Intrinsic
|
||||||
public Collection<T> terra$values() {
|
public Collection<T> terra$values() {
|
||||||
|
@ -49,9 +49,6 @@ public abstract class WorldChunkMixin {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public abstract net.minecraft.block.BlockState setBlockState(BlockPos pos, net.minecraft.block.BlockState state, boolean moved);
|
public abstract net.minecraft.block.BlockState setBlockState(BlockPos pos, net.minecraft.block.BlockState state, boolean moved);
|
||||||
|
|
||||||
@Shadow
|
|
||||||
public abstract TickSchedulers getTickSchedulers();
|
|
||||||
|
|
||||||
public void terra$setBlock(int x, int y, int z, BlockState data, boolean physics) {
|
public void terra$setBlock(int x, int y, int z, BlockState data, boolean physics) {
|
||||||
BlockPos blockPos = new BlockPos(x, y, z);
|
BlockPos blockPos = new BlockPos(x, y, z);
|
||||||
setBlockState(blockPos, (net.minecraft.block.BlockState) data, false);
|
setBlockState(blockPos, (net.minecraft.block.BlockState) data, false);
|
||||||
|
@ -48,6 +48,6 @@ public abstract class ProtoChunkMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int terra$getMaxHeight() {
|
public int terra$getMaxHeight() {
|
||||||
return getHeightLimitView().getTopY();
|
return getHeightLimitView().getTopYInclusive();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ package com.dfsek.terra.mod.mixin.implementations.terra.inventory.item;
|
|||||||
|
|
||||||
import net.minecraft.component.ComponentChanges;
|
import net.minecraft.component.ComponentChanges;
|
||||||
import net.minecraft.component.ComponentMap;
|
import net.minecraft.component.ComponentMap;
|
||||||
import net.minecraft.component.ComponentMapImpl;
|
import net.minecraft.component.MergedComponentMap;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
@ -37,7 +37,7 @@ import com.dfsek.terra.api.inventory.item.ItemMeta;
|
|||||||
public abstract class ItemStackMixin {
|
public abstract class ItemStackMixin {
|
||||||
@Shadow
|
@Shadow
|
||||||
@Final
|
@Final
|
||||||
private ComponentMapImpl components;
|
private MergedComponentMap components;
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
public abstract int getCount();
|
public abstract int getCount();
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package com.dfsek.terra.mod.mixin.implementations.terra.world;
|
package com.dfsek.terra.mod.mixin.implementations.terra.world;
|
||||||
|
|
||||||
import net.minecraft.block.FluidBlock;
|
import net.minecraft.block.FluidBlock;
|
||||||
|
import net.minecraft.entity.SpawnReason;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.util.collection.BoundedRegionArray;
|
import net.minecraft.util.collection.BoundedRegionArray;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@ -99,7 +100,7 @@ public abstract class ChunkRegionMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int terraWorld$getMaxHeight() {
|
public int terraWorld$getMaxHeight() {
|
||||||
return world.getTopY();
|
return world.getTopYInclusive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Intrinsic(displace = true)
|
@Intrinsic(displace = true)
|
||||||
@ -125,7 +126,7 @@ public abstract class ChunkRegionMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Entity terraWorld$spawnEntity(double x, double y, double z, EntityType entityType) {
|
public Entity terraWorld$spawnEntity(double x, double y, double z, EntityType entityType) {
|
||||||
net.minecraft.entity.Entity entity = ((net.minecraft.entity.EntityType<?>) entityType).create(world);
|
net.minecraft.entity.Entity entity = ((net.minecraft.entity.EntityType<?>) entityType).create(world, SpawnReason.CHUNK_GENERATION);
|
||||||
entity.setPos(x, y, z);
|
entity.setPos(x, y, z);
|
||||||
((ChunkRegion) (Object) this).spawnEntity(entity);
|
((ChunkRegion) (Object) this).spawnEntity(entity);
|
||||||
return (Entity) entity;
|
return (Entity) entity;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.mod.mixin.implementations.terra.world;
|
package com.dfsek.terra.mod.mixin.implementations.terra.world;
|
||||||
|
|
||||||
|
import net.minecraft.entity.SpawnReason;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.WorldAccess;
|
import net.minecraft.world.WorldAccess;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
@ -42,7 +43,7 @@ import com.dfsek.terra.mod.util.MinecraftUtil;
|
|||||||
@Implements(@Interface(iface = ServerWorld.class, prefix = "terra$"))
|
@Implements(@Interface(iface = ServerWorld.class, prefix = "terra$"))
|
||||||
public abstract class ServerWorldMixin {
|
public abstract class ServerWorldMixin {
|
||||||
public Entity terra$spawnEntity(double x, double y, double z, EntityType entityType) {
|
public Entity terra$spawnEntity(double x, double y, double z, EntityType entityType) {
|
||||||
net.minecraft.entity.Entity entity = ((net.minecraft.entity.EntityType<?>) entityType).create(null);
|
net.minecraft.entity.Entity entity = ((net.minecraft.entity.EntityType<?>) entityType).create(null, SpawnReason.CHUNK_GENERATION);
|
||||||
entity.setPos(x, y, z);
|
entity.setPos(x, y, z);
|
||||||
((net.minecraft.server.world.ServerWorld) (Object) this).spawnEntity(entity);
|
((net.minecraft.server.world.ServerWorld) (Object) this).spawnEntity(entity);
|
||||||
return (Entity) entity;
|
return (Entity) entity;
|
||||||
|
@ -1,10 +1,16 @@
|
|||||||
package com.dfsek.terra.mod.mixin.lifecycle;
|
package com.dfsek.terra.mod.mixin.lifecycle;
|
||||||
|
|
||||||
|
import net.minecraft.registry.CombinedDynamicRegistries;
|
||||||
import net.minecraft.registry.DynamicRegistryManager;
|
import net.minecraft.registry.DynamicRegistryManager;
|
||||||
import net.minecraft.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
|
import net.minecraft.registry.Registry.PendingTagLoad;
|
||||||
import net.minecraft.registry.RegistryKeys;
|
import net.minecraft.registry.RegistryKeys;
|
||||||
import net.minecraft.registry.ReloadableRegistries;
|
import net.minecraft.registry.ReloadableRegistries;
|
||||||
|
import net.minecraft.registry.ServerDynamicRegistryType;
|
||||||
|
import net.minecraft.resource.ResourceManager;
|
||||||
|
import net.minecraft.resource.featuretoggle.FeatureSet;
|
||||||
import net.minecraft.server.DataPackContents;
|
import net.minecraft.server.DataPackContents;
|
||||||
|
import net.minecraft.server.command.CommandManager;
|
||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@ -16,6 +22,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
import com.dfsek.terra.mod.util.MinecraftUtil;
|
import com.dfsek.terra.mod.util.MinecraftUtil;
|
||||||
import com.dfsek.terra.mod.util.TagUtil;
|
import com.dfsek.terra.mod.util.TagUtil;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
|
|
||||||
@Mixin(DataPackContents.class)
|
@Mixin(DataPackContents.class)
|
||||||
public class DataPackContentsMixin {
|
public class DataPackContentsMixin {
|
||||||
@ -26,12 +38,17 @@ public class DataPackContentsMixin {
|
|||||||
/*
|
/*
|
||||||
* #refresh populates all tags in the registries
|
* #refresh populates all tags in the registries
|
||||||
*/
|
*/
|
||||||
@Inject(method = "refresh()V", at = @At("RETURN"))
|
@Inject(method = "reload(Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/registry/CombinedDynamicRegistries;Ljava/util/List;Lnet/minecraft/resource/featuretoggle/FeatureSet;Lnet/minecraft/server/command/CommandManager$RegistrationEnvironment;ILjava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;", at = @At("RETURN"))
|
||||||
private void injectReload(CallbackInfo ci) {
|
private static void injectReload(ResourceManager resourceManager,
|
||||||
DynamicRegistryManager.Immutable dynamicRegistryManager = this.reloadableRegistries.getRegistryManager();
|
CombinedDynamicRegistries<ServerDynamicRegistryType> dynamicRegistries,
|
||||||
TagUtil.registerWorldPresetTags(dynamicRegistryManager.get(RegistryKeys.WORLD_PRESET));
|
List<PendingTagLoad<?>> pendingTagLoads, FeatureSet enabledFeatures,
|
||||||
|
CommandManager.RegistrationEnvironment environment, int functionPermissionLevel,
|
||||||
|
Executor prepareExecutor,
|
||||||
|
Executor applyExecutor, CallbackInfoReturnable<CompletableFuture<DataPackContents>> cir) {
|
||||||
|
DynamicRegistryManager.Immutable dynamicRegistryManager = dynamicRegistries.getCombinedRegistryManager();
|
||||||
|
TagUtil.registerWorldPresetTags(dynamicRegistryManager.getOrThrow(RegistryKeys.WORLD_PRESET));
|
||||||
|
|
||||||
Registry<Biome> biomeRegistry = dynamicRegistryManager.get(RegistryKeys.BIOME);
|
Registry<Biome> biomeRegistry = dynamicRegistryManager.getOrThrow(RegistryKeys.BIOME);
|
||||||
TagUtil.registerBiomeTags(biomeRegistry);
|
TagUtil.registerBiomeTags(biomeRegistry);
|
||||||
MinecraftUtil.registerFlora(biomeRegistry);
|
MinecraftUtil.registerFlora(biomeRegistry);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ public final class MinecraftAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxHeight() {
|
public int getMaxHeight() {
|
||||||
return height.getTopY();
|
return height.getTopYInclusive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -46,9 +46,8 @@ public final class MinecraftUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static <T> Optional<RegistryEntry<T>> getEntry(Registry<T> registry, Identifier identifier) {
|
public static <T> Optional<RegistryEntry<T>> getEntry(Registry<T> registry, Identifier identifier) {
|
||||||
return registry.getOrEmpty(identifier)
|
return registry.getOptionalValue(identifier)
|
||||||
.flatMap(registry::getKey)
|
.flatMap(id -> Optional.ofNullable(registry.getEntry(id)));
|
||||||
.flatMap(registry::getEntry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockEntity createState(WorldAccess worldAccess, BlockPos pos) {
|
public static BlockEntity createState(WorldAccess worldAccess, BlockPos pos) {
|
||||||
@ -67,9 +66,9 @@ public final class MinecraftUtil {
|
|||||||
logger.info("Injecting flora into Terra biomes...");
|
logger.info("Injecting flora into Terra biomes...");
|
||||||
TERRA_BIOME_MAP
|
TERRA_BIOME_MAP
|
||||||
.forEach((vb, terraBiomes) ->
|
.forEach((vb, terraBiomes) ->
|
||||||
biomes.getOrEmpty(vb)
|
biomes.getOptionalValue(vb)
|
||||||
.ifPresentOrElse(vanilla -> terraBiomes
|
.ifPresentOrElse(vanilla -> terraBiomes
|
||||||
.forEach(tb -> biomes.getOrEmpty(tb)
|
.forEach(tb -> biomes.getOptionalValue(tb)
|
||||||
.ifPresentOrElse(
|
.ifPresentOrElse(
|
||||||
terra -> {
|
terra -> {
|
||||||
List<ConfiguredFeature<?, ?>> flowerFeatures = List.copyOf(
|
List<ConfiguredFeature<?, ?>> flowerFeatures = List.copyOf(
|
||||||
|
@ -40,9 +40,8 @@ public class PresetUtil {
|
|||||||
platform.multiNoiseBiomeSourceParameterListRegistry();
|
platform.multiNoiseBiomeSourceParameterListRegistry();
|
||||||
|
|
||||||
|
|
||||||
RegistryEntry<DimensionType> overworldDimensionType = dimensionTypeRegistry.getEntry(DimensionTypes.OVERWORLD).orElseThrow();
|
RegistryEntry<DimensionType> overworldDimensionType = dimensionTypeRegistry.getEntry(dimensionTypeRegistry.get(DimensionTypes.OVERWORLD));
|
||||||
RegistryEntry<ChunkGeneratorSettings> overworld = chunkGeneratorSettingsRegistry.getEntry(ChunkGeneratorSettings.OVERWORLD)
|
RegistryEntry<ChunkGeneratorSettings> overworld = chunkGeneratorSettingsRegistry.getEntry(chunkGeneratorSettingsRegistry.get(ChunkGeneratorSettings.OVERWORLD));
|
||||||
.orElseThrow();
|
|
||||||
|
|
||||||
|
|
||||||
Identifier generatorID = Identifier.tryParse(
|
Identifier generatorID = Identifier.tryParse(
|
||||||
@ -51,15 +50,13 @@ public class PresetUtil {
|
|||||||
|
|
||||||
PRESETS.add(generatorID);
|
PRESETS.add(generatorID);
|
||||||
|
|
||||||
RegistryEntry<DimensionType> registryEntry = dimensionTypeRegistry.getEntry(DimensionTypes.THE_NETHER).orElseThrow();
|
RegistryEntry<DimensionType> registryEntry = dimensionTypeRegistry.getEntry(dimensionTypeRegistry.get(DimensionTypes.THE_NETHER));
|
||||||
RegistryEntry.Reference<MultiNoiseBiomeSourceParameterList> reference = multiNoiseBiomeSourceParameterLists.getEntry(
|
RegistryEntry<MultiNoiseBiomeSourceParameterList> reference = multiNoiseBiomeSourceParameterLists.getEntry(
|
||||||
MultiNoiseBiomeSourceParameterLists.NETHER).orElseThrow();
|
multiNoiseBiomeSourceParameterLists.get(MultiNoiseBiomeSourceParameterLists.NETHER));
|
||||||
RegistryEntry<ChunkGeneratorSettings> registryEntry2 = chunkGeneratorSettingsRegistry.getEntry(ChunkGeneratorSettings.NETHER)
|
RegistryEntry<ChunkGeneratorSettings> registryEntry2 = chunkGeneratorSettingsRegistry.getEntry(chunkGeneratorSettingsRegistry.get(ChunkGeneratorSettings.NETHER));
|
||||||
.orElseThrow();
|
|
||||||
|
|
||||||
RegistryEntry<DimensionType> registryEntry3 = dimensionTypeRegistry.getEntry(DimensionTypes.THE_END).orElseThrow();
|
RegistryEntry<DimensionType> registryEntry3 = dimensionTypeRegistry.getEntry(dimensionTypeRegistry.get(DimensionTypes.THE_END));
|
||||||
RegistryEntry<ChunkGeneratorSettings> registryEntry4 = chunkGeneratorSettingsRegistry.getEntry(ChunkGeneratorSettings.END)
|
RegistryEntry<ChunkGeneratorSettings> registryEntry4 = chunkGeneratorSettingsRegistry.getEntry(chunkGeneratorSettingsRegistry.get(ChunkGeneratorSettings.END));
|
||||||
.orElseThrow();
|
|
||||||
|
|
||||||
TerraBiomeSource biomeSource = new TerraBiomeSource(pack);
|
TerraBiomeSource biomeSource = new TerraBiomeSource(pack);
|
||||||
ChunkGenerator generator = new MinecraftChunkGeneratorWrapper(biomeSource, pack, overworld);
|
ChunkGenerator generator = new MinecraftChunkGeneratorWrapper(biomeSource, pack, overworld);
|
||||||
@ -69,7 +66,7 @@ public class PresetUtil {
|
|||||||
new NoiseChunkGenerator(MultiNoiseBiomeSource.create(reference),
|
new NoiseChunkGenerator(MultiNoiseBiomeSource.create(reference),
|
||||||
registryEntry2));
|
registryEntry2));
|
||||||
DimensionOptions endDimensionOptions = new DimensionOptions(registryEntry3, new NoiseChunkGenerator(
|
DimensionOptions endDimensionOptions = new DimensionOptions(registryEntry3, new NoiseChunkGenerator(
|
||||||
TheEndBiomeSource.createVanilla(platform.biomeRegistry().getReadOnlyWrapper()), registryEntry4));
|
TheEndBiomeSource.createVanilla(platform.biomeRegistry()), registryEntry4));
|
||||||
|
|
||||||
WorldPreset preset = createPreset(dimensionOptions, netherDimensionOptions, endDimensionOptions);
|
WorldPreset preset = createPreset(dimensionOptions, netherDimensionOptions, endDimensionOptions);
|
||||||
LOGGER.info("Created world type \"{}\"", generatorID);
|
LOGGER.info("Created world type \"{}\"", generatorID);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.dfsek.terra.mod.util;
|
package com.dfsek.terra.mod.util;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import net.minecraft.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.registry.entry.RegistryEntry;
|
import net.minecraft.registry.entry.RegistryEntry;
|
||||||
|
import net.minecraft.registry.tag.TagGroupLoader.RegistryTags;
|
||||||
import net.minecraft.registry.tag.TagKey;
|
import net.minecraft.registry.tag.TagKey;
|
||||||
import net.minecraft.registry.tag.WorldPresetTags;
|
import net.minecraft.registry.tag.WorldPresetTags;
|
||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
@ -14,6 +14,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
public final class TagUtil {
|
public final class TagUtil {
|
||||||
@ -24,11 +25,8 @@ public final class TagUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static <T> Map<TagKey<T>, List<RegistryEntry<T>>> tagsToMutableMap(Registry<T> registry) {
|
private static <T> Map<TagKey<T>, List<RegistryEntry<T>>> tagsToMutableMap(Registry<T> registry) {
|
||||||
return registry
|
return registry.streamTags().collect(HashMap::new,
|
||||||
.streamTagsAndEntries()
|
(map, tag) -> map.put(tag.getTag(), tag.stream().collect(Collectors.toList())),
|
||||||
.collect(HashMap::new,
|
|
||||||
(map, pair) ->
|
|
||||||
map.put(pair.getFirst(), new ArrayList<>(pair.getSecond().stream().toList())),
|
|
||||||
HashMap::putAll);
|
HashMap::putAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,8 +44,14 @@ public final class TagUtil {
|
|||||||
.add(preset),
|
.add(preset),
|
||||||
() -> logger.error("Preset {} does not exist!", id)));
|
() -> logger.error("Preset {} does not exist!", id)));
|
||||||
|
|
||||||
registry.clearTags();
|
registry.startTagReload(new RegistryTags<>(registry.getKey(), collect)).apply();
|
||||||
registry.populateTags(ImmutableMap.copyOf(collect));
|
|
||||||
|
if(logger.isDebugEnabled()) {
|
||||||
|
registry.streamEntries()
|
||||||
|
.map(e -> e.registryKey().getValue() + ": " +
|
||||||
|
e.streamTags().reduce("", (s, t) -> t.id() + ", " + s, String::concat))
|
||||||
|
.forEach(logger::debug);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerBiomeTags(Registry<Biome> registry) {
|
public static void registerBiomeTags(Registry<Biome> registry) {
|
||||||
@ -90,8 +94,7 @@ public final class TagUtil {
|
|||||||
tb))),
|
tb))),
|
||||||
() -> logger.error("No vanilla biome: {}", vb)));
|
() -> logger.error("No vanilla biome: {}", vb)));
|
||||||
|
|
||||||
registry.clearTags();
|
registry.startTagReload(new RegistryTags<>(registry.getKey(), collect)).apply();
|
||||||
registry.populateTags(ImmutableMap.copyOf(collect));
|
|
||||||
|
|
||||||
if(logger.isDebugEnabled()) {
|
if(logger.isDebugEnabled()) {
|
||||||
registry.streamEntries()
|
registry.streamEntries()
|
||||||
|
@ -15,7 +15,7 @@ dependencies {
|
|||||||
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
|
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
|
||||||
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
|
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
|
||||||
|
|
||||||
modImplementation("org.incendo", "cloud-fabric", Versions.Libraries.cloudFabric) {
|
modImplementation("org.incendo", "cloud-fabric", Versions.Fabric.cloud) {
|
||||||
exclude("net.fabricmc")
|
exclude("net.fabricmc")
|
||||||
exclude("net.fabricmc.fabric-api")
|
exclude("net.fabricmc.fabric-api")
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public abstract class LifecyclePlatform extends ModPlatform {
|
|||||||
|
|
||||||
|
|
||||||
if(server != null) {
|
if(server != null) {
|
||||||
BiomeUtil.registerBiomes(server.getRegistryManager().get(RegistryKeys.BIOME));
|
BiomeUtil.registerBiomes(server.getRegistryManager().getOrThrow(RegistryKeys.BIOME));
|
||||||
server.reloadResources(server.getDataPackManager().getEnabledIds()).exceptionally(throwable -> {
|
server.reloadResources(server.getDataPackManager().getEnabledIds()).exceptionally(throwable -> {
|
||||||
LOGGER.warn("Failed to execute reload", throwable);
|
LOGGER.warn("Failed to execute reload", throwable);
|
||||||
return null;
|
return null;
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.dfsek.terra.lifecycle.mixin.lifecycle;
|
||||||
|
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.Platform;
|
||||||
|
|
||||||
|
import com.dfsek.terra.mod.CommonPlatform;
|
||||||
|
|
||||||
|
import com.dfsek.terra.mod.ModPlatform;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.screen.world.CreateWorldScreen;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import static com.dfsek.terra.lifecycle.util.LifecycleUtil.initialized;
|
||||||
|
|
||||||
|
|
||||||
|
@Mixin(CreateWorldScreen.class)
|
||||||
|
public class CreateWorldScreenMixin {
|
||||||
|
@Inject(method = "onCloseScreen()V", at = @At("HEAD"))
|
||||||
|
public void onClose(CallbackInfo ci) {
|
||||||
|
ModPlatform platform = CommonPlatform.get();
|
||||||
|
platform.getRawConfigRegistry().clear();
|
||||||
|
initialized = false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,8 @@
|
|||||||
package com.dfsek.terra.lifecycle.mixin.lifecycle;
|
package com.dfsek.terra.lifecycle.mixin.lifecycle;
|
||||||
|
|
||||||
|
import com.dfsek.terra.mod.CommonPlatform;
|
||||||
|
import com.dfsek.terra.mod.ModPlatform;
|
||||||
|
|
||||||
import com.mojang.datafixers.DataFixer;
|
import com.mojang.datafixers.DataFixer;
|
||||||
import net.minecraft.resource.ResourcePackManager;
|
import net.minecraft.resource.ResourcePackManager;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
@ -34,6 +37,8 @@ public class MinecraftServerMixin {
|
|||||||
|
|
||||||
@Inject(method = "shutdown()V", at = @At("RETURN"))
|
@Inject(method = "shutdown()V", at = @At("RETURN"))
|
||||||
private void injectShutdown(CallbackInfo ci) {
|
private void injectShutdown(CallbackInfo ci) {
|
||||||
|
ModPlatform platform = CommonPlatform.get();
|
||||||
|
platform.getRawConfigRegistry().clear();
|
||||||
initialized = false;
|
initialized = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,7 @@ public class RegistryLoaderMixin {
|
|||||||
private static Logger LOGGER;
|
private static Logger LOGGER;
|
||||||
|
|
||||||
@Redirect(
|
@Redirect(
|
||||||
method = "load(Lnet/minecraft/registry/RegistryLoader$RegistryLoadable;Lnet/minecraft/registry/DynamicRegistryManager;" +
|
method = "load(Lnet/minecraft/registry/RegistryLoader$RegistryLoadable;Ljava/util/List;Ljava/util/List;)Lnet/minecraft/registry/DynamicRegistryManager$Immutable;",
|
||||||
"Ljava/util/List;)Lnet/minecraft/registry/DynamicRegistryManager$Immutable;",
|
|
||||||
at = @At(
|
at = @At(
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "Ljava/util/List;forEach(Ljava/util/function/Consumer;)V",
|
target = "Ljava/util/List;forEach(Ljava/util/function/Consumer;)V",
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package com.dfsek.terra.lifecycle.mixin.lifecycle;
|
package com.dfsek.terra.lifecycle.mixin.lifecycle;
|
||||||
|
|
||||||
import net.minecraft.registry.DynamicRegistryManager;
|
import net.minecraft.registry.CombinedDynamicRegistries;
|
||||||
import net.minecraft.registry.RegistryKeys;
|
import net.minecraft.registry.RegistryKeys;
|
||||||
|
import net.minecraft.registry.ServerDynamicRegistryType;
|
||||||
import net.minecraft.server.SaveLoading;
|
import net.minecraft.server.SaveLoading;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@ -18,13 +19,11 @@ public class SaveLoadingMixin {
|
|||||||
"Ljava/util/concurrent/CompletableFuture;",
|
"Ljava/util/concurrent/CompletableFuture;",
|
||||||
at = @At(
|
at = @At(
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "Lnet/minecraft/registry/RegistryLoader;loadFromResource(Lnet/minecraft/resource/ResourceManager;" +
|
target = "Lnet/minecraft/server/DataPackContents;reload(Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/registry/CombinedDynamicRegistries;Ljava/util/List;Lnet/minecraft/resource/featuretoggle/FeatureSet;Lnet/minecraft/server/command/CommandManager$RegistrationEnvironment;ILjava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;"),
|
||||||
"Lnet/minecraft/registry/DynamicRegistryManager;Ljava/util/List;)" +
|
|
||||||
"Lnet/minecraft/registry/DynamicRegistryManager$Immutable;"),
|
|
||||||
index = 1
|
index = 1
|
||||||
)
|
)
|
||||||
private static DynamicRegistryManager grabManager(DynamicRegistryManager registryManager) {
|
private static CombinedDynamicRegistries<ServerDynamicRegistryType> grabManager(CombinedDynamicRegistries<ServerDynamicRegistryType> dynamicRegistries) {
|
||||||
MinecraftUtil.registerFlora(registryManager.get(RegistryKeys.BIOME));
|
MinecraftUtil.registerFlora(dynamicRegistries.getCombinedRegistryManager().getOrThrow(RegistryKeys.BIOME));
|
||||||
return registryManager;
|
return dynamicRegistries;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public final class BiomeUtil {
|
|||||||
|
|
||||||
|
|
||||||
if(pack.getContext().get(PreLoadCompatibilityOptions.class).useVanillaBiomes()) {
|
if(pack.getContext().get(PreLoadCompatibilityOptions.class).useVanillaBiomes()) {
|
||||||
((ProtoPlatformBiome) biome.getPlatformBiome()).setDelegate(registry.getEntry(vanilla).orElseThrow());
|
((ProtoPlatformBiome) biome.getPlatformBiome()).setDelegate(registry.getEntry(registry.get(vanilla)));
|
||||||
} else {
|
} else {
|
||||||
VanillaBiomeProperties vanillaBiomeProperties = biome.getContext().get(VanillaBiomeProperties.class);
|
VanillaBiomeProperties vanillaBiomeProperties = biome.getContext().get(VanillaBiomeProperties.class);
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
"lifecycle.SaveLoadingMixin"
|
"lifecycle.SaveLoadingMixin"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
|
"lifecycle.CreateWorldScreenMixin"
|
||||||
],
|
],
|
||||||
"server": [
|
"server": [
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user