Downported stuff from 1.17 to 1.16
This commit is contained in:
+2
-1
@@ -70,7 +70,8 @@ allprojects {
|
||||
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
|
||||
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
|
||||
// We'll use that if it's available, but otherwise we'll use the older option.
|
||||
def targetVersion = 8
|
||||
// def targetVersion = 8
|
||||
def targetVersion = 16 // This is using java 16 for now till it is fixed, use the line above when fixed
|
||||
if (JavaVersion.current().isJava9Compatible()) {
|
||||
options.release = targetVersion
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class Config extends ConfigGui
|
||||
@ConfigAnnotations.ScreenEntry
|
||||
public static FogQuality fogQuality;
|
||||
|
||||
@ConfigAnnotations.ScreenEntry
|
||||
// @ConfigAnnotations.ScreenEntry // TODO: This isnt done in 1.16 branch
|
||||
public static CloudQuality cloudQuality;
|
||||
|
||||
@ConfigAnnotations.ScreenEntry
|
||||
|
||||
@@ -31,30 +31,21 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
{
|
||||
private ChunkAccess chunk;
|
||||
private BlockAndTintGetter lightSource;
|
||||
private final int CHUNK_SECTION_SHIFT = 4;
|
||||
private final int CHUNK_SECTION_MASK = 0b1111;
|
||||
private final int CHUNK_SIZE_SHIFT = 4;
|
||||
private final int CHUNK_SIZE_MASK = 0b1111;
|
||||
|
||||
@Override
|
||||
public int getHeight(){
|
||||
return chunk.getMaxBuildHeight();
|
||||
return 255;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPositionInWater(int x, int y, int z)
|
||||
public int getMinBuildHeight()
|
||||
{
|
||||
BlockState blockState = chunk.getSections()[y >> CHUNK_SECTION_SHIFT].getBlockState(x & CHUNK_SIZE_MASK, y & CHUNK_SECTION_MASK, z & CHUNK_SIZE_MASK);
|
||||
|
||||
//This type of block is always in water
|
||||
if((blockState.getBlock() instanceof LiquidBlock))// && !(blockState.getBlock() instanceof IWaterLoggable))
|
||||
return true;
|
||||
|
||||
//This type of block could be in water
|
||||
if(blockState.getOptionalValue(BlockStateProperties.WATERLOGGED).isPresent() && blockState.getOptionalValue(BlockStateProperties.WATERLOGGED).get())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getMaxBuildHeight()
|
||||
{
|
||||
return chunk.getMaxBuildHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,22 +57,23 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
@Override
|
||||
public IBiomeWrapper getBiome(int x, int y, int z)
|
||||
{
|
||||
return BiomeWrapper.getBiomeWrapper(chunk.getBiomes().getNoiseBiome((x & CHUNK_SIZE_MASK) >> 2, y >> 2, (z & CHUNK_SIZE_MASK) >> 2));
|
||||
return BiomeWrapper.getBiomeWrapper(chunk.getBiomes().getNoiseBiome(
|
||||
x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockColorWrapper getBlockColorWrapper(int x, int y, int z)
|
||||
{
|
||||
Block block = chunk.getSections()[y >> CHUNK_SECTION_SHIFT].getBlockState(x & CHUNK_SIZE_MASK, y & CHUNK_SECTION_MASK, z & CHUNK_SIZE_MASK).getBlock();
|
||||
BlockState blockState = chunk.getBlockState(new BlockPos(x,y,z));
|
||||
Block block = blockState.getBlock();
|
||||
return BlockColorWrapper.getBlockColorWrapper(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockShapeWrapper getBlockShapeWrapper(int x, int y, int z)
|
||||
{
|
||||
LevelChunkSection section = chunk.getSections()[y >> CHUNK_SECTION_SHIFT];
|
||||
if (section == null) return null;
|
||||
Block block = section.getBlockState(x & CHUNK_SIZE_MASK, y & CHUNK_SECTION_MASK, z & CHUNK_SIZE_MASK).getBlock();
|
||||
BlockState blockState = chunk.getBlockState(new BlockPos(x,y,z));
|
||||
Block block = blockState.getBlock();
|
||||
return BlockShapeWrapper.getBlockShapeWrapper(block, this, x, y, z);
|
||||
}
|
||||
|
||||
@@ -122,7 +114,7 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
|
||||
@Override
|
||||
public int getMaxY(int x, int z) {
|
||||
return chunk.getHeight(Heightmap.Types.MOTION_BLOCKING, x, z);
|
||||
return chunk.getHeight(Heightmap.Types.MOTION_BLOCKING, Math.floorMod(x, 16), Math.floorMod(z, 16));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -149,11 +141,9 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
|
||||
public boolean isWaterLogged(int x, int y, int z)
|
||||
{
|
||||
LevelChunkSection section = chunk.getSections()[y >> CHUNK_SECTION_SHIFT];
|
||||
if (section == null) return false;
|
||||
BlockState blockState = section.getBlockState(x & CHUNK_SIZE_MASK, y & CHUNK_SECTION_MASK, z & CHUNK_SIZE_MASK);
|
||||
BlockState blockState = chunk.getBlockState(new BlockPos(x,y,z));
|
||||
|
||||
//This type of block is always in water
|
||||
//This type of block is always in water
|
||||
return (!(blockState.getBlock() instanceof LiquidBlockContainer) && (blockState.getBlock() instanceof SimpleWaterloggedBlock))
|
||||
&& (blockState.hasProperty(BlockStateProperties.WATERLOGGED) && blockState.getValue(BlockStateProperties.WATERLOGGED));
|
||||
}
|
||||
|
||||
+44
-2
@@ -15,6 +15,10 @@ import com.seibel.lod.core.api.ModAccessorApi;
|
||||
import com.seibel.lod.core.handlers.IReflectionHandler;
|
||||
import com.seibel.lod.core.handlers.ReflectionHandler;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.util.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.ISodiumAccessor;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectList;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
@@ -109,7 +113,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
GL15.glGetFloatv(GL15.GL_FOG_COLOR, colorValues);
|
||||
return new Color(colorValues[0], colorValues[1], colorValues[2], colorValues[3]);
|
||||
}
|
||||
// getUnderWaterFogColor() is the same as getFogColor()
|
||||
// getSpecialFogColor() is the same as getFogColor()
|
||||
|
||||
@Override
|
||||
public Color getSkyColor() {
|
||||
@@ -155,6 +159,12 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
if (sodium != null) {
|
||||
return sodium.getNormalRenderedChunks();
|
||||
}
|
||||
IOptifineAccessor optifine = ModAccessorApi.get(IOptifineAccessor.class);
|
||||
if (optifine != null) {
|
||||
HashSet<AbstractChunkPosWrapper> pos = optifine.getNormalRenderedChunks();
|
||||
if (pos==null) pos = getMaximumRenderedChunks();
|
||||
return pos;
|
||||
}
|
||||
LevelRenderer levelRenderer = MC.levelRenderer;
|
||||
ObjectList<LevelRenderer.RenderChunkInfo> chunks = levelRenderer.renderChunks;
|
||||
return (chunks.stream().map((chunk) -> {
|
||||
@@ -164,6 +174,32 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
}).collect(Collectors.toCollection(HashSet::new)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<AbstractChunkPosWrapper> getMaximumRenderedChunks()
|
||||
{
|
||||
IMinecraftWrapper mcWrapper = SingletonHandler.get(IMinecraftWrapper.class);
|
||||
IWrapperFactory factory = SingletonHandler.get(IWrapperFactory.class);
|
||||
|
||||
int chunkRenderDist = this.getRenderDistance();
|
||||
|
||||
AbstractChunkPosWrapper centerChunkPos = mcWrapper.getPlayerChunkPos();
|
||||
int startChunkX = centerChunkPos.getX() - chunkRenderDist;
|
||||
int startChunkZ = centerChunkPos.getZ() - chunkRenderDist;
|
||||
|
||||
// add every position within render distance
|
||||
HashSet<AbstractChunkPosWrapper> renderedPos = new HashSet<AbstractChunkPosWrapper>();
|
||||
for (int chunkX = 0; chunkX < (chunkRenderDist * 2+1); chunkX++)
|
||||
{
|
||||
for(int chunkZ = 0; chunkZ < (chunkRenderDist * 2+1); chunkZ++)
|
||||
{
|
||||
renderedPos.add(factory.createChunkPos(startChunkX + chunkX, startChunkZ + chunkZ));
|
||||
}
|
||||
}
|
||||
|
||||
return renderedPos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int[] getLightmapPixels()
|
||||
@@ -265,7 +301,13 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
return glFormat;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean isFogStateSpecial() {
|
||||
// return GAME_RENDERER.getMainCamera().getFluidInCamera() != FogType.NONE;
|
||||
return false; // FIXME
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tryDisableVanillaFog() {
|
||||
return true; // Handled via the MixinFogRenderer at fabric and forge
|
||||
}
|
||||
|
||||
@@ -20,6 +20,10 @@ accessible field net/minecraft/world/level/lighting/LevelLightEngine skyEngine L
|
||||
accessible method net/minecraft/world/level/levelgen/Heightmap setHeight (III)V
|
||||
accessible field net/minecraft/world/level/biome/Biome generationSettings Lnet/minecraft/world/level/biome/BiomeGenerationSettings;
|
||||
|
||||
# lod generation from save file
|
||||
accessible field net/minecraft/server/level/ChunkMap mainThreadExecutor Lnet/minecraft/util/thread/BlockableEventLoop;
|
||||
accessible method net/minecraft/server/level/ChunkMap readChunk (Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/nbt/CompoundTag;
|
||||
|
||||
# grabbing textures
|
||||
accessible field net/minecraft/client/renderer/block/model/BakedQuad sprite Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;
|
||||
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite framesX [I
|
||||
|
||||
+1
-1
Submodule core updated: bba7f34d46...14e72c68cb
@@ -25,8 +25,10 @@ import com.seibel.lod.core.api.ClientApi;
|
||||
import com.seibel.lod.core.api.ModAccessorApi;
|
||||
import com.seibel.lod.core.util.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.ISodiumAccessor;
|
||||
import com.seibel.lod.fabric.wrappers.modAccessor.ModChecker;
|
||||
import com.seibel.lod.fabric.wrappers.modAccessor.OptifineAccessor;
|
||||
import com.seibel.lod.fabric.wrappers.modAccessor.SodiumAccessor;
|
||||
import com.seibel.lod.fabric.wrappers.DependencySetup;
|
||||
|
||||
@@ -70,6 +72,9 @@ public class Main implements ClientModInitializer
|
||||
if (SingletonHandler.get(IModChecker.class).isModLoaded("sodium")) {
|
||||
ModAccessorApi.bind(ISodiumAccessor.class, new SodiumAccessor());
|
||||
}
|
||||
if (SingletonHandler.get(IModChecker.class).isModLoaded("optifine")) {
|
||||
ModAccessorApi.bind(IOptifineAccessor.class, new OptifineAccessor());
|
||||
}
|
||||
}
|
||||
|
||||
public static void initServer() {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
package com.seibel.lod.fabric.wrappers.modAccessor;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.AbstractChunkPosWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
||||
|
||||
public class OptifineAccessor implements IOptifineAccessor
|
||||
{
|
||||
|
||||
@Override
|
||||
public String getModName()
|
||||
{
|
||||
return "Optifine-Fabric-1.18.X";
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<AbstractChunkPosWrapper> getNormalRenderedChunks()
|
||||
{
|
||||
// TODO: Impl proper methods here
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,11 +24,16 @@ import com.seibel.lod.common.forge.LodForgeMethodCaller;
|
||||
import com.seibel.lod.common.wrappers.config.ConfigGui;
|
||||
import com.seibel.lod.common.wrappers.minecraft.MinecraftWrapper;
|
||||
import com.seibel.lod.core.ModInfo;
|
||||
import com.seibel.lod.core.api.ClientApi;
|
||||
import com.seibel.lod.core.api.ModAccessorApi;
|
||||
import com.seibel.lod.core.handlers.ReflectionHandler;
|
||||
import com.seibel.lod.core.util.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
||||
import com.seibel.lod.forge.wrappers.ForgeDependencySetup;
|
||||
|
||||
import com.seibel.lod.forge.wrappers.modAccessor.ModChecker;
|
||||
import com.seibel.lod.forge.wrappers.modAccessor.OptifineAccessor;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
@@ -65,7 +70,12 @@ public class ForgeMain implements LodForgeMethodCaller
|
||||
LodCommonMain.initConfig();
|
||||
LodCommonMain.startup(this, !FMLLoader.getDist().isClient());
|
||||
ForgeDependencySetup.createInitialBindings();
|
||||
ClientApi.LOGGER.info("Distant Horizons initializing...");
|
||||
|
||||
SingletonHandler.bind(IModChecker.class, ModChecker.INSTANCE);
|
||||
if (ReflectionHandler.instance.optifinePresent()) {
|
||||
ModAccessorApi.bind(IOptifineAccessor.class, new OptifineAccessor());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
package com.seibel.lod.forge.wrappers.modAccessor;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.AbstractChunkPosWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
||||
|
||||
public class OptifineAccessor implements IOptifineAccessor
|
||||
{
|
||||
|
||||
@Override
|
||||
public String getModName()
|
||||
{
|
||||
return "Optifine-Forge-1.18.X";
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<AbstractChunkPosWrapper> getNormalRenderedChunks()
|
||||
{
|
||||
// TODO: Impl proper methods here
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -17,6 +17,6 @@ fabric_api_version=0.34.2+1.16
|
||||
# iris_version=1.16.x-v1.1.4
|
||||
|
||||
# Forge loader
|
||||
forge_version=36.1.0
|
||||
forge_version=36.2.23
|
||||
# Forge mods
|
||||
## currentlly no mods ##
|
||||
|
||||
Reference in New Issue
Block a user