Compare commits
74 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 71ca26bba9 | |||
| 75a51be28c | |||
| a66e4ba157 | |||
| f2b9e428d3 | |||
| 5b2497b9d4 | |||
| e78424def4 | |||
| e2c94de6e6 | |||
| daa3caf684 | |||
| 5991aa42d9 | |||
| ff6a5aae69 | |||
| 80d9b4540b | |||
| 4998991ebe | |||
| 14343569fe | |||
| be6cc5ff4e | |||
| 0ad3391bea | |||
| 582d998e2e | |||
| c00ee26075 | |||
| 4c9f70a52f | |||
| 29481bc123 | |||
| e274c9e004 | |||
| 73988f0308 | |||
| c4a9e7a2a7 | |||
| af6dca6e5e | |||
| a49720a221 | |||
| 12a66e70c9 | |||
| 00d8aa356b | |||
| d40d94a565 | |||
| c1f798793e | |||
| 8fe4ad454c | |||
| 17022f2df2 | |||
| 7fa4bc35f6 | |||
| 85df9c5ef4 | |||
| 45d4f390a9 | |||
| e7b60b7562 | |||
| 2615177907 | |||
| a83d7e2a26 | |||
| 8a2182e238 | |||
| d45455092c | |||
| da18469fd4 | |||
| 6b5bae9bee | |||
| e29a7786e4 | |||
| 55a837ca5e | |||
| 94cba6cf67 | |||
| 294685df00 | |||
| 2642b7a9a4 | |||
| 45594e4e47 | |||
| 54cd1a2e48 | |||
| a20fb982ec | |||
| 184d61e637 | |||
| 06ea56767f | |||
| 1f6e137759 | |||
| c7cf7885ae | |||
| 8e98444887 | |||
| 9bfe2e8233 | |||
| 21f4adc769 | |||
| 3b10ca5809 | |||
| 6cc8284747 | |||
| 6254f7156f | |||
| 0fa03701a4 | |||
| 49125cae47 | |||
| 3298857d0c | |||
| d939cbeb96 | |||
| 54d254be73 | |||
| d433fdea62 | |||
| ffa1c54ff3 | |||
| 019ac6dec3 | |||
| 08d3da47f4 | |||
| 348ac2b734 | |||
| fe014b4985 | |||
| b7f6f3b900 | |||
| 3c76ed71d8 | |||
| 5de1998913 | |||
| 05c0f030cb | |||
| bd85329589 |
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
# use Eclipse's JDK
|
# use Eclipse's JDK
|
||||||
# The ci should always use a unix(-like) OS to work
|
# The ci should always use a unix(-like) OS to work
|
||||||
image: eclipse-temurin:17
|
image: eclipse-temurin:21
|
||||||
|
|
||||||
# all stages need to be defined here
|
# all stages need to be defined here
|
||||||
# TODO: Make stages depend on what is in versionProperties
|
# TODO: Make stages depend on what is in versionProperties
|
||||||
@@ -30,7 +30,7 @@ build:
|
|||||||
stage: build
|
stage: build
|
||||||
parallel:
|
parallel:
|
||||||
matrix:
|
matrix:
|
||||||
- MC_VER: ["1.16.5", "1.17.1", "1.18.2", "1.19.2", "1.19.4", "1.20.1", "1.20.2", "1.20.4"]
|
- MC_VER: ["1.16.5", "1.17.1", "1.18.2", "1.19.2", "1.19.4", "1.20.1", "1.20.2", "1.20.4", "1.20.6"]
|
||||||
script:
|
script:
|
||||||
# this both runs the unit tests and assembles the code
|
# this both runs the unit tests and assembles the code
|
||||||
- ./gradlew clean -PmcVer="${MC_VER}" -PinfoGitCommit="${CI_COMMIT_SHA}" -PinfoGitBranch="${CI_COMMIT_BRANCH}" -PinfoBuildSource="GitLab CI (${CI_PIPELINE_ID})" --gradle-user-home cache/;
|
- ./gradlew clean -PmcVer="${MC_VER}" -PinfoGitCommit="${CI_COMMIT_SHA}" -PinfoGitBranch="${CI_COMMIT_BRANCH}" -PinfoBuildSource="GitLab CI (${CI_PIPELINE_ID})" --gradle-user-home cache/;
|
||||||
|
|||||||
+39
-10
@@ -2,16 +2,16 @@ plugins {
|
|||||||
id "java"
|
id "java"
|
||||||
|
|
||||||
// Plugin to put dependencies inside our final jar
|
// Plugin to put dependencies inside our final jar
|
||||||
id "com.github.johnrengelman.shadow" version '7.1.2' apply false
|
id "com.github.johnrengelman.shadow" version '8.1.1' apply false
|
||||||
|
|
||||||
// Plugin to create merged jars
|
// Plugin to create merged jars
|
||||||
id "io.github.pacifistmc.forgix" version "1.2.6"
|
id "io.github.pacifistmc.forgix" version "1.2.9"
|
||||||
|
|
||||||
// Manifold preprocessor
|
// Manifold preprocessor
|
||||||
id "systems.manifold.manifold-gradle-plugin" version "0.0.2-alpha"
|
id "systems.manifold.manifold-gradle-plugin" version "0.0.2-alpha"
|
||||||
|
|
||||||
// Architectury is used here only as a replacement for forge's own loom
|
// Architectury is used here only as a replacement for forge's own loom
|
||||||
id "dev.architectury.loom" version "1.5-SNAPSHOT" apply false
|
id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -196,17 +196,29 @@ subprojects { p ->
|
|||||||
implementation("org.junit.jupiter:junit-jupiter-engine:5.8.2")
|
implementation("org.junit.jupiter:junit-jupiter-engine:5.8.2")
|
||||||
implementation("junit:junit:4.13")
|
implementation("junit:junit:4.13")
|
||||||
|
|
||||||
|
// FastUtil
|
||||||
|
// Note: MC 1.16 uses 8.2.1, and versions after use 8.5.12
|
||||||
|
// We cannot relocate this library since we call some MC classes that reference it
|
||||||
|
implementation("it.unimi.dsi:fastutil:${rootProject.fastutil_version}")
|
||||||
|
|
||||||
|
|
||||||
|
// Compression
|
||||||
|
forgeShadowMe("org.lz4:lz4-java:${rootProject.lz4_version}") // LZ4
|
||||||
|
forgeShadowMe("org.tukaani:xz:${rootProject.xz_version}") // LZMA
|
||||||
|
|
||||||
|
// Sqlite Database
|
||||||
|
forgeShadowMe("org.xerial:sqlite-jdbc:${rootProject.sqlite_jdbc_version}")
|
||||||
|
|
||||||
// NightConfig (includes Toml & Json)
|
// NightConfig (includes Toml & Json)
|
||||||
// needs to be here and in core to prevent compiler errors
|
|
||||||
forgeShadowMe("com.electronwill.night-config:toml:${rootProject.nightconfig_version}")
|
forgeShadowMe("com.electronwill.night-config:toml:${rootProject.nightconfig_version}")
|
||||||
forgeShadowMe("com.electronwill.night-config:json:${rootProject.nightconfig_version}")
|
forgeShadowMe("com.electronwill.night-config:json:${rootProject.nightconfig_version}")
|
||||||
|
|
||||||
// Compression
|
// SVG (not needed atm)
|
||||||
// needs to be here and in core to prevent compiler errors
|
// forgeShadowMe("com.formdev:svgSalamander:${rootProject.svgSalamander_version}")
|
||||||
forgeShadowMe("org.lz4:lz4-java:${rootProject.lz4_version}") // LZ4
|
|
||||||
|
|
||||||
|
// Netty
|
||||||
|
// Breaks 1.16.5
|
||||||
|
//forgeShadowMe("io.netty:netty-all:${rootProject.netty_version}")
|
||||||
|
|
||||||
// Remember, for lwjgl dependencies that arent included in Minecraft, you need to also need to add it to the ShadowJar thing
|
// Remember, for lwjgl dependencies that arent included in Minecraft, you need to also need to add it to the ShadowJar thing
|
||||||
forgeShadowMe("org.lwjgl:lwjgl-jawt:${rootProject.lwjgl_version}") {
|
forgeShadowMe("org.lwjgl:lwjgl-jawt:${rootProject.lwjgl_version}") {
|
||||||
@@ -270,16 +282,32 @@ subprojects { p ->
|
|||||||
relocate "com.seibel.distanthorizons.fabriclike", "loaderCommon.${p.name}.com.seibel.distanthorizons.fabriclike" // Move the loader files to a different location
|
relocate "com.seibel.distanthorizons.fabriclike", "loaderCommon.${p.name}.com.seibel.distanthorizons.fabriclike" // Move the loader files to a different location
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def librariesLocation = "distanthorizons.libraries"
|
def librariesLocation = "DistantHorizons.libraries"
|
||||||
|
|
||||||
// SVG (not needed atm)
|
// LWJGL
|
||||||
// relocate "com.kitfox.svg", "${librariesLocation}.kitfox.svg"
|
// Only ever shadow the dependencies we use otherwise some stuff would break when running on an external client
|
||||||
|
relocate "org.lwjgl.system.jawt", "${librariesLocation}.lwjgl.system.jawt"
|
||||||
|
|
||||||
// Compression (LZ4)
|
// Compression (LZ4)
|
||||||
relocate "net.jpountz", "${librariesLocation}.jpountz"
|
relocate "net.jpountz", "${librariesLocation}.jpountz"
|
||||||
|
|
||||||
|
// Sqlite Database
|
||||||
|
//At the moment, there is a bug in this library which doesnt allow it to be relocated
|
||||||
|
// relocate "org.sqlite", "${librariesLocation}.sqlite"
|
||||||
|
|
||||||
|
// JOML
|
||||||
|
if (project.hasProperty("embed_joml") && embed_joml == "true")
|
||||||
|
relocate "org.joml", "${librariesLocation}.joml"
|
||||||
|
|
||||||
|
// NightConfig (includes Toml & Json)
|
||||||
relocate "com.electronwill.nightconfig", "${librariesLocation}.electronwill.nightconfig"
|
relocate "com.electronwill.nightconfig", "${librariesLocation}.electronwill.nightconfig"
|
||||||
|
|
||||||
|
// SVG (not needed atm)
|
||||||
|
// relocate "com.kitfox.svg", "${librariesLocation}.kitfox.svg"
|
||||||
|
|
||||||
|
// Netty
|
||||||
|
relocate "io.netty", "${librariesLocation}.netty"
|
||||||
|
|
||||||
mergeServiceFiles()
|
mergeServiceFiles()
|
||||||
}
|
}
|
||||||
// Using jar.finalizedBy(shadowJar) causes issues so we do this scuffed bypass
|
// Using jar.finalizedBy(shadowJar) causes issues so we do this scuffed bypass
|
||||||
@@ -297,6 +325,7 @@ subprojects { p ->
|
|||||||
"fabric.mod.json",
|
"fabric.mod.json",
|
||||||
"quilt.mod.json",
|
"quilt.mod.json",
|
||||||
"META-INF/mods.toml",
|
"META-INF/mods.toml",
|
||||||
|
"META-INF/neoforge.mods.toml",
|
||||||
|
|
||||||
// The mixins for each of the loaders
|
// The mixins for each of the loaders
|
||||||
"DistantHorizons."+ p.name +".fabricLike.mixins.json"
|
"DistantHorizons."+ p.name +".fabricLike.mixins.json"
|
||||||
|
|||||||
+19
-7
@@ -32,6 +32,7 @@ import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper;
|
|||||||
import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
||||||
import com.seibel.distanthorizons.core.level.IDhLevel;
|
import com.seibel.distanthorizons.core.level.IDhLevel;
|
||||||
import com.seibel.distanthorizons.core.level.IDhServerLevel;
|
import com.seibel.distanthorizons.core.level.IDhServerLevel;
|
||||||
|
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.IWrapperFactory;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.IWrapperFactory;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||||
@@ -83,10 +84,21 @@ public class WrapperFactory implements IWrapperFactory
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBiomeWrapper deserializeBiomeWrapper(String str, ILevelWrapper levelWrapper) throws IOException { return BiomeWrapper.deserialize(str, levelWrapper); }
|
public IBiomeWrapper deserializeBiomeWrapper(String str, ILevelWrapper levelWrapper) throws IOException { return BiomeWrapper.deserialize(str, levelWrapper); }
|
||||||
|
@Override
|
||||||
|
public IBiomeWrapper getPlainsBiomeWrapper(ILevelWrapper levelWrapper) // TODO is there a way we could get this without the levelWrapper? it isn't necessary but would clean up the code a bit
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return BiomeWrapper.deserialize(BiomeWrapper.PLAINS_RESOURCE_LOCATION_STRING, levelWrapper);
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new LodUtil.AssertFailureException("Unable to parse plains resource string ["+BiomeWrapper.PLAINS_RESOURCE_LOCATION_STRING+"], error:\n " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockStateWrapper deserializeBlockStateWrapper(String str, ILevelWrapper levelWrapper) throws IOException { return BlockStateWrapper.deserialize(str, levelWrapper); }
|
public IBlockStateWrapper deserializeBlockStateWrapper(String str, ILevelWrapper levelWrapper) throws IOException { return BlockStateWrapper.deserialize(str, levelWrapper); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockStateWrapper getAirBlockStateWrapper() { return BlockStateWrapper.AIR; }
|
public IBlockStateWrapper getAirBlockStateWrapper() { return BlockStateWrapper.AIR; }
|
||||||
|
|
||||||
@@ -118,7 +130,7 @@ public class WrapperFactory implements IWrapperFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MC_VER <= MC_1_20_4
|
#if MC_VER <= MC_1_20_6
|
||||||
else if (objectArray.length == 2)
|
else if (objectArray.length == 2)
|
||||||
{
|
{
|
||||||
// correct number of parameters from the API
|
// correct number of parameters from the API
|
||||||
@@ -183,7 +195,7 @@ public class WrapperFactory implements IWrapperFactory
|
|||||||
{
|
{
|
||||||
String[] expectedClassNames;
|
String[] expectedClassNames;
|
||||||
|
|
||||||
#if MC_VER <= MC_1_20_4
|
#if MC_VER <= MC_1_20_6
|
||||||
expectedClassNames = new String[]
|
expectedClassNames = new String[]
|
||||||
{
|
{
|
||||||
ChunkAccess.class.getName(),
|
ChunkAccess.class.getName(),
|
||||||
@@ -231,7 +243,7 @@ public class WrapperFactory implements IWrapperFactory
|
|||||||
|
|
||||||
Biome biome = (Biome) objectArray[0];
|
Biome biome = (Biome) objectArray[0];
|
||||||
return BiomeWrapper.getBiomeWrapper(biome, coreLevelWrapper);
|
return BiomeWrapper.getBiomeWrapper(biome, coreLevelWrapper);
|
||||||
#elif MC_VER <= MC_1_20_4
|
#elif MC_VER <= MC_1_20_6
|
||||||
if (!(objectArray[0] instanceof Holder) || !(((Holder<?>) objectArray[0]).value() instanceof Biome))
|
if (!(objectArray[0] instanceof Holder) || !(((Holder<?>) objectArray[0]).value() instanceof Biome))
|
||||||
{
|
{
|
||||||
throw new ClassCastException(createBiomeWrapperErrorMessage(objectArray));
|
throw new ClassCastException(createBiomeWrapperErrorMessage(objectArray));
|
||||||
@@ -254,7 +266,7 @@ public class WrapperFactory implements IWrapperFactory
|
|||||||
|
|
||||||
#if MC_VER < MC_1_18_2
|
#if MC_VER < MC_1_18_2
|
||||||
expectedClassNames = new String[] { Biome.class.getName() };
|
expectedClassNames = new String[] { Biome.class.getName() };
|
||||||
#elif MC_VER <= MC_1_20_4
|
#elif MC_VER <= MC_1_20_6
|
||||||
expectedClassNames = new String[] { Holder.class.getName()+"<"+Biome.class.getName()+">" };
|
expectedClassNames = new String[] { Holder.class.getName()+"<"+Biome.class.getName()+">" };
|
||||||
#else
|
#else
|
||||||
// See preprocessor comment in createChunkWrapper() for full documentation
|
// See preprocessor comment in createChunkWrapper() for full documentation
|
||||||
@@ -275,7 +287,7 @@ public class WrapperFactory implements IWrapperFactory
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if MC_VER <= MC_1_20_4
|
#if MC_VER <= MC_1_20_6
|
||||||
if (objectArray.length != 1)
|
if (objectArray.length != 1)
|
||||||
{
|
{
|
||||||
throw new ClassCastException(createBlockStateWrapperErrorMessage(objectArray));
|
throw new ClassCastException(createBlockStateWrapperErrorMessage(objectArray));
|
||||||
@@ -302,7 +314,7 @@ public class WrapperFactory implements IWrapperFactory
|
|||||||
|
|
||||||
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
||||||
expectedClassNames = new String[] { Biome.class.getName() };
|
expectedClassNames = new String[] { Biome.class.getName() };
|
||||||
#elif MC_VER <= MC_1_20_4
|
#elif MC_VER <= MC_1_20_6
|
||||||
expectedClassNames = new String[] { Holder.class.getName()+"<"+Biome.class.getName()+">" };
|
expectedClassNames = new String[] { Holder.class.getName()+"<"+Biome.class.getName()+">" };
|
||||||
#else
|
#else
|
||||||
// See preprocessor comment in createChunkWrapper() for full documentation
|
// See preprocessor comment in createChunkWrapper() for full documentation
|
||||||
|
|||||||
+79
-47
@@ -32,8 +32,6 @@ import org.apache.logging.log4j.Logger;
|
|||||||
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
|
|
||||||
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2
|
#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2
|
||||||
@@ -66,9 +64,13 @@ public class BiomeWrapper implements IBiomeWrapper
|
|||||||
public static final ConcurrentMap<Holder<Biome>, BiomeWrapper> WRAPPER_BY_BIOME = new ConcurrentHashMap<>();
|
public static final ConcurrentMap<Holder<Biome>, BiomeWrapper> WRAPPER_BY_BIOME = new ConcurrentHashMap<>();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public static final String EMPTY_STRING = "EMPTY";
|
public static final ConcurrentHashMap<String, BiomeWrapper> WRAPPER_BY_RESOURCE_LOCATION = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
public static final String EMPTY_BIOME_STRING = "EMPTY";
|
||||||
public static final BiomeWrapper EMPTY_WRAPPER = new BiomeWrapper(null, null);
|
public static final BiomeWrapper EMPTY_WRAPPER = new BiomeWrapper(null, null);
|
||||||
|
|
||||||
|
public static final String PLAINS_RESOURCE_LOCATION_STRING = "minecraft:plains";
|
||||||
|
|
||||||
/** keep track of broken biomes so we don't log every time */
|
/** keep track of broken biomes so we don't log every time */
|
||||||
private static final HashSet<String> brokenResourceLocationStrings = new HashSet<>();
|
private static final HashSet<String> brokenResourceLocationStrings = new HashSet<>();
|
||||||
|
|
||||||
@@ -131,7 +133,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
|||||||
private BiomeWrapper()
|
private BiomeWrapper()
|
||||||
{
|
{
|
||||||
this.biome = null;
|
this.biome = null;
|
||||||
this.serialString = EMPTY_STRING;
|
this.serialString = EMPTY_BIOME_STRING;
|
||||||
this.hashCode = Objects.hash(this.serialString);
|
this.hashCode = Objects.hash(this.serialString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +148,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
|||||||
{
|
{
|
||||||
if (this == EMPTY_WRAPPER)
|
if (this == EMPTY_WRAPPER)
|
||||||
{
|
{
|
||||||
return EMPTY_STRING;
|
return EMPTY_BIOME_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MC_VER < MC_1_18_2
|
#if MC_VER < MC_1_18_2
|
||||||
@@ -193,22 +195,23 @@ public class BiomeWrapper implements IBiomeWrapper
|
|||||||
|
|
||||||
public String serialize(ILevelWrapper levelWrapper)
|
public String serialize(ILevelWrapper levelWrapper)
|
||||||
{
|
{
|
||||||
if (this.serialString != null)
|
if (this.biome == null)
|
||||||
{
|
{
|
||||||
return this.serialString;
|
return EMPTY_BIOME_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// we can't generate a serial string if the level is null
|
// we can't generate a serial string if the level is null
|
||||||
if (levelWrapper == null)
|
if (levelWrapper == null)
|
||||||
{
|
{
|
||||||
if (!emptyLevelSerializeFailLogged)
|
if (!emptyLevelSerializeFailLogged)
|
||||||
{
|
{
|
||||||
emptyLevelSerializeFailLogged = true;
|
emptyLevelSerializeFailLogged = true;
|
||||||
LOGGER.warn("Unable to serialize biome: ["+this.biome+"] because the passed in level wrapper is null. Future errors won't be logged.");
|
LOGGER.warn("Unable to serialize biome: [" + this.biome + "] because the passed in level wrapper is null. Future errors of this type won't be logged.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return EMPTY_STRING;
|
return EMPTY_BIOME_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -248,14 +251,18 @@ public class BiomeWrapper implements IBiomeWrapper
|
|||||||
return this.serialString;
|
return this.serialString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO would it be worth while to cache these objects in a ConcurrentHashMap<string, IBiomeWrapper>?
|
||||||
public static IBiomeWrapper deserialize(String resourceLocationString, ILevelWrapper levelWrapper) throws IOException
|
public static IBiomeWrapper deserialize(String resourceLocationString, ILevelWrapper levelWrapper) throws IOException
|
||||||
{
|
{
|
||||||
if (resourceLocationString.equals(EMPTY_STRING))
|
// we need the final string for the concurrent hash map later
|
||||||
|
final String finalResourceStateString = resourceLocationString;
|
||||||
|
|
||||||
|
if (resourceLocationString.equals(EMPTY_BIOME_STRING))
|
||||||
{
|
{
|
||||||
if (!emptyStringWarningLogged)
|
if (!emptyStringWarningLogged)
|
||||||
{
|
{
|
||||||
emptyStringWarningLogged = true;
|
emptyStringWarningLogged = true;
|
||||||
LOGGER.warn("[" + EMPTY_STRING + "] biome string deserialized. This may mean the level was null when a save was attempted, a file saving error, or a biome saving error. Future errors will not be logged.");
|
LOGGER.warn("[" + EMPTY_BIOME_STRING + "] biome string deserialized. This may mean the level was null when a save was attempted, a file saving error, or a biome saving error. Future errors will not be logged.");
|
||||||
}
|
}
|
||||||
return EMPTY_WRAPPER;
|
return EMPTY_WRAPPER;
|
||||||
}
|
}
|
||||||
@@ -265,53 +272,78 @@ public class BiomeWrapper implements IBiomeWrapper
|
|||||||
return EMPTY_WRAPPER;
|
return EMPTY_WRAPPER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (WRAPPER_BY_RESOURCE_LOCATION.containsKey(finalResourceStateString))
|
||||||
|
|
||||||
// parse the resource location
|
|
||||||
int separatorIndex = resourceLocationString.indexOf(":");
|
|
||||||
if (separatorIndex == -1)
|
|
||||||
{
|
{
|
||||||
throw new IOException("Unable to parse resource location string: [" + resourceLocationString + "].");
|
return WRAPPER_BY_RESOURCE_LOCATION.get(finalResourceStateString);
|
||||||
}
|
}
|
||||||
ResourceLocation resourceLocation = new ResourceLocation(resourceLocationString.substring(0, separatorIndex), resourceLocationString.substring(separatorIndex + 1));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// if no wrapper is found, default to the empty wrapper
|
||||||
|
BiomeWrapper foundWrapper = EMPTY_WRAPPER;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Level level = (Level)levelWrapper.getWrappedMcObject();
|
// parse the resource location
|
||||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
int separatorIndex = resourceLocationString.indexOf(":");
|
||||||
|
if (separatorIndex == -1)
|
||||||
boolean success;
|
|
||||||
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
|
||||||
Biome biome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation);
|
|
||||||
success = (biome != null);
|
|
||||||
#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2
|
|
||||||
Biome unwrappedBiome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation);
|
|
||||||
success = (unwrappedBiome != null);
|
|
||||||
Holder<Biome> biome = new Holder.Direct<>(unwrappedBiome);
|
|
||||||
#else
|
|
||||||
Biome unwrappedBiome = registryAccess.registryOrThrow(Registries.BIOME).get(resourceLocation);
|
|
||||||
success = (unwrappedBiome != null);
|
|
||||||
Holder<Biome> biome = new Holder.Direct<>(unwrappedBiome);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!success)
|
|
||||||
{
|
{
|
||||||
if (!brokenResourceLocationStrings.contains(resourceLocationString))
|
throw new IOException("Unable to parse resource location string: [" + resourceLocationString + "].");
|
||||||
{
|
|
||||||
brokenResourceLocationStrings.add(resourceLocationString);
|
|
||||||
LOGGER.warn("Unable to deserialize biome from string: [" + resourceLocationString + "]");
|
|
||||||
}
|
|
||||||
return EMPTY_WRAPPER;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return getBiomeWrapper(biome, levelWrapper);
|
ResourceLocation resourceLocation;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
resourceLocation = new ResourceLocation(resourceLocationString.substring(0, separatorIndex), resourceLocationString.substring(separatorIndex + 1));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new IOException("No Resource Location found for the string: [" + resourceLocationString + "] Error: [" + e.getMessage() + "].");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Level level = (Level) levelWrapper.getWrappedMcObject();
|
||||||
|
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||||
|
|
||||||
|
boolean success;
|
||||||
|
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
||||||
|
Biome biome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation);
|
||||||
|
success = (biome != null);
|
||||||
|
#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2
|
||||||
|
Biome unwrappedBiome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation);
|
||||||
|
success = (unwrappedBiome != null);
|
||||||
|
Holder<Biome> biome = new Holder.Direct<>(unwrappedBiome);
|
||||||
|
#else
|
||||||
|
Biome unwrappedBiome = registryAccess.registryOrThrow(Registries.BIOME).get(resourceLocation);
|
||||||
|
success = (unwrappedBiome != null);
|
||||||
|
Holder<Biome> biome = new Holder.Direct<>(unwrappedBiome);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
if (!brokenResourceLocationStrings.contains(resourceLocationString))
|
||||||
|
{
|
||||||
|
brokenResourceLocationStrings.add(resourceLocationString);
|
||||||
|
LOGGER.warn("Unable to deserialize biome from string: [" + resourceLocationString + "]");
|
||||||
|
}
|
||||||
|
return EMPTY_WRAPPER;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foundWrapper = (BiomeWrapper) getBiomeWrapper(biome, levelWrapper);
|
||||||
|
return foundWrapper;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new IOException("Failed to deserialize the string [" + finalResourceStateString + "] into a BiomeWrapper: " + e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
finally
|
||||||
{
|
{
|
||||||
throw new IOException("Failed to deserialize the string [" + resourceLocationString + "] into a BiomeWrapper: " + e.getMessage(), e);
|
WRAPPER_BY_RESOURCE_LOCATION.putIfAbsent(finalResourceStateString, foundWrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+103
-70
@@ -65,6 +65,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||||
|
|
||||||
public static final ConcurrentHashMap<BlockState, BlockStateWrapper> WRAPPER_BY_BLOCK_STATE = new ConcurrentHashMap<>();
|
public static final ConcurrentHashMap<BlockState, BlockStateWrapper> WRAPPER_BY_BLOCK_STATE = new ConcurrentHashMap<>();
|
||||||
|
public static final ConcurrentHashMap<String, BlockStateWrapper> WRAPPER_BY_RESOURCE_LOCATION = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public static final String AIR_STRING = "AIR";
|
public static final String AIR_STRING = "AIR";
|
||||||
public static final BlockStateWrapper AIR = new BlockStateWrapper(null, null);
|
public static final BlockStateWrapper AIR = new BlockStateWrapper(null, null);
|
||||||
@@ -339,103 +340,135 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
/** will only work if a level is currently loaded */
|
/** will only work if a level is currently loaded */
|
||||||
public static IBlockStateWrapper deserialize(String resourceStateString, ILevelWrapper levelWrapper) throws IOException
|
public static IBlockStateWrapper deserialize(String resourceStateString, ILevelWrapper levelWrapper) throws IOException
|
||||||
{
|
{
|
||||||
if (resourceStateString.equals(AIR_STRING) || resourceStateString.equals("")) // the empty string shouldn't normally happen, but just in case
|
// we need the final string for the concurrent hash map later
|
||||||
|
final String finalResourceStateString = resourceStateString;
|
||||||
|
|
||||||
|
if (finalResourceStateString.equals(AIR_STRING) || finalResourceStateString.equals("")) // the empty string shouldn't normally happen, but just in case
|
||||||
{
|
{
|
||||||
return AIR;
|
return AIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// attempt to use the existing wrapper
|
||||||
|
if (WRAPPER_BY_RESOURCE_LOCATION.containsKey(finalResourceStateString))
|
||||||
// try to parse out the BlockState
|
|
||||||
String blockStatePropertiesString = null; // will be null if no properties were included
|
|
||||||
int stateSeparatorIndex = resourceStateString.indexOf(STATE_STRING_SEPARATOR);
|
|
||||||
if (stateSeparatorIndex != -1)
|
|
||||||
{
|
{
|
||||||
// blockstate properties found
|
return WRAPPER_BY_RESOURCE_LOCATION.get(finalResourceStateString);
|
||||||
blockStatePropertiesString = resourceStateString.substring(stateSeparatorIndex + STATE_STRING_SEPARATOR.length());
|
|
||||||
resourceStateString = resourceStateString.substring(0, stateSeparatorIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse the resource location
|
|
||||||
int resourceSeparatorIndex = resourceStateString.indexOf(RESOURCE_LOCATION_SEPARATOR);
|
|
||||||
if (resourceSeparatorIndex == -1)
|
|
||||||
{
|
|
||||||
throw new IOException("Unable to parse Resource Location out of string: [" + resourceStateString + "].");
|
|
||||||
}
|
|
||||||
ResourceLocation resourceLocation = new ResourceLocation(resourceStateString.substring(0, resourceSeparatorIndex), resourceStateString.substring(resourceSeparatorIndex + 1));
|
|
||||||
|
|
||||||
|
|
||||||
|
// if no wrapper is found, default to air
|
||||||
// attempt to get the BlockState from all possible BlockStates
|
BlockStateWrapper foundWrapper = AIR;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// try to parse out the BlockState
|
||||||
#if MC_VER > MC_1_17_1
|
String blockStatePropertiesString = null; // will be null if no properties were included
|
||||||
// use the given level if possible, otherwise try using the currently loaded one
|
int stateSeparatorIndex = resourceStateString.indexOf(STATE_STRING_SEPARATOR);
|
||||||
Level level = (levelWrapper != null ? (Level)levelWrapper.getWrappedMcObject() : null);
|
if (stateSeparatorIndex != -1)
|
||||||
level = (level == null ? Minecraft.getInstance().level : level);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Block block;
|
|
||||||
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
|
||||||
block = Registry.BLOCK.get(resourceLocation);
|
|
||||||
#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2
|
|
||||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
|
||||||
block = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).get(resourceLocation);
|
|
||||||
#else
|
|
||||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
|
||||||
block = registryAccess.registryOrThrow(Registries.BLOCK).get(resourceLocation);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
if (block == null)
|
|
||||||
{
|
{
|
||||||
// shouldn't normally happen, but here to make the compiler happy
|
// blockstate properties found
|
||||||
if (!BrokenResourceLocations.contains(resourceLocation))
|
blockStatePropertiesString = resourceStateString.substring(stateSeparatorIndex + STATE_STRING_SEPARATOR.length());
|
||||||
{
|
resourceStateString = resourceStateString.substring(0, stateSeparatorIndex);
|
||||||
BrokenResourceLocations.add(resourceLocation);
|
}
|
||||||
LOGGER.warn("Unable to find BlockState with the resourceLocation [" + resourceLocation + "] and properties: [" + blockStatePropertiesString + "]. Air will be used instead, some data may be lost.");
|
|
||||||
}
|
// parse the resource location
|
||||||
return AIR;
|
int separatorIndex = resourceStateString.indexOf(RESOURCE_LOCATION_SEPARATOR);
|
||||||
|
if (separatorIndex == -1)
|
||||||
|
{
|
||||||
|
throw new IOException("Unable to parse Resource Location out of string: [" + resourceStateString + "].");
|
||||||
|
}
|
||||||
|
|
||||||
|
ResourceLocation resourceLocation;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
resourceLocation = new ResourceLocation(resourceStateString.substring(0, separatorIndex), resourceStateString.substring(separatorIndex + 1));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new IOException("No Resource Location found for the string: [" + resourceStateString + "] Error: [" + e.getMessage() + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// attempt to find the blockstate from all possibilities
|
|
||||||
BlockState foundState = null;
|
|
||||||
if (blockStatePropertiesString != null)
|
|
||||||
{
|
|
||||||
List<BlockState> possibleStateList = block.getStateDefinition().getPossibleStates();
|
|
||||||
for (BlockState possibleState : possibleStateList)
|
|
||||||
{
|
|
||||||
String possibleStatePropertiesString = serializeBlockStateProperties(possibleState);
|
|
||||||
if (possibleStatePropertiesString.equals(blockStatePropertiesString))
|
|
||||||
{
|
|
||||||
foundState = possibleState;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// use the default if no state was found or given
|
// attempt to get the BlockState from all possible BlockStates
|
||||||
if (foundState == null)
|
try
|
||||||
{
|
{
|
||||||
if (blockStatePropertiesString != null)
|
|
||||||
|
#if MC_VER > MC_1_17_1
|
||||||
|
// use the given level if possible, otherwise try using the currently loaded one
|
||||||
|
Level level = (levelWrapper != null ? (Level) levelWrapper.getWrappedMcObject() : null);
|
||||||
|
level = (level == null ? Minecraft.getInstance().level : level);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Block block;
|
||||||
|
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
||||||
|
block = Registry.BLOCK.get(resourceLocation);
|
||||||
|
#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2
|
||||||
|
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||||
|
block = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).get(resourceLocation);
|
||||||
|
#else
|
||||||
|
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||||
|
block = registryAccess.registryOrThrow(Registries.BLOCK).get(resourceLocation);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
if (block == null)
|
||||||
{
|
{
|
||||||
// we should have found a blockstate, but didn't
|
// shouldn't normally happen, but here to make the compiler happy
|
||||||
if (!BrokenResourceLocations.contains(resourceLocation))
|
if (!BrokenResourceLocations.contains(resourceLocation))
|
||||||
{
|
{
|
||||||
BrokenResourceLocations.add(resourceLocation);
|
BrokenResourceLocations.add(resourceLocation);
|
||||||
LOGGER.warn("Unable to find BlockState for Block [" + resourceLocation + "] with properties: [" + blockStatePropertiesString + "]. Using the default block state.");
|
LOGGER.warn("Unable to find BlockState with the resourceLocation [" + resourceLocation + "] and properties: [" + blockStatePropertiesString + "]. Air will be used instead, some data may be lost.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return AIR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// attempt to find the blockstate from all possibilities
|
||||||
|
BlockState foundState = null;
|
||||||
|
if (blockStatePropertiesString != null)
|
||||||
|
{
|
||||||
|
List<BlockState> possibleStateList = block.getStateDefinition().getPossibleStates();
|
||||||
|
for (BlockState possibleState : possibleStateList)
|
||||||
|
{
|
||||||
|
String possibleStatePropertiesString = serializeBlockStateProperties(possibleState);
|
||||||
|
if (possibleStatePropertiesString.equals(blockStatePropertiesString))
|
||||||
|
{
|
||||||
|
foundState = possibleState;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foundState = block.defaultBlockState();
|
// use the default if no state was found or given
|
||||||
|
if (foundState == null)
|
||||||
|
{
|
||||||
|
if (blockStatePropertiesString != null)
|
||||||
|
{
|
||||||
|
// we should have found a blockstate, but didn't
|
||||||
|
if (!BrokenResourceLocations.contains(resourceLocation))
|
||||||
|
{
|
||||||
|
BrokenResourceLocations.add(resourceLocation);
|
||||||
|
LOGGER.warn("Unable to find BlockState for Block [" + resourceLocation + "] with properties: [" + blockStatePropertiesString + "]. Using the default block state.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foundState = block.defaultBlockState();
|
||||||
|
}
|
||||||
|
|
||||||
|
foundWrapper = new BlockStateWrapper(foundState, levelWrapper);
|
||||||
|
return foundWrapper;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new IOException("Failed to deserialize the string [" + finalResourceStateString + "] into a BlockStateWrapper: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
return new BlockStateWrapper(foundState, levelWrapper);
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
finally
|
||||||
{
|
{
|
||||||
throw new IOException("Failed to deserialize the string [" + resourceStateString + "] into a BlockStateWrapper: " + e.getMessage(), e);
|
// put if absent in case two threads deserialize at the same time
|
||||||
|
// unfortunately we can't put everything in a computeIfAbsent() since we also throw exceptions
|
||||||
|
WRAPPER_BY_RESOURCE_LOCATION.putIfAbsent(finalResourceStateString, foundWrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+59
-11
@@ -19,14 +19,20 @@
|
|||||||
|
|
||||||
package com.seibel.distanthorizons.common.wrappers.block;
|
package com.seibel.distanthorizons.common.wrappers.block;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
|
import com.seibel.distanthorizons.core.util.ColorUtil;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.level.*;
|
import net.minecraft.world.level.*;
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
|
import net.minecraft.world.level.biome.Biomes;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
#if MC_VER >= MC_1_18_2
|
#if MC_VER >= MC_1_18_2
|
||||||
@@ -35,18 +41,54 @@ import net.minecraft.core.Holder;
|
|||||||
|
|
||||||
public class TintWithoutLevelOverrider implements BlockAndTintGetter
|
public class TintWithoutLevelOverrider implements BlockAndTintGetter
|
||||||
{
|
{
|
||||||
final BiomeWrapper biome;
|
/**
|
||||||
|
* This will only ever be null if there was an issue with {@link IClientLevelWrapper#getPlainsBiomeWrapper()}
|
||||||
|
* but {@link Nullable} is there just in case.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
private final Biome biome;
|
||||||
|
|
||||||
public TintWithoutLevelOverrider(BiomeWrapper biome)
|
|
||||||
|
|
||||||
|
public TintWithoutLevelOverrider(BiomeWrapper biomeWrapper, IClientLevelWrapper clientLevelWrapper)
|
||||||
{
|
{
|
||||||
this.biome = biome;
|
// try to get the wrapped biome
|
||||||
|
Biome unwrappedBiome = null;
|
||||||
|
if (biomeWrapper.biome != null)
|
||||||
|
{
|
||||||
|
unwrappedBiome = unwrap(biomeWrapper.biome);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(unwrappedBiome == null)
|
||||||
|
{
|
||||||
|
// we are looking at the empty biome wrapper, try using plains as a backup
|
||||||
|
BiomeWrapper plainsBiomeWrapper = ((BiomeWrapper) clientLevelWrapper.getPlainsBiomeWrapper());
|
||||||
|
if (plainsBiomeWrapper != null)
|
||||||
|
{
|
||||||
|
unwrappedBiome = unwrap(plainsBiomeWrapper.biome);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.biome = unwrappedBiome;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver)
|
public int getBlockTint(@NotNull BlockPos blockPos, @NotNull ColorResolver colorResolver)
|
||||||
{
|
{
|
||||||
return colorResolver.getColor(_unwrap(biome.biome), blockPos.getX(), blockPos.getZ());
|
if (this.biome != null)
|
||||||
|
{
|
||||||
|
return colorResolver.getColor(this.biome, blockPos.getX(), blockPos.getZ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// hopefully unneeded debug color
|
||||||
|
return ColorUtil.CYAN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private Biome _unwrap(#if MC_VER >= MC_1_18_2 Holder<Biome> #else Biome #endif biome)
|
|
||||||
|
private static Biome unwrap(#if MC_VER >= MC_1_18_2 Holder<Biome> #else Biome #endif biome)
|
||||||
{
|
{
|
||||||
#if MC_VER >= MC_1_18_2
|
#if MC_VER >= MC_1_18_2
|
||||||
return biome.value();
|
return biome.value();
|
||||||
@@ -55,30 +97,36 @@ public class TintWithoutLevelOverrider implements BlockAndTintGetter
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//================//
|
||||||
|
// unused methods //
|
||||||
|
//================//
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getShade(Direction direction, boolean shade)
|
public float getShade(@NotNull Direction direction, boolean shade)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("ERROR: getShade() called on TintWithoutLevelOverrider. Object is for tinting only.");
|
throw new UnsupportedOperationException("ERROR: getShade() called on TintWithoutLevelOverrider. Object is for tinting only.");
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public LevelLightEngine getLightEngine()
|
public @NotNull LevelLightEngine getLightEngine()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("ERROR: getLightEngine() called on TintWithoutLevelOverrider. Object is for tinting only.");
|
throw new UnsupportedOperationException("ERROR: getLightEngine() called on TintWithoutLevelOverrider. Object is for tinting only.");
|
||||||
}
|
}
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public BlockEntity getBlockEntity(BlockPos pos)
|
public BlockEntity getBlockEntity(@NotNull BlockPos pos)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("ERROR: getBlockEntity() called on TintWithoutLevelOverrider. Object is for tinting only.");
|
throw new UnsupportedOperationException("ERROR: getBlockEntity() called on TintWithoutLevelOverrider. Object is for tinting only.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlockState(BlockPos pos)
|
public @NotNull BlockState getBlockState(@NotNull BlockPos pos)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("ERROR: getBlockState() called on TintWithoutLevelOverrider. Object is for tinting only.");
|
throw new UnsupportedOperationException("ERROR: getBlockState() called on TintWithoutLevelOverrider. Object is for tinting only.");
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public FluidState getFluidState(BlockPos pos)
|
public @NotNull FluidState getFluidState(@NotNull BlockPos pos)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("ERROR: getFluidState() called on TintWithoutLevelOverrider. Object is for tinting only.");
|
throw new UnsupportedOperationException("ERROR: getFluidState() called on TintWithoutLevelOverrider. Object is for tinting only.");
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-5
@@ -54,7 +54,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class ClientBlockStateCache
|
public class ClientBlockStateCache
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||||
|
|
||||||
private static final HashSet<BlockState> BLOCK_STATES_THAT_NEED_LEVEL = new HashSet<>();
|
private static final HashSet<BlockState> BLOCK_STATES_THAT_NEED_LEVEL = new HashSet<>();
|
||||||
@@ -66,15 +65,20 @@ public class ClientBlockStateCache
|
|||||||
public static final RandomSource random = RandomSource.create();
|
public static final RandomSource random = RandomSource.create();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
public final IClientLevelWrapper levelWrapper;
|
||||||
public final BlockState blockState;
|
public final BlockState blockState;
|
||||||
public final LevelReader level;
|
public final LevelReader level;
|
||||||
public final BlockPos pos;
|
public final BlockPos pos;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ClientBlockStateCache(BlockState blockState, IClientLevelWrapper samplingLevel, DhBlockPos samplingPos)
|
public ClientBlockStateCache(BlockState blockState, IClientLevelWrapper samplingLevel, DhBlockPos samplingPos)
|
||||||
{
|
{
|
||||||
this.blockState = blockState;
|
this.blockState = blockState;
|
||||||
level = (LevelReader) samplingLevel.getWrappedMcObject();
|
this.levelWrapper = samplingLevel;
|
||||||
pos = McObjectConverter.Convert(samplingPos);
|
this.level = (LevelReader) samplingLevel.getWrappedMcObject();
|
||||||
resolveColors();
|
this.pos = McObjectConverter.Convert(samplingPos);
|
||||||
|
this.resolveColors();
|
||||||
//LOGGER.info("ClientBlocKCache created for {}", blockState);
|
//LOGGER.info("ClientBlocKCache created for {}", blockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,7 +367,7 @@ public class ClientBlockStateCache
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
tintColor = Minecraft.getInstance().getBlockColors()
|
tintColor = Minecraft.getInstance().getBlockColors()
|
||||||
.getColor(this.blockState, new TintWithoutLevelOverrider(biome), McObjectConverter.Convert(pos), this.tintIndex);
|
.getColor(this.blockState, new TintWithoutLevelOverrider(biome, this.levelWrapper), McObjectConverter.Convert(pos), this.tintIndex);
|
||||||
}
|
}
|
||||||
catch (UnsupportedOperationException e)
|
catch (UnsupportedOperationException e)
|
||||||
{
|
{
|
||||||
|
|||||||
+7
-1
@@ -38,7 +38,6 @@ import net.minecraft.core.BlockPos;
|
|||||||
import net.minecraft.world.level.LevelReader;
|
import net.minecraft.world.level.LevelReader;
|
||||||
import net.minecraft.world.level.LightLayer;
|
import net.minecraft.world.level.LightLayer;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
|
||||||
import net.minecraft.world.level.chunk.LevelChunk;
|
import net.minecraft.world.level.chunk.LevelChunk;
|
||||||
import net.minecraft.world.level.levelgen.Heightmap;
|
import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
|
|
||||||
@@ -73,6 +72,13 @@ import net.minecraft.world.level.lighting.LevelLightEngine;
|
|||||||
import net.minecraft.core.SectionPos;
|
import net.minecraft.core.SectionPos;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_20_4
|
||||||
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
public class ChunkWrapper implements IChunkWrapper
|
public class ChunkWrapper implements IChunkWrapper
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||||
|
|||||||
+19
-10
@@ -98,6 +98,7 @@ public class ClassicConfigGUI
|
|||||||
public static final int SpaceFromRightScreen = 10;
|
public static final int SpaceFromRightScreen = 10;
|
||||||
public static final int ButtonWidthSpacing = 5;
|
public static final int ButtonWidthSpacing = 5;
|
||||||
public static final int ResetButtonWidth = 40;
|
public static final int ResetButtonWidth = 40;
|
||||||
|
public static final int ResetButtonHeight = 20;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,7 +252,7 @@ public class ClassicConfigGUI
|
|||||||
this.width - 28, this.height - 28,
|
this.width - 28, this.height - 28,
|
||||||
// Width and height of the button
|
// Width and height of the button
|
||||||
20, 20,
|
20, 20,
|
||||||
// Offset
|
// texture UV Offset
|
||||||
0, 0,
|
0, 0,
|
||||||
// Some textuary stuff
|
// Some textuary stuff
|
||||||
0, new ResourceLocation(ModInfo.ID, "textures/gui/changelog.png"), 20, 20,
|
0, new ResourceLocation(ModInfo.ID, "textures/gui/changelog.png"), 20, 20,
|
||||||
@@ -269,18 +270,25 @@ public class ClassicConfigGUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
addBtn(MakeBtn(Translatable("distanthorizons.general.cancel"), this.width / 2 - 154, this.height - 28, 150, 20, button -> {
|
addBtn(MakeBtn(Translatable("distanthorizons.general.cancel"),
|
||||||
ConfigBase.INSTANCE.configFileINSTANCE.loadFromFile();
|
this.width / 2 - 154, this.height - 28,
|
||||||
Objects.requireNonNull(minecraft).setScreen(parent);
|
150, 20,
|
||||||
}));
|
button ->
|
||||||
|
{
|
||||||
|
ConfigBase.INSTANCE.configFileINSTANCE.loadFromFile();
|
||||||
|
Objects.requireNonNull(minecraft).setScreen(parent);
|
||||||
|
}));
|
||||||
doneButton = addBtn(MakeBtn(Translatable("distanthorizons.general.done"), this.width / 2 + 4, this.height - 28, 150, 20, (button) -> {
|
doneButton = addBtn(MakeBtn(Translatable("distanthorizons.general.done"), this.width / 2 + 4, this.height - 28, 150, 20, (button) -> {
|
||||||
ConfigBase.INSTANCE.configFileINSTANCE.saveToFile();
|
ConfigBase.INSTANCE.configFileINSTANCE.saveToFile();
|
||||||
Objects.requireNonNull(minecraft).setScreen(parent);
|
Objects.requireNonNull(minecraft).setScreen(parent);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.list = new ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, 32, 25);
|
this.list = new ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, 32, 25);
|
||||||
|
|
||||||
|
#if MC_VER < MC_1_20_6 // no background is rendered in MC 1.20.6+
|
||||||
if (this.minecraft != null && this.minecraft.level != null)
|
if (this.minecraft != null && this.minecraft.level != null)
|
||||||
this.list.setRenderBackground(false);
|
this.list.setRenderBackground(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
this.addWidget(this.list);
|
this.addWidget(this.list);
|
||||||
|
|
||||||
@@ -311,6 +319,7 @@ public class ClassicConfigGUI
|
|||||||
initEntry(info, this.translationPrefix);
|
initEntry(info, this.translationPrefix);
|
||||||
Component name = Translatable(translationPrefix + info.getNameWCategory());
|
Component name = Translatable(translationPrefix + info.getNameWCategory());
|
||||||
|
|
||||||
|
|
||||||
if (ConfigEntry.class.isAssignableFrom(info.getClass()))
|
if (ConfigEntry.class.isAssignableFrom(info.getClass()))
|
||||||
{
|
{
|
||||||
Button.OnPress btnAction = button -> {
|
Button.OnPress btnAction = button -> {
|
||||||
@@ -319,12 +328,12 @@ public class ClassicConfigGUI
|
|||||||
this.reload = true;
|
this.reload = true;
|
||||||
Objects.requireNonNull(minecraft).setScreen(this);
|
Objects.requireNonNull(minecraft).setScreen(this);
|
||||||
};
|
};
|
||||||
int a = this.width - ConfigScreenConfigs.SpaceFromRightScreen - 150 - ConfigScreenConfigs.ButtonWidthSpacing - ConfigScreenConfigs.ResetButtonWidth;
|
int posX = this.width - ConfigScreenConfigs.SpaceFromRightScreen - 150 - ConfigScreenConfigs.ButtonWidthSpacing - ConfigScreenConfigs.ResetButtonWidth;
|
||||||
int b = 0;
|
int posZ = 0;
|
||||||
int c = ConfigScreenConfigs.ResetButtonWidth;
|
|
||||||
int d = 20;
|
|
||||||
|
|
||||||
Button resetButton = MakeBtn(Translatable("distanthorizons.general.reset").withStyle(ChatFormatting.RED), a, b, c, d, btnAction);
|
Button resetButton = MakeBtn(Translatable("distanthorizons.general.reset").withStyle(ChatFormatting.RED),
|
||||||
|
posX, posZ, ConfigScreenConfigs.ResetButtonWidth, ConfigScreenConfigs.ResetButtonHeight,
|
||||||
|
btnAction);
|
||||||
|
|
||||||
if (((EntryInfo) info.guiValue).widget instanceof Map.Entry)
|
if (((EntryInfo) info.guiValue).widget instanceof Map.Entry)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ public class GetConfigScreen
|
|||||||
case JavaFX:
|
case JavaFX:
|
||||||
return MinecraftScreen.getScreen(parent, new JavaScreenHandlerScreen(new ConfigScreen()), ModInfo.ID + ".title");
|
return MinecraftScreen.getScreen(parent, new JavaScreenHandlerScreen(new ConfigScreen()), ModInfo.ID + ".title");
|
||||||
default:
|
default:
|
||||||
return null;
|
throw new IllegalArgumentException("No config screen implementation defined for ["+useScreen+"].");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ public class GuiHelper
|
|||||||
/**
|
/**
|
||||||
* Helper static methods for versional compat
|
* Helper static methods for versional compat
|
||||||
*/
|
*/
|
||||||
public static Button MakeBtn(Component base, int a, int b, int c, int d, Button.OnPress action)
|
public static Button MakeBtn(Component base, int posX, int posZ, int width, int height, Button.OnPress action)
|
||||||
{
|
{
|
||||||
#if MC_VER < MC_1_19_4
|
#if MC_VER < MC_1_19_4
|
||||||
return new Button(a, b, c, d, base, action);
|
return new Button(posX, posZ, width, height, base, action);
|
||||||
#else
|
#else
|
||||||
return Button.builder(base, action).bounds(a, b, c, d).build();
|
return Button.builder(base, action).bounds(posX, posZ, width, height).build();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
@@ -60,8 +60,12 @@ public class MinecraftScreen
|
|||||||
screen.init(); // Init our own config screen
|
screen.init(); // Init our own config screen
|
||||||
|
|
||||||
this.list = new ConfigListWidget(this.minecraft, this.width, this.height, 0, 0, 25); // Select the area to tint
|
this.list = new ConfigListWidget(this.minecraft, this.width, this.height, 0, 0, 25); // Select the area to tint
|
||||||
|
|
||||||
|
#if MC_VER < MC_1_20_6 // no background is rendered in MC 1.20.6+
|
||||||
if (this.minecraft != null && this.minecraft.level != null) // Check if in game
|
if (this.minecraft != null && this.minecraft.level != null) // Check if in game
|
||||||
this.list.setRenderBackground(false); // Disable from rendering
|
this.list.setRenderBackground(false); // Disable from rendering
|
||||||
|
#endif
|
||||||
|
|
||||||
this.addWidget(this.list); // Add the tint to the things to be rendered
|
this.addWidget(this.list); // Add the tint to the things to be rendered
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-5
@@ -147,17 +147,15 @@ public class UpdateModScreen extends DhScreen
|
|||||||
this.renderBackground(matrices, mouseX, mouseY, delta); // Render background
|
this.renderBackground(matrices, mouseX, mouseY, delta); // Render background
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// TODO: add the tooltips for the buttons
|
||||||
|
super.render(matrices, mouseX, mouseY, delta); // Render the buttons
|
||||||
|
// TODO: Add tooltips
|
||||||
|
|
||||||
// Render the text's
|
// Render the text's
|
||||||
DhDrawCenteredString(matrices, this.font, Translatable(ModInfo.ID + ".updater.text1"), this.width / 2, this.height / 2 - 35, 0xFFFFFF);
|
DhDrawCenteredString(matrices, this.font, Translatable(ModInfo.ID + ".updater.text1"), this.width / 2, this.height / 2 - 35, 0xFFFFFF);
|
||||||
DhDrawCenteredString(matrices, this.font,
|
DhDrawCenteredString(matrices, this.font,
|
||||||
Translatable(ModInfo.ID + ".updater.text2", currentVer, nextVer),
|
Translatable(ModInfo.ID + ".updater.text2", currentVer, nextVer),
|
||||||
this.width / 2, this.height / 2 - 20, 0x52FD52);
|
this.width / 2, this.height / 2 - 20, 0x52FD52);
|
||||||
|
|
||||||
// TODO: add the tooltips for the buttons
|
|
||||||
super.render(matrices, mouseX, mouseY, delta); // Render the buttons
|
|
||||||
|
|
||||||
// TODO: Add tooltips
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+4
-6
@@ -25,6 +25,7 @@ import java.nio.FloatBuffer;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.mojang.blaze3d.pipeline.RenderTarget;
|
import com.mojang.blaze3d.pipeline.RenderTarget;
|
||||||
@@ -105,7 +106,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
* In the case of immersive portals multiple levels may be active at once, causing conflicting lightmaps. <br>
|
* In the case of immersive portals multiple levels may be active at once, causing conflicting lightmaps. <br>
|
||||||
* Requiring the use of multiple {@link LightMapWrapper}.
|
* Requiring the use of multiple {@link LightMapWrapper}.
|
||||||
*/
|
*/
|
||||||
public HashMap<IDimensionTypeWrapper, LightMapWrapper> lightmapByDimensionType = new HashMap<>();
|
public ConcurrentHashMap<IDimensionTypeWrapper, LightMapWrapper> lightmapByDimensionType = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the render buffer that should be used when displaying levels to the screen.
|
* Holds the render buffer that should be used when displaying levels to the screen.
|
||||||
@@ -405,11 +406,8 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
// so this will have to do for now
|
// so this will have to do for now
|
||||||
IDimensionTypeWrapper dimensionType = level.getDimensionType();
|
IDimensionTypeWrapper dimensionType = level.getDimensionType();
|
||||||
|
|
||||||
if (!this.lightmapByDimensionType.containsKey(dimensionType))
|
LightMapWrapper wrapper = this.lightmapByDimensionType.compute(dimensionType, (dimType, oldWrapper) -> new LightMapWrapper());
|
||||||
{
|
wrapper.uploadLightmap(lightPixels);
|
||||||
this.lightmapByDimensionType.put(dimensionType, new LightMapWrapper());
|
|
||||||
}
|
|
||||||
this.lightmapByDimensionType.get(dimensionType).uploadLightmap(lightPixels);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-1
@@ -25,7 +25,6 @@ import net.minecraft.server.level.ServerLevel;
|
|||||||
import net.minecraft.world.level.LightLayer;
|
import net.minecraft.world.level.LightLayer;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
import net.minecraft.world.level.chunk.ChunkSource;
|
import net.minecraft.world.level.chunk.ChunkSource;
|
||||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -33,6 +32,12 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_20_4
|
||||||
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||||
|
#endif
|
||||||
|
|
||||||
public class ClientLevelWrapper implements IClientLevelWrapper
|
public class ClientLevelWrapper implements IClientLevelWrapper
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger(ClientLevelWrapper.class.getSimpleName());
|
private static final Logger LOGGER = DhLoggerBuilder.getLogger(ClientLevelWrapper.class.getSimpleName());
|
||||||
@@ -43,6 +48,7 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
|||||||
private final ClientBlockDetailMap blockMap = new ClientBlockDetailMap(this);
|
private final ClientBlockDetailMap blockMap = new ClientBlockDetailMap(this);
|
||||||
|
|
||||||
private BlockStateWrapper dirtBlockWrapper;
|
private BlockStateWrapper dirtBlockWrapper;
|
||||||
|
private BiomeWrapper plainsBiomeWrapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -139,6 +145,26 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
|||||||
return this.blockMap.getColor(this.dirtBlockWrapper.blockState, BiomeWrapper.EMPTY_WRAPPER, DhBlockPos.ZERO);
|
return this.blockMap.getColor(this.dirtBlockWrapper.blockState, BiomeWrapper.EMPTY_WRAPPER, DhBlockPos.ZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBiomeWrapper getPlainsBiomeWrapper()
|
||||||
|
{
|
||||||
|
if (this.plainsBiomeWrapper == null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.plainsBiomeWrapper = (BiomeWrapper) BiomeWrapper.deserialize(BiomeWrapper.PLAINS_RESOURCE_LOCATION_STRING, this);
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
// shouldn't happen, but just in case
|
||||||
|
LOGGER.warn("Unable to get planes biome with resource location ["+BiomeWrapper.PLAINS_RESOURCE_LOCATION_STRING+"] with level ["+this+"].", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.plainsBiomeWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IDimensionTypeWrapper getDimensionType() { return DimensionTypeWrapper.getDimensionTypeWrapper(this.level.dimensionType()); }
|
public IDimensionTypeWrapper getDimensionType() { return DimensionTypeWrapper.getDimensionTypeWrapper(this.level.dimensionType()); }
|
||||||
|
|
||||||
|
|||||||
+5
@@ -41,7 +41,12 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.world.IServerLevelWrapp
|
|||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
import net.minecraft.world.level.chunk.ChunkSource;
|
import net.minecraft.world.level.chunk.ChunkSource;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_20_4
|
||||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||||
|
#endif
|
||||||
|
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|||||||
+6
-1
@@ -66,7 +66,6 @@ import net.minecraft.server.level.ServerLevel;
|
|||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
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.ChunkStatus;
|
|
||||||
import net.minecraft.world.level.chunk.LevelChunk;
|
import net.minecraft.world.level.chunk.LevelChunk;
|
||||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||||
import net.minecraft.world.level.chunk.UpgradeData;
|
import net.minecraft.world.level.chunk.UpgradeData;
|
||||||
@@ -79,6 +78,12 @@ import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
|||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_20_4
|
||||||
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Total: 3.135214124s
|
Total: 3.135214124s
|
||||||
=====================================
|
=====================================
|
||||||
|
|||||||
+33
-15
@@ -76,6 +76,11 @@ import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
|||||||
import net.minecraft.world.level.material.Fluids;
|
import net.minecraft.world.level.material.Fluids;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER == MC_1_20_6
|
||||||
|
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||||
|
import net.minecraft.world.level.chunk.status.ChunkType;
|
||||||
|
#endif
|
||||||
|
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
|
|
||||||
|
|
||||||
@@ -164,7 +169,8 @@ public class ChunkLoader
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
blockStateContainer = tagSection.contains("block_states", 10)
|
blockStateContainer = tagSection.contains("block_states", 10)
|
||||||
? BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, tagSection.getCompound("block_states")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error)
|
? BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, tagSection.getCompound("block_states")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string))
|
||||||
|
#if MC_VER < MC_1_20_6 .getOrThrow(false, LOGGER::error) #else .getOrThrow((message) -> (RuntimeException) LOGGER.errorAndThrow(message, null)) #endif
|
||||||
: new PalettedContainer<BlockState>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES);
|
: new PalettedContainer<BlockState>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES);
|
||||||
|
|
||||||
#if MC_VER < MC_1_18_2
|
#if MC_VER < MC_1_18_2
|
||||||
@@ -172,10 +178,13 @@ public class ChunkLoader
|
|||||||
? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error)
|
? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error)
|
||||||
: new PalettedContainer<Biome>(biomes, biomes.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES);
|
: new PalettedContainer<Biome>(biomes, biomes.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
biomeContainer = tagSection.contains("biomes", 10)
|
biomeContainer = tagSection.contains("biomes", 10)
|
||||||
? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, i, (String) string)).getOrThrow(false, LOGGER::error)
|
? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, i, (String) string))
|
||||||
|
#if MC_VER < MC_1_20_6 .getOrThrow(false, LOGGER::error) #else .getOrThrow((message) -> (RuntimeException) LOGGER.errorAndThrow(message, null)) #endif
|
||||||
: new PalettedContainer<Holder<Biome>>(biomes.asHolderIdMap(), biomes.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES);
|
: new PalettedContainer<Holder<Biome>>(biomes.asHolderIdMap(), biomes.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER < MC_1_20_1
|
#if MC_VER < MC_1_20_1
|
||||||
chunkSections[sectionId] = new LevelChunkSection(sectionYPos, blockStateContainer, biomeContainer);
|
chunkSections[sectionId] = new LevelChunkSection(sectionYPos, blockStateContainer, biomeContainer);
|
||||||
#else
|
#else
|
||||||
@@ -213,14 +222,15 @@ public class ChunkLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ChunkStatus.ChunkType readChunkType(CompoundTag tagLevel)
|
public static #if MC_VER < MC_1_20_6 ChunkStatus.ChunkType #else ChunkType #endif readChunkType(CompoundTag tagLevel)
|
||||||
{
|
{
|
||||||
ChunkStatus chunkStatus = ChunkStatus.byName(tagLevel.getString("Status"));
|
ChunkStatus chunkStatus = ChunkStatus.byName(tagLevel.getString("Status"));
|
||||||
if (chunkStatus != null)
|
if (chunkStatus != null)
|
||||||
{
|
{
|
||||||
return chunkStatus.getChunkType();
|
return chunkStatus.getChunkType();
|
||||||
}
|
}
|
||||||
return ChunkStatus.ChunkType.PROTOCHUNK;
|
|
||||||
|
return #if MC_VER < MC_1_20_6 ChunkStatus.ChunkType.PROTOCHUNK; #else ChunkType.PROTOCHUNK; #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LevelChunk read(WorldGenLevel level, ChunkPos chunkPos, CompoundTag chunkData)
|
public static LevelChunk read(WorldGenLevel level, ChunkPos chunkPos, CompoundTag chunkData)
|
||||||
@@ -262,19 +272,27 @@ public class ChunkLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ChunkStatus.ChunkType chunkType = readChunkType(tagLevel);
|
#if MC_VER < MC_1_20_6
|
||||||
#if MC_VER < MC_1_18_2
|
ChunkStatus.ChunkType chunkType;
|
||||||
if (chunkType != ChunkStatus.ChunkType.LEVELCHUNK)
|
|
||||||
return null;
|
|
||||||
#else
|
#else
|
||||||
BlendingData blendingData = readBlendingData(tagLevel);
|
ChunkType chunkType;
|
||||||
#if MC_VER < MC_1_19_2
|
|
||||||
if (chunkType == ChunkStatus.ChunkType.PROTOCHUNK && (blendingData == null || !blendingData.oldNoise()))
|
|
||||||
return null;
|
|
||||||
#else
|
|
||||||
if (chunkType == ChunkStatus.ChunkType.PROTOCHUNK && blendingData == null)
|
|
||||||
return null;
|
|
||||||
#endif
|
#endif
|
||||||
|
chunkType = readChunkType(tagLevel);
|
||||||
|
|
||||||
|
#if MC_VER < MC_1_18_2
|
||||||
|
if (chunkType != ChunkStatus.ChunkType.LEVELCHUNK)
|
||||||
|
return null;
|
||||||
|
#else
|
||||||
|
|
||||||
|
BlendingData blendingData = readBlendingData(tagLevel);
|
||||||
|
#if MC_VER < MC_1_19_2
|
||||||
|
if (chunkType == ChunkStatus.ChunkType.PROTOCHUNK && (blendingData == null || !blendingData.oldNoise()))
|
||||||
|
return null;
|
||||||
|
#else
|
||||||
|
if (chunkType == #if MC_VER < MC_1_20_6 ChunkStatus.ChunkType.PROTOCHUNK #else ChunkType.PROTOCHUNK #endif && blendingData == null)
|
||||||
|
return null;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
long inhabitedTime = tagLevel.getLong("InhabitedTime");
|
long inhabitedTime = tagLevel.getLong("InhabitedTime");
|
||||||
|
|||||||
+7
-1
@@ -52,11 +52,17 @@ import net.minecraft.world.level.block.Blocks;
|
|||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
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.ChunkStatus;
|
|
||||||
import net.minecraft.world.level.chunk.ImposterProtoChunk;
|
import net.minecraft.world.level.chunk.ImposterProtoChunk;
|
||||||
import net.minecraft.world.level.chunk.LevelChunk;
|
import net.minecraft.world.level.chunk.LevelChunk;
|
||||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_20_4
|
||||||
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
public class DhLitWorldGenRegion extends WorldGenRegion
|
public class DhLitWorldGenRegion extends WorldGenRegion
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName());
|
private static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName());
|
||||||
|
|||||||
+11
-2
@@ -23,15 +23,24 @@ import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
|||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IStarlightAccessor;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IStarlightAccessor;
|
||||||
|
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
|
import net.minecraft.world.level.chunk.LightChunkGetter;
|
||||||
|
|
||||||
#if MC_VER >= MC_1_17_1
|
#if MC_VER >= MC_1_17_1
|
||||||
import net.minecraft.world.level.LevelHeightAccessor;
|
import net.minecraft.world.level.LevelHeightAccessor;
|
||||||
#endif
|
#endif
|
||||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
|
||||||
import net.minecraft.world.level.chunk.LightChunkGetter;
|
|
||||||
#if MC_VER >= MC_1_20_1
|
#if MC_VER >= MC_1_20_1
|
||||||
import net.minecraft.world.level.chunk.LightChunk;
|
import net.minecraft.world.level.chunk.LightChunk;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_20_4
|
||||||
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class LightGetterAdaptor implements LightChunkGetter
|
public class LightGetterAdaptor implements LightChunkGetter
|
||||||
{
|
{
|
||||||
private final BlockGetter heightGetter;
|
private final BlockGetter heightGetter;
|
||||||
|
|||||||
+7
-1
@@ -17,6 +17,10 @@ import java.nio.file.Path;
|
|||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
|
#if MC_VER >= MC_1_20_6
|
||||||
|
import net.minecraft.world.level.chunk.storage.RegionStorageInfo;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated should be replaced with net.minecraft.world.level.chunk.storage.IOWorker to
|
* @deprecated should be replaced with net.minecraft.world.level.chunk.storage.IOWorker to
|
||||||
* prevent potential file corruption and issues with the C2ME mod.
|
* prevent potential file corruption and issues with the C2ME mod.
|
||||||
@@ -180,8 +184,10 @@ public class RegionFileStorageExternalCache implements AutoCloseable
|
|||||||
Path regionFilePath = storageFolderPath.resolve("r." + pos.getRegionX() + "." + pos.getRegionZ() + ".mca");
|
Path regionFilePath = storageFolderPath.resolve("r." + pos.getRegionX() + "." + pos.getRegionZ() + ".mca");
|
||||||
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
||||||
rFile = new RegionFile(regionFilePath.toFile(), storageFolderPath.toFile(), false);
|
rFile = new RegionFile(regionFilePath.toFile(), storageFolderPath.toFile(), false);
|
||||||
#else
|
#elif MC_VER <= MC_1_20_4
|
||||||
rFile = new RegionFile(regionFilePath, storageFolderPath, false);
|
rFile = new RegionFile(regionFilePath, storageFolderPath, false);
|
||||||
|
#else
|
||||||
|
rFile = new RegionFile(new RegionStorageInfo("level", null, "level type"), regionFilePath, storageFolderPath, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
this.regionFileCache.add(new RegionFileCache(ChunkPos.asLong(pos.getRegionX(), pos.getRegionZ()), rFile));
|
this.regionFileCache.add(new RegionFileCache(ChunkPos.asLong(pos.getRegionX(), pos.getRegionZ()), rFile));
|
||||||
|
|||||||
+6
-1
@@ -35,7 +35,6 @@ import net.minecraft.server.level.WorldGenRegion;
|
|||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
|
||||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||||
#if MC_VER < MC_1_19_2
|
#if MC_VER < MC_1_19_2
|
||||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||||
@@ -57,6 +56,12 @@ import net.minecraft.world.level.levelgen.structure.StructureStart;
|
|||||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_20_4
|
||||||
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class WorldGenStructFeatManager extends #if MC_VER < MC_1_19_2 StructureFeatureManager #else StructureManager #endif
|
public class WorldGenStructFeatManager extends #if MC_VER < MC_1_19_2 StructureFeatureManager #else StructureManager #endif
|
||||||
|
|||||||
+7
-3
@@ -27,15 +27,19 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGeneratio
|
|||||||
import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParameters;
|
import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParameters;
|
||||||
|
|
||||||
import net.minecraft.server.level.WorldGenRegion;
|
import net.minecraft.server.level.WorldGenRegion;
|
||||||
#if MC_VER < MC_1_19_2
|
|
||||||
#endif
|
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
|
||||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||||
|
|
||||||
#if MC_VER >= MC_1_18_2
|
#if MC_VER >= MC_1_18_2
|
||||||
import net.minecraft.world.level.levelgen.blending.Blender;
|
import net.minecraft.world.level.levelgen.blending.Blender;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_20_4
|
||||||
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||||
|
#endif
|
||||||
|
|
||||||
public final class StepBiomes
|
public final class StepBiomes
|
||||||
{
|
{
|
||||||
public static final ChunkStatus STATUS = ChunkStatus.BIOMES;
|
public static final ChunkStatus STATUS = ChunkStatus.BIOMES;
|
||||||
|
|||||||
+6
-1
@@ -27,11 +27,16 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
|||||||
import com.seibel.distanthorizons.core.util.gridList.ArrayGridList;
|
import com.seibel.distanthorizons.core.util.gridList.ArrayGridList;
|
||||||
|
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
|
||||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||||
import net.minecraft.world.level.levelgen.Heightmap;
|
import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_20_4
|
||||||
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
public final class StepFeatures
|
public final class StepFeatures
|
||||||
{
|
{
|
||||||
|
|||||||
+7
-5
@@ -28,17 +28,19 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParame
|
|||||||
|
|
||||||
import com.seibel.distanthorizons.core.util.objects.UncheckedInterruptedException;
|
import com.seibel.distanthorizons.core.util.objects.UncheckedInterruptedException;
|
||||||
import net.minecraft.server.level.WorldGenRegion;
|
import net.minecraft.server.level.WorldGenRegion;
|
||||||
#if MC_VER >= MC_1_17_1
|
|
||||||
#endif
|
|
||||||
#if MC_VER < MC_1_19_2
|
|
||||||
#endif
|
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
|
||||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||||
|
|
||||||
#if MC_VER >= MC_1_18_2
|
#if MC_VER >= MC_1_18_2
|
||||||
import net.minecraft.world.level.levelgen.blending.Blender;
|
import net.minecraft.world.level.levelgen.blending.Blender;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_20_4
|
||||||
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||||
|
#endif
|
||||||
|
|
||||||
public final class StepNoise
|
public final class StepNoise
|
||||||
{
|
{
|
||||||
private static final ChunkStatus STATUS = ChunkStatus.NOISE;
|
private static final ChunkStatus STATUS = ChunkStatus.NOISE;
|
||||||
|
|||||||
+7
-3
@@ -27,12 +27,16 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGeneratio
|
|||||||
import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParameters;
|
import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParameters;
|
||||||
|
|
||||||
import net.minecraft.server.level.WorldGenRegion;
|
import net.minecraft.server.level.WorldGenRegion;
|
||||||
#if MC_VER < MC_1_19_2
|
|
||||||
#endif
|
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
|
||||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_20_4
|
||||||
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
public final class StepStructureReference
|
public final class StepStructureReference
|
||||||
{
|
{
|
||||||
private static final ChunkStatus STATUS = ChunkStatus.STRUCTURE_REFERENCES;
|
private static final ChunkStatus STATUS = ChunkStatus.STRUCTURE_REFERENCES;
|
||||||
|
|||||||
+7
-1
@@ -30,10 +30,16 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParame
|
|||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import net.minecraft.server.level.WorldGenRegion;
|
import net.minecraft.server.level.WorldGenRegion;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
|
||||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_20_4
|
||||||
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
public final class StepStructureStart
|
public final class StepStructureStart
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||||
|
|||||||
+7
-2
@@ -28,9 +28,14 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParame
|
|||||||
|
|
||||||
import net.minecraft.server.level.WorldGenRegion;
|
import net.minecraft.server.level.WorldGenRegion;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
|
||||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||||
import net.minecraft.world.level.levelgen.Heightmap;
|
|
||||||
|
#if MC_VER <= MC_1_20_4
|
||||||
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
public final class StepSurface
|
public final class StepSurface
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
accessWidener v1 named
|
||||||
|
|
||||||
|
# used when determining where to save files to
|
||||||
|
accessible field net/minecraft/world/level/storage/DimensionDataStorage dataFolder Ljava/io/File;
|
||||||
|
|
||||||
|
# used when rendering
|
||||||
|
accessible method net/minecraft/client/renderer/GameRenderer getFov (Lnet/minecraft/client/Camera;FZ)D
|
||||||
|
|
||||||
|
# used for grabbing vanilla rendered chunks
|
||||||
|
accessible field net/minecraft/client/renderer/LevelRenderer visibleSections Lit/unimi/dsi/fastutil/objects/ObjectArrayList;
|
||||||
|
|
||||||
|
#accessible method net/minecraft/client/renderer/LevelRenderer renderSectionLayer (Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V
|
||||||
|
|
||||||
|
# world generation
|
||||||
|
# accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V
|
||||||
|
accessible field net/minecraft/world/level/chunk/LevelChunk loaded Z
|
||||||
|
accessible field net/minecraft/world/level/lighting/LightEngine storage Lnet/minecraft/world/level/lighting/LayerLightSectionStorage;
|
||||||
|
accessible method net/minecraft/world/level/lighting/LayerLightSectionStorage lightOnInSection (J)Z
|
||||||
|
|
||||||
|
# lod generation from save file
|
||||||
|
accessible field net/minecraft/world/level/chunk/storage/ChunkStorage worker Lnet/minecraft/world/level/chunk/storage/IOWorker;
|
||||||
|
accessible field net/minecraft/world/level/chunk/storage/IOWorker storage Lnet/minecraft/world/level/chunk/storage/RegionFileStorage;
|
||||||
|
accessible field net/minecraft/world/level/chunk/storage/RegionFileStorage regionCache Lit/unimi/dsi/fastutil/longs/Long2ObjectLinkedOpenHashMap;
|
||||||
|
accessible field net/minecraft/world/level/chunk/storage/RegionFileStorage folder Ljava/nio/file/Path;
|
||||||
|
|
||||||
|
# grabbing textures
|
||||||
|
accessible class net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture
|
||||||
|
accessible method net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture getFrameX (I)I
|
||||||
|
accessible method net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture getFrameY (I)I
|
||||||
|
accessible field net/minecraft/client/renderer/texture/SpriteContents animatedTexture Lnet/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture;
|
||||||
|
accessible field net/minecraft/client/renderer/texture/SpriteContents originalImage Lcom/mojang/blaze3d/platform/NativeImage;
|
||||||
|
|
||||||
|
# UI stuff
|
||||||
|
accessible field net/minecraft/client/gui/components/AbstractButton SPRITES Lnet/minecraft/client/gui/components/WidgetSprites;
|
||||||
|
# Handles inserting the config button
|
||||||
|
accessible field net/minecraft/client/gui/layouts/HeaderAndFooterLayout headerFrame Lnet/minecraft/client/gui/layouts/FrameLayout;
|
||||||
|
accessible field net/minecraft/client/gui/layouts/FrameLayout children Ljava/util/List;
|
||||||
|
accessible class net/minecraft/client/gui/layouts/FrameLayout$ChildContainer
|
||||||
|
accessible field net/minecraft/client/gui/layouts/LinearLayout wrapped Lnet/minecraft/client/gui/layouts/GridLayout;
|
||||||
|
|
||||||
|
# hacky stuff
|
||||||
|
accessible field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore;
|
||||||
|
mutable field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore;
|
||||||
|
accessible field net/minecraft/client/gui/components/AbstractSelectionList scrollAmount D # Hack to bypass vanilla's setScrollAmount's clamp
|
||||||
|
|
||||||
|
|
||||||
+1
-1
Submodule coreSubProjects updated: b41e54e6a6...76f28e648c
+8
-5
@@ -45,7 +45,7 @@ def addMod(path, enabled) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "com.mojang:minecraft:${minecraft_version}"
|
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
|
||||||
mappings loom.layered() {
|
mappings loom.layered() {
|
||||||
// Mojmap mappings
|
// Mojmap mappings
|
||||||
officialMojangMappings()
|
officialMojangMappings()
|
||||||
@@ -70,12 +70,14 @@ dependencies {
|
|||||||
addModJar(fabricApi.module("fabric-rendering-v1", rootProject.fabric_api_version)) // TODO: Remove this as it is only needed in 1 line (FabricClientProxy)
|
addModJar(fabricApi.module("fabric-rendering-v1", rootProject.fabric_api_version)) // TODO: Remove this as it is only needed in 1 line (FabricClientProxy)
|
||||||
addModJar(fabricApi.module("fabric-networking-api-v1", rootProject.fabric_api_version))
|
addModJar(fabricApi.module("fabric-networking-api-v1", rootProject.fabric_api_version))
|
||||||
|
|
||||||
|
// used by mod menu in MC 1.20.6+
|
||||||
|
addModJar(fabricApi.module("fabric-screen-api-v1", rootProject.fabric_api_version))
|
||||||
|
addModJar(fabricApi.module("fabric-key-binding-api-v1", rootProject.fabric_api_version))
|
||||||
|
|
||||||
|
|
||||||
// Mod Menu
|
// Mod Menu
|
||||||
modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}")
|
modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Starlight
|
// Starlight
|
||||||
addMod("curse.maven:starlight-521783:${rootProject.starlight_version_fabric}", rootProject.enable_starlight)
|
addMod("curse.maven:starlight-521783:${rootProject.starlight_version_fabric}", rootProject.enable_starlight)
|
||||||
|
|
||||||
@@ -103,8 +105,9 @@ dependencies {
|
|||||||
addMod("io.vram:canvas-fabric-${project.canvas_version}", rootProject.enable_canvas)
|
addMod("io.vram:canvas-fabric-${project.canvas_version}", rootProject.enable_canvas)
|
||||||
|
|
||||||
// Immersive Portals
|
// Immersive Portals
|
||||||
if (rootProject.enable_immersive_portals == "1")
|
if (rootProject.enable_immersive_portals == "1") {
|
||||||
modCompileOnly ("com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:${project.immersive_portals_version}")
|
modCompileOnly("com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:${project.immersive_portals_version}")
|
||||||
|
}
|
||||||
else if (rootProject.enable_immersive_portals == "2") {
|
else if (rootProject.enable_immersive_portals == "2") {
|
||||||
modImplementation ("com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:${project.immersive_portals_version}") {
|
modImplementation ("com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:${project.immersive_portals_version}") {
|
||||||
exclude(group: "net.fabricmc.fabric-api")
|
exclude(group: "net.fabricmc.fabric-api")
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
package com.seibel.distanthorizons.fabric;
|
package com.seibel.distanthorizons.fabric;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
||||||
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||||
@@ -36,6 +38,7 @@ import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
|||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.ISodiumAccessor;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.ISodiumAccessor;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||||
|
import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
|
||||||
import com.seibel.distanthorizons.fabric.wrappers.modAccessor.SodiumAccessor;
|
import com.seibel.distanthorizons.fabric.wrappers.modAccessor.SodiumAccessor;
|
||||||
//import io.netty.buffer.ByteBuf;
|
//import io.netty.buffer.ByteBuf;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
@@ -58,6 +61,7 @@ import net.minecraft.world.InteractionResult;
|
|||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
import net.minecraft.world.phys.HitResult;
|
import net.minecraft.world.phys.HitResult;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.joml.Matrix4f;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -192,9 +196,18 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy
|
|||||||
|
|
||||||
WorldRenderEvents.AFTER_SETUP.register((renderContext) ->
|
WorldRenderEvents.AFTER_SETUP.register((renderContext) ->
|
||||||
{
|
{
|
||||||
|
Mat4f projectionMatrix = McObjectConverter.Convert(renderContext.projectionMatrix());
|
||||||
|
|
||||||
|
Mat4f modelViewMatrix;
|
||||||
|
#if MC_VER < MC_1_20_6
|
||||||
|
modelViewMatrix = McObjectConverter.Convert(renderContext.matrixStack().last().pose());
|
||||||
|
#else
|
||||||
|
modelViewMatrix = McObjectConverter.Convert(renderContext.positionMatrix());
|
||||||
|
#endif
|
||||||
|
|
||||||
this.clientApi.renderLods(ClientLevelWrapper.getWrapper(renderContext.world()),
|
this.clientApi.renderLods(ClientLevelWrapper.getWrapper(renderContext.world()),
|
||||||
McObjectConverter.Convert(renderContext.matrixStack().last().pose()),
|
modelViewMatrix,
|
||||||
McObjectConverter.Convert(renderContext.projectionMatrix()),
|
projectionMatrix,
|
||||||
renderContext.tickDelta());
|
renderContext.tickDelta());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti
|
|||||||
// If sodium is installed Indium is also necessary in order to use the Fabric rendering API
|
// If sodium is installed Indium is also necessary in order to use the Fabric rendering API
|
||||||
if (!modChecker.isModLoaded("indium"))
|
if (!modChecker.isModLoaded("indium"))
|
||||||
{
|
{
|
||||||
String indiumMissingMessage = ModInfo.READABLE_NAME + " now relies on Indium to work with Sodium.\nPlease download Indium from https://modrinth.com/mod/indium";
|
String indiumMissingMessage = ModInfo.READABLE_NAME + " needs Indium to work with Sodium.\nPlease download Indium from https://modrinth.com/mod/indium";
|
||||||
LOGGER.fatal(indiumMissingMessage);
|
LOGGER.fatal(indiumMissingMessage);
|
||||||
|
|
||||||
if (!GraphicsEnvironment.isHeadless())
|
if (!GraphicsEnvironment.isHeadless())
|
||||||
|
|||||||
-69
@@ -1,69 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of the Distant Horizons mod
|
|
||||||
* licensed under the GNU LGPL v3 License.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020-2023 James Seibel
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.seibel.distanthorizons.fabric.mixins.client;
|
|
||||||
|
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.NativeImage;
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
|
||||||
import com.seibel.distanthorizons.common.util.ILightTextureMarker;
|
|
||||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
@Mixin(DynamicTexture.class)
|
|
||||||
public class MixinDynamicTexture implements ILightTextureMarker
|
|
||||||
{
|
|
||||||
/** Used to prevent accidentally using other dynamic textures as a lightmap */
|
|
||||||
@Unique
|
|
||||||
private boolean isLightTexture = false;
|
|
||||||
|
|
||||||
@Shadow
|
|
||||||
@Final
|
|
||||||
private NativeImage pixels;
|
|
||||||
|
|
||||||
@Inject(method = "upload()V", at = @At("HEAD"))
|
|
||||||
public void updateLightTexture(CallbackInfo ci)
|
|
||||||
{
|
|
||||||
// since the light map is always updated on the client render thread we should be able to access the client level at the same time
|
|
||||||
IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
|
||||||
if (!this.isLightTexture
|
|
||||||
|| mc == null
|
|
||||||
|| mc.getWrappedClientLevel() == null
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//ApiShared.LOGGER.info("Lightmap update");
|
|
||||||
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
|
||||||
MinecraftRenderWrapper.INSTANCE.updateLightmap(this.pixels, clientLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void markLightTexture() { this.isLightTexture = true; }
|
|
||||||
|
|
||||||
}
|
|
||||||
+16
-3
@@ -84,11 +84,16 @@ public class MixinLevelRenderer
|
|||||||
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
||||||
cancellable = true)
|
cancellable = true)
|
||||||
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
|
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||||
#else
|
#elif MC_VER < MC_1_20_6
|
||||||
@Inject(at = @At("HEAD"),
|
@Inject(at = @At("HEAD"),
|
||||||
method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
||||||
cancellable = true)
|
cancellable = true)
|
||||||
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double camX, double camY, double camZ, Matrix4f projectionMatrix, CallbackInfo callback)
|
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double camX, double camY, double camZ, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||||
|
#else
|
||||||
|
@Inject(at = @At("HEAD"),
|
||||||
|
method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;DDDLorg/joml/Matrix4f;Lorg/joml/Matrix4f;)V",
|
||||||
|
cancellable = true)
|
||||||
|
private void renderChunkLayer(RenderType renderType, double x, double y, double z, Matrix4f projectionMatrix, Matrix4f frustumMatrix, CallbackInfo callback)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if MC_VER == MC_1_16_5
|
#if MC_VER == MC_1_16_5
|
||||||
@@ -100,10 +105,15 @@ public class MixinLevelRenderer
|
|||||||
|
|
||||||
Mat4f mcModelViewMatrix = McObjectConverter.Convert(matrixStackIn.last().pose());
|
Mat4f mcModelViewMatrix = McObjectConverter.Convert(matrixStackIn.last().pose());
|
||||||
|
|
||||||
#else
|
#elif MC_VER <= MC_1_20_4
|
||||||
// get the matrices directly from MC
|
// get the matrices directly from MC
|
||||||
Mat4f mcModelViewMatrix = McObjectConverter.Convert(modelViewMatrixStack.last().pose());
|
Mat4f mcModelViewMatrix = McObjectConverter.Convert(modelViewMatrixStack.last().pose());
|
||||||
Mat4f mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix);
|
Mat4f mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix);
|
||||||
|
#else
|
||||||
|
// get the matrices directly from MC
|
||||||
|
Mat4f mcModelViewMatrix = McObjectConverter.Convert(projectionMatrix);
|
||||||
|
Mat4f mcProjectionMatrix = new Mat4f();
|
||||||
|
mcProjectionMatrix.setIdentity();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (renderType.equals(RenderType.translucent())) {
|
if (renderType.equals(RenderType.translucent())) {
|
||||||
@@ -126,9 +136,12 @@ public class MixinLevelRenderer
|
|||||||
#elif MC_VER < MC_1_20_1
|
#elif MC_VER < MC_1_20_1
|
||||||
@Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel")
|
@Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel")
|
||||||
public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci)
|
public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci)
|
||||||
#else
|
#elif MC_VER < MC_1_20_6
|
||||||
@Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runLightUpdates()I"), method = "renderLevel")
|
@Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runLightUpdates()I"), method = "renderLevel")
|
||||||
private void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci)
|
private void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci)
|
||||||
|
#else
|
||||||
|
@Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runLightUpdates()I"), method = "renderLevel")
|
||||||
|
private void callAfterRunUpdates(CallbackInfo ci)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ChunkWrapper.syncedUpdateClientLightStatus();
|
ChunkWrapper.syncedUpdateClientLightStatus();
|
||||||
|
|||||||
+19
-7
@@ -20,9 +20,14 @@
|
|||||||
package com.seibel.distanthorizons.fabric.mixins.client;
|
package com.seibel.distanthorizons.fabric.mixins.client;
|
||||||
|
|
||||||
|
|
||||||
import com.seibel.distanthorizons.common.util.ILightTextureMarker;
|
import com.mojang.blaze3d.platform.NativeImage;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||||
import net.minecraft.client.renderer.LightTexture;
|
import net.minecraft.client.renderer.LightTexture;
|
||||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
@@ -35,13 +40,20 @@ public class MixinLightTexture
|
|||||||
{
|
{
|
||||||
@Shadow
|
@Shadow
|
||||||
@Final
|
@Final
|
||||||
private DynamicTexture lightTexture;
|
private NativeImage lightPixels;
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("RETURN"))
|
|
||||||
public void markLightTexture(CallbackInfo ci)
|
@Inject(method = "updateLightTexture(F)V", at = @At("RETURN"))
|
||||||
|
public void updateLightTexture(float partialTicks, CallbackInfo ci)
|
||||||
{
|
{
|
||||||
//
|
IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
||||||
((ILightTextureMarker) this.lightTexture).markLightTexture();
|
if (mc == null || mc.getWrappedClientLevel() == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
||||||
|
MinecraftRenderWrapper.INSTANCE.updateLightmap(this.lightPixels, clientLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-6
@@ -8,10 +8,11 @@ import com.seibel.distanthorizons.core.jar.installer.GitlabGetter;
|
|||||||
import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter;
|
import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter;
|
||||||
import com.seibel.distanthorizons.core.jar.updater.SelfUpdater;
|
import com.seibel.distanthorizons.core.jar.updater.SelfUpdater;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screens.TitleScreen;
|
import net.minecraft.client.gui.screens.TitleScreen;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
@@ -25,6 +26,15 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
@Mixin(Minecraft.class)
|
@Mixin(Minecraft.class)
|
||||||
public class MixinMinecraft
|
public class MixinMinecraft
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Can be enabled for testing the auto updater UI. <br/>
|
||||||
|
* will always show the auto updater if set to true.
|
||||||
|
*/
|
||||||
|
@Unique
|
||||||
|
private static final boolean DEBUG_ALWAYS_SHOW_UPDATER = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if MC_VER < MC_1_20_2
|
#if MC_VER < MC_1_20_2
|
||||||
#if MC_VER == MC_1_20_1
|
#if MC_VER == MC_1_20_1
|
||||||
@Redirect(
|
@Redirect(
|
||||||
@@ -41,13 +51,13 @@ public class MixinMinecraft
|
|||||||
public void onOpenScreen(Minecraft instance, Screen guiScreen)
|
public void onOpenScreen(Minecraft instance, Screen guiScreen)
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
if (!Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get()) // Don't do anything if the user doesn't want it
|
if (!Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() && !DEBUG_ALWAYS_SHOW_UPDATER) // Don't do anything if the user doesn't want it
|
||||||
{
|
{
|
||||||
instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened
|
instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelfUpdater.onStart())
|
if (SelfUpdater.onStart() || DEBUG_ALWAYS_SHOW_UPDATER)
|
||||||
{
|
{
|
||||||
instance.setScreen(new UpdateModScreen(
|
instance.setScreen(new UpdateModScreen(
|
||||||
new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons
|
new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons
|
||||||
@@ -69,9 +79,13 @@ public class MixinMinecraft
|
|||||||
private void buildInitialScreens(Runnable runnable)
|
private void buildInitialScreens(Runnable runnable)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() // Don't do anything if the user doesn't want it
|
DEBUG_ALWAYS_SHOW_UPDATER ||
|
||||||
&& SelfUpdater.onStart()
|
(
|
||||||
)
|
// Don't do anything if the user doesn't want it
|
||||||
|
Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get()
|
||||||
|
&& SelfUpdater.onStart()
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
runnable = () -> {
|
runnable = () -> {
|
||||||
Minecraft.getInstance().setScreen(new UpdateModScreen(
|
Minecraft.getInstance().setScreen(new UpdateModScreen(
|
||||||
|
|||||||
+90
-26
@@ -30,52 +30,116 @@ import net.minecraft.network.chat.Component;
|
|||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
#endif
|
#endif
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
#if MC_VER == MC_1_20_6
|
||||||
|
import net.minecraft.client.gui.layouts.LinearLayout;
|
||||||
|
import net.minecraft.client.gui.layouts.HeaderAndFooterLayout;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a button to the menu to goto the config
|
* Adds a button to the menu to goto the config
|
||||||
*
|
*
|
||||||
* @author coolGi
|
* @author coolGi
|
||||||
* @version 12-02-2021
|
* @version 2024-5-20
|
||||||
*/
|
*/
|
||||||
@Mixin(OptionsScreen.class)
|
@Mixin(OptionsScreen.class)
|
||||||
public class MixinOptionsScreen extends Screen
|
public class MixinOptionsScreen extends Screen
|
||||||
{
|
{
|
||||||
// Get the texture for the button
|
/** Texture used for the config opening button */
|
||||||
|
@Unique
|
||||||
private static final ResourceLocation ICON_TEXTURE = new ResourceLocation(ModInfo.ID, "textures/gui/button.png");
|
private static final ResourceLocation ICON_TEXTURE = new ResourceLocation(ModInfo.ID, "textures/gui/button.png");
|
||||||
protected MixinOptionsScreen(Component title)
|
|
||||||
{
|
|
||||||
super(title);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "init")
|
|
||||||
|
@Unique
|
||||||
|
private TexturedButtonWidget optionsButton = null;
|
||||||
|
|
||||||
|
#if MC_VER == MC_1_20_6
|
||||||
|
@Shadow
|
||||||
|
@Final
|
||||||
|
protected HeaderAndFooterLayout layout;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//==============//
|
||||||
|
// constructors //
|
||||||
|
//==============//
|
||||||
|
|
||||||
|
protected MixinOptionsScreen(Component title) { super(title); }
|
||||||
|
|
||||||
|
@Inject(at = @At("RETURN"), method = "init")
|
||||||
private void lodconfig$init(CallbackInfo ci)
|
private void lodconfig$init(CallbackInfo ci)
|
||||||
{
|
{
|
||||||
if (Config.Client.optionsButton.get())
|
if (Config.Client.optionsButton.get())
|
||||||
this. #if MC_VER < MC_1_17_1 addButton #else addRenderableWidget #endif
|
{
|
||||||
(new TexturedButtonWidget(
|
#if MC_VER < MC_1_17_1
|
||||||
// Where the button is on the screen
|
this.addButton(this.getOptionsButton());
|
||||||
this.width / 2 - 180, this.height / 6 - 12,
|
#elif MC_VER < MC_1_20_6
|
||||||
// Width and height of the button
|
this.addRenderableWidget(this.getOptionsButton());
|
||||||
20, 20,
|
#else
|
||||||
// Offset
|
|
||||||
0, 0,
|
// add the button so it's rendered
|
||||||
// Some textuary stuff
|
this.addRenderableWidget(this.getOptionsButton());
|
||||||
20, ICON_TEXTURE, 20, 40,
|
|
||||||
// Create the button and tell it where to go
|
// add the button to the correct location in the UI
|
||||||
// For now it goes to the client option by default
|
// TODO is there a better way to do this instead of using access transformers to inject into the exact UI elements?
|
||||||
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(GetConfigScreen.getScreen(this)),
|
LinearLayout layout = (LinearLayout) this.layout.headerFrame.children.get(0).child;
|
||||||
// Add a title to the utton
|
|
||||||
#if MC_VER < MC_1_19_2
|
// determine how wide the other option buttons are so we can put our botton to the left of them all
|
||||||
new TranslatableComponent(ModInfo.ID + ".title")));
|
AtomicInteger width = new AtomicInteger(0);
|
||||||
#else
|
layout.visitChildren(x -> { width.addAndGet(x.getWidth()); });
|
||||||
Component.translatable(ModInfo.ID + ".title")));
|
width.addAndGet(-10); // padding between the DH button and the FOV slider
|
||||||
#endif
|
|
||||||
|
layout.wrapped.addChild(this.getOptionsButton(), 1, 2, (settings) -> { settings.paddingLeft(width.get() * -1); });
|
||||||
|
layout.arrangeElements();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//================//
|
||||||
|
// helper methods //
|
||||||
|
//================//
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
public TexturedButtonWidget getOptionsButton()
|
||||||
|
{
|
||||||
|
if (this.optionsButton == null)
|
||||||
|
{
|
||||||
|
this.optionsButton
|
||||||
|
= new TexturedButtonWidget(
|
||||||
|
// Where the button is on the screen
|
||||||
|
this.width / 2 - 180, this.height / 6 - 12,
|
||||||
|
// Width and height of the button
|
||||||
|
20, 20,
|
||||||
|
// texture UV Offset
|
||||||
|
0, 0,
|
||||||
|
// Some textuary stuff
|
||||||
|
20, ICON_TEXTURE, 20, 40,
|
||||||
|
// Create the button and tell it where to go
|
||||||
|
// For now it goes to the client option by default
|
||||||
|
(buttonWidget) -> Objects.requireNonNull(this.minecraft).setScreen(GetConfigScreen.getScreen(this)),
|
||||||
|
// Add a title to the button
|
||||||
|
#if MC_VER < MC_1_19_2
|
||||||
|
new TranslatableComponent(ModInfo.ID + ".title"));
|
||||||
|
#else
|
||||||
|
Component.translatable(ModInfo.ID + ".title"));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.optionsButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
-60
@@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of the Distant Horizons mod
|
|
||||||
* licensed under the GNU LGPL v3 License.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020-2023 James Seibel
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.seibel.distanthorizons.fabric.mixins.server.unsafe;
|
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
|
|
||||||
//FIXME: Is this still needed?
|
|
||||||
#if MC_VER >= MC_1_18_2
|
|
||||||
|
|
||||||
import net.minecraft.util.ThreadingDetector;
|
|
||||||
import org.spongepowered.asm.mixin.Mutable;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
import java.util.concurrent.Semaphore;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Why does this exist? But okay! (Will be probably removed when the experimental generator is done)
|
|
||||||
* FIXME: Recheck this
|
|
||||||
*/
|
|
||||||
@Mixin(ThreadingDetector.class)
|
|
||||||
public class MixinThreadingDetector
|
|
||||||
{
|
|
||||||
@Mutable
|
|
||||||
@Shadow
|
|
||||||
private Semaphore lock;
|
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("RETURN"))
|
|
||||||
private void setSemaphore(CallbackInfo ci)
|
|
||||||
{
|
|
||||||
this.lock = new Semaphore(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
|
|
||||||
@Mixin(ServerLevel.class)
|
|
||||||
public class MixinThreadingDetector { } //FIXME: Is there some way to make this file just not be added?
|
|
||||||
#endif
|
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
package com.seibel.distanthorizons.fabric.wrappers.modAccessor;
|
package com.seibel.distanthorizons.fabric.wrappers.modAccessor;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IBCLibAccessor;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IBCLibAccessor;
|
||||||
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 || MC_VER == MC_1_20_4 // These versions either don't have BCLib, or the implementation is different
|
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 || MC_VER == MC_1_20_4 || MC_VER == MC_1_20_6 // These versions either don't have BCLib, or the implementation is different
|
||||||
#elif MC_VER == MC_1_18_2
|
#elif MC_VER == MC_1_18_2
|
||||||
import ru.bclib.config.ClientConfig;
|
import ru.bclib.config.ClientConfig;
|
||||||
import ru.bclib.config.Configs;
|
import ru.bclib.config.Configs;
|
||||||
@@ -17,7 +17,7 @@ public class BCLibAccessor implements IBCLibAccessor
|
|||||||
|
|
||||||
public void setRenderCustomFog(boolean newValue)
|
public void setRenderCustomFog(boolean newValue)
|
||||||
{
|
{
|
||||||
#if !(MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 || MC_VER == MC_1_20_4) // These versions either don't have BCLib, or the implementation is different
|
#if !(MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 || MC_VER == MC_1_20_4 || MC_VER == MC_1_20_6) // These versions either don't have BCLib, or the implementation is different
|
||||||
|
|
||||||
// Change the value of CUSTOM_FOG_RENDERING in the bclib client config
|
// Change the value of CUSTOM_FOG_RENDERING in the bclib client config
|
||||||
// This disabled fog from rendering within bclib
|
// This disabled fog from rendering within bclib
|
||||||
|
|||||||
+4
@@ -22,7 +22,11 @@ package com.seibel.distanthorizons.fabric.wrappers.modAccessor;
|
|||||||
#if MC_VER >= MC_1_19_4
|
#if MC_VER >= MC_1_19_4
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor;
|
||||||
|
#if MC_VER <= MC_1_20_4
|
||||||
import net.coderbot.iris.Iris;
|
import net.coderbot.iris.Iris;
|
||||||
|
#else
|
||||||
|
import net.irisshaders.iris.Iris;
|
||||||
|
#endif
|
||||||
import net.irisshaders.iris.api.v0.IrisApi;
|
import net.irisshaders.iris.api.v0.IrisApi;
|
||||||
|
|
||||||
public class IrisAccessor implements IIrisAccessor
|
public class IrisAccessor implements IIrisAccessor
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "com.seibel.distanthorizons.fabric.mixins",
|
"package": "com.seibel.distanthorizons.fabric.mixins",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"server.unsafe.MixinThreadingDetector",
|
|
||||||
"server.MixinChunkGenerator",
|
"server.MixinChunkGenerator",
|
||||||
"server.MixinChunkMap",
|
"server.MixinChunkMap",
|
||||||
"server.MixinUtilBackgroundThread"
|
"server.MixinUtilBackgroundThread"
|
||||||
@@ -15,7 +14,6 @@
|
|||||||
"client.MixinFogRenderer",
|
"client.MixinFogRenderer",
|
||||||
"client.MixinGameRenderer",
|
"client.MixinGameRenderer",
|
||||||
"client.MixinLevelRenderer",
|
"client.MixinLevelRenderer",
|
||||||
"client.MixinDynamicTexture",
|
|
||||||
"client.MixinLightTexture",
|
"client.MixinLightTexture",
|
||||||
"client.MixinOptionsScreen",
|
"client.MixinOptionsScreen",
|
||||||
"client.MixinMinecraft",
|
"client.MixinMinecraft",
|
||||||
|
|||||||
+13
-1
@@ -4,7 +4,7 @@ plugins {
|
|||||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
|
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
|
||||||
|
|
||||||
architectury {
|
architectury {
|
||||||
platformSetupLoomIde()
|
platformSetupLoomIde()
|
||||||
@@ -78,6 +78,18 @@ dependencies {
|
|||||||
|
|
||||||
addMod("curse.maven:TerraFirmaCraft-302973:4616004", rootProject.enable_terrafirmacraft)
|
addMod("curse.maven:TerraFirmaCraft-302973:4616004", rootProject.enable_terrafirmacraft)
|
||||||
|
|
||||||
|
|
||||||
|
if ( // Only run on MC 1.20.6 or later
|
||||||
|
// FIXME: Add an environment variable for the Major, Minor, and Patch version number of Minecraft
|
||||||
|
minecraft_version.split("\\.")[1].toInteger() >= 20 &&
|
||||||
|
(
|
||||||
|
minecraft_version.split("\\.").length > 1 && // Incase there isn't a minor version
|
||||||
|
minecraft_version.split("\\.")[2].toInteger() >= 6
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
// (potential) hack fix, force jopt-simple to be exactly 5.0.4 because Mojang ships that version, but some transitive dependencies request 6.0+
|
||||||
|
implementation('net.sf.jopt-simple:jopt-simple:5.0.4') //{ version { strictly '5.0.4' } }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task deleteResources(type: Delete) {
|
task deleteResources(type: Delete) {
|
||||||
|
|||||||
@@ -328,9 +328,7 @@ public class ForgeClientProxy implements AbstractModInitializer.IEventProxy
|
|||||||
#elif MC_VER >= MC_1_18_2
|
#elif MC_VER >= MC_1_18_2
|
||||||
if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_SOLID_BLOCKS)
|
if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_SOLID_BLOCKS)
|
||||||
#else
|
#else
|
||||||
// FIXME: Is this the correct location for 1.16 & 1.17???
|
if (event.type.equals(TickEvent.RenderTickEvent.Type.RENDER))
|
||||||
// I couldnt find anything for rendering after the level, so is rendering after overlays ok?
|
|
||||||
if (event.type.equals(TickEvent.RenderTickEvent.Type.WORLD))
|
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
-74
@@ -1,74 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of the Distant Horizons mod
|
|
||||||
* licensed under the GNU LGPL v3 License.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020-2023 James Seibel
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.seibel.distanthorizons.forge.mixins.client;
|
|
||||||
|
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.NativeImage;
|
|
||||||
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
|
||||||
import com.seibel.distanthorizons.common.util.ILightTextureMarker;
|
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
@Mixin(DynamicTexture.class)
|
|
||||||
public abstract class MixinDynamicTexture implements ILightTextureMarker
|
|
||||||
{
|
|
||||||
/** Used to prevent accidentally using other dynamic textures as a lightmap */
|
|
||||||
@Unique
|
|
||||||
private boolean isLightTexture = false;
|
|
||||||
|
|
||||||
@Shadow
|
|
||||||
@Final
|
|
||||||
private NativeImage pixels;
|
|
||||||
|
|
||||||
@Inject(method = "upload()V", at = @At("HEAD"))
|
|
||||||
public void updateLightTexture(CallbackInfo ci)
|
|
||||||
{
|
|
||||||
// since the light map is always updated on the client render thread we should be able to access the client level at the same time
|
|
||||||
IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
|
||||||
if (!this.isLightTexture
|
|
||||||
|| mc == null
|
|
||||||
|| mc.getWrappedClientLevel() == null
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//ApiShared.LOGGER.info("Lightmap update");
|
|
||||||
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
|
||||||
MinecraftRenderWrapper.INSTANCE.updateLightmap(this.pixels, clientLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void markLightTexture() { this.isLightTexture = true; }
|
|
||||||
|
|
||||||
}
|
|
||||||
+9
-2
@@ -49,6 +49,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.nio.FloatBuffer;
|
import java.nio.FloatBuffer;
|
||||||
|
|
||||||
#if MC_VER < MC_1_17_1
|
#if MC_VER < MC_1_17_1
|
||||||
@@ -68,7 +69,8 @@ import org.lwjgl.opengl.GL15;
|
|||||||
@Mixin(LevelRenderer.class)
|
@Mixin(LevelRenderer.class)
|
||||||
public class MixinLevelRenderer
|
public class MixinLevelRenderer
|
||||||
{
|
{
|
||||||
@Shadow
|
@Nullable
|
||||||
|
@Shadow //# if MC_VER >= MC_1_20_4 (remap = false) # endif
|
||||||
private ClientLevel level;
|
private ClientLevel level;
|
||||||
@Unique
|
@Unique
|
||||||
private static float previousPartialTicks = 0;
|
private static float previousPartialTicks = 0;
|
||||||
@@ -111,11 +113,16 @@ public class MixinLevelRenderer
|
|||||||
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
||||||
cancellable = true)
|
cancellable = true)
|
||||||
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
|
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||||
#else
|
#elif MC_VER < MC_1_20_4
|
||||||
@Inject(at = @At("HEAD"),
|
@Inject(at = @At("HEAD"),
|
||||||
method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
||||||
cancellable = true)
|
cancellable = true)
|
||||||
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double camX, double camY, double camZ, Matrix4f projectionMatrix, CallbackInfo callback)
|
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double camX, double camY, double camZ, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||||
|
#else
|
||||||
|
@Inject(at = @At("HEAD"),
|
||||||
|
method = "renderSectionLayer",
|
||||||
|
cancellable = true)
|
||||||
|
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double camX, double camY, double camZ, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// get MC's model view and projection matrices
|
// get MC's model view and projection matrices
|
||||||
|
|||||||
+20
-6
@@ -20,10 +20,13 @@
|
|||||||
package com.seibel.distanthorizons.forge.mixins.client;
|
package com.seibel.distanthorizons.forge.mixins.client;
|
||||||
|
|
||||||
|
|
||||||
import com.seibel.distanthorizons.common.util.ILightTextureMarker;
|
import com.mojang.blaze3d.platform.NativeImage;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||||
import net.minecraft.client.renderer.LightTexture;
|
import net.minecraft.client.renderer.LightTexture;
|
||||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -35,11 +38,22 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
@Mixin(LightTexture.class)
|
@Mixin(LightTexture.class)
|
||||||
public class MixinLightTexture
|
public class MixinLightTexture
|
||||||
{
|
{
|
||||||
@Shadow
|
@Shadow //# if MC_VER >= MC_1_20_4 (remap = false) # endif
|
||||||
@Final
|
@Final
|
||||||
private DynamicTexture lightTexture;
|
private NativeImage lightPixels;
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("RETURN"))
|
|
||||||
public void markLightTexture(CallbackInfo ci) { ((ILightTextureMarker) this.lightTexture).markLightTexture(); }
|
@Inject(method = "updateLightTexture(F)V", at = @At("RETURN"))
|
||||||
|
public void updateLightTexture(float partialTicks, CallbackInfo ci)
|
||||||
|
{
|
||||||
|
IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
||||||
|
if (mc == null || mc.getWrappedClientLevel() == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
||||||
|
MinecraftRenderWrapper.INSTANCE.updateLightmap(this.lightPixels, clientLevel);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
-156
@@ -1,156 +0,0 @@
|
|||||||
package com.seibel.distanthorizons.forge.mixins.client;
|
|
||||||
|
|
||||||
import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiLevelType;
|
|
||||||
import com.seibel.distanthorizons.api.interfaces.world.IDhApiDimensionTypeWrapper;
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.block.BlockStateWrapper;
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.world.DimensionTypeWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.file.structure.LocalSaveStructure;
|
|
||||||
import com.seibel.distanthorizons.core.level.DhServerLevel;
|
|
||||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IServerLevelWrapper;
|
|
||||||
import net.minecraft.resources.ResourceKey;
|
|
||||||
import net.minecraft.util.worldupdate.WorldUpgrader;
|
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
import net.minecraft.world.level.dimension.DimensionType;
|
|
||||||
import net.minecraft.world.level.dimension.LevelStem;
|
|
||||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
|
||||||
import net.minecraft.world.level.storage.DimensionDataStorage;
|
|
||||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
#if FALSE
|
|
||||||
@Mixin(WorldUpgrader.class)
|
|
||||||
public class MixinWorldUpgrader {
|
|
||||||
static class FakeLevelWrapper implements IServerLevelWrapper {
|
|
||||||
private Path saveFolder;
|
|
||||||
private LevelStem stem;
|
|
||||||
private DimensionType dimension;
|
|
||||||
private DimensionTypeWrapper dimensionTypeWrapper;
|
|
||||||
|
|
||||||
public FakeLevelWrapper(LevelStorageSource.LevelStorageAccess storage, WorldGenSettings gen, ResourceKey<Level> dim) {
|
|
||||||
saveFolder = storage.getDimensionPath(dim);
|
|
||||||
stem = gen.dimensions().getOrThrow(WorldGenSettings.levelToLevelStem(dim));
|
|
||||||
dimension = stem.typeHolder().value();
|
|
||||||
dimensionTypeWrapper = DimensionTypeWrapper.getDimensionTypeWrapper(dimension);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EDhApiLevelType getLevelType() {
|
|
||||||
return EDhApiLevelType.SERVER_LEVEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IDhApiDimensionTypeWrapper getDimensionType() {
|
|
||||||
return dimensionTypeWrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getBlockLight(int x, int y, int z) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSkyLight(int x, int y, int z) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasCeiling() {
|
|
||||||
return dimension.hasCeiling();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasSkyLight() {
|
|
||||||
return dimension.hasSkyLight();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHeight() {
|
|
||||||
return dimension.height();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMinHeight() {
|
|
||||||
return dimension.minY();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasChunkLoaded(int chunkX, int chunkZ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockStateWrapper getBlockState(DhBlockPos pos) {
|
|
||||||
return BlockStateWrapper.AIR;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBiomeWrapper getBiome(DhBlockPos pos) {
|
|
||||||
throw new UnsupportedOperationException("Not implemented yet");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getWrappedMcObject() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public IClientLevelWrapper tryGetClientLevelWrapper() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public File getSaveFolder() {
|
|
||||||
return saveFolder.toFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Unique
|
|
||||||
private DhServerLevel dhServerLevel;
|
|
||||||
@Unique
|
|
||||||
private FakeLevelWrapper fakeLevelWrapper;
|
|
||||||
@Unique
|
|
||||||
public LocalSaveStructure saveStructure;
|
|
||||||
|
|
||||||
@Shadow @Final
|
|
||||||
private DimensionDataStorage overworldDataStorage;
|
|
||||||
@Shadow @Final
|
|
||||||
private LevelStorageSource.LevelStorageAccess levelStorage;
|
|
||||||
@Shadow @Final
|
|
||||||
private WorldGenSettings worldGenSettings;
|
|
||||||
|
|
||||||
@Inject(method = "Lnet/minecraft/util/worldupdate/WorldUpgrader;work()V",
|
|
||||||
at = @At(value = "INVOKE")
|
|
||||||
)
|
|
||||||
private void initWorldUpgrade() {
|
|
||||||
saveStructure = new LocalSaveStructure();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "Lnet/minecraft/util/worldupdate/WorldUpgrader;work()V",
|
|
||||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/worldupdate/WorldUpgrader;getAllChunkPos(Lnet/minecraft/resources/ResourceKey;)Ljava/util/List;", shift = At.Shift.AFTER),
|
|
||||||
locals = LocalCapture.CAPTURE_FAILSOFT
|
|
||||||
)
|
|
||||||
private void startWorldUpgrade(CallbackInfo info, ResourceKey resourceKey) {
|
|
||||||
ResourceKey<Level> key = resourceKey;
|
|
||||||
fakeLevelWrapper = new FakeLevelWrapper(levelStorage, worldGenSettings, key);
|
|
||||||
dhServerLevel = new DhServerLevel(saveStructure, fakeLevelWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
-59
@@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of the Distant Horizons mod
|
|
||||||
* licensed under the GNU LGPL v3 License.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020-2023 James Seibel
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.seibel.distanthorizons.forge.mixins.server.unsafe;
|
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
#if MC_VER >= MC_1_18_2
|
|
||||||
|
|
||||||
import net.minecraft.util.ThreadingDetector;
|
|
||||||
import org.spongepowered.asm.mixin.Mutable;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
import java.util.concurrent.Semaphore;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Why does this exist? But okay! (Will be probably removed when the experimental generator is done)
|
|
||||||
* FIXME: Recheck this // STILL check this
|
|
||||||
*/
|
|
||||||
@Mixin(ThreadingDetector.class)
|
|
||||||
public class MixinThreadingDetector
|
|
||||||
{
|
|
||||||
@Mutable
|
|
||||||
@Shadow
|
|
||||||
private Semaphore lock;
|
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("RETURN"))
|
|
||||||
private void setSemaphore(CallbackInfo ci)
|
|
||||||
{
|
|
||||||
this.lock = new Semaphore(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
|
||||||
|
|
||||||
@Mixin(ChunkGenerator.class)
|
|
||||||
public class MixinThreadingDetector { }
|
|
||||||
#endif
|
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "com.seibel.distanthorizons.forge.mixins",
|
"package": "com.seibel.distanthorizons.forge.mixins",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"server.unsafe.MixinThreadingDetector",
|
|
||||||
"server.MixinUtilBackgroundThread",
|
"server.MixinUtilBackgroundThread",
|
||||||
"server.MixinChunkGenerator",
|
"server.MixinChunkGenerator",
|
||||||
"server.MixinTFChunkGenerator"
|
"server.MixinTFChunkGenerator"
|
||||||
@@ -14,7 +13,6 @@
|
|||||||
"client.MixinFogRenderer",
|
"client.MixinFogRenderer",
|
||||||
"client.MixinGameRenderer",
|
"client.MixinGameRenderer",
|
||||||
"client.MixinLevelRenderer",
|
"client.MixinLevelRenderer",
|
||||||
"client.MixinDynamicTexture",
|
|
||||||
"client.MixinLightTexture",
|
"client.MixinLightTexture",
|
||||||
"client.MixinOptionsScreen",
|
"client.MixinOptionsScreen",
|
||||||
"client.MixinTextureUtil"
|
"client.MixinTextureUtil"
|
||||||
|
|||||||
+12
-10
@@ -5,12 +5,12 @@ org.gradle.caching=true
|
|||||||
|
|
||||||
# Mod Info
|
# Mod Info
|
||||||
mod_name=DistantHorizons
|
mod_name=DistantHorizons
|
||||||
mod_version=2.0.3-a-dev
|
mod_version=2.1.0-a
|
||||||
api_version=1.1.0
|
api_version=2.0.0
|
||||||
maven_group=com.seibel.distanthorizons
|
maven_group=com.seibel.distanthorizons
|
||||||
mod_readable_name=Distant Horizons
|
mod_readable_name=Distant Horizons
|
||||||
mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow.
|
mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow.
|
||||||
# Note: In forge's mods.toml this is hard coded because Architectury throws an error with setting it as a varuable
|
# Note: In forge's mods.toml this is hard coded because Architectury throws an error with setting it as a variable
|
||||||
mod_authors=["James Seibel", "Leonardo Amato", "Cola", "coolGi", "Ran", "Leetom"]
|
mod_authors=["James Seibel", "Leonardo Amato", "Cola", "coolGi", "Ran", "Leetom"]
|
||||||
mod_homepage=https://modrinth.com/mod/distanthorizons
|
mod_homepage=https://modrinth.com/mod/distanthorizons
|
||||||
mod_source=https://gitlab.com/jeseibel/distant-horizons
|
mod_source=https://gitlab.com/jeseibel/distant-horizons
|
||||||
@@ -18,17 +18,19 @@ mod_issues=https://gitlab.com/jeseibel/distant-horizons/-/issues
|
|||||||
mod_discord=https://discord.gg/xAB8G4cENx
|
mod_discord=https://discord.gg/xAB8G4cENx
|
||||||
|
|
||||||
# Global Plugin Versions
|
# Global Plugin Versions
|
||||||
manifold_version=2024.1.9
|
manifold_version=2023.1.17
|
||||||
|
# 2023.1.17 can be used if there are mystery Java compiler issues
|
||||||
nightconfig_version=3.6.6
|
nightconfig_version=3.6.6
|
||||||
lz4_version=1.8.0
|
lz4_version=1.8.0
|
||||||
zstd_version=1.5.5-11
|
|
||||||
xz_version=1.9
|
xz_version=1.9
|
||||||
sqlite_jdbc_version=3.43.0.0
|
sqlite_jdbc_version=3.43.0.0
|
||||||
fastutil_version=8.5.13
|
# 8.2.1 is the newest version we can use since that's the version MC 1.16.5 uses
|
||||||
|
# (at least until we can fix the gradle script so core and main can use/shade different fastutil versions)
|
||||||
|
fastutil_version=8.2.1
|
||||||
#svgSalamander_version=1.1.3
|
#svgSalamander_version=1.1.3
|
||||||
|
|
||||||
# Minecraft related libaries (included in MC's jar)
|
# Minecraft related libraries (included in MC's jar)
|
||||||
log4j_version=2.20.0
|
log4j_version=2.23.1
|
||||||
netty_version=4.1.94.Final
|
netty_version=4.1.94.Final
|
||||||
lwjgl_version=3.3.1
|
lwjgl_version=3.3.1
|
||||||
joml_version=1.10.2
|
joml_version=1.10.2
|
||||||
@@ -47,7 +49,7 @@ versionStr=
|
|||||||
|
|
||||||
# This defines what MC version Intellij will use for the preprocessor
|
# This defines what MC version Intellij will use for the preprocessor
|
||||||
# and what version is used automatically by build and run commands
|
# and what version is used automatically by build and run commands
|
||||||
mcVer=1.20.4
|
mcVer=1.20.6
|
||||||
|
|
||||||
# Defines the maximum amount of memory Minecraft is allowed when run in a developement environment
|
# Defines the maximum amount of memory Minecraft is allowed when run in a development environment
|
||||||
#minecraftMemoryJavaArg="-Xmx4G"
|
#minecraftMemoryJavaArg="-Xmx4G"
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
+38
-2
@@ -21,6 +21,7 @@ package com.seibel.distanthorizons.neoforge;
|
|||||||
|
|
||||||
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
||||||
import com.seibel.distanthorizons.common.util.ProxyUtil;
|
import com.seibel.distanthorizons.common.util.ProxyUtil;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
||||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||||
@@ -34,6 +35,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapp
|
|||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
||||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||||
//import io.netty.buffer.ByteBuf;
|
//import io.netty.buffer.ByteBuf;
|
||||||
|
import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
import net.minecraft.world.level.LevelAccessor;
|
||||||
|
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
@@ -54,10 +56,16 @@ import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
|||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.neoforged.neoforge.client.event.InputEvent;
|
import net.neoforged.neoforge.client.event.InputEvent;
|
||||||
import net.neoforged.neoforge.event.TickEvent;
|
|
||||||
import net.neoforged.bus.api.SubscribeEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import org.lwjgl.opengl.GL32;
|
import org.lwjgl.opengl.GL32;
|
||||||
|
|
||||||
|
#if MC_VER < MC_1_20_6
|
||||||
|
import net.neoforged.neoforge.event.TickEvent;
|
||||||
|
#else
|
||||||
|
import net.neoforged.neoforge.client.event.ClientTickEvent;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This handles all events sent to the client,
|
* This handles all events sent to the client,
|
||||||
* and is the starting point for most of the mod.
|
* and is the starting point for most of the mod.
|
||||||
@@ -72,8 +80,10 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy
|
|||||||
|
|
||||||
// private static SimpleChannel multiversePluginChannel;
|
// private static SimpleChannel multiversePluginChannel;
|
||||||
|
|
||||||
|
// Not the cleanest way of passing this to the LOD renderer, but it'll have to do for now
|
||||||
|
public static Mat4f currentModelViewMatrix = new Mat4f();
|
||||||
|
public static Mat4f currentProjectionMatrix = new Mat4f();
|
||||||
|
|
||||||
private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -90,6 +100,7 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy
|
|||||||
// tick events //
|
// tick events //
|
||||||
//=============//
|
//=============//
|
||||||
|
|
||||||
|
#if MC_VER < MC_1_20_6
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void clientTickEvent(TickEvent.ClientTickEvent event)
|
public void clientTickEvent(TickEvent.ClientTickEvent event)
|
||||||
{
|
{
|
||||||
@@ -98,6 +109,13 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy
|
|||||||
ClientApi.INSTANCE.clientTickEvent();
|
ClientApi.INSTANCE.clientTickEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
@SubscribeEvent
|
||||||
|
public void clientTickEvent(ClientTickEvent.Pre event)
|
||||||
|
{
|
||||||
|
ClientApi.INSTANCE.clientTickEvent();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -281,6 +299,16 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy
|
|||||||
// rendering //
|
// rendering //
|
||||||
//===========//
|
//===========//
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void beforeLevelRenderEvent(RenderLevelStageEvent event)
|
||||||
|
{
|
||||||
|
if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_SKY)
|
||||||
|
{
|
||||||
|
currentModelViewMatrix = McObjectConverter.Convert(event.getModelViewMatrix());
|
||||||
|
currentProjectionMatrix = McObjectConverter.Convert(event.getProjectionMatrix());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void afterLevelRenderEvent(RenderLevelStageEvent event)
|
public void afterLevelRenderEvent(RenderLevelStageEvent event)
|
||||||
{
|
{
|
||||||
@@ -301,4 +329,12 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//================//
|
||||||
|
// helper methods //
|
||||||
|
//================//
|
||||||
|
|
||||||
|
private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,13 +35,18 @@ import net.neoforged.fml.ModLoadingContext;
|
|||||||
import net.neoforged.fml.common.Mod;
|
import net.neoforged.fml.common.Mod;
|
||||||
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
import net.neoforged.fml.event.lifecycle.FMLDedicatedServerSetupEvent;
|
import net.neoforged.fml.event.lifecycle.FMLDedicatedServerSetupEvent;
|
||||||
import net.neoforged.neoforge.client.ConfigScreenHandler;
|
|
||||||
import net.neoforged.neoforge.common.NeoForge;
|
import net.neoforged.neoforge.common.NeoForge;
|
||||||
import net.neoforged.neoforge.event.RegisterCommandsEvent;
|
import net.neoforged.neoforge.event.RegisterCommandsEvent;
|
||||||
import net.neoforged.neoforge.event.server.ServerStartingEvent;
|
import net.neoforged.neoforge.event.server.ServerStartingEvent;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
#if MC_VER < MC_1_20_6
|
||||||
|
import net.neoforged.neoforge.client.ConfigScreenHandler;
|
||||||
|
#else
|
||||||
|
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize and setup the Mod. <br>
|
* Initialize and setup the Mod. <br>
|
||||||
* If you are looking for the real start of the mod
|
* If you are looking for the real start of the mod
|
||||||
@@ -70,8 +75,14 @@ public class NeoforgeMain extends AbstractModInitializer
|
|||||||
{
|
{
|
||||||
this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new);
|
this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new);
|
||||||
|
|
||||||
|
#if MC_VER < MC_1_20_6
|
||||||
ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class,
|
ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class,
|
||||||
() -> new ConfigScreenHandler.ConfigScreenFactory((client, parent) -> GetConfigScreen.getScreen(parent)));
|
() -> new ConfigScreenHandler.ConfigScreenFactory((client, parent) -> GetConfigScreen.getScreen(parent)));
|
||||||
|
#else
|
||||||
|
ModLoadingContext.get().registerExtensionPoint(IConfigScreenFactory.class,
|
||||||
|
// TODO fix potential null pointer
|
||||||
|
() -> (client, parent) -> GetConfigScreen.getScreen(parent));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+15
-3
@@ -12,7 +12,6 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
|||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
import net.minecraft.world.level.LevelAccessor;
|
||||||
import net.neoforged.neoforge.common.NeoForge;
|
import net.neoforged.neoforge.common.NeoForge;
|
||||||
import net.neoforged.neoforge.event.TickEvent;
|
|
||||||
import net.neoforged.neoforge.event.level.ChunkEvent;
|
import net.neoforged.neoforge.event.level.ChunkEvent;
|
||||||
import net.neoforged.neoforge.event.level.LevelEvent;
|
import net.neoforged.neoforge.event.level.LevelEvent;
|
||||||
import net.neoforged.bus.api.SubscribeEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
@@ -20,11 +19,17 @@ import net.neoforged.bus.api.SubscribeEvent;
|
|||||||
import net.neoforged.neoforge.event.server.ServerAboutToStartEvent;
|
import net.neoforged.neoforge.event.server.ServerAboutToStartEvent;
|
||||||
import net.neoforged.neoforge.event.server.ServerStoppingEvent;
|
import net.neoforged.neoforge.event.server.ServerStoppingEvent;
|
||||||
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
#if MC_VER < MC_1_20_6
|
||||||
|
import net.neoforged.neoforge.event.TickEvent;
|
||||||
|
#else
|
||||||
|
import net.neoforged.neoforge.event.tick.ServerTickEvent;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
public class NeoforgeServerProxy implements AbstractModInitializer.IEventProxy
|
public class NeoforgeServerProxy implements AbstractModInitializer.IEventProxy
|
||||||
{
|
{
|
||||||
private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); }
|
private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); }
|
||||||
@@ -58,7 +63,7 @@ public class NeoforgeServerProxy implements AbstractModInitializer.IEventProxy
|
|||||||
// events //
|
// events //
|
||||||
//========//
|
//========//
|
||||||
|
|
||||||
// ServerTickEvent (at end)
|
#if MC_VER < MC_1_20_6
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void serverTickEvent(TickEvent.ServerTickEvent event)
|
public void serverTickEvent(TickEvent.ServerTickEvent event)
|
||||||
{
|
{
|
||||||
@@ -67,6 +72,13 @@ public class NeoforgeServerProxy implements AbstractModInitializer.IEventProxy
|
|||||||
this.serverApi.serverTickEvent();
|
this.serverApi.serverTickEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
@SubscribeEvent
|
||||||
|
public void serverTickEvent(ServerTickEvent.Post event)
|
||||||
|
{
|
||||||
|
this.serverApi.serverTickEvent();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// ServerWorldLoadEvent
|
// ServerWorldLoadEvent
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|||||||
-75
@@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of the Distant Horizons mod
|
|
||||||
* licensed under the GNU LGPL v3 License.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020-2023 James Seibel
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.seibel.distanthorizons.neoforge.mixins.client;
|
|
||||||
|
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.NativeImage;
|
|
||||||
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
|
||||||
import com.seibel.distanthorizons.common.util.ILightTextureMarker;
|
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
@Mixin(DynamicTexture.class)
|
|
||||||
public abstract class MixinDynamicTexture implements ILightTextureMarker
|
|
||||||
{
|
|
||||||
/** Used to prevent accidentally using other dynamic textures as a lightmap */
|
|
||||||
@Unique
|
|
||||||
private boolean isLightTexture = false;
|
|
||||||
|
|
||||||
@Shadow
|
|
||||||
#if MC_VER >= MC_1_20_4
|
|
||||||
(remap = false)
|
|
||||||
#endif
|
|
||||||
@Final
|
|
||||||
private NativeImage pixels;
|
|
||||||
|
|
||||||
@Inject(method = "upload()V", at = @At("HEAD"))
|
|
||||||
public void updateLightTexture(CallbackInfo ci)
|
|
||||||
{
|
|
||||||
// since the light map is always updated on the client render thread we should be able to access the client level at the same time
|
|
||||||
IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
|
||||||
if (!this.isLightTexture
|
|
||||||
|| mc == null
|
|
||||||
|| mc.getWrappedClientLevel() == null
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//ApiShared.LOGGER.info("Lightmap update");
|
|
||||||
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
|
||||||
MinecraftRenderWrapper.INSTANCE.updateLightmap(this.pixels, clientLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void markLightTexture() { this.isLightTexture = true; }
|
|
||||||
|
|
||||||
}
|
|
||||||
+21
-30
@@ -19,10 +19,12 @@
|
|||||||
|
|
||||||
package com.seibel.distanthorizons.neoforge.mixins.client;
|
package com.seibel.distanthorizons.neoforge.mixins.client;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
#if MC_VER < MC_1_19_4
|
#if MC_VER < MC_1_19_4
|
||||||
import com.mojang.math.Matrix4f;
|
import com.mojang.math.Matrix4f;
|
||||||
#else
|
#else
|
||||||
|
import com.seibel.distanthorizons.neoforge.NeoforgeClientProxy;
|
||||||
import net.minecraft.client.Camera;
|
import net.minecraft.client.Camera;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GameRenderer;
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
@@ -67,30 +69,6 @@ public class MixinLevelRenderer
|
|||||||
(remap = false)
|
(remap = false)
|
||||||
#endif
|
#endif
|
||||||
private ClientLevel level;
|
private ClientLevel level;
|
||||||
@Unique
|
|
||||||
private static float previousPartialTicks = 0;
|
|
||||||
|
|
||||||
// TODO: Is there any reason why this is here? Can it be deleted?
|
|
||||||
public MixinLevelRenderer()
|
|
||||||
{
|
|
||||||
throw new NullPointerException("Null cannot be cast to non-null type.");
|
|
||||||
}
|
|
||||||
|
|
||||||
#if MC_VER < MC_1_17_1
|
|
||||||
@Inject(at = @At("RETURN"), method = "renderSky(Lcom/mojang/blaze3d/vertex/PoseStack;F)V")
|
|
||||||
private void renderSky(PoseStack matrixStackIn, float partialTicks, CallbackInfo callback)
|
|
||||||
#else
|
|
||||||
@Inject(method = "renderClouds", at = @At("HEAD"), cancellable = true)
|
|
||||||
public void renderClouds(PoseStack poseStack, Matrix4f projectionMatrix, float partialTicks, double cameraX, double cameraY, double cameraZ, CallbackInfo ci)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
// FIXME this is only called when clouds are enabled and vanilla render distance is far enough
|
|
||||||
// not having the partial ticks doesn't appear to be critical currently, but might cause weird issues down the line
|
|
||||||
|
|
||||||
// get the partial ticks since renderBlockLayer doesn't
|
|
||||||
// have access to them
|
|
||||||
previousPartialTicks = partialTicks;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#if MC_VER < MC_1_17_1
|
#if MC_VER < MC_1_17_1
|
||||||
@@ -108,12 +86,17 @@ public class MixinLevelRenderer
|
|||||||
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
||||||
cancellable = true)
|
cancellable = true)
|
||||||
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
|
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||||
#else
|
#elif MC_VER < MC_1_20_6
|
||||||
@Inject(at = @At("HEAD"),
|
@Inject(at = @At("HEAD"),
|
||||||
method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
||||||
cancellable = true)
|
cancellable = true)
|
||||||
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double camX, double camY, double camZ, Matrix4f projectionMatrix, CallbackInfo callback)
|
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double camX, double camY, double camZ, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||||
#endif
|
#else
|
||||||
|
@Inject(at = @At("HEAD"),
|
||||||
|
method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;DDDLorg/joml/Matrix4f;Lorg/joml/Matrix4f;)V",
|
||||||
|
cancellable = true)
|
||||||
|
private void renderChunkLayer(RenderType renderType, double x, double y, double z, Matrix4f projectionMatrix, Matrix4f frustumMatrix, CallbackInfo callback)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// get MC's model view and projection matrices
|
// get MC's model view and projection matrices
|
||||||
#if MC_VER == MC_1_16_5
|
#if MC_VER == MC_1_16_5
|
||||||
@@ -125,10 +108,15 @@ public class MixinLevelRenderer
|
|||||||
|
|
||||||
Mat4f mcModelViewMatrix = McObjectConverter.Convert(matrixStackIn.last().pose());
|
Mat4f mcModelViewMatrix = McObjectConverter.Convert(matrixStackIn.last().pose());
|
||||||
|
|
||||||
#else
|
#elif MC_VER <= MC_1_20_4
|
||||||
// get the matrices directly from MC
|
// get the matrices directly from MC
|
||||||
Mat4f mcModelViewMatrix = McObjectConverter.Convert(modelViewMatrixStack.last().pose());
|
Mat4f mcModelViewMatrix = McObjectConverter.Convert(modelViewMatrixStack.last().pose());
|
||||||
Mat4f mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix);
|
Mat4f mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix);
|
||||||
|
#else
|
||||||
|
// get the matrices from neoForge's render event.
|
||||||
|
// We can't call the renderer there because we don't have access to the level that's being rendered
|
||||||
|
Mat4f mcModelViewMatrix = NeoforgeClientProxy.currentModelViewMatrix;
|
||||||
|
Mat4f mcProjectionMatrix = NeoforgeClientProxy.currentProjectionMatrix;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -136,11 +124,11 @@ public class MixinLevelRenderer
|
|||||||
// only render before solid blocks
|
// only render before solid blocks
|
||||||
if (renderType.equals(RenderType.solid()))
|
if (renderType.equals(RenderType.solid()))
|
||||||
{
|
{
|
||||||
ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime());
|
ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime());
|
||||||
}
|
}
|
||||||
else if (renderType.equals(RenderType.translucent()))
|
else if (renderType.equals(RenderType.translucent()))
|
||||||
{
|
{
|
||||||
ClientApi.INSTANCE.renderDeferredLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime());
|
ClientApi.INSTANCE.renderDeferredLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.Client.Advanced.Debugging.lodOnlyMode.get())
|
if (Config.Client.Advanced.Debugging.lodOnlyMode.get())
|
||||||
@@ -155,9 +143,12 @@ public class MixinLevelRenderer
|
|||||||
#elif MC_VER < MC_1_20_1
|
#elif MC_VER < MC_1_20_1
|
||||||
@Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel")
|
@Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel")
|
||||||
public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci)
|
public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci)
|
||||||
#else
|
#elif MC_VER < MC_1_20_6
|
||||||
@Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runLightUpdates()I"), method = "renderLevel")
|
@Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runLightUpdates()I"), method = "renderLevel")
|
||||||
private void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci)
|
private void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci)
|
||||||
|
#else
|
||||||
|
@Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runLightUpdates()I"), method = "renderLevel")
|
||||||
|
private void callAfterRunUpdates(CallbackInfo ci)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ChunkWrapper.syncedUpdateClientLightStatus();
|
ChunkWrapper.syncedUpdateClientLightStatus();
|
||||||
|
|||||||
+19
-8
@@ -20,10 +20,13 @@
|
|||||||
package com.seibel.distanthorizons.neoforge.mixins.client;
|
package com.seibel.distanthorizons.neoforge.mixins.client;
|
||||||
|
|
||||||
|
|
||||||
import com.seibel.distanthorizons.common.util.ILightTextureMarker;
|
import com.mojang.blaze3d.platform.NativeImage;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||||
import net.minecraft.client.renderer.LightTexture;
|
import net.minecraft.client.renderer.LightTexture;
|
||||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -36,13 +39,21 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
public class MixinLightTexture
|
public class MixinLightTexture
|
||||||
{
|
{
|
||||||
@Shadow
|
@Shadow
|
||||||
#if MC_VER >= MC_1_20_4
|
|
||||||
(remap = false)
|
|
||||||
#endif
|
|
||||||
@Final
|
@Final
|
||||||
private DynamicTexture lightTexture;
|
private NativeImage lightPixels;
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("RETURN"))
|
|
||||||
public void markLightTexture(CallbackInfo ci) { ((ILightTextureMarker) this.lightTexture).markLightTexture(); }
|
@Inject(method = "updateLightTexture(F)V", at = @At("RETURN"))
|
||||||
|
public void updateLightTexture(float partialTicks, CallbackInfo ci)
|
||||||
|
{
|
||||||
|
IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
||||||
|
if (mc == null || mc.getWrappedClientLevel() == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
||||||
|
MinecraftRenderWrapper.INSTANCE.updateLightmap(this.lightPixels, clientLevel);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+37
-34
@@ -24,41 +24,44 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
@Mixin(Minecraft.class)
|
@Mixin(Minecraft.class)
|
||||||
public class MixinMinecraft
|
public class MixinMinecraft
|
||||||
{
|
{
|
||||||
#if MC_VER < MC_1_20_2
|
// commented out due to a bug with Manifold and having nested preprocessors
|
||||||
#if MC_VER == MC_1_20_1
|
// and since neoforge doesn't work for anything before MC 1.20.6 anyway it doesn't need to be included
|
||||||
@Redirect(
|
|
||||||
method = "Lnet/minecraft/client/Minecraft;setInitialScreen(Lcom/mojang/realmsclient/client/RealmsClient;Lnet/minecraft/server/packs/resources/ReloadInstance;Lnet/minecraft/client/main/GameConfig$QuickPlayData;)V",
|
|
||||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V")
|
|
||||||
)
|
|
||||||
public void onOpenScreen(Minecraft instance, Screen guiScreen)
|
|
||||||
{
|
|
||||||
#else
|
|
||||||
@Redirect(
|
|
||||||
method = "<init>(Lnet/minecraft/client/main/GameConfig;)V",
|
|
||||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V")
|
|
||||||
)
|
|
||||||
public void onOpenScreen(Minecraft instance, Screen guiScreen)
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
if (!Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get()) // Don't do anything if the user doesn't want it
|
|
||||||
{
|
|
||||||
instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SelfUpdater.onStart())
|
//#if MC_VER < MC_1_20_2
|
||||||
{
|
//#if MC_VER == MC_1_20_1
|
||||||
instance.setScreen(new UpdateModScreen(
|
//@Redirect(
|
||||||
new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons
|
// method = "Lnet/minecraft/client/Minecraft;setInitialScreen(Lcom/mojang/realmsclient/client/RealmsClient;Lnet/minecraft/server/packs/resources/ReloadInstance;Lnet/minecraft/client/main/GameConfig$QuickPlayData;)V",
|
||||||
(Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"))
|
// at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V")
|
||||||
));
|
//)
|
||||||
}
|
//public void onOpenScreen(Minecraft instance, Screen guiScreen)
|
||||||
else
|
//{
|
||||||
{
|
//#else
|
||||||
instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened
|
//@Redirect(
|
||||||
}
|
// method = "<init>(Lnet/minecraft/client/main/GameConfig;)V",
|
||||||
}
|
// at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V")
|
||||||
#endif
|
//)
|
||||||
|
//public void onOpenScreen(Minecraft instance, Screen guiScreen)
|
||||||
|
//{
|
||||||
|
//#endif
|
||||||
|
// if (!Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get()) // Don't do anything if the user doesn't want it
|
||||||
|
// {
|
||||||
|
// instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (SelfUpdater.onStart())
|
||||||
|
// {
|
||||||
|
// instance.setScreen(new UpdateModScreen(
|
||||||
|
// new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons
|
||||||
|
// (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"))
|
||||||
|
// ));
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//#endif
|
||||||
|
|
||||||
#if MC_VER >= MC_1_20_2
|
#if MC_VER >= MC_1_20_2
|
||||||
@Redirect(
|
@Redirect(
|
||||||
|
|||||||
+91
-26
@@ -30,52 +30,117 @@ import net.minecraft.network.chat.Component;
|
|||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
#endif
|
#endif
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
#if MC_VER == MC_1_20_6
|
||||||
|
import net.minecraft.client.gui.layouts.LinearLayout;
|
||||||
|
import net.minecraft.client.gui.layouts.HeaderAndFooterLayout;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a button to the menu to goto the config
|
* Adds a button to the menu to goto the config
|
||||||
*
|
*
|
||||||
* @author coolGi
|
* @author coolGi
|
||||||
* @version 12-02-2021
|
* @version 2024-5-20
|
||||||
*/
|
*/
|
||||||
@Mixin(OptionsScreen.class)
|
@Mixin(OptionsScreen.class)
|
||||||
public class MixinOptionsScreen extends Screen
|
public class MixinOptionsScreen extends Screen
|
||||||
{
|
{
|
||||||
// Get the texture for the button
|
/** Texture used for the config opening button */
|
||||||
|
@Unique
|
||||||
private static final ResourceLocation ICON_TEXTURE = new ResourceLocation(ModInfo.ID, "textures/gui/button.png");
|
private static final ResourceLocation ICON_TEXTURE = new ResourceLocation(ModInfo.ID, "textures/gui/button.png");
|
||||||
protected MixinOptionsScreen(Component title)
|
|
||||||
{
|
|
||||||
super(title);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "init")
|
|
||||||
|
@Unique
|
||||||
|
private TexturedButtonWidget optionsButton = null;
|
||||||
|
|
||||||
|
#if MC_VER == MC_1_20_6
|
||||||
|
@Shadow
|
||||||
|
@Final
|
||||||
|
protected HeaderAndFooterLayout layout;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//==============//
|
||||||
|
// constructors //
|
||||||
|
//==============//
|
||||||
|
|
||||||
|
protected MixinOptionsScreen(Component title) { super(title); }
|
||||||
|
|
||||||
|
@Inject(at = @At("RETURN"), method = "init")
|
||||||
private void lodconfig$init(CallbackInfo ci)
|
private void lodconfig$init(CallbackInfo ci)
|
||||||
{
|
{
|
||||||
if (Config.Client.optionsButton.get())
|
if (Config.Client.optionsButton.get())
|
||||||
this. #if MC_VER < MC_1_17_1 addButton #else addRenderableWidget #endif
|
{
|
||||||
(new TexturedButtonWidget(
|
#if MC_VER < MC_1_17_1
|
||||||
// Where the button is on the screen
|
this.addButton(this.getOptionsButton());
|
||||||
this.width / 2 - 180, this.height / 6 - 12,
|
#elif MC_VER < MC_1_20_6
|
||||||
// Width and height of the button
|
this.addRenderableWidget(this.getOptionsButton());
|
||||||
20, 20,
|
#else
|
||||||
// Offset
|
|
||||||
0, 0,
|
// add the button so it's rendered
|
||||||
// Some textuary stuff
|
this.addRenderableWidget(this.getOptionsButton());
|
||||||
20, ICON_TEXTURE, 20, 40,
|
|
||||||
// Create the button and tell it where to go
|
// add the button to the correct location in the UI
|
||||||
// For now it goes to the client option by default
|
// TODO is there a better way to do this instead of using access transformers to inject into the exact UI elements?
|
||||||
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(GetConfigScreen.getScreen(this)),
|
// TODO is there a way we can put the button on the left side of the FOV bar like before?
|
||||||
// Add a title to the button
|
LinearLayout layout = (LinearLayout) this.layout.headerFrame.children.get(0).child;
|
||||||
#if MC_VER < MC_1_19_2
|
|
||||||
new TranslatableComponent(ModInfo.ID + ".title")));
|
// determine how wide the other option buttons are so we can put our botton to the left of them all
|
||||||
#else
|
AtomicInteger width = new AtomicInteger(0);
|
||||||
Component.translatable(ModInfo.ID + ".title")));
|
layout.visitChildren(x -> { width.addAndGet(x.getWidth()); });
|
||||||
#endif
|
width.addAndGet(-10); // padding between the DH button and the FOV slider
|
||||||
|
|
||||||
|
layout.wrapped.addChild(this.getOptionsButton(), 1, 2, (settings) -> { settings.paddingLeft(width.get() * -1); });
|
||||||
|
layout.arrangeElements();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//================//
|
||||||
|
// helper methods //
|
||||||
|
//================//
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
public TexturedButtonWidget getOptionsButton()
|
||||||
|
{
|
||||||
|
if (this.optionsButton == null)
|
||||||
|
{
|
||||||
|
this.optionsButton
|
||||||
|
= new TexturedButtonWidget(
|
||||||
|
// Where the button is on the screen
|
||||||
|
this.width / 2 - 180, this.height / 6 - 12,
|
||||||
|
// Width and height of the button
|
||||||
|
20, 20,
|
||||||
|
// texture UV Offset
|
||||||
|
0, 0,
|
||||||
|
// Some textuary stuff
|
||||||
|
20, ICON_TEXTURE, 20, 40,
|
||||||
|
// Create the button and tell it where to go
|
||||||
|
// For now it goes to the client option by default
|
||||||
|
(buttonWidget) -> Objects.requireNonNull(this.minecraft).setScreen(GetConfigScreen.getScreen(this)),
|
||||||
|
// Add a title to the button
|
||||||
|
#if MC_VER < MC_1_19_2
|
||||||
|
new TranslatableComponent(ModInfo.ID + ".title"));
|
||||||
|
#else
|
||||||
|
Component.translatable(ModInfo.ID + ".title"));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.optionsButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
-126
@@ -1,126 +0,0 @@
|
|||||||
package com.seibel.distanthorizons.neoforge.mixins.client;
|
|
||||||
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.block.BlockStateWrapper;
|
|
||||||
|
|
||||||
#if FALSE
|
|
||||||
@Mixin(WorldUpgrader.class)
|
|
||||||
public class MixinWorldUpgrader {
|
|
||||||
static class FakeLevelWrapper implements IServerLevelWrapper {
|
|
||||||
private Path saveFolder;
|
|
||||||
private LevelStem stem;
|
|
||||||
private DimensionType dimension;
|
|
||||||
private DimensionTypeWrapper dimensionTypeWrapper;
|
|
||||||
|
|
||||||
public FakeLevelWrapper(LevelStorageSource.LevelStorageAccess storage, WorldGenSettings gen, ResourceKey<Level> dim) {
|
|
||||||
saveFolder = storage.getDimensionPath(dim);
|
|
||||||
stem = gen.dimensions().getOrThrow(WorldGenSettings.levelToLevelStem(dim));
|
|
||||||
dimension = stem.typeHolder().value();
|
|
||||||
dimensionTypeWrapper = DimensionTypeWrapper.getDimensionTypeWrapper(dimension);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EDhApiLevelType getLevelType() {
|
|
||||||
return EDhApiLevelType.SERVER_LEVEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IDhApiDimensionTypeWrapper getDimensionType() {
|
|
||||||
return dimensionTypeWrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getBlockLight(int x, int y, int z) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSkyLight(int x, int y, int z) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasCeiling() {
|
|
||||||
return dimension.hasCeiling();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasSkyLight() {
|
|
||||||
return dimension.hasSkyLight();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHeight() {
|
|
||||||
return dimension.height();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMinHeight() {
|
|
||||||
return dimension.minY();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasChunkLoaded(int chunkX, int chunkZ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockStateWrapper getBlockState(DhBlockPos pos) {
|
|
||||||
return BlockStateWrapper.AIR;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBiomeWrapper getBiome(DhBlockPos pos) {
|
|
||||||
throw new UnsupportedOperationException("Not implemented yet");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getWrappedMcObject() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public IClientLevelWrapper tryGetClientLevelWrapper() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public File getSaveFolder() {
|
|
||||||
return saveFolder.toFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Unique
|
|
||||||
private DhServerLevel dhServerLevel;
|
|
||||||
@Unique
|
|
||||||
private FakeLevelWrapper fakeLevelWrapper;
|
|
||||||
@Unique
|
|
||||||
public LocalSaveStructure saveStructure;
|
|
||||||
|
|
||||||
@Shadow @Final
|
|
||||||
private DimensionDataStorage overworldDataStorage;
|
|
||||||
@Shadow @Final
|
|
||||||
private LevelStorageSource.LevelStorageAccess levelStorage;
|
|
||||||
@Shadow @Final
|
|
||||||
private WorldGenSettings worldGenSettings;
|
|
||||||
|
|
||||||
@Inject(method = "Lnet/minecraft/util/worldupdate/WorldUpgrader;work()V",
|
|
||||||
at = @At(value = "INVOKE")
|
|
||||||
)
|
|
||||||
private void initWorldUpgrade() {
|
|
||||||
saveStructure = new LocalSaveStructure();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "Lnet/minecraft/util/worldupdate/WorldUpgrader;work()V",
|
|
||||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/worldupdate/WorldUpgrader;getAllChunkPos(Lnet/minecraft/resources/ResourceKey;)Ljava/util/List;", shift = At.Shift.AFTER),
|
|
||||||
locals = LocalCapture.CAPTURE_FAILSOFT
|
|
||||||
)
|
|
||||||
private void startWorldUpgrade(CallbackInfo info, ResourceKey resourceKey) {
|
|
||||||
ResourceKey<Level> key = resourceKey;
|
|
||||||
fakeLevelWrapper = new FakeLevelWrapper(levelStorage, worldGenSettings, key);
|
|
||||||
dhServerLevel = new DhServerLevel(saveStructure, fakeLevelWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
-59
@@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of the Distant Horizons mod
|
|
||||||
* licensed under the GNU LGPL v3 License.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020-2023 James Seibel
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.seibel.distanthorizons.neoforge.mixins.server.unsafe;
|
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
#if MC_VER >= MC_1_18_2
|
|
||||||
|
|
||||||
import net.minecraft.util.ThreadingDetector;
|
|
||||||
import org.spongepowered.asm.mixin.Mutable;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
import java.util.concurrent.Semaphore;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Why does this exist? But okay! (Will be probably removed when the experimental generator is done)
|
|
||||||
* FIXME: Recheck this // STILL check this
|
|
||||||
*/
|
|
||||||
@Mixin(ThreadingDetector.class)
|
|
||||||
public class MixinThreadingDetector
|
|
||||||
{
|
|
||||||
@Mutable
|
|
||||||
@Shadow
|
|
||||||
private Semaphore lock;
|
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("RETURN"))
|
|
||||||
private void setSemaphore(CallbackInfo ci)
|
|
||||||
{
|
|
||||||
this.lock = new Semaphore(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
|
||||||
|
|
||||||
@Mixin(ChunkGenerator.class)
|
|
||||||
public class MixinThreadingDetector { }
|
|
||||||
#endif
|
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "com.seibel.distanthorizons.neoforge.mixins",
|
"package": "com.seibel.distanthorizons.neoforge.mixins",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"server.unsafe.MixinThreadingDetector",
|
|
||||||
"server.MixinUtilBackgroundThread",
|
"server.MixinUtilBackgroundThread",
|
||||||
"server.MixinChunkGenerator",
|
"server.MixinChunkGenerator",
|
||||||
"server.MixinTFChunkGenerator"
|
"server.MixinTFChunkGenerator"
|
||||||
@@ -14,7 +13,6 @@
|
|||||||
"client.MixinFogRenderer",
|
"client.MixinFogRenderer",
|
||||||
"client.MixinGameRenderer",
|
"client.MixinGameRenderer",
|
||||||
"client.MixinLevelRenderer",
|
"client.MixinLevelRenderer",
|
||||||
"client.MixinDynamicTexture",
|
|
||||||
"client.MixinLightTexture",
|
"client.MixinLightTexture",
|
||||||
"client.MixinOptionsScreen",
|
"client.MixinOptionsScreen",
|
||||||
"client.MixinTextureUtil"
|
"client.MixinTextureUtil"
|
||||||
|
|||||||
+3
-4
@@ -24,13 +24,12 @@ issueTrackerURL = "${issues}"
|
|||||||
acceptableRemoteVersions = "*"
|
acceptableRemoteVersions = "*"
|
||||||
|
|
||||||
# We may need this to make forge (lexforge) & neoforge work together
|
# We may need this to make forge (lexforge) & neoforge work together
|
||||||
#[[mixins]]
|
[[mixins]]
|
||||||
# config = "DistantHorizons.neoforge.mixins.json"
|
config = "DistantHorizons.neoforge.mixins.json"
|
||||||
|
|
||||||
[[dependencies.distanthorizons]]
|
[[dependencies.distanthorizons]]
|
||||||
modId = "minecraft"
|
modId = "minecraft"
|
||||||
mandatory = true # Forge syntax
|
type = "required"
|
||||||
type = "required" # Neoforge syntax
|
|
||||||
versionRange = "${compatible_forgemc_versions}" # Where we set what version of mc it is avalible for
|
versionRange = "${compatible_forgemc_versions}" # Where we set what version of mc it is avalible for
|
||||||
ordering = "NONE"
|
ordering = "NONE"
|
||||||
side = "BOTH"
|
side = "BOTH"
|
||||||
@@ -22,7 +22,7 @@ fabric_api_version=0.42.0+1.16
|
|||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
fabric_incompatibility_list={ "iris": "*" }
|
fabric_incompatibility_list={ "iris": "*" }
|
||||||
fabric_recommend_list={ "indium": "*" }
|
fabric_recommend_list={}
|
||||||
|
|
||||||
# Fabric mod run
|
# Fabric mod run
|
||||||
# 0 = Don't enable and don't run
|
# 0 = Don't enable and don't run
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ fabric_api_version=0.46.1+1.17
|
|||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
fabric_incompatibility_list={ "iris": "*" }
|
fabric_incompatibility_list={ "iris": "*" }
|
||||||
fabric_recommend_list={ "indium": "*" }
|
fabric_recommend_list={}
|
||||||
|
|
||||||
# Fabric mod run
|
# Fabric mod run
|
||||||
# 0 = Don't enable and don't run
|
# 0 = Don't enable and don't run
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ fabric_api_version=0.76.0+1.18.2
|
|||||||
canvas_version=mc118:1.0.2616
|
canvas_version=mc118:1.0.2616
|
||||||
|
|
||||||
fabric_incompatibility_list={ "iris": "*" }
|
fabric_incompatibility_list={ "iris": "*" }
|
||||||
fabric_recommend_list={ "indium": "*" }
|
fabric_recommend_list={}
|
||||||
|
|
||||||
# Fabric mod run
|
# Fabric mod run
|
||||||
# 0 = Don't enable and don't run
|
# 0 = Don't enable and don't run
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ fabric_api_version=0.76.1+1.19.2
|
|||||||
canvas_version=mc119-1.0.2480
|
canvas_version=mc119-1.0.2480
|
||||||
|
|
||||||
fabric_incompatibility_list={ "iris": "*" }
|
fabric_incompatibility_list={ "iris": "*" }
|
||||||
fabric_recommend_list={ "indium": "*" }
|
fabric_recommend_list={}
|
||||||
|
|
||||||
# Fabric mod run
|
# Fabric mod run
|
||||||
# 0 = Don't enable and don't run
|
# 0 = Don't enable and don't run
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ fabric_api_version=0.87.1+1.19.4
|
|||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
fabric_incompatibility_list={ "iris": "*" }
|
fabric_incompatibility_list={ "iris": "*" }
|
||||||
fabric_recommend_list={ "indium": "*" }
|
fabric_recommend_list={}
|
||||||
|
|
||||||
# Fabric mod run
|
# Fabric mod run
|
||||||
# 0 = Don't enable and don't run
|
# 0 = Don't enable and don't run
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ accessWidenerVersion=1_20
|
|||||||
builds_for=fabric,forge
|
builds_for=fabric,forge
|
||||||
|
|
||||||
# Fabric loader
|
# Fabric loader
|
||||||
fabric_loader_version=0.14.24
|
fabric_loader_version=0.15.6
|
||||||
fabric_api_version=0.90.4+1.20.1
|
fabric_api_version=0.90.4+1.20.1
|
||||||
# Fabric mod versions
|
# Fabric mod versions
|
||||||
modmenu_version=7.2.2
|
modmenu_version=7.2.2
|
||||||
@@ -21,7 +21,7 @@ fabric_api_version=0.90.4+1.20.1
|
|||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
fabric_incompatibility_list={ "iris": "<=1.6.20" }
|
fabric_incompatibility_list={ "iris": "<=1.6.20" }
|
||||||
fabric_recommend_list={ "indium": "*" }
|
fabric_recommend_list={}
|
||||||
|
|
||||||
# Fabric mod run
|
# Fabric mod run
|
||||||
# 0 = Don't enable and don't run
|
# 0 = Don't enable and don't run
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ accessWidenerVersion=1_20_2
|
|||||||
builds_for=fabric,forge
|
builds_for=fabric,forge
|
||||||
|
|
||||||
# Fabric loader
|
# Fabric loader
|
||||||
fabric_loader_version=0.14.24
|
fabric_loader_version=0.15.6
|
||||||
fabric_api_version=0.90.4+1.20.2
|
fabric_api_version=0.90.4+1.20.2
|
||||||
# Fabric mod versions
|
# Fabric mod versions
|
||||||
modmenu_version=8.0.0
|
modmenu_version=8.0.0
|
||||||
@@ -21,7 +21,7 @@ fabric_api_version=0.90.4+1.20.2
|
|||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
fabric_incompatibility_list={ "iris": "<=1.6.20" }
|
fabric_incompatibility_list={ "iris": "<=1.6.20" }
|
||||||
fabric_recommend_list={ "indium": "*" }
|
fabric_recommend_list={}
|
||||||
|
|
||||||
# Fabric mod run
|
# Fabric mod run
|
||||||
# 0 = Don't enable and don't run
|
# 0 = Don't enable and don't run
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ builds_for=fabric,forge
|
|||||||
# neoforge can be added once the issue with mixins has been resolved
|
# neoforge can be added once the issue with mixins has been resolved
|
||||||
|
|
||||||
# Fabric loader
|
# Fabric loader
|
||||||
fabric_loader_version=0.15.1
|
fabric_loader_version=0.15.6
|
||||||
fabric_api_version=0.91.2+1.20.4
|
fabric_api_version=0.91.2+1.20.4
|
||||||
# Fabric mod versions
|
# Fabric mod versions
|
||||||
modmenu_version=9.0.0-pre.1
|
modmenu_version=9.0.0-pre.1
|
||||||
@@ -22,7 +22,7 @@ fabric_api_version=0.91.2+1.20.4
|
|||||||
canvas_version=
|
canvas_version=
|
||||||
|
|
||||||
fabric_incompatibility_list={ "iris": "<=1.6.20" }
|
fabric_incompatibility_list={ "iris": "<=1.6.20" }
|
||||||
fabric_recommend_list={ "indium": "*" }
|
fabric_recommend_list={}
|
||||||
|
|
||||||
# Fabric mod run
|
# Fabric mod run
|
||||||
# 0 = Don't enable and don't run
|
# 0 = Don't enable and don't run
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
# 1.20.6 version
|
||||||
|
java_version=21
|
||||||
|
minecraft_version=1.20.6
|
||||||
|
parchment_version=1.20.6:2024.05.01
|
||||||
|
compatible_minecraft_versions=["1.20.6"]
|
||||||
|
accessWidenerVersion=1_20_6
|
||||||
|
builds_for=fabric,neoforge
|
||||||
|
# forge is broken due to gradle/build script issues
|
||||||
|
|
||||||
|
# Fabric loader
|
||||||
|
fabric_loader_version=0.15.10
|
||||||
|
fabric_api_version=0.97.8+1.20.6
|
||||||
|
# Fabric mod versions
|
||||||
|
modmenu_version=10.0.0-beta.1
|
||||||
|
starlight_version_fabric=
|
||||||
|
phosphor_version_fabric=
|
||||||
|
lithium_version=
|
||||||
|
sodium_version=mc1.20.6-0.5.8
|
||||||
|
iris_version=1.7.0+1.20.6
|
||||||
|
bclib_version=
|
||||||
|
immersive_portals_version=
|
||||||
|
canvas_version=
|
||||||
|
|
||||||
|
fabric_incompatibility_list={ "iris": "<=1.6.20" }
|
||||||
|
fabric_recommend_list={}
|
||||||
|
|
||||||
|
# Fabric mod run
|
||||||
|
# 0 = Don't enable and don't run
|
||||||
|
# 1 = Can be referenced in code but doesn't run
|
||||||
|
# 2 = Can be referenced in code and runs in client
|
||||||
|
enable_starlight=0
|
||||||
|
enable_phosphor=0
|
||||||
|
enable_sodium=1
|
||||||
|
enable_lithium=0
|
||||||
|
enable_iris=1
|
||||||
|
enable_bclib=0
|
||||||
|
enable_immersive_portals=0
|
||||||
|
enable_canvas=0
|
||||||
|
|
||||||
|
# (Neo)Forge loader
|
||||||
|
forge_version=50.0.19
|
||||||
|
neoforge_version=20.6.70-beta
|
||||||
|
# (Neo)Forge mod versions
|
||||||
|
starlight_version_forge=
|
||||||
|
terraforged_version=
|
||||||
|
|
||||||
|
# (Neo)Forge mod run
|
||||||
|
# 0 = Don't enable and don't run
|
||||||
|
# 1 = Can be referenced in code but doesn't run
|
||||||
|
# 2 = Can be referenced in code and runs in client
|
||||||
|
enable_starlight_forge=0
|
||||||
|
enable_terraforged=0
|
||||||
|
enable_terrafirmacraft=0
|
||||||
Reference in New Issue
Block a user