Fixes for 1.19-pre1
This commit is contained in:
parent
d533f93113
commit
c6742982df
13 changed files with 165 additions and 174 deletions
156
bclib.gradle
156
bclib.gradle
|
@ -1,11 +1,11 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'org.kohsuke:github-api:1.114'
|
classpath 'org.kohsuke:github-api:1.114'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sourceCompatibility = JavaVersion.VERSION_17
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
targetCompatibility = JavaVersion.VERSION_17
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
|
@ -15,70 +15,70 @@ version = project.mod_version
|
||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://maven.dblsaiko.net/" }
|
maven { url "https://maven.dblsaiko.net/" }
|
||||||
maven { url "https://maven.fabricmc.net/" }
|
maven { url "https://maven.fabricmc.net/" }
|
||||||
maven { url "https://maven.shedaniel.me/" }
|
maven { url "https://maven.shedaniel.me/" }
|
||||||
maven { url 'https://maven.blamejared.com' }
|
maven { url 'https://maven.blamejared.com' }
|
||||||
maven { url 'https://jitpack.io' }
|
maven { url 'https://jitpack.io' }
|
||||||
maven { url 'https://maven.terraformersmc.com/releases' }
|
maven { url 'https://maven.terraformersmc.com/releases' }
|
||||||
}
|
}
|
||||||
|
|
||||||
loom {
|
loom {
|
||||||
accessWidenerPath = file("src/main/resources/bclib.accesswidener")
|
accessWidenerPath = file("src/main/resources/bclib.accesswidener")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||||
mappings loom.officialMojangMappings()
|
mappings loom.officialMojangMappings()
|
||||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
|
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
|
||||||
|
|
||||||
//useApi "vazkii.patchouli:Patchouli:1.16.4-${project.patchouli_version}"
|
//useApi "vazkii.patchouli:Patchouli:1.16.4-${project.patchouli_version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
println "Version: ${project.mod_version}"
|
println "Version: ${project.mod_version}"
|
||||||
inputs.property "version", project.mod_version
|
inputs.property "version", project.mod_version
|
||||||
|
|
||||||
filesMatching("fabric.mod.json") {
|
filesMatching("fabric.mod.json") {
|
||||||
expand "version": project.mod_version
|
expand "version": project.mod_version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||||
// this fixes some edge cases with special characters not displaying correctly
|
// this fixes some edge cases with special characters not displaying correctly
|
||||||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
options.encoding = "UTF-8"
|
options.encoding = "UTF-8"
|
||||||
it.options.release = 17
|
it.options.release = 17
|
||||||
}
|
}
|
||||||
|
|
||||||
javadoc {
|
javadoc {
|
||||||
options.tags = [ "reason" ]
|
options.tags = ["reason"]
|
||||||
options.stylesheetFile = new File(projectDir, "javadoc.css");
|
options.stylesheetFile = new File(projectDir, "javadoc.css");
|
||||||
}
|
}
|
||||||
|
|
||||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||||
classifier = 'javadoc'
|
classifier = 'javadoc'
|
||||||
from javadoc.destinationDir
|
from javadoc.destinationDir
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||||
// if it is present.
|
// if it is present.
|
||||||
// If you remove this task, sources will not be generated.
|
// If you remove this task, sources will not be generated.
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
classifier = 'sources'
|
classifier = 'sources'
|
||||||
from sourceSets.main.allSource
|
from sourceSets.main.allSource
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
from "LICENSE"
|
from "LICENSE"
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
archives sourcesJar
|
archives sourcesJar
|
||||||
archives javadocJar
|
archives javadocJar
|
||||||
}
|
}
|
||||||
|
|
||||||
def env = System.getenv()
|
def env = System.getenv()
|
||||||
|
@ -87,60 +87,60 @@ import org.kohsuke.github.GHReleaseBuilder
|
||||||
import org.kohsuke.github.GitHub
|
import org.kohsuke.github.GitHub
|
||||||
|
|
||||||
task release(dependsOn: [remapJar, sourcesJar, javadocJar]) {
|
task release(dependsOn: [remapJar, sourcesJar, javadocJar]) {
|
||||||
onlyIf {
|
onlyIf {
|
||||||
env.GITHUB_TOKEN
|
env.GITHUB_TOKEN
|
||||||
}
|
}
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
def github = GitHub.connectUsingOAuth(env.GITHUB_TOKEN as String)
|
def github = GitHub.connectUsingOAuth(env.GITHUB_TOKEN as String)
|
||||||
def repository = github.getRepository("paulevsGitch/BCLib")
|
def repository = github.getRepository("quiqueck/BCLib")
|
||||||
|
|
||||||
def releaseBuilder = new GHReleaseBuilder(repository, version as String)
|
def releaseBuilder = new GHReleaseBuilder(repository, version as String)
|
||||||
releaseBuilder.name("${archivesBaseName}-${version}")
|
releaseBuilder.name("${archivesBaseName}-${version}")
|
||||||
releaseBuilder.body("A changelog can be found at https://github.com/paulevsGitch/BCLib/commits")
|
releaseBuilder.body("A changelog can be found at https://github.com/quiqueck/BCLib/commits")
|
||||||
releaseBuilder.commitish("main")
|
releaseBuilder.commitish("main")
|
||||||
|
|
||||||
def ghRelease = releaseBuilder.create()
|
def ghRelease = releaseBuilder.create()
|
||||||
ghRelease.uploadAsset(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"), "application/java-archive");
|
ghRelease.uploadAsset(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"), "application/java-archive");
|
||||||
ghRelease.uploadAsset(file("${project.buildDir}/libs/${archivesBaseName}-${version}-sources.jar"), "application/java-archive");
|
ghRelease.uploadAsset(file("${project.buildDir}/libs/${archivesBaseName}-${version}-sources.jar"), "application/java-archive");
|
||||||
ghRelease.uploadAsset(file("${project.buildDir}/libs/${archivesBaseName}-${version}-javadoc.jar"), "application/java-archive");
|
ghRelease.uploadAsset(file("${project.buildDir}/libs/${archivesBaseName}-${version}-javadoc.jar"), "application/java-archive");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// configure the maven publication
|
// configure the maven publication
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
gpr(MavenPublication) {
|
gpr(MavenPublication) {
|
||||||
artifactId archivesBaseName
|
artifactId archivesBaseName
|
||||||
artifact(remapJar) {
|
artifact(remapJar) {
|
||||||
builtBy remapJar
|
builtBy remapJar
|
||||||
}
|
}
|
||||||
artifact(sourcesJar) {
|
artifact(sourcesJar) {
|
||||||
builtBy remapSourcesJar
|
builtBy remapSourcesJar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// select the repositories you want to publish to
|
// select the repositories you want to publish to
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
name = "GitHubPackages"
|
name = "GitHubPackages"
|
||||||
url = uri("https://maven.pkg.github.com/paulevsgitch/bclib")
|
url = uri("https://maven.pkg.github.com/quiqueck/bclib")
|
||||||
credentials {
|
credentials {
|
||||||
username = env.GITHUB_USER
|
username = env.GITHUB_USER
|
||||||
password = env.GITHUB_TOKEN
|
password = env.GITHUB_TOKEN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
dev {
|
dev {
|
||||||
canBeResolved = false
|
canBeResolved = false
|
||||||
canBeConsumed = true
|
canBeConsumed = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
dev jar
|
dev jar
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ loom_version=0.11-SNAPSHOT
|
||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/versions.html
|
# check these on https://fabricmc.net/versions.html
|
||||||
minecraft_version= 22w18a
|
minecraft_version= 1.19-pre1
|
||||||
loader_version= 0.14.3
|
loader_version= 0.14.5
|
||||||
fabric_version = 0.52.1+1.19
|
fabric_version = 0.52.4+1.19
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 2.0.0
|
mod_version = 2.0.0
|
||||||
|
|
|
@ -22,18 +22,14 @@ import net.minecraft.world.level.biome.BiomeGenerationSettings;
|
||||||
import net.minecraft.world.level.biome.BiomeSource;
|
import net.minecraft.world.level.biome.BiomeSource;
|
||||||
import net.minecraft.world.level.biome.Biomes;
|
import net.minecraft.world.level.biome.Biomes;
|
||||||
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
|
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
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.chunk.PalettedContainer;
|
import net.minecraft.world.level.chunk.PalettedContainer;
|
||||||
import net.minecraft.world.level.levelgen.GenerationStep.Carving;
|
|
||||||
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
|
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
|
||||||
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
|
||||||
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
|
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
|
||||||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||||
import net.minecraft.world.level.levelgen.SurfaceRules.RuleSource;
|
import net.minecraft.world.level.levelgen.SurfaceRules.RuleSource;
|
||||||
import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
|
|
||||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||||
|
@ -53,8 +49,10 @@ import org.apache.commons.lang3.mutable.MutableInt;
|
||||||
import org.betterx.bclib.BCLib;
|
import org.betterx.bclib.BCLib;
|
||||||
import org.betterx.bclib.api.tag.CommonBiomeTags;
|
import org.betterx.bclib.api.tag.CommonBiomeTags;
|
||||||
import org.betterx.bclib.api.tag.TagAPI;
|
import org.betterx.bclib.api.tag.TagAPI;
|
||||||
import org.betterx.bclib.entity.BCLEntityWrapper;
|
import org.betterx.bclib.interfaces.BiomeSourceAccessor;
|
||||||
import org.betterx.bclib.interfaces.*;
|
import org.betterx.bclib.interfaces.NoiseGeneratorSettingsProvider;
|
||||||
|
import org.betterx.bclib.interfaces.SurfaceMaterialProvider;
|
||||||
|
import org.betterx.bclib.interfaces.SurfaceRuleProvider;
|
||||||
import org.betterx.bclib.mixin.client.MinecraftMixin;
|
import org.betterx.bclib.mixin.client.MinecraftMixin;
|
||||||
import org.betterx.bclib.mixin.common.BiomeGenerationSettingsAccessor;
|
import org.betterx.bclib.mixin.common.BiomeGenerationSettingsAccessor;
|
||||||
import org.betterx.bclib.mixin.common.MobSpawnSettingsAccessor;
|
import org.betterx.bclib.mixin.common.MobSpawnSettingsAccessor;
|
||||||
|
@ -483,7 +481,7 @@ public class BiomeAPI {
|
||||||
|
|
||||||
FabricBiomesData.END_VOID_BIOMES.forEach((key, weight) -> {
|
FabricBiomesData.END_VOID_BIOMES.forEach((key, weight) -> {
|
||||||
if (!hasBiome(key.location())) {
|
if (!hasBiome(key.location())) {
|
||||||
registerEndVoidBiome(BuiltinRegistries.BIOME.getOrCreateHolder(key), weight);
|
registerEndVoidBiome(BuiltinRegistries.BIOME.getOrCreateHolderOrThrow(key), weight);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -495,7 +493,7 @@ public class BiomeAPI {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static Holder<Biome> getFromRegistry(ResourceKey<Biome> key) {
|
public static Holder<Biome> getFromRegistry(ResourceKey<Biome> key) {
|
||||||
return BuiltinRegistries.BIOME.getOrCreateHolder(key);
|
return BuiltinRegistries.BIOME.getOrCreateHolderOrThrow(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDatapackBiome(ResourceLocation biomeID) {
|
public static boolean isDatapackBiome(ResourceLocation biomeID) {
|
||||||
|
@ -858,6 +856,7 @@ public class BiomeAPI {
|
||||||
public static Optional<BlockState> findUnderMaterial(Holder<Biome> biome) {
|
public static Optional<BlockState> findUnderMaterial(Holder<Biome> biome) {
|
||||||
return findUnderMaterial(getBiome(biome.value()));
|
return findUnderMaterial(getBiome(biome.value()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Optional<BlockState> findUnderMaterial(BCLBiome biome) {
|
public static Optional<BlockState> findUnderMaterial(BCLBiome biome) {
|
||||||
if (biome instanceof SurfaceMaterialProvider smp) {
|
if (biome instanceof SurfaceMaterialProvider smp) {
|
||||||
return Optional.of(smp.getUnderMaterial());
|
return Optional.of(smp.getUnderMaterial());
|
||||||
|
|
|
@ -5,8 +5,9 @@ import net.minecraft.core.Registry;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.packs.resources.ResourceManager;
|
import net.minecraft.server.packs.resources.ResourceManager;
|
||||||
import net.minecraft.tags.Tag;
|
import net.minecraft.tags.TagEntry;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
|
import net.minecraft.tags.TagLoader;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
|
@ -16,9 +17,11 @@ import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import org.betterx.bclib.BCLib;
|
||||||
import org.betterx.bclib.api.biomes.BiomeAPI;
|
import org.betterx.bclib.api.biomes.BiomeAPI;
|
||||||
import org.betterx.bclib.mixin.common.DiggerItemAccessor;
|
import org.betterx.bclib.mixin.common.DiggerItemAccessor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
@ -229,8 +232,8 @@ public class TagAPI {
|
||||||
* @param tagsMap The map that will hold the registered Tags
|
* @param tagsMap The map that will hold the registered Tags
|
||||||
* @return The {@code tagsMap} Parameter.
|
* @return The {@code tagsMap} Parameter.
|
||||||
*/
|
*/
|
||||||
public static <T> Map<ResourceLocation, Tag.Builder> apply(String directory,
|
public static <T> Map<ResourceLocation, List<TagLoader.EntryWithSource>> apply(String directory,
|
||||||
Map<ResourceLocation, Tag.Builder> tagsMap) {
|
Map<ResourceLocation, List<TagLoader.EntryWithSource>> tagsMap) {
|
||||||
|
|
||||||
TagType<?> type = TYPES.get(directory);
|
TagType<?> type = TYPES.get(directory);
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
|
@ -259,8 +262,9 @@ public class TagAPI {
|
||||||
* @param ids
|
* @param ids
|
||||||
* @return The Builder passed as {@code builder}.
|
* @return The Builder passed as {@code builder}.
|
||||||
*/
|
*/
|
||||||
public static Tag.Builder apply(Tag.Builder builder, Set<ResourceLocation> ids) {
|
public static List<TagLoader.EntryWithSource> apply(List<TagLoader.EntryWithSource> builder,
|
||||||
ids.forEach(value -> builder.addElement(value, "BCLib Code"));
|
Set<ResourceLocation> ids) {
|
||||||
|
ids.forEach(value -> builder.add(new TagLoader.EntryWithSource(TagEntry.element(value), BCLib.MOD_ID)));
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,16 +4,18 @@ import net.minecraft.core.DefaultedRegistry;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.tags.Tag;
|
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
|
import net.minecraft.tags.TagLoader;
|
||||||
import net.minecraft.tags.TagManager;
|
import net.minecraft.tags.TagManager;
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import org.betterx.bclib.BCLib;
|
import org.betterx.bclib.BCLib;
|
||||||
import org.betterx.bclib.api.biomes.BiomeAPI;
|
import org.betterx.bclib.api.biomes.BiomeAPI;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
|
@ -190,10 +192,10 @@ public class TagType<T> {
|
||||||
tags.forEach(consumer);
|
tags.forEach(consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void apply(Map<ResourceLocation, Tag.Builder> tagsMap) {
|
public void apply(Map<ResourceLocation, List<TagLoader.EntryWithSource>> tagsMap) {
|
||||||
if (Registry.BIOME_REGISTRY.equals(registryKey)) BiomeAPI._runTagAdders();
|
if (Registry.BIOME_REGISTRY.equals(registryKey)) BiomeAPI._runTagAdders();
|
||||||
|
|
||||||
//this.isFrozen = true;
|
//this.isFrozen = true;
|
||||||
this.forEach((id, ids) -> TagAPI.apply(tagsMap.computeIfAbsent(id, key -> Tag.Builder.tag()), ids));
|
this.forEach((id, ids) -> TagAPI.apply(tagsMap.computeIfAbsent(id, key -> Lists.newArrayList()), ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,35 +2,23 @@ package org.betterx.bclib.mixin.common;
|
||||||
|
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.biome.BiomeSource;
|
import net.minecraft.world.level.biome.BiomeSource;
|
||||||
import net.minecraft.world.level.biome.BiomeSource.StepFeatureData;
|
|
||||||
|
|
||||||
import com.google.common.base.Suppliers;
|
|
||||||
import org.betterx.bclib.BCLib;
|
import org.betterx.bclib.BCLib;
|
||||||
import org.betterx.bclib.interfaces.BiomeSourceAccessor;
|
import org.betterx.bclib.interfaces.BiomeSourceAccessor;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Mutable;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
@Mixin(BiomeSource.class)
|
@Mixin(BiomeSource.class)
|
||||||
public abstract class BiomeSourceMixin implements BiomeSourceAccessor {
|
public abstract class BiomeSourceMixin implements BiomeSourceAccessor {
|
||||||
@Shadow
|
|
||||||
protected abstract List<StepFeatureData> buildFeaturesPerStep(List<Biome> list, boolean bl);
|
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
public abstract Set<Biome> possibleBiomes();
|
public abstract Set<Biome> possibleBiomes();
|
||||||
|
|
||||||
@Mutable
|
|
||||||
@Shadow
|
|
||||||
@Final
|
|
||||||
private Supplier<List<StepFeatureData>> featuresPerStep;
|
|
||||||
|
|
||||||
public void bclRebuildFeatures() {
|
public void bclRebuildFeatures() {
|
||||||
|
//Feature sorting is now a task in ChunkGenerator
|
||||||
BCLib.LOGGER.info("Rebuilding features in BiomeSource " + this);
|
BCLib.LOGGER.info("Rebuilding features in BiomeSource " + this);
|
||||||
featuresPerStep = Suppliers.memoize(() -> buildFeaturesPerStep(this.possibleBiomes().stream().toList(), true));
|
//featuresPerStep = Suppliers.memoize(() -> FeatureSorter.buildFeaturesPerStep(this.possibleBiomes().stream().toList(), true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,18 +2,16 @@ package org.betterx.bclib.mixin.common;
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.server.Services;
|
||||||
import net.minecraft.server.WorldStem;
|
import net.minecraft.server.WorldStem;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.progress.ChunkProgressListener;
|
import net.minecraft.server.level.progress.ChunkProgressListener;
|
||||||
import net.minecraft.server.level.progress.ChunkProgressListenerFactory;
|
import net.minecraft.server.level.progress.ChunkProgressListenerFactory;
|
||||||
import net.minecraft.server.packs.repository.PackRepository;
|
import net.minecraft.server.packs.repository.PackRepository;
|
||||||
import net.minecraft.server.players.GameProfileCache;
|
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.storage.LevelStorageSource.LevelStorageAccess;
|
import net.minecraft.world.level.storage.LevelStorageSource.LevelStorageAccess;
|
||||||
import net.minecraft.world.level.storage.WorldData;
|
import net.minecraft.world.level.storage.WorldData;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfileRepository;
|
|
||||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
|
||||||
import com.mojang.datafixers.DataFixer;
|
import com.mojang.datafixers.DataFixer;
|
||||||
import org.betterx.bclib.api.dataexchange.DataExchangeAPI;
|
import org.betterx.bclib.api.dataexchange.DataExchangeAPI;
|
||||||
import org.betterx.bclib.recipes.BCLRecipeManager;
|
import org.betterx.bclib.recipes.BCLRecipeManager;
|
||||||
|
@ -50,9 +48,7 @@ public class MinecraftServerMixin {
|
||||||
WorldStem worldStem,
|
WorldStem worldStem,
|
||||||
Proxy proxy,
|
Proxy proxy,
|
||||||
DataFixer dataFixer,
|
DataFixer dataFixer,
|
||||||
MinecraftSessionService minecraftSessionService,
|
Services services,
|
||||||
GameProfileRepository gameProfileRepository,
|
|
||||||
GameProfileCache gameProfileCache,
|
|
||||||
ChunkProgressListenerFactory chunkProgressListenerFactory,
|
ChunkProgressListenerFactory chunkProgressListenerFactory,
|
||||||
CallbackInfo ci) {
|
CallbackInfo ci) {
|
||||||
DataExchangeAPI.prepareServerside();
|
DataExchangeAPI.prepareServerside();
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.betterx.bclib.mixin.common;
|
package org.betterx.bclib.mixin.common;
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.tags.Tag;
|
|
||||||
import net.minecraft.tags.TagLoader;
|
import net.minecraft.tags.TagLoader;
|
||||||
|
|
||||||
import org.betterx.bclib.api.tag.TagAPI;
|
import org.betterx.bclib.api.tag.TagAPI;
|
||||||
|
@ -11,6 +10,7 @@ import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Mixin(TagLoader.class)
|
@Mixin(TagLoader.class)
|
||||||
|
@ -20,7 +20,7 @@ public class TagLoaderMixin {
|
||||||
private String directory;
|
private String directory;
|
||||||
|
|
||||||
@ModifyArg(method = "loadAndBuild", at = @At(value = "INVOKE", target = "Lnet/minecraft/tags/TagLoader;build(Ljava/util/Map;)Ljava/util/Map;"))
|
@ModifyArg(method = "loadAndBuild", at = @At(value = "INVOKE", target = "Lnet/minecraft/tags/TagLoader;build(Ljava/util/Map;)Ljava/util/Map;"))
|
||||||
public Map<ResourceLocation, Tag.Builder> be_modifyTags(Map<ResourceLocation, Tag.Builder> tagsMap) {
|
public Map<ResourceLocation, List<TagLoader.EntryWithSource>> be_modifyTags(Map<ResourceLocation, List<TagLoader.EntryWithSource>> tagsMap) {
|
||||||
return TagAPI.apply(directory, tagsMap);
|
return TagAPI.apply(directory, tagsMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,7 +189,7 @@ public class BCLBiome extends BCLBiomeSettings {
|
||||||
|
|
||||||
|
|
||||||
public Holder<Biome> getBiomeHolder() {
|
public Holder<Biome> getBiomeHolder() {
|
||||||
return BuiltinRegistries.BIOME.getOrCreateHolder(BiomeAPI.getBiomeKey(biome));
|
return BuiltinRegistries.BIOME.getOrCreateHolderOrThrow(BiomeAPI.getBiomeKey(biome));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -102,8 +102,8 @@ public class BCLibEndBiomeSource extends BCLBiomeSource {
|
||||||
endVoidBiomePicker.rebuild();
|
endVoidBiomePicker.rebuild();
|
||||||
|
|
||||||
|
|
||||||
this.centerBiome = biomeRegistry.getOrCreateHolder(Biomes.THE_END);
|
this.centerBiome = biomeRegistry.getOrCreateHolderOrThrow(Biomes.THE_END);
|
||||||
this.barrens = biomeRegistry.getOrCreateHolder(Biomes.END_BARRENS);
|
this.barrens = biomeRegistry.getOrCreateHolderOrThrow(Biomes.END_BARRENS);
|
||||||
|
|
||||||
this.endLandFunction = GeneratorOptions.getEndLandFunction();
|
this.endLandFunction = GeneratorOptions.getEndLandFunction();
|
||||||
this.pos = new Point();
|
this.pos = new Point();
|
||||||
|
@ -119,7 +119,8 @@ public class BCLibEndBiomeSource extends BCLBiomeSource {
|
||||||
|
|
||||||
return biomeRegistry.stream()
|
return biomeRegistry.stream()
|
||||||
.filter(biome -> biomeRegistry.getResourceKey(biome).isPresent())
|
.filter(biome -> biomeRegistry.getResourceKey(biome).isPresent())
|
||||||
.map(biome -> biomeRegistry.getOrCreateHolder(biomeRegistry.getResourceKey(biome).get()))
|
.map(biome -> biomeRegistry.getOrCreateHolderOrThrow(biomeRegistry.getResourceKey(biome)
|
||||||
|
.get()))
|
||||||
.filter(biome -> {
|
.filter(biome -> {
|
||||||
ResourceLocation key = biome.unwrapKey().orElseThrow().location();
|
ResourceLocation key = biome.unwrapKey().orElseThrow().location();
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,8 @@ public class BCLibNetherBiomeSource extends BCLBiomeSource {
|
||||||
|
|
||||||
return biomeRegistry.stream()
|
return biomeRegistry.stream()
|
||||||
.filter(biome -> biomeRegistry.getResourceKey(biome).isPresent())
|
.filter(biome -> biomeRegistry.getResourceKey(biome).isPresent())
|
||||||
.map(biome -> biomeRegistry.getOrCreateHolder(biomeRegistry.getResourceKey(biome).get()))
|
.map(biome -> biomeRegistry.getOrCreateHolderOrThrow(biomeRegistry.getResourceKey(biome)
|
||||||
|
.get()))
|
||||||
.filter(biome -> {
|
.filter(biome -> {
|
||||||
ResourceLocation location = biome.unwrapKey().orElseThrow().location();
|
ResourceLocation location = biome.unwrapKey().orElseThrow().location();
|
||||||
final String strLocation = location.toString();
|
final String strLocation = location.toString();
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class BiomePicker {
|
||||||
this.bclBiome = bclBiome;
|
this.bclBiome = bclBiome;
|
||||||
|
|
||||||
this.key = biomeRegistry.getResourceKey(biomeRegistry.get(bclBiome.getID())).orElseThrow();
|
this.key = biomeRegistry.getResourceKey(biomeRegistry.get(bclBiome.getID())).orElseThrow();
|
||||||
this.biome = biomeRegistry.getOrCreateHolder(key);
|
this.biome = biomeRegistry.getOrCreateHolderOrThrow(key);
|
||||||
|
|
||||||
bclBiome.forEachSubBiome((b, w) -> {
|
bclBiome.forEachSubBiome((b, w) -> {
|
||||||
subbiomes.add(create(b), w);
|
subbiomes.add(create(b), w);
|
||||||
|
|
|
@ -1,51 +1,51 @@
|
||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "bclib",
|
"id": "bclib",
|
||||||
"version": "${version}",
|
"version": "2.0.0",
|
||||||
"name": "BCLib",
|
"name": "BCLib",
|
||||||
"description": "A library for BetterX team mods",
|
"description": "A library for BetterX team mods",
|
||||||
"authors": [
|
"authors": [
|
||||||
"paulevs",
|
"paulevs",
|
||||||
"Quiqueck",
|
"Quiqueck",
|
||||||
"Bulldog83"
|
"Bulldog83"
|
||||||
],
|
],
|
||||||
"contact": {
|
"contact": {
|
||||||
"homepage": "https://www.curseforge.com/minecraft/mc-mods/bclib",
|
"homepage": "https://www.curseforge.com/minecraft/mc-mods/bclib",
|
||||||
"issues": "https://github.com/paulevsGitch/bclib/issues",
|
"issues": "https://github.com/paulevsGitch/bclib/issues",
|
||||||
"sources": "https://github.com/paulevsGitch/bclib"
|
"sources": "https://github.com/paulevsGitch/bclib"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"icon": "assets/bclib/icon.png",
|
"icon": "assets/bclib/icon.png",
|
||||||
"environment": "*",
|
"environment": "*",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"main": [
|
"main": [
|
||||||
"ru.bclib.BCLib"
|
"org.betterx.bclib.BCLib"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"ru.bclib.client.BCLibClient"
|
"org.betterx.bclib.client.BCLibClient"
|
||||||
],
|
],
|
||||||
"server": [
|
"server": [
|
||||||
"ru.bclib.server.BCLibServer"
|
"org.betterx.bclib.server.BCLibServer"
|
||||||
],
|
],
|
||||||
"modmenu": [
|
"modmenu": [
|
||||||
"ru.bclib.integration.modmenu.ModMenuEntryPoint"
|
"org.betterx.bclib.integration.modmenu.ModMenuEntryPoint"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"accessWidener" : "bclib.accesswidener",
|
"accessWidener": "bclib.accesswidener",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"bclib.mixins.common.json",
|
"bclib.mixins.common.json",
|
||||||
"bclib.mixins.client.json"
|
"bclib.mixins.client.json"
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.14.3",
|
"fabricloader": ">=0.14.5",
|
||||||
"fabric": ">=0.52.0",
|
"fabric": ">=0.52.4",
|
||||||
"minecraft": "1.19-alpha.22.18.a"
|
"minecraft": "1.19-beta.1"
|
||||||
},
|
},
|
||||||
"custom":{
|
"custom": {
|
||||||
"modmenu":{
|
"modmenu": {
|
||||||
"links":{
|
"links": {
|
||||||
"title.link.bclib.discord":"https://discord.gg/kYuATbYbKW"
|
"title.link.bclib.discord": "https://discord.gg/kYuATbYbKW"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue