Revert "resolved couple warnings. If it causes problems just revert it."

This reverts commit b390e54801.
This commit is contained in:
cola98765
2022-01-17 16:27:27 +01:00
parent 23bbbce749
commit b158dff2c6
28 changed files with 200 additions and 97 deletions
@@ -13,8 +13,8 @@ public class CloudBufferSingleton
public static final CloudBufferSingleton INSTANCE = new CloudBufferSingleton();
public final FloatBuffer customBuffer = MemoryUtil.memAllocFloat(16);
public final FloatBuffer mcBuffer = MemoryUtil.memAllocFloat(16);
public FloatBuffer customBuffer = MemoryUtil.memAllocFloat(16);
public FloatBuffer mcBuffer = MemoryUtil.memAllocFloat(16);
public CloudBufferSingleton(){
@@ -7,14 +7,15 @@ import net.minecraft.world.level.levelgen.LegacyRandomSource;
import net.minecraft.world.level.levelgen.synth.SimplexNoise;
import java.util.*;
import java.util.List;
public class CloudTexture {
public final List<PixelCoordinate> pixels = new LinkedList<PixelCoordinate>() {};
public List<PixelCoordinate> pixels = new LinkedList<PixelCoordinate>() {};
public SimplexNoise noise;
public DynamicTexture cloudsTexture;
public final ResourceLocation resourceLocation;
public ResourceLocation resourceLocation;
public double cloudiness;
public CloudTexture(ResourceLocation resourceLocation) {
@@ -71,9 +72,9 @@ public class CloudTexture {
}
public static class PixelCoordinate {
public final int posX;
public final int posZ;
public final boolean fading;
public int posX;
public int posZ;
public boolean fading;
public PixelCoordinate(int posX, int posZ, boolean fading) {
this.posX = posX;
@@ -8,7 +8,7 @@ import java.util.List;
public final class NoiseCloudHandler {
public static final List<CloudTexture> cloudTextures = new LinkedList<CloudTexture>() {};
public static List<CloudTexture> cloudTextures = new LinkedList<CloudTexture>() {};
private static long cloudIdx = -1;
private static long timeIdx = -1;
@@ -1,8 +1,11 @@
package com.seibel.lod.common.networking;
import com.seibel.lod.common.LodCommonMain;
import io.netty.buffer.Unpooled;
import net.minecraft.network.FriendlyByteBuf;
import java.nio.charset.StandardCharsets;
/**
* This class holds most of the networking code for the mod.
* @author Ran
@@ -6,6 +6,7 @@ import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import com.seibel.lod.common.LodCommonMain;
import com.seibel.lod.common.wrappers.minecraft.MinecraftWrapper;
import com.seibel.lod.core.util.ColorUtil;
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
@@ -153,8 +154,10 @@ public class BlockColorWrapper implements IBlockColorWrapper
// generate the block's color
// for (int frameIndex = 0; frameIndex < texture.getFrameCount(); frameIndex++)
boolean lookForTint = grassInstance() || leavesInstance() || waterIstance();
boolean lookForTint = false;
if (grassInstance() || leavesInstance() || waterIstance())
lookForTint = true;
int frameIndex = 0; // TODO
{
// textures normally use u and v instead of x and y
@@ -14,7 +14,7 @@ import net.minecraft.core.BlockPos;
*/
public class BlockPosWrapper extends AbstractBlockPosWrapper
{
private final BlockPos.MutableBlockPos blockPos;
private BlockPos.MutableBlockPos blockPos;
public BlockPosWrapper()
@@ -5,6 +5,7 @@ import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
import com.seibel.lod.core.wrapperInterfaces.block.IBlockShapeWrapper;
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
import com.seibel.lod.common.wrappers.chunk.ChunkWrapper;
@@ -2,6 +2,7 @@ package com.seibel.lod.common.wrappers.chunk;
import java.util.Objects;
import com.seibel.lod.core.objects.lod.RegionPos;
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
import com.seibel.lod.core.wrapperInterfaces.chunk.AbstractChunkPosWrapper;
import com.seibel.lod.common.wrappers.block.BlockPosWrapper;
@@ -16,7 +17,7 @@ import net.minecraft.world.level.ChunkPos;
*/
public class ChunkPosWrapper extends AbstractChunkPosWrapper
{
private final net.minecraft.world.level.ChunkPos chunkPos;
private net.minecraft.world.level.ChunkPos chunkPos;
public ChunkPosWrapper()
{
@@ -30,8 +30,8 @@ import net.minecraft.world.level.levelgen.Heightmap;
*/
public class ChunkWrapper implements IChunkWrapper
{
private final ChunkAccess chunk;
private final BlockAndTintGetter lightSource;
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;
@@ -46,10 +46,16 @@ public class ChunkWrapper implements IChunkWrapper
public boolean isPositionInWater(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);
//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
return (blockState.getBlock() instanceof LiquidBlock)// && !(blockState.getBlock() instanceof IWaterLoggable))
|| (blockState.getOptionalValue(BlockStateProperties.WATERLOGGED).isPresent() && blockState.getOptionalValue(BlockStateProperties.WATERLOGGED).get());
if(blockState.getOptionalValue(BlockStateProperties.WATERLOGGED).isPresent() && blockState.getOptionalValue(BlockStateProperties.WATERLOGGED).get())
return true;
return false;
}
@Override
@@ -124,7 +124,7 @@ public abstract class ConfigGui
TranslatableComponent name;
int index;
/** Hides the button */
final boolean hideOption = false;
boolean hideOption = false;
/** This asks if it is a button to goto a new screen */
boolean screenButton = false;
/** This is only called if button is true */
@@ -170,10 +170,9 @@ public abstract class ConfigGui
initClient(field, info, category);
}
String s = (!category.isEmpty() ? category + "." : "") + field.getName();
if (field.isAnnotationPresent(ConfigAnnotations.Entry.class))
{
entryMap.put(s, info);
entryMap.put((!category.isEmpty() ? category + "." : "") + field.getName(), info);
info.varClass = field.getType();
try
{
@@ -183,7 +182,7 @@ public abstract class ConfigGui
}
if (field.isAnnotationPresent(ConfigAnnotations.ScreenEntry.class))
initNestedClass(field.getType(), s);
initNestedClass(field.getType(), (!category.isEmpty() ? category + "." : "") + field.getName());
info.field = field;
@@ -441,6 +440,7 @@ public abstract class ConfigGui
try {
Files.deleteIfExists(configFilePath);
saveToFile();
return;
} catch (Exception f) {
LOGGER.info("Failed creating config file for " + MOD_NAME_READABLE + " at the path [" + configFilePath.toString() + "].");
f.printStackTrace();
@@ -476,7 +476,7 @@ public abstract class ConfigGui
private final String translationPrefix;
private final Screen parent;
private final String category;
private String category;
private ConfigListWidget list;
private boolean reload = false;
@@ -605,7 +605,7 @@ public abstract class ConfigGui
String key = translationPrefix + (info.category.isEmpty() ? "" : info.category + ".") + info.field.getName() + ".@tooltip";
if (info.error != null && text.equals(name)) renderTooltip(matrices, (Component) info.error.getValue(), mouseX, mouseY);
else if (I18n.exists(key) && (text != null && text.equals(name))) {
else if (I18n.exists(key) && (text == null ? false : text.equals(name))) {
List<Component> list = new ArrayList<>();
for (String str : I18n.get(key).split("\n"))
list.add(new TextComponent(str));
@@ -623,7 +623,7 @@ public abstract class ConfigGui
public static class ConfigListWidget extends ContainerObjectSelectionList<ButtonEntry>
{
final Font textRenderer;
Font textRenderer;
public ConfigListWidget(Minecraft minecraftClient, int i, int j, int k, int l, int m)
{
@@ -172,7 +172,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
int lightMapHeight = getLightmapTextureHeight();
int lightMapWidth = getLightmapTextureWidth();
int[] pixels = new int[lightMapWidth * lightMapHeight];
int pixels[] = new int[lightMapWidth * lightMapHeight];
for (int u = 0; u < lightMapWidth; u++)
{
for (int v = 0; v < lightMapWidth; v++)
@@ -36,7 +36,7 @@ public class BiomeWrapper implements IBiomeWrapper
{
public static final ConcurrentMap<Biome, BiomeWrapper> biomeWrapperMap = new ConcurrentHashMap<>();
private final Biome biome;
private Biome biome;
public BiomeWrapper(Biome biome)
{
@@ -34,7 +34,7 @@ import net.minecraft.world.level.dimension.DimensionType;
public class DimensionTypeWrapper implements IDimensionTypeWrapper
{
private static final ConcurrentMap<DimensionType, DimensionTypeWrapper> dimensionTypeWrapperMap = new ConcurrentHashMap<>();
private final DimensionType dimensionType;
private DimensionType dimensionType;
public DimensionTypeWrapper(DimensionType dimensionType)
{
@@ -24,9 +24,12 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import com.seibel.lod.core.enums.WorldType;
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
import com.seibel.lod.core.wrapperInterfaces.chunk.AbstractChunkPosWrapper;
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
import com.seibel.lod.core.wrapperInterfaces.world.IBiomeWrapper;
import com.seibel.lod.core.wrapperInterfaces.world.IWorldWrapper;
import com.seibel.lod.common.wrappers.block.BlockPosWrapper;
import com.seibel.lod.common.wrappers.chunk.ChunkWrapper;
import net.minecraft.client.multiplayer.ClientLevel;
@@ -113,10 +113,11 @@ public class ExperimentalGenerator extends AbstractExperimentalWorldGeneratorWra
targetStep = Steps.Surface; //Carvers or Surface???
break;
case FEATURES:
case FULL:
targetStep = Steps.Features;
break;
// TODO!
case FULL:
targetStep = Steps.Features; // TODO!
break;
default:
assert false;
return;
@@ -27,8 +27,11 @@ import com.seibel.lod.core.enums.config.DistanceGenerationMode;
import com.seibel.lod.core.objects.lod.LodDimension;
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IStarlightAccessor;
import it.unimi.dsi.fastutil.objects.ObjectListIterator;
import java.time.Duration;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -41,17 +44,23 @@ import java.util.concurrent.TimeUnit;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.mojang.datafixers.DataFixer;
import com.mojang.datafixers.util.Pair;
import com.seibel.lod.common.wrappers.chunk.ChunkWrapper;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.WorldGenRegion;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.ColorResolver;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.StructureFeatureManager;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.chunk.ChunkStatus;
@@ -65,6 +74,7 @@ import net.minecraft.CrashReport;
import net.minecraft.CrashReportCategory;
import net.minecraft.ReportedException;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.SectionPos;
@@ -74,7 +84,9 @@ import net.minecraft.world.level.levelgen.blending.Blender;
import net.minecraft.world.level.levelgen.structure.StructureCheck;
import net.minecraft.world.level.levelgen.structure.StructureStart;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
import net.minecraft.world.level.lighting.LayerLightEngine;
import net.minecraft.world.level.lighting.LevelLightEngine;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.storage.WorldData;
/*
@@ -99,10 +111,10 @@ public final class WorldGenerationStep {
public static class Rolling {
private final int size;
private int size;
private double total = 0d;
private int index = 0;
private final double[] samples;
private double samples[];
public Rolling(int size) {
this.size = size;
@@ -140,17 +152,17 @@ public final class WorldGenerationStep {
public static class PerfCalculator {
public static final int SIZE = 50;
final Rolling totalTime = new Rolling(SIZE);
final Rolling emptyTime = new Rolling(SIZE);
final Rolling structStartTime = new Rolling(SIZE);
final Rolling structRefTime = new Rolling(SIZE);
final Rolling biomeTime = new Rolling(SIZE);
final Rolling noiseTime = new Rolling(SIZE);
final Rolling surfaceTime = new Rolling(SIZE);
final Rolling carverTime = new Rolling(SIZE);
final Rolling featureTime = new Rolling(SIZE);
final Rolling lightTime = new Rolling(SIZE);
final Rolling lodTime = new Rolling(SIZE);
Rolling totalTime = new Rolling(SIZE);
Rolling emptyTime = new Rolling(SIZE);
Rolling structStartTime = new Rolling(SIZE);
Rolling structRefTime = new Rolling(SIZE);
Rolling biomeTime = new Rolling(SIZE);
Rolling noiseTime = new Rolling(SIZE);
Rolling surfaceTime = new Rolling(SIZE);
Rolling carverTime = new Rolling(SIZE);
Rolling featureTime = new Rolling(SIZE);
Rolling lightTime = new Rolling(SIZE);
Rolling lodTime = new Rolling(SIZE);
public void recordEvent(PrefEvent e) {
totalTime.add(e.endNano - e.beginNano);
@@ -194,8 +206,8 @@ public final class WorldGenerationStep {
public static final class GridList<T> extends ArrayList<T> implements List<T> {
public static class Pos {
public final int x;
public final int y;
public int x;
public int y;
public Pos(int xx, int yy) {
x = xx;
@@ -213,23 +225,23 @@ public final class WorldGenerationStep {
this.gridCentreToEdge = gridCentreToEdge;
}
public T getOffsetOf(int index, int x, int y) {
public final T getOffsetOf(int index, int x, int y) {
return get(index + x + y * gridSize);
}
public int offsetOf(int index, int x, int y) {
public final int offsetOf(int index, int x, int y) {
return index + x + y * gridSize;
}
public Pos posOf(int index) {
public final Pos posOf(int index) {
return new Pos(index % gridSize, index / gridSize);
}
public int calculateOffset(int x, int y) {
public final int calculateOffset(int x, int y) {
return x + y * gridSize;
}
public GridList<T> subGrid(int gridCentreToEdge) {
public final GridList<T> subGrid(int gridCentreToEdge) {
int centreIndex = size() / 2;
GridList<T> subGrid = new GridList<T>(gridCentreToEdge);
for (int oy = -gridCentreToEdge; oy <= gridCentreToEdge; oy++) {
@@ -298,14 +310,14 @@ public final class WorldGenerationStep {
}
public static final class ThreadedParameters {
private static final ThreadLocal<ThreadedParameters> localParam = new ThreadLocal<ThreadedParameters>();
private static ThreadLocal<ThreadedParameters> localParam = new ThreadLocal<ThreadedParameters>();
final ServerLevel level;
final StructureFeatureManager structFeat;
final StructureCheck structCheck;
boolean isValid = true;
public final PerfCalculator perf = new PerfCalculator();
public static ThreadedParameters getOrMake(GlobalParameters param) {
public static final ThreadedParameters getOrMake(GlobalParameters param) {
ThreadedParameters tParam = localParam.get();
if (tParam != null && tParam.isValid && tParam.level == param.level)
return tParam;
@@ -354,21 +366,21 @@ public final class WorldGenerationStep {
});
}
public boolean isCompleted() {
public final boolean isCompleted() {
return future.isDone();
}
public boolean hasTimeout(int duration, TimeUnit unit) {
public final boolean hasTimeout(int duration, TimeUnit unit) {
long currentTime = System.nanoTime();
long delta = currentTime - nanotime;
return (delta > TimeUnit.NANOSECONDS.convert(duration, unit));
}
public void terminate() {
public final void terminate() {
future.cancel(true);
}
public void join() {
public final void join() {
try {
future.get();
} catch (InterruptedException | ExecutionException e) {
@@ -376,7 +388,7 @@ public final class WorldGenerationStep {
}
}
public boolean tooClose(int cx, int cz, int cr) {
public final boolean tooClose(int cx, int cz, int cr) {
int distX = Math.abs(cx - pos.x);
int distZ = Math.abs(cz - pos.z);
int minRange = cr+range+1; //Need one to account for the center
@@ -384,7 +396,7 @@ public final class WorldGenerationStep {
return distX < minRange && distZ < minRange;
}
public void refreshTimeout() {
public final void refreshTimeout() {
nanotime = System.nanoTime();
}
@@ -394,7 +406,7 @@ public final class WorldGenerationStep {
}
}
private static <T> T joinAsync(CompletableFuture<T> f) {
private final static <T> T joinAsync(CompletableFuture<T> f) {
return f.join();
}
@@ -412,7 +424,7 @@ public final class WorldGenerationStep {
public final ExecutorService executors = Executors
.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("Gen-Worker-Thread-%d").build());
public boolean tryAddPoint(int px, int pz, int range, Steps target) {
public final boolean tryAddPoint(int px, int pz, int range, Steps target) {
int boxSize = range * 2 + 1;
int x = Math.floorDiv(px, boxSize) * boxSize + range;
int z = Math.floorDiv(pz, boxSize) * boxSize + range;
@@ -426,7 +438,7 @@ public final class WorldGenerationStep {
return true;
}
public void updateAllFutures() {
public final void updateAllFutures() {
// Update all current out standing jobs
Iterator<GenerationEvent> iter = events.iterator();
while (iter.hasNext()) {
@@ -492,24 +504,33 @@ public final class WorldGenerationStep {
}
switch (e.target) {
case Empty:
return;
case StructureStart:
generationMode = DistanceGenerationMode.NONE;
break;
case StructureReference:
generationMode = DistanceGenerationMode.NONE;
break;
case Biomes:
generationMode = DistanceGenerationMode.BIOME_ONLY_SIMULATE_HEIGHT;
break;
case Noise:
generationMode = DistanceGenerationMode.BIOME_ONLY_SIMULATE_HEIGHT;
break;
case Surface:
generationMode = DistanceGenerationMode.SURFACE;
break;
case Carvers:
generationMode = DistanceGenerationMode.SURFACE;
break;
case Features:
generationMode = DistanceGenerationMode.FEATURES;
break;
case Empty:
case LiquidCarvers:
return;
case Light:
return;
default:
return;
}
@@ -532,7 +553,7 @@ public final class WorldGenerationStep {
}
}
public GridList<ChunkAccess> generateDirect(GenerationEvent e, GridList<ChunkAccess> subRange, Steps step,
public final GridList<ChunkAccess> generateDirect(GenerationEvent e, GridList<ChunkAccess> subRange, Steps step,
LightedWorldGenRegion region) {
try {
subRange.forEach((chunk) -> {
@@ -608,7 +629,7 @@ public final class WorldGenerationStep {
}
}
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
public final void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
List<ChunkAccess> chunks) {
for (ChunkAccess chunk : chunks) {
@@ -633,7 +654,7 @@ public final class WorldGenerationStep {
}
}
public static final class StepStructureReference {
public final class StepStructureReference {
public final ChunkStatus STATUS = ChunkStatus.STRUCTURE_REFERENCES;
private void createReferences(WorldGenRegion worldGenLevel, StructureFeatureManager structureFeatureManager,
@@ -674,7 +695,7 @@ public final class WorldGenerationStep {
}
}
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
public final void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
List<ChunkAccess> chunks) {
for (ChunkAccess chunk : chunks) {
@@ -691,7 +712,7 @@ public final class WorldGenerationStep {
public final class StepBiomes {
public final ChunkStatus STATUS = ChunkStatus.BIOMES;
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
public final void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
List<ChunkAccess> chunks) {
for (ChunkAccess chunk : chunks) {
@@ -709,7 +730,7 @@ public final class WorldGenerationStep {
public final class StepNoise {
public final ChunkStatus STATUS = ChunkStatus.NOISE;
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
public final void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
List<ChunkAccess> chunks) {
for (ChunkAccess chunk : chunks) {
@@ -726,7 +747,7 @@ public final class WorldGenerationStep {
public final class StepSurface {
public final ChunkStatus STATUS = ChunkStatus.SURFACE;
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
public final void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
List<ChunkAccess> chunks) {
for (ChunkAccess chunk : chunks) {
((ProtoChunk) chunk).setStatus(STATUS);
@@ -739,10 +760,10 @@ public final class WorldGenerationStep {
}
}
public static final class StepCarvers {
public final class StepCarvers {
public final ChunkStatus STATUS = ChunkStatus.CARVERS;
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
public final void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
List<ChunkAccess> chunks) {
for (ChunkAccess chunk : chunks) {
// DISABLED CURRENTLY!
@@ -761,7 +782,7 @@ public final class WorldGenerationStep {
public final class StepFeatures {
public final ChunkStatus STATUS = ChunkStatus.FEATURES;
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
public final void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
GridList<ChunkAccess> chunks) {
for (ChunkAccess chunk : chunks) {
((ProtoChunk) chunk).setStatus(STATUS);
@@ -774,6 +795,7 @@ public final class WorldGenerationStep {
Blender.generateBorderTicks(worldGenRegion, chunk);
} catch (ReportedException e) {
e.printStackTrace();
continue;
// FIXME: Features concurrent modification issue. Something about cocobeans just
// aren't happy
// For now just retry.
@@ -787,10 +809,10 @@ public final class WorldGenerationStep {
}
}
public static final class StepLight {
public final class StepLight {
public final ChunkStatus STATUS = ChunkStatus.LIGHT;
public void generateGroup(LevelLightEngine lightEngine,
public final void generateGroup(LevelLightEngine lightEngine,
GridList<ChunkAccess> chunks) {
for (ChunkAccess chunk : chunks) {
((ProtoChunk) chunk).setStatus(STATUS);
@@ -807,6 +829,7 @@ public final class WorldGenerationStep {
} catch (Exception e) {
e.printStackTrace();
continue;
}
}
}
@@ -859,7 +882,8 @@ public final class WorldGenerationStep {
@Override
public BlockGetter getChunkForLighting(int chunkX, int chunkZ) {
// May be null
return genRegion.getChunk(chunkX, chunkZ, ChunkStatus.EMPTY, false);
ChunkAccess chunk = genRegion.getChunk(chunkX, chunkZ, ChunkStatus.EMPTY, false);
return chunk;
}
@Override
public BlockGetter getLevel() {
@@ -4,25 +4,58 @@ import com.seibel.lod.core.builders.lodBuilding.LodBuilder;
import com.seibel.lod.core.builders.lodBuilding.LodBuilderConfig;
import com.seibel.lod.core.enums.config.DistanceGenerationMode;
import com.seibel.lod.core.objects.lod.LodDimension;
import com.seibel.lod.core.util.LodThreadFactory;
import com.seibel.lod.core.wrapperInterfaces.chunk.AbstractChunkPosWrapper;
import com.seibel.lod.core.wrapperInterfaces.world.IWorldWrapper;
import com.seibel.lod.core.wrapperInterfaces.worldGeneration.AbstractWorldGeneratorWrapper;
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.function.Function;
import java.util.function.IntFunction;
import org.jetbrains.annotations.Nullable;
import com.google.common.collect.Lists;
import com.mojang.datafixers.util.Either;
import com.seibel.lod.common.wrappers.chunk.ChunkWrapper;
import com.seibel.lod.common.wrappers.world.WorldWrapper;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.WorldGenRegion;
import net.minecraft.server.level.ChunkHolder.ChunkLoadingFailure;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.LevelHeightAccessor;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.chunk.*;
/* */
import net.minecraft.world.level.chunk.ChunkStatus.ChunkType;
import net.minecraft.server.level.ThreadedLevelLightEngine;
import net.minecraft.Util;
import net.minecraft.core.Registry;
/* */ import net.minecraft.server.level.ChunkHolder;
/* */ import net.minecraft.server.level.ServerLevel;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ import net.minecraft.server.level.ThreadedLevelLightEngine;
/* */ import net.minecraft.server.level.WorldGenRegion;
/* */ import net.minecraft.util.profiling.jfr.JvmProfiler;
/* */ import net.minecraft.util.profiling.jfr.callback.ProfiledDuration;
/* */ import net.minecraft.world.level.WorldGenLevel;
/* */ import net.minecraft.world.level.levelgen.BelowZeroRetrogen;
/* */ import net.minecraft.world.level.levelgen.GenerationStep;
/* */ import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.levelgen.Heightmap.Types;
/* */ import net.minecraft.world.level.levelgen.blending.Blender;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
import net.minecraft.world.level.lighting.LevelLightEngine;
/**
* @author James Seibel
@@ -89,6 +122,8 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
ChunkStatus targetStatus;
switch (generationMode) {
case NONE:
return;
case BIOME_ONLY:
targetStatus = ChunkStatus.BIOMES;
break;
@@ -104,7 +139,6 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
case FULL:
targetStatus = ChunkStatus.FULL;
break;
case NONE:
default:
return;
}
@@ -28,12 +28,20 @@ import com.seibel.lod.common.wrappers.world.WorldWrapper;
import com.seibel.lod.core.util.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import com.seibel.lod.fabric.mixins.events.MixinClientLevel;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientChunkEvents;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerChunkEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents;
import net.fabricmc.fabric.mixin.event.lifecycle.client.ClientChunkManagerMixin;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientChunkCache;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.core.BlockPos;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.level.Level;
@@ -26,7 +26,7 @@ public class MixinFogRenderer {
private static final float A_EVEN_LARGER_VALUE = 42069420694206942069.F;
@Inject(at = @At("RETURN"), method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZ)V")
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, CallbackInfo callback) {
private static final void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, CallbackInfo callback) {
FogType fogTypes = camera.getFluidInCamera();
Entity entity = camera.getEntity();
boolean isUnderWater = (entity instanceof LivingEntity) && ((LivingEntity)entity).hasEffect(MobEffects.BLINDNESS);
@@ -19,15 +19,19 @@
package com.seibel.lod.fabric.mixins;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
import com.seibel.lod.common.clouds.CloudBufferSingleton;
import com.seibel.lod.common.clouds.CloudTexture;
import com.seibel.lod.common.clouds.NoiseCloudHandler;
import com.seibel.lod.common.wrappers.McObjectConverter;
import com.seibel.lod.common.wrappers.config.LodConfigWrapperSingleton;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.util.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
import net.minecraft.client.renderer.LevelRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -35,6 +39,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.objects.math.Mat4f;
import net.minecraft.client.renderer.RenderType;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
@@ -164,9 +170,9 @@ public class MixinWorldRenderer
double posZ = cameraZ / scale + 0.33000001311302185D;
posX -= Math.floor(posX / 2048.0D) * 2048;
posZ -= Math.floor(posZ / 2048.0D) * 2048;
float adjustedX = (float) (posX - Math.floor(posX));
float adjustedY = (float) (posY / 4.0D - Math.floor(posY / 4.0D)) * 4.0F;
float adjustedZ = (float) (posZ - Math.floor(posZ));
float adjustedX = (float) (posX - (double) Math.floor(posX));
float adjustedY = (float) (posY / 4.0D - (double) Math.floor(posY / 4.0D)) * 4.0F;
float adjustedZ = (float) (posZ - (double) Math.floor(posZ));
Vec3 cloudColor = minecraft.level.getCloudColor(tickDelta);
int floorX = (int) Math.floor(posX);
int floorY = (int) Math.floor(posY / 4.0D);
@@ -5,6 +5,8 @@ import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.resources.ResourceKey;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.dimension.DimensionType;
import org.spongepowered.asm.mixin.Mixin;
@@ -4,6 +4,7 @@ import com.seibel.lod.fabric.Main;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.server.level.ServerLevel;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
@@ -15,7 +15,7 @@ import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.LevelHeightAccessor;
public class SodiumAccessor implements ISodiumAccessor {
final IWrapperFactory factory = SingletonHandler.get(IWrapperFactory.class);
IWrapperFactory factory = SingletonHandler.get(IWrapperFactory.class);
@Override
public String getModName() {
@@ -37,7 +37,7 @@ public class SodiumAccessor implements ISodiumAccessor {
return false;
//return true;
}).mapToObj((long l) -> {
return factory.createChunkPos(l);
return (AbstractChunkPosWrapper)factory.createChunkPos(l);
}).collect(Collectors.toCollection(HashSet::new));
}
@@ -18,6 +18,6 @@ public class DependencySetup
{
public static void createInitialBindings()
{
SingletonHandler.bind(ILodConfigWrapperSingleton.class, LodConfigWrapperSingleton.INSTANCE);
SingletonHandler.bind(ILodConfigWrapperSingleton.class, LodConfigWrapperSingleton.INSTANCE);;
}
}
@@ -6,6 +6,9 @@ import com.terraformersmc.modmenu.api.ModMenuApi;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import java.util.HashMap;
import java.util.Map;
/**
* For making the config show up in modmenu
*/
@@ -87,7 +87,7 @@ public class ForgeMain implements LodForgeMethodCaller
MinecraftForge.EVENT_BUS.register(forgeClientProxy);
}
private final ModelDataMap dataMap = new ModelDataMap.Builder().build();
private ModelDataMap dataMap = new ModelDataMap.Builder().build();
@Override
public List<BakedQuad> getQuads(MinecraftWrapper mc, Block block, BlockState blockState, Direction direction, Random random) {
return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, dataMap);
@@ -27,7 +27,7 @@ public class MixinFogRenderer {
@Inject(at = @At("RETURN"),
method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZF)V",
remap = false) // Remap = false due to this being added by forge.
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float partTick, CallbackInfo callback) {
private static final void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float partTick, CallbackInfo callback) {
ILodConfigWrapperSingleton CONFIG;
try {
CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
@@ -19,15 +19,19 @@
package com.seibel.lod.forge.mixins;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
import com.seibel.lod.common.clouds.CloudBufferSingleton;
import com.seibel.lod.common.clouds.CloudTexture;
import com.seibel.lod.common.clouds.NoiseCloudHandler;
import com.seibel.lod.common.wrappers.McObjectConverter;
import com.seibel.lod.common.wrappers.config.LodConfigWrapperSingleton;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.util.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
import net.minecraft.client.renderer.LevelRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -35,6 +39,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.objects.math.Mat4f;
import net.minecraft.client.renderer.RenderType;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
@@ -164,9 +170,9 @@ public class MixinWorldRenderer
double posZ = cameraZ / scale + 0.33000001311302185D;
posX -= Math.floor(posX / 2048.0D) * 2048;
posZ -= Math.floor(posZ / 2048.0D) * 2048;
float adjustedX = (float) (posX - Math.floor(posX));
float adjustedY = (float) (posY / 4.0D - Math.floor(posY / 4.0D)) * 4.0F;
float adjustedZ = (float) (posZ - Math.floor(posZ));
float adjustedX = (float) (posX - (double) Math.floor(posX));
float adjustedY = (float) (posY / 4.0D - (double) Math.floor(posY / 4.0D)) * 4.0F;
float adjustedZ = (float) (posZ - (double) Math.floor(posZ));
Vec3 cloudColor = minecraft.level.getCloudColor(tickDelta);
int floorX = (int) Math.floor(posX);
int floorY = (int) Math.floor(posY / 4.0D);