Updated core

This commit is contained in:
coolGi2007
2021-12-13 12:22:43 +00:00
parent e7f9c01292
commit 56e74a15ba
4 changed files with 36 additions and 17 deletions
@@ -20,6 +20,7 @@ import net.minecraft.world.level.block.SimpleWaterloggedBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.LevelChunkSection;
import net.minecraft.world.level.levelgen.Heightmap;
/**
@@ -78,7 +79,9 @@ public class ChunkWrapper implements IChunkWrapper
@Override
public IBlockShapeWrapper getBlockShapeWrapper(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();
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();
return BlockShapeWrapper.getBlockShapeWrapper(block, this, x, y, z);
}
@@ -140,9 +143,11 @@ public class ChunkWrapper implements IChunkWrapper
public boolean isWaterLogged(int x, int y, int z)
{
BlockState blockState = chunk.getSections()[y >> CHUNK_SECTION_SHIFT].getBlockState(x & CHUNK_SIZE_MASK, y & CHUNK_SECTION_MASK, z & CHUNK_SIZE_MASK);
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);
// //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));
}
@@ -5,6 +5,7 @@ import com.moandjiezana.toml.Toml;
// TomlWriter is threadsave while Writer is not
import com.moandjiezana.toml.TomlWriter;
import com.mojang.blaze3d.vertex.PoseStack;
import com.seibel.lod.core.ModInfo;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
@@ -400,7 +401,7 @@ public abstract class ConfigGui {
this.list.addButton(widget, resetButton, null, name);
} else if (info.button) {
Button widget = new Button(this.width / 2 - info.width, this.height - 28, info.width*2, 20, name, (button -> {
Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, modid, info.gotoScreen));
Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, ModInfo.ID, info.gotoScreen));
}));
this.list.addButton(widget, null, null, null);
} else {
@@ -5,6 +5,8 @@ import java.util.HashSet;
import com.mojang.blaze3d.platform.NativeImage;
import com.seibel.lod.common.wrappers.misc.LightMapWrapper;
import com.seibel.lod.core.handlers.IReflectionHandler;
import com.seibel.lod.core.handlers.ReflectionHandler;
import com.seibel.lod.core.util.LodUtil;
import net.minecraft.client.renderer.LightTexture;
import org.lwjgl.opengl.GL20;
@@ -36,12 +38,13 @@ import net.minecraft.world.phys.Vec3;
* related to rendering in Minecraft.
*
* @author James Seibel
* @version 12-05-2021
* @version 12-12-2021
*/
public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
{
public static final MinecraftRenderWrapper INSTANCE = new MinecraftRenderWrapper();
public static final MinecraftWrapper MC_WRAPPER = MinecraftWrapper.INSTANCE;
private static final MinecraftWrapper MC_WRAPPER = MinecraftWrapper.INSTANCE;
private static final Minecraft MC = Minecraft.getInstance();
private static final GameRenderer GAME_RENDERER = MC.gameRenderer;
@@ -144,19 +147,29 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
{
HashSet<AbstractChunkPosWrapper> loadedPos = new HashSet<>();
// Wow, those are some long names!
// TODO James needs to allow for circular references in the SingletonHandler
IReflectionHandler reflectionHandler = ReflectionHandler.instance;
// go through every RenderInfo to get the compiled chunks
LevelRenderer renderer = MC.levelRenderer;
for (RenderChunkInfo worldRenderer$LocalRenderInformationContainer : renderer.renderChunks)
if (reflectionHandler.sodiumPresent())
{
CompiledChunk compiledChunk = worldRenderer$LocalRenderInformationContainer.chunk.getCompiledChunk();
if (!compiledChunk.hasNoRenderableLayers())
{
// add the ChunkPos for every rendered chunk
BlockPos bpos = worldRenderer$LocalRenderInformationContainer.chunk.getOrigin();
loadedPos = reflectionHandler.getSodiumRenderedChunks();
}
else
{
// Wow, those are some long names!
loadedPos.add(new ChunkPosWrapper(bpos));
// go through every RenderInfo to get the compiled chunks
LevelRenderer renderer = MC.levelRenderer;
for (LevelRenderer.RenderChunkInfo worldRenderer$LocalRenderInformationContainer : renderer.renderChunks)
{
CompiledChunk compiledChunk = worldRenderer$LocalRenderInformationContainer.chunk.getCompiledChunk();
if (!compiledChunk.hasNoRenderableLayers())
{
// add the ChunkPos for every rendered chunk
BlockPos bpos = worldRenderer$LocalRenderInformationContainer.chunk.getOrigin();
loadedPos.add(new ChunkPosWrapper(bpos));
}
}
}
+1 -1
Submodule core updated: 92b6a9695d...c811e6bad6