Update everything latest & fix some issues & new accesswideners
This commit is contained in:
@@ -1,77 +1,30 @@
|
||||
accessWidener v1 named
|
||||
accessible class net/minecraft/client/renderer/LightTexture
|
||||
accessible class net/minecraft/world/entity/ai/behavior/ShufflingList
|
||||
accessible class net/minecraft/world/level/block/state/BlockBehaviour$BlockStateBase
|
||||
accessible class net/minecraft/world/level/levelgen/feature/stateproviders/WeightedStateProvider
|
||||
accessible class net/minecraft/world/level/lighting/LevelLightEngine
|
||||
accessible class net/minecraft/client/renderer/LevelRenderer
|
||||
accessible class net/minecraft/world/level/levelgen/structure/templatesystem/StructureManager
|
||||
accessible class net/minecraft/world/level/levelgen/placement/ConfiguredDecorator
|
||||
accessible class com/mojang/blaze3d/vertex/BufferBuilder
|
||||
accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo
|
||||
accessible class net/minecraft/world/level/levelgen/Heightmap
|
||||
accessible class net/minecraft/world/level/biome/Biome
|
||||
accessible class net/minecraft/server/level/ServerLevel
|
||||
accessible class net/minecraft/server/MinecraftServer
|
||||
accessible class net/minecraft/util/UniformInt
|
||||
accessible class net/minecraft/client/gui/screens/MenuScreens$ScreenConstructor
|
||||
accessible class net/minecraft/world/level/storage/DimensionDataStorage
|
||||
accessible class net/minecraft/world/level/levelgen/feature/Feature
|
||||
accessible class net/minecraft/client/renderer/GameRenderer
|
||||
accessible class net/minecraft/server/level/ServerChunkCache
|
||||
accessible class net/minecraft/core/SerializableUUID
|
||||
accessible class net/minecraft/server/level/ChunkMap
|
||||
accessible class net/minecraft/Util
|
||||
accessible class net/minecraft/world/level/chunk/ProtoChunk
|
||||
accessible class net/minecraft/world/level/levelgen/feature/ConfiguredFeature
|
||||
accessible class com/mojang/blaze3d/vertex/VertexBuffer
|
||||
accessible class net/minecraft/world/level/chunk/LevelChunk
|
||||
accessible class net/minecraft/client/renderer/LevelRenderer
|
||||
accessible class net/minecraft/client/renderer/texture/TextureAtlasSprite
|
||||
accessible class net/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture
|
||||
accessible method net/minecraft/client/renderer/GameRenderer bobView (Lcom/mojang/blaze3d/vertex/PoseStack;F)V
|
||||
accessible method net/minecraft/client/renderer/GameRenderer getFov (Lnet/minecraft/client/Camera;FZ)D
|
||||
accessible method net/minecraft/client/renderer/GameRenderer bobHurt (Lcom/mojang/blaze3d/vertex/PoseStack;F)V
|
||||
accessible method net/minecraft/world/level/levelgen/Heightmap setHeight (III)V
|
||||
accessible method net/minecraft/core/SerializableUUID leastMostToIntArray (JJ)[I
|
||||
accessible method net/minecraft/world/level/levelgen/feature/ConfiguredFeature place (Lnet/minecraft/world/level/WorldGenLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Ljava/util/Random;Lnet/minecraft/core/BlockPos;)Z
|
||||
accessible method net/minecraft/world/level/levelgen/Heightmap getIndex (II)I
|
||||
accessible method net/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture getFrameX (I)I
|
||||
accessible method net/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture getFrameY (I)I
|
||||
accessible method net/minecraft/Util makeExecutor (Ljava/lang/String;)Ljava/util/concurrent/ExecutorService;
|
||||
accessible field com/mojang/blaze3d/vertex/VertexBuffer vertexCount I
|
||||
accessible field net/minecraft/world/level/levelgen/placement/ConfiguredDecorator config Lnet/minecraft/world/level/levelgen/feature/configurations/DecoratorConfiguration;
|
||||
accessible field net/minecraft/world/level/chunk/LevelChunk sections [Lnet/minecraft/world/level/chunk/LevelChunkSection;
|
||||
accessible field net/minecraft/world/level/lighting/LevelLightEngine skyEngine Lnet/minecraft/world/level/lighting/LayerLightEngine;
|
||||
accessible field net/minecraft/world/level/biome/Biome generationSettings Lnet/minecraft/world/level/biome/BiomeGenerationSettings;
|
||||
accessible field net/minecraft/server/level/ChunkMap lightEngine Lnet/minecraft/server/level/ThreadedLevelLightEngine;
|
||||
accessible field net/minecraft/server/MinecraftServer random Ljava/util/Random;
|
||||
accessible field net/minecraft/world/entity/ai/behavior/ShufflingList entries Ljava/util/List;
|
||||
accessible field com/mojang/blaze3d/vertex/VertexBuffer format Lcom/mojang/blaze3d/vertex/VertexFormat;
|
||||
accessible field net/minecraft/client/renderer/GameRenderer tick I
|
||||
accessible field net/minecraft/world/level/levelgen/placement/ConfiguredDecorator decorator Lnet/minecraft/world/level/levelgen/placement/FeatureDecorator;
|
||||
accessible field com/mojang/blaze3d/vertex/BufferBuilder buffer Ljava/nio/ByteBuffer;
|
||||
accessible field net/minecraft/world/level/chunk/ProtoChunk sections [Lnet/minecraft/world/level/chunk/LevelChunkSection;
|
||||
accessible field net/minecraft/world/level/block/state/BlockBehaviour$BlockStateBase materialColor Lnet/minecraft/world/level/material/MaterialColor;
|
||||
accessible field net/minecraft/server/level/ServerLevel structureFeatureManager Lnet/minecraft/world/level/StructureFeatureManager;
|
||||
accessible field net/minecraft/client/renderer/LevelRenderer renderChunks Lit/unimi/dsi/fastutil/objects/ObjectList;
|
||||
accessible field net/minecraft/server/level/ServerChunkCache dataStorage Lnet/minecraft/world/level/storage/DimensionDataStorage;
|
||||
accessible field net/minecraft/util/UniformInt baseValue I
|
||||
accessible field net/minecraft/world/level/lighting/LevelLightEngine blockEngine Lnet/minecraft/world/level/lighting/LayerLightEngine;
|
||||
accessible field net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo chunk Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;
|
||||
accessible field com/mojang/blaze3d/vertex/VertexBuffer vertextBufferId I
|
||||
accessible field net/minecraft/util/UniformInt spread I
|
||||
accessible field net/minecraft/client/renderer/LightTexture lightPixels Lcom/mojang/blaze3d/platform/NativeImage;
|
||||
accessible field net/minecraft/server/level/ChunkMap structureManager Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructureManager;
|
||||
accessible field net/minecraft/world/level/levelgen/structure/templatesystem/StructureManager structureRepository Ljava/util/Map;
|
||||
accessible field net/minecraft/world/level/levelgen/feature/Feature configuredCodec Lcom/mojang/serialization/Codec;
|
||||
accessible field net/minecraft/world/level/storage/DimensionDataStorage dataFolder Ljava/io/File;
|
||||
accessible field net/minecraft/world/level/chunk/LevelChunk heightmaps Ljava/util/Map;
|
||||
accessible field net/minecraft/world/level/levelgen/feature/stateproviders/WeightedStateProvider weightedList Lnet/minecraft/util/random/SimpleWeightedRandomList;
|
||||
accessible field com/mojang/blaze3d/vertex/VertexBuffer indexCount I
|
||||
accessible field net/minecraft/client/renderer/LevelRenderer renderChunks Lit/unimi/dsi/fastutil/objects/ObjectArrayList;
|
||||
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite animatedTexture Lnet/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture;
|
||||
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite width I
|
||||
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite height I
|
||||
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite mainImage [Lcom/mojang/blaze3d/platform/NativeImage;
|
||||
extendable class com/mojang/math/Matrix4f
|
||||
accessWidener v1 named
|
||||
|
||||
# used when determining where to save files too
|
||||
accessible field net/minecraft/world/level/storage/DimensionDataStorage dataFolder Ljava/io/File;
|
||||
|
||||
# used when rendering
|
||||
accessible field com/mojang/blaze3d/vertex/VertexBuffer indexCount I
|
||||
accessible field com/mojang/blaze3d/vertex/VertexBuffer vertextBufferId I
|
||||
accessible method net/minecraft/client/renderer/GameRenderer getFov (Lnet/minecraft/client/Camera;FZ)D
|
||||
|
||||
# pre-render setup
|
||||
accessible field net/minecraft/client/renderer/LevelRenderer renderChunks Lit/unimi/dsi/fastutil/objects/ObjectArrayList;
|
||||
accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo
|
||||
accessible field net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo chunk Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;
|
||||
|
||||
# lighting
|
||||
accessible field net/minecraft/client/renderer/LightTexture lightPixels Lcom/mojang/blaze3d/platform/NativeImage;
|
||||
accessible field net/minecraft/world/level/lighting/LevelLightEngine blockEngine Lnet/minecraft/world/level/lighting/LayerLightEngine;
|
||||
accessible field net/minecraft/world/level/lighting/LevelLightEngine skyEngine Lnet/minecraft/world/level/lighting/LayerLightEngine;
|
||||
|
||||
# world generation
|
||||
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;
|
||||
|
||||
# idk what's going on here
|
||||
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite animatedTexture Lnet/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture;
|
||||
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite width I
|
||||
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite height I
|
||||
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite mainImage [Lcom/mojang/blaze3d/platform/NativeImage;
|
||||
extendable class com/mojang/math/Matrix4f
|
||||
|
||||
+1
-1
Submodule core updated: 511a771351...a489810d68
@@ -31,7 +31,7 @@ import me.shedaniel.autoconfig.annotation.ConfigEntry;
|
||||
/**
|
||||
* This handles any configuration the user has access to.
|
||||
* @author coolGi2007
|
||||
* @version 11-23-2021
|
||||
* @version 11-29-2021
|
||||
*/
|
||||
@me.shedaniel.autoconfig.annotation.Config(name = ModInfo.ID)
|
||||
public class Config implements ConfigData
|
||||
@@ -54,10 +54,6 @@ public class Config implements ConfigData
|
||||
// Since the original config system uses forge stuff, that means we have to rewrite the whole config system
|
||||
// TODO: Stop using autoconfig and use manual config for cloth config
|
||||
|
||||
@ConfigEntry.Gui.Excluded
|
||||
//@ConfigEntry.Category("lod.debug")
|
||||
public int ConfigVersion = 1;
|
||||
|
||||
@ConfigEntry.Gui.CollapsibleObject
|
||||
public Client client = new Client();
|
||||
|
||||
@@ -117,7 +113,11 @@ public class Config implements ConfigData
|
||||
|
||||
@ConfigEntry.Category("lod.Graphics.FogQualityOption")
|
||||
@ConfigEntry.Gui.Tooltip
|
||||
public static FogDrawOverride fogDrawOverride = IFogQuality.FOG_DRAW_OVERRIDE_DEFAULT;
|
||||
public static FogDrawMode fogDrawMode = IFogQuality.FOG_DRAW_MODE_DEFAULT;
|
||||
|
||||
@ConfigEntry.Category("lod.Graphics.FogQualityOption")
|
||||
@ConfigEntry.Gui.Tooltip
|
||||
public static FogColorMode fogColorMode = IFogQuality.FOG_COLOR_MODE_DEFAULT;
|
||||
|
||||
@ConfigEntry.Category("lod.Graphics.FogQualityOption")
|
||||
@ConfigEntry.Gui.Tooltip
|
||||
@@ -146,6 +146,11 @@ public class Config implements ConfigData
|
||||
@ConfigEntry.Gui.Tooltip
|
||||
public static GpuUploadMethod gpuUploadMethod = IAdvancedGraphics.GPU_UPLOAD_METHOD_DEFAULT;
|
||||
|
||||
@ConfigEntry.Category("lod.Graphics.AdvancedGraphicsOption")
|
||||
@ConfigEntry.Gui.Tooltip
|
||||
@ConfigEntry.BoundedDiscrete(min = 0, max = 5000)
|
||||
public static int gpuUploadTimeoutInMilleseconds = IAdvancedGraphics.GPU_UPLOAD_TIMEOUT_IN_MILLISECONDS_DEFAULT.defaultValue;
|
||||
|
||||
@ConfigEntry.Category("lod.Graphics.AdvancedGraphicsOption")
|
||||
@ConfigEntry.Gui.Tooltip
|
||||
public static boolean useExtendedNearClipPlane = IAdvancedGraphics.USE_EXTENDED_NEAR_CLIP_PLANE_DEFAULT;
|
||||
|
||||
@@ -27,7 +27,6 @@ import me.shedaniel.autoconfig.AutoConfig;
|
||||
import me.shedaniel.autoconfig.serializer.Toml4jConfigSerializer;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||
import net.minecraftforge.common.WorldWorkerManager;
|
||||
|
||||
/**
|
||||
* Initialize and setup the Mod. <br>
|
||||
@@ -51,30 +50,19 @@ public class Main implements ClientModInitializer
|
||||
|
||||
|
||||
// Do if implements ClientModInitializer
|
||||
// This loads the mod before minecraft loads which causes a lot of issues
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
|
||||
// no.
|
||||
}
|
||||
|
||||
// This loads the mod after minecraft loads which doesn't causes a lot of issues
|
||||
public static void init() {
|
||||
if (instance != null) return;
|
||||
instance = new Main();
|
||||
|
||||
DependencySetup.createInitialBindings();
|
||||
DependencySetup.createInitialBindings();
|
||||
ClientApi.LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
|
||||
initializeForge();
|
||||
|
||||
// Check if this works
|
||||
client_proxy = new ClientProxy();
|
||||
client_proxy.registerEvents();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method makes forge classes work instead of just sitting there
|
||||
* @author Ran
|
||||
*/
|
||||
public static void initializeForge() {
|
||||
ServerTickEvents.START_SERVER_TICK.register((server) -> WorldWorkerManager.tick(true));
|
||||
ServerTickEvents.END_SERVER_TICK.register((server) -> WorldWorkerManager.tick(false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
/**
|
||||
* Loads the mod after minecraft loads.
|
||||
* @author Ran
|
||||
*/
|
||||
@Mixin(value = Minecraft.class)
|
||||
public class MixinMinecraft {
|
||||
@Inject(method = "<init>", at = @At("TAIL"))
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.seibel.lod.fabric.mixins;
|
||||
|
||||
import com.seibel.lod.core.ModInfo;
|
||||
import com.seibel.lod.fabric.Config;
|
||||
import com.seibel.lod.fabric.wrappers.config.TexturedButtonWidget;
|
||||
import me.shedaniel.autoconfig.AutoConfig;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.gui.screens.OptionsScreen;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Mixin(OptionsScreen.class)
|
||||
public class MixinOptionsScreen extends Screen {
|
||||
// Get the texture for the button
|
||||
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")
|
||||
private void lodconfig$init(CallbackInfo ci) {
|
||||
this.addRenderableWidget(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,
|
||||
// Offset
|
||||
0, 0,
|
||||
// Some textuary stuff
|
||||
20, ICON_TEXTURE, 20, 40,
|
||||
// Create the button and tell it where to go
|
||||
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(AutoConfig.getConfigScreen(Config.class, this).get()),
|
||||
// Add a title to the screen
|
||||
new TranslatableComponent("text.autoconfig." + ModInfo.ID + ".title")));
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,7 @@ import net.minecraft.client.renderer.RenderType;
|
||||
@Mixin(LevelRenderer.class)
|
||||
public class MixinWorldRenderer
|
||||
{
|
||||
/*
|
||||
private static float previousPartialTicks = 0;
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "renderClouds")
|
||||
@@ -77,6 +78,32 @@ public class MixinWorldRenderer
|
||||
|
||||
Mat4f mcModelViewMatrix = McObjectConverter.Convert(matrixStackIn.last().pose());
|
||||
|
||||
ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
private static float previousPartialTicks = 0;
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "renderClouds(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/math/Matrix4f;FDDD)V")
|
||||
private void renderClouds(PoseStack modelViewMatrixStack, Matrix4f projectionMatrix, float partialTicks, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, CallbackInfo callback)
|
||||
{
|
||||
// get the partial ticks since renderChunkLayer doesn't
|
||||
// have access to them
|
||||
previousPartialTicks = partialTicks;
|
||||
}
|
||||
|
||||
// HEAD or RETURN
|
||||
@Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V")
|
||||
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||
{
|
||||
// only render before solid blocks
|
||||
if (renderType.equals(RenderType.solid()))
|
||||
{
|
||||
Mat4f mcModelViewMatrix = McObjectConverter.Convert(modelViewMatrixStack.last().pose());
|
||||
Mat4f mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix);
|
||||
|
||||
ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@ import com.seibel.lod.core.wrapperInterfaces.block.IBlockColorSingletonWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper;
|
||||
import com.seibel.lod.fabric.wrappers.block.BlockColorSingletonWrapper;
|
||||
import com.seibel.lod.fabric.wrappers.config.LodConfigWrapperSingleton;
|
||||
import com.seibel.lod.fabric.wrappers.block.BlockColorSingletonWrapper;
|
||||
import com.seibel.lod.fabric.wrappers.minecraft.MinecraftRenderWrapper;
|
||||
import com.seibel.lod.fabric.wrappers.minecraft.MinecraftWrapper;
|
||||
|
||||
/**
|
||||
* Binds all necessary dependencies so we
|
||||
* Binds all necessary dependencies, so we
|
||||
* can access them in Core. <br>
|
||||
* This needs to be called before any Core classes
|
||||
* are loaded.
|
||||
|
||||
@@ -30,21 +30,12 @@ import net.minecraft.core.Direction;
|
||||
/**
|
||||
* This class converts to and from Minecraft objects (Ex: Matrix4f)
|
||||
* and objects we created (Ex: Mat4f).
|
||||
* Since we don't want to deal with a bunch of tiny changes
|
||||
* every time Minecraft renames a variable in Matrix4f or something.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 11-11-2021
|
||||
* @version 11-20-2021
|
||||
*/
|
||||
public class McObjectConverter
|
||||
{
|
||||
|
||||
public McObjectConverter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** 4x4 float matrix converter */
|
||||
public static Mat4f Convert(Matrix4f mcMatrix)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
||||
* licensed under the GNU GPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.fabric.wrappers;
|
||||
|
||||
import com.seibel.lod.core.builders.lodBuilding.LodBuilder;
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
||||
* licensed under the GNU GPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.fabric.wrappers;
|
||||
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
@@ -5,14 +24,12 @@ import net.minecraft.world.level.levelgen.Heightmap;
|
||||
/**
|
||||
* Stores any variables or code that
|
||||
* may be shared between wrapper objects.
|
||||
*
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 11-20-2021
|
||||
*/
|
||||
public class WrapperUtil
|
||||
{
|
||||
|
||||
/** If we ever need to use a heightmap for any reason, use this one. */
|
||||
public static final Heightmap.Types DEFAULT_HEIGHTMAP = Heightmap.Types.WORLD_SURFACE_WG;
|
||||
|
||||
public static final Heightmap.Types DEFAULT_HEIGHTMAP = Heightmap.Types.WORLD_SURFACE_WG;
|
||||
}
|
||||
|
||||
+25
-4
@@ -1,25 +1,46 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
||||
* licensed under the GNU GPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.fabric.wrappers.block;
|
||||
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockColorSingletonWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockColorWrapper;
|
||||
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
|
||||
/**
|
||||
* This class wraps the minecraft Block class
|
||||
* Contains methods that would have been static in BlockColorWrapper.
|
||||
* Since interfaces can't create/implement static methods we have
|
||||
* to split the object up in two.
|
||||
*
|
||||
* @author ??
|
||||
* @author James Seibel
|
||||
* @version 11-17-2021
|
||||
*/
|
||||
public class BlockColorSingletonWrapper implements IBlockColorSingletonWrapper
|
||||
{
|
||||
public static final BlockColorSingletonWrapper INSTANCE = new BlockColorSingletonWrapper();
|
||||
|
||||
/** return base color of water (grey value) */
|
||||
@Override
|
||||
public IBlockColorWrapper getWaterColor()
|
||||
{
|
||||
return BlockColorWrapper.getBlockColorWrapper(Blocks.WATER);
|
||||
return BlockColorWrapper.getBlockColorWrapper(Blocks.WATER.defaultBlockState(), new BlockPosWrapper(0,0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,80 +7,74 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import com.seibel.lod.core.util.ColorUtil;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockColorWrapper;
|
||||
import com.seibel.lod.fabric.wrappers.minecraft.MinecraftWrapper;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.*;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.BushBlock;
|
||||
import net.minecraft.world.level.block.FlowerBlock;
|
||||
import net.minecraft.world.level.block.GrassBlock;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.TallGrassBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
|
||||
/**
|
||||
* This class wraps the minecraft Block color class
|
||||
*
|
||||
* @author ??
|
||||
* @version 11-17-2021
|
||||
* @author James Seibel
|
||||
* @version 11-21-2021
|
||||
*/
|
||||
public class BlockColorWrapper implements IBlockColorWrapper
|
||||
{
|
||||
//set of block which require tint
|
||||
public static final ConcurrentMap<Block, BlockColorWrapper> blockColorWrapperMap = new ConcurrentHashMap<>();
|
||||
public static final ConcurrentMap<Block, IBlockColorWrapper> blockColorWrapperMap = new ConcurrentHashMap<>();
|
||||
// public static final ModelDataMap dataMap = new ModelDataMap.Builder().build();
|
||||
public static final BlockPos blockPos = new BlockPos(0, 0, 0);
|
||||
public static final Random random = new Random(0);
|
||||
public static final AbstractBlockPosWrapper blockPos = new BlockPosWrapper(0,0,0);
|
||||
public static Random random = new Random(0);
|
||||
//public static BlockColourWrapper WATER_COLOR = getBlockColorWrapper(Blocks.WATER);
|
||||
public static final Direction[] directions = new Direction[] { Direction.UP, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, Direction.DOWN };
|
||||
|
||||
private final Block block;
|
||||
private Block block;
|
||||
private int color;
|
||||
private boolean isColored;
|
||||
private boolean toTint;
|
||||
private boolean foliageTint;
|
||||
private boolean folliageTint;
|
||||
private boolean grassTint;
|
||||
private boolean waterTint;
|
||||
|
||||
|
||||
/**Constructor only require for the block instance we are wrapping**/
|
||||
public BlockColorWrapper(Block block)
|
||||
public BlockColorWrapper(BlockState blockState, AbstractBlockPosWrapper blockPosWrapper)
|
||||
{
|
||||
this.block = block;
|
||||
this.block = blockState.getBlock();
|
||||
this.color = 0;
|
||||
this.isColored = true;
|
||||
this.toTint = false;
|
||||
this.foliageTint = false;
|
||||
this.folliageTint = false;
|
||||
this.grassTint = false;
|
||||
this.waterTint = false;
|
||||
setupColorAndTint();
|
||||
/*StringBuilder s = new StringBuilder();
|
||||
s.append(block + "\n"
|
||||
+ Integer.toHexString(
|
||||
Minecraft.getInstance().getBlockColors().createDefault().getColor(
|
||||
block.defaultBlockState(),
|
||||
(World) MinecraftWrapper.INSTANCE.getWrappedServerLevel().getLevel(),
|
||||
blockPosWrapper.getBlockPos())) + "\n"
|
||||
);
|
||||
for(Property x : Minecraft.getInstance().getBlockColors().getColoringProperties(block))
|
||||
s.append(x.getName() + " " + x.getPossibleValues() + '\n');
|
||||
System.out.println(s);*/
|
||||
//System.out.println(block + " color " + Integer.toHexString(color) + " to tint " + toTint + " folliageTint " + folliageTint + " grassTint " + grassTint + " waterTint " + waterTint);
|
||||
setupColorAndTint(blockState,blockPosWrapper);
|
||||
System.out.println(block + " color " + Integer.toHexString(color) + " to tint " + toTint + " folliageTint " + folliageTint + " grassTint " + grassTint + " waterTint " + waterTint);
|
||||
}
|
||||
|
||||
/**
|
||||
* this return a wrapper of the block in input
|
||||
* @param block object of the block to wrap
|
||||
* @param blockState of the block to wrap
|
||||
*/
|
||||
public static IBlockColorWrapper getBlockColorWrapper(Block block)
|
||||
static public IBlockColorWrapper getBlockColorWrapper(BlockState blockState, AbstractBlockPosWrapper blockPosWrapper)
|
||||
{
|
||||
//first we check if the block has already been wrapped
|
||||
if (blockColorWrapperMap.containsKey(block) && blockColorWrapperMap.get(block) != null)
|
||||
return blockColorWrapperMap.get(block);
|
||||
if (blockColorWrapperMap.containsKey(blockState.getBlock()) && blockColorWrapperMap.get(blockState.getBlock()) != null)
|
||||
return blockColorWrapperMap.get(blockState.getBlock());
|
||||
|
||||
|
||||
//if it hasn't been created yet, we create it and save it in the map
|
||||
BlockColorWrapper blockWrapper = new BlockColorWrapper(block);
|
||||
blockColorWrapperMap.put(block, blockWrapper);
|
||||
IBlockColorWrapper blockWrapper = new BlockColorWrapper(blockState, blockPosWrapper);
|
||||
blockColorWrapperMap.put(blockState.getBlock(), blockWrapper);
|
||||
|
||||
//we return the newly created wrapper
|
||||
return blockWrapper;
|
||||
@@ -90,10 +84,8 @@ public class BlockColorWrapper implements IBlockColorWrapper
|
||||
* Generate the color of the given block from its texture
|
||||
* and store it for later use.
|
||||
*/
|
||||
private void setupColorAndTint()
|
||||
private void setupColorAndTint(BlockState blockState, AbstractBlockPosWrapper blockPosWrapper)
|
||||
{
|
||||
BlockState blockState = block.defaultBlockState();
|
||||
BlockPosWrapper blockPosWrapper = new BlockPosWrapper();
|
||||
MinecraftWrapper mc = MinecraftWrapper.INSTANCE;
|
||||
TextureAtlasSprite texture;
|
||||
List<BakedQuad> quads = null;
|
||||
@@ -117,7 +109,7 @@ public class BlockColorWrapper implements IBlockColorWrapper
|
||||
if (isTinted)
|
||||
this.toTint = true;
|
||||
|
||||
//now we get the first non empty face
|
||||
//now we get the first non-empty face
|
||||
for (Direction direction : directions)
|
||||
{
|
||||
// quads = mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, dataMap);
|
||||
@@ -148,17 +140,17 @@ public class BlockColorWrapper implements IBlockColorWrapper
|
||||
int colorMultiplier;
|
||||
|
||||
// generate the block's color
|
||||
// for (int frameIndex = 0; frameIndex < texture.getFrameCount(); frameIndex++)
|
||||
//for (int frameIndex = 0; frameIndex < texture.getFrameCount(); frameIndex++)
|
||||
int frameIndex = 0; // TODO
|
||||
{
|
||||
// textures normally use u and v instead of x and y
|
||||
for (int u = 0; u < texture.getWidth(); u++)
|
||||
for (int u = 0; u < texture.getHeight(); u++)
|
||||
{
|
||||
for (int v = 0; v < texture.getHeight(); v++)
|
||||
for (int v = 0; v < texture.getWidth(); v++)
|
||||
{
|
||||
|
||||
tempColor = TextureAtlasSpriteWrapper.getPixelRGBA(texture, frameIndex, u, v);
|
||||
|
||||
|
||||
if (ColorUtil.getAlpha(TextureAtlasSpriteWrapper.getPixelRGBA(texture, frameIndex, u, v)) == 0)
|
||||
continue;
|
||||
|
||||
@@ -208,7 +200,7 @@ public class BlockColorWrapper implements IBlockColorWrapper
|
||||
// we check which kind of tint we need to apply
|
||||
this.grassTint = grassInstance() && toTint;
|
||||
|
||||
this.foliageTint = leavesInstance() && toTint;
|
||||
this.folliageTint = leavesInstance() && toTint;
|
||||
|
||||
this.waterTint = waterIstance() && toTint;
|
||||
|
||||
@@ -220,7 +212,7 @@ public class BlockColorWrapper implements IBlockColorWrapper
|
||||
{
|
||||
return block instanceof GrassBlock
|
||||
|| block instanceof BushBlock
|
||||
|| block instanceof GrowingPlantBlock;
|
||||
|| block instanceof TallGrassBlock;
|
||||
}
|
||||
|
||||
/** determine if the given block should use the biome's foliage color */
|
||||
@@ -250,7 +242,7 @@ public class BlockColorWrapper implements IBlockColorWrapper
|
||||
@Override
|
||||
public int getColor()
|
||||
{
|
||||
return color;
|
||||
return color;
|
||||
}
|
||||
|
||||
//------------//
|
||||
@@ -273,7 +265,7 @@ public class BlockColorWrapper implements IBlockColorWrapper
|
||||
@Override
|
||||
public boolean hasFolliageTint()
|
||||
{
|
||||
return foliageTint;
|
||||
return folliageTint;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,14 +7,19 @@ import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 11-21-2021
|
||||
*/
|
||||
public class BlockPosWrapper extends AbstractBlockPosWrapper
|
||||
{
|
||||
private final BlockPos.MutableBlockPos blockPos;
|
||||
private BlockPos.MutableBlockPos blockPos;
|
||||
|
||||
|
||||
public BlockPosWrapper()
|
||||
{
|
||||
this.blockPos = new BlockPos.MutableBlockPos(0, 0, 0);
|
||||
this.blockPos = new BlockPos.MutableBlockPos(0,0,0);
|
||||
}
|
||||
|
||||
public BlockPosWrapper(int x, int y, int z)
|
||||
@@ -22,26 +27,33 @@ public class BlockPosWrapper extends AbstractBlockPosWrapper
|
||||
this.blockPos = new BlockPos.MutableBlockPos(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void set(int x, int y, int z)
|
||||
{
|
||||
blockPos.set(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getX()
|
||||
{
|
||||
return blockPos.getX();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getY()
|
||||
{
|
||||
return blockPos.getY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZ()
|
||||
{
|
||||
return blockPos.getZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int get(LodDirection.Axis axis)
|
||||
{
|
||||
return axis.choose(getX(), getY(), getZ());
|
||||
@@ -52,18 +64,17 @@ public class BlockPosWrapper extends AbstractBlockPosWrapper
|
||||
return blockPos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
@Override public boolean equals(Object o)
|
||||
{
|
||||
return blockPos.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
@Override public int hashCode()
|
||||
{
|
||||
return Objects.hash(blockPos);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BlockPosWrapper offset(int x, int y, int z)
|
||||
{
|
||||
blockPos.set(blockPos.getX() + x, blockPos.getY() + y, blockPos.getZ() + z);
|
||||
|
||||
@@ -19,10 +19,8 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
|
||||
/**
|
||||
* This class wraps Minecraft's Block class
|
||||
*
|
||||
* @author ??
|
||||
* @version 11-18-2021
|
||||
* @author James Seibel
|
||||
* @version 11-21-2021
|
||||
*/
|
||||
public class BlockShapeWrapper implements IBlockShapeWrapper
|
||||
{
|
||||
@@ -31,7 +29,7 @@ public class BlockShapeWrapper implements IBlockShapeWrapper
|
||||
public static BlockShapeWrapper WATER_SHAPE = new BlockShapeWrapper();
|
||||
|
||||
private final Block block;
|
||||
private boolean toAvoid;
|
||||
private final boolean toAvoid;
|
||||
private boolean nonFull;
|
||||
private boolean noCollision;
|
||||
|
||||
@@ -42,8 +40,8 @@ public class BlockShapeWrapper implements IBlockShapeWrapper
|
||||
this.nonFull = false;
|
||||
this.noCollision = false;
|
||||
this.toAvoid = ofBlockToAvoid();
|
||||
setupShapes((ChunkWrapper) chunkWrapper, (BlockPosWrapper) blockPosWrapper);
|
||||
//System.out.println(block + " non full " + nonFull + " no collision " + noCollision + " to avoid " + toAvoid);
|
||||
setupShapes(chunkWrapper, blockPosWrapper);
|
||||
System.out.println(block + " non full " + nonFull + " no collision " + noCollision + " to avoid " + toAvoid);
|
||||
}
|
||||
|
||||
private BlockShapeWrapper()
|
||||
@@ -58,7 +56,7 @@ public class BlockShapeWrapper implements IBlockShapeWrapper
|
||||
* this return a wrapper of the block in input
|
||||
* @param block Block object to wrap
|
||||
*/
|
||||
static public BlockShapeWrapper getBlockShapeWrapper(Block block, IChunkWrapper chunkWrapper, AbstractBlockPosWrapper blockPosWrapper)
|
||||
static public BlockShapeWrapper getBlockShapeWrapper(Block block, ChunkWrapper chunkWrapper, AbstractBlockPosWrapper blockPosWrapper)
|
||||
{
|
||||
//first we check if the block has already been wrapped
|
||||
if (blockShapeWrapperMap.containsKey(block) && blockShapeWrapperMap.get(block) != null)
|
||||
@@ -73,13 +71,13 @@ public class BlockShapeWrapper implements IBlockShapeWrapper
|
||||
return blockWrapper;
|
||||
}
|
||||
|
||||
private void setupShapes(ChunkWrapper chunkWrapper, BlockPosWrapper blockPosWrapper)
|
||||
private void setupShapes(IChunkWrapper chunkWrapper, AbstractBlockPosWrapper blockPosWrapper)
|
||||
{
|
||||
ChunkAccess chunk = chunkWrapper.getChunk();
|
||||
BlockPos blockPos = blockPosWrapper.getBlockPos();
|
||||
ChunkAccess chunk = ((ChunkWrapper) chunkWrapper).getChunk();
|
||||
BlockPos blockPos = ((BlockPosWrapper) blockPosWrapper).getBlockPos();
|
||||
boolean noCollisionSetted = false;
|
||||
boolean nonFullSetted = false;
|
||||
if (!block.defaultBlockState().getFluidState().isEmpty()) // || block instanceof SixWayBlock)
|
||||
if (!block.defaultBlockState().getFluidState().isEmpty())// || block instanceof SixWayBlock)
|
||||
{
|
||||
noCollisionSetted = true;
|
||||
nonFullSetted = true;
|
||||
@@ -116,8 +114,7 @@ public class BlockShapeWrapper implements IBlockShapeWrapper
|
||||
{
|
||||
return block.equals(Blocks.AIR)
|
||||
|| block.equals(Blocks.CAVE_AIR)
|
||||
|| block.equals(Blocks.BARRIER)
|
||||
|| block.equals(Blocks.VOID_AIR);
|
||||
|| block.equals(Blocks.BARRIER);
|
||||
}
|
||||
//-----------------//
|
||||
//Avoidance getters//
|
||||
|
||||
@@ -11,48 +11,47 @@ import net.minecraft.world.level.ChunkPos;
|
||||
|
||||
|
||||
/**
|
||||
* This class wraps minecraft's ChunkPos class
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 11-18-2021
|
||||
* @version 11-21-2021
|
||||
*/
|
||||
public class ChunkPosWrapper extends AbstractChunkPosWrapper
|
||||
{
|
||||
private final ChunkPos chunkPos;
|
||||
private net.minecraft.world.level.ChunkPos chunkPos;
|
||||
|
||||
public ChunkPosWrapper(ChunkPos newChunkPos)
|
||||
{
|
||||
this.chunkPos = newChunkPos;
|
||||
}
|
||||
|
||||
public ChunkPosWrapper(BlockPos blockPos)
|
||||
{
|
||||
this.chunkPos = new ChunkPos(blockPos);
|
||||
}
|
||||
|
||||
|
||||
public ChunkPosWrapper(AbstractChunkPosWrapper newChunkPos)
|
||||
{
|
||||
this.chunkPos = ((ChunkPosWrapper) newChunkPos).chunkPos;
|
||||
}
|
||||
|
||||
public ChunkPosWrapper(AbstractBlockPosWrapper blockPos)
|
||||
public ChunkPosWrapper()
|
||||
{
|
||||
this.chunkPos = new ChunkPos(((BlockPosWrapper) blockPos).getBlockPos());
|
||||
}
|
||||
|
||||
public ChunkPosWrapper(int chunkX, int chunkZ)
|
||||
{
|
||||
this.chunkPos = new ChunkPos(chunkX, chunkZ);
|
||||
this.chunkPos = new ChunkPos(0, 0);
|
||||
}
|
||||
|
||||
public ChunkPosWrapper()
|
||||
{
|
||||
this.chunkPos = new ChunkPos(0, 0);
|
||||
public ChunkPosWrapper(BlockPos blockPos)
|
||||
{
|
||||
this.chunkPos = new ChunkPos(blockPos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public ChunkPosWrapper(AbstractChunkPosWrapper newChunkPos)
|
||||
{
|
||||
this.chunkPos = ((ChunkPosWrapper) newChunkPos).chunkPos;
|
||||
}
|
||||
|
||||
public ChunkPosWrapper(AbstractBlockPosWrapper blockPos)
|
||||
{
|
||||
this.chunkPos = new ChunkPos(((BlockPosWrapper) blockPos).getBlockPos());
|
||||
}
|
||||
|
||||
public ChunkPosWrapper(int chunkX, int chunkZ)
|
||||
{
|
||||
this.chunkPos = new ChunkPos(chunkX, chunkZ);
|
||||
}
|
||||
|
||||
|
||||
public ChunkPosWrapper(ChunkPos pos)
|
||||
{
|
||||
this.chunkPos = pos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getX()
|
||||
{
|
||||
@@ -94,8 +93,6 @@ public class ChunkPosWrapper extends AbstractChunkPosWrapper
|
||||
return chunkPos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
@@ -107,11 +104,12 @@ public class ChunkPosWrapper extends AbstractChunkPosWrapper
|
||||
{
|
||||
return Objects.hash(chunkPos);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BlockPosWrapper getWorldPosition()
|
||||
public AbstractBlockPosWrapper getWorldPosition()
|
||||
{
|
||||
BlockPos blockPos = chunkPos.getWorldPosition();
|
||||
// the parameter here is the y position
|
||||
BlockPos blockPos = chunkPos.getMiddleBlockPosition(0);
|
||||
return new BlockPosWrapper(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
}
|
||||
|
||||
|
||||
@@ -3,31 +3,33 @@ package com.seibel.lod.fabric.wrappers.chunk;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockColorWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockShapeWrapper;
|
||||
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.fabric.wrappers.WrapperUtil;
|
||||
import com.seibel.lod.fabric.wrappers.block.BlockColorWrapper;
|
||||
import com.seibel.lod.fabric.wrappers.block.BlockPosWrapper;
|
||||
import com.seibel.lod.fabric.wrappers.block.BlockShapeWrapper;
|
||||
import com.seibel.lod.fabric.wrappers.world.BiomeWrapper;
|
||||
import net.minecraft.world.level.block.LiquidBlockContainer;
|
||||
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
|
||||
|
||||
import net.minecraft.world.level.block.LiquidBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ??
|
||||
* @version 11-17-2021
|
||||
* @author James Seibel
|
||||
* @version 11-21-2021
|
||||
*/
|
||||
public class ChunkWrapper implements IChunkWrapper
|
||||
{
|
||||
private final ChunkAccess chunk;
|
||||
private final ChunkPosWrapper chunkPos;
|
||||
|
||||
private ChunkAccess chunk;
|
||||
private AbstractChunkPosWrapper chunkPos;
|
||||
|
||||
@Override
|
||||
public int getHeight()
|
||||
{
|
||||
public int getHeight(){
|
||||
return chunk.getMaxBuildHeight();
|
||||
}
|
||||
|
||||
@@ -37,8 +39,14 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
BlockState blockState = chunk.getBlockState(((BlockPosWrapper) blockPos).getBlockPos());
|
||||
|
||||
//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));
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,7 +56,7 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeWrapper getBiome(int xRel, int yAbs, int zRel)
|
||||
public IBiomeWrapper getBiome(int xRel, int yAbs, int zRel)
|
||||
{
|
||||
return BiomeWrapper.getBiomeWrapper(chunk.getBiomes().getNoiseBiome(xRel >> 2, yAbs >> 2, zRel >> 2));
|
||||
}
|
||||
@@ -56,7 +64,7 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
@Override
|
||||
public IBlockColorWrapper getBlockColorWrapper(AbstractBlockPosWrapper blockPos)
|
||||
{
|
||||
return BlockColorWrapper.getBlockColorWrapper(chunk.getBlockState(((BlockPosWrapper) blockPos).getBlockPos()).getBlock());
|
||||
return BlockColorWrapper.getBlockColorWrapper(chunk.getBlockState(((BlockPosWrapper) blockPos).getBlockPos()), blockPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,36 +79,52 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
this.chunkPos = new ChunkPosWrapper(chunk.getPos());
|
||||
}
|
||||
|
||||
public ChunkAccess getChunk()
|
||||
{
|
||||
public ChunkAccess getChunk(){
|
||||
return chunk;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkPosWrapper getPos()
|
||||
public AbstractChunkPosWrapper getPos()
|
||||
{
|
||||
return chunkPos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLightCorrect()
|
||||
{
|
||||
public boolean isLightCorrect(){
|
||||
return chunk.isLightCorrect();
|
||||
}
|
||||
|
||||
public boolean
|
||||
isWaterLogged(BlockPosWrapper blockPos)
|
||||
{
|
||||
BlockState blockState = chunk.getBlockState(blockPos.getBlockPos());
|
||||
|
||||
// //This type of block is always in water
|
||||
// if((blockState.getBlock() instanceof ILiquidContainer) && !(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;
|
||||
}
|
||||
|
||||
public int getEmittedBrightness(BlockPosWrapper blockPos)
|
||||
{
|
||||
return chunk.getLightEmission(blockPos.getBlockPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWaterLogged(AbstractBlockPosWrapper blockPos)
|
||||
{
|
||||
BlockState blockState = chunk.getBlockState(((BlockPosWrapper)blockPos).getBlockPos());
|
||||
|
||||
//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));
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getEmittedBrightness(AbstractBlockPosWrapper blockPos)
|
||||
{
|
||||
return chunk.getLightEmission(((BlockPosWrapper)blockPos).getBlockPos());
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
+106
-81
@@ -8,49 +8,49 @@ import com.seibel.lod.fabric.Config;
|
||||
/**
|
||||
* This holds the config defaults and setters/getters
|
||||
* that should be hooked into the host mod loader (Fabric, Forge, etc.).
|
||||
*
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 11-16-2021
|
||||
*/
|
||||
public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
public static final LodConfigWrapperSingleton INSTANCE = new LodConfigWrapperSingleton();
|
||||
|
||||
|
||||
|
||||
|
||||
private static final Client client = new Client();
|
||||
@Override
|
||||
public IClient client()
|
||||
{
|
||||
return client;
|
||||
}
|
||||
|
||||
|
||||
public static class Client implements IClient
|
||||
{
|
||||
public final IGraphics graphics;
|
||||
public final IWorldGenerator worldGenerator;
|
||||
public final IAdvanced advanced;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IGraphics graphics()
|
||||
{
|
||||
return graphics;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IWorldGenerator worldGenerator()
|
||||
{
|
||||
return worldGenerator;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IAdvanced advanced()
|
||||
{
|
||||
return advanced;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//================//
|
||||
// Client Configs //
|
||||
//================//
|
||||
@@ -60,8 +60,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
worldGenerator = new WorldGenerator();
|
||||
advanced = new Advanced();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//==================//
|
||||
// Graphics Configs //
|
||||
//==================//
|
||||
@@ -70,8 +70,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
public final IQuality quality;
|
||||
public final IFogQuality fogQuality;
|
||||
public final IAdvancedGraphics advancedGraphics;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IQuality quality()
|
||||
@@ -90,16 +90,16 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
return advancedGraphics;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Graphics()
|
||||
{
|
||||
quality = new Quality();
|
||||
advancedGraphics = new AdvancedGraphics();
|
||||
fogQuality = new FogQuality();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static class Quality implements IQuality
|
||||
{
|
||||
@Override
|
||||
@@ -112,8 +112,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
Config.Client.Graphics.QualityOption.drawResolution = newHorizontalResolution;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getLodChunkRenderDistance()
|
||||
{
|
||||
@@ -124,8 +124,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
Config.Client.Graphics.QualityOption.lodChunkRenderDistance = newLodChunkRenderDistance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public VerticalQuality getVerticalQuality()
|
||||
{
|
||||
@@ -136,8 +136,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
Config.Client.Graphics.QualityOption.verticalQuality = newVerticalQuality;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public HorizontalScale getHorizontalScale()
|
||||
{
|
||||
@@ -148,8 +148,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
Config.Client.Graphics.QualityOption.horizontalScale = newHorizontalScale;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public HorizontalQuality getHorizontalQuality()
|
||||
{
|
||||
@@ -161,8 +161,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
Config.Client.Graphics.QualityOption.horizontalQuality = newHorizontalQuality;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static class FogQuality implements IFogQuality
|
||||
{
|
||||
@Override
|
||||
@@ -175,20 +175,34 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
Config.Client.Graphics.FogQualityOption.fogDistance = newFogDistance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public FogDrawOverride getFogDrawOverride()
|
||||
public FogDrawMode getFogDrawMode()
|
||||
{
|
||||
return Config.Client.Graphics.FogQualityOption.fogDrawOverride;
|
||||
return Config.Client.Graphics.FogQualityOption.fogDrawMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFogDrawOverride(FogDrawOverride newFogDrawOverride)
|
||||
public void setFogDrawMode(FogDrawMode setFogDrawMode)
|
||||
{
|
||||
Config.Client.Graphics.FogQualityOption.fogDrawOverride = newFogDrawOverride;
|
||||
Config.Client.Graphics.FogQualityOption.fogDrawMode = setFogDrawMode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public FogColorMode getFogColorMode()
|
||||
{
|
||||
return Config.Client.Graphics.FogQualityOption.fogColorMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFogColorMode(FogColorMode newFogColorMode)
|
||||
{
|
||||
Config.Client.Graphics.FogQualityOption.fogColorMode = newFogColorMode;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getDisableVanillaFog()
|
||||
{
|
||||
@@ -200,8 +214,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
Config.Client.Graphics.FogQualityOption.disableVanillaFog = newDisableVanillaFog;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static class AdvancedGraphics implements IAdvancedGraphics
|
||||
{
|
||||
@Override
|
||||
@@ -214,8 +228,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
Config.Client.Graphics.AdvancedGraphicsOption.lodTemplate = newLodTemplate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getDisableDirectionalCulling()
|
||||
{
|
||||
@@ -226,8 +240,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
Config.Client.Graphics.AdvancedGraphicsOption.disableDirectionalCulling = newDisableDirectionalCulling;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getAlwaysDrawAtMaxQuality()
|
||||
{
|
||||
@@ -238,8 +252,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
Config.Client.Graphics.AdvancedGraphicsOption.alwaysDrawAtMaxQuality = newAlwaysDrawAtMaxQuality;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public VanillaOverdraw getVanillaOverdraw()
|
||||
{
|
||||
@@ -250,8 +264,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
Config.Client.Graphics.AdvancedGraphicsOption.vanillaOverdraw = newVanillaOverdraw;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public GpuUploadMethod getGpuUploadMethod()
|
||||
{
|
||||
@@ -262,8 +276,19 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
Config.Client.Graphics.AdvancedGraphicsOption.gpuUploadMethod = newDisableVanillaFog;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getGpuUploadTimeoutInMilliseconds()
|
||||
{
|
||||
return Config.Client.Graphics.AdvancedGraphicsOption.gpuUploadTimeoutInMilleseconds;
|
||||
}
|
||||
@Override
|
||||
public void setGpuUploadTimeoutInMilliseconds(int newTimeoutInMilliseconds) {
|
||||
Config.Client.Graphics.AdvancedGraphicsOption.gpuUploadTimeoutInMilleseconds = newTimeoutInMilliseconds;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getUseExtendedNearClipPlane()
|
||||
{
|
||||
@@ -276,10 +301,10 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//========================//
|
||||
// WorldGenerator Configs //
|
||||
//========================//
|
||||
@@ -295,8 +320,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
Config.Client.WorldGenerator.generationPriority = newGenerationPriority;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public DistanceGenerationMode getDistanceGenerationMode()
|
||||
{
|
||||
@@ -307,8 +332,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
Config.Client.WorldGenerator.distanceGenerationMode = newDistanceGenerationMode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getAllowUnstableFeatureGeneration()
|
||||
{
|
||||
@@ -319,8 +344,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
Config.Client.WorldGenerator.allowUnstableFeatureGeneration = newAllowUnstableFeatureGeneration;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public BlocksToAvoid getBlocksToAvoid()
|
||||
{
|
||||
@@ -332,10 +357,10 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
Config.Client.WorldGenerator.blocksToAvoid = newBlockToAvoid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//============================//
|
||||
// AdvancedModOptions Configs //
|
||||
//============================//
|
||||
@@ -344,8 +369,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
public final IThreading threading;
|
||||
public final IDebugging debugging;
|
||||
public final IBuffers buffers;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IThreading threading()
|
||||
{
|
||||
@@ -365,15 +390,15 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
return buffers;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public Advanced()
|
||||
{
|
||||
threading = new Threading();
|
||||
debugging = new Debugging();
|
||||
buffers = new Buffers();
|
||||
}
|
||||
|
||||
|
||||
public static class Threading implements IThreading
|
||||
{
|
||||
@Override
|
||||
@@ -386,8 +411,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
Config.Client.AdvancedModOptions.Threading.numberOfWorldGenerationThreads = newNumberOfWorldGenerationThreads;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getNumberOfBufferBuilderThreads()
|
||||
{
|
||||
@@ -399,10 +424,10 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
Config.Client.AdvancedModOptions.Threading.numberOfBufferBuilderThreads = newNumberOfWorldBuilderThreads;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//===============//
|
||||
// Debug Options //
|
||||
//===============//
|
||||
@@ -418,8 +443,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
Config.Client.AdvancedModOptions.Debugging.drawLods = newDrawLods;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public DebugMode getDebugMode()
|
||||
{
|
||||
@@ -430,8 +455,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
Config.Client.AdvancedModOptions.Debugging.debugMode = newDebugMode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getDebugKeybindingsEnabled()
|
||||
{
|
||||
@@ -443,8 +468,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
Config.Client.AdvancedModOptions.Debugging.enableDebugKeybindings = newEnableDebugKeybindings;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static class Buffers implements IBuffers
|
||||
{
|
||||
@Override
|
||||
@@ -458,6 +483,6 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
Config.Client.AdvancedModOptions.Buffers.rebuildTimes = newBufferRebuildTimes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.seibel.lod.fabric.wrappers.config;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.client.gui.components.ImageButton;
|
||||
|
||||
/**
|
||||
* Creates a button with a texture on it
|
||||
*/
|
||||
public class TexturedButtonWidget extends ImageButton {
|
||||
public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, ResourceLocation texture, OnPress pressAction) {
|
||||
super(x, y, width, height, u, v, texture, pressAction);
|
||||
}
|
||||
public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, ResourceLocation texture, int textureWidth, int textureHeight, OnPress pressAction) {
|
||||
super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction);
|
||||
}
|
||||
|
||||
public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, ResourceLocation texture, int textureWidth, int textureHeight, OnPress pressAction, Component text) {
|
||||
super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, text);
|
||||
}
|
||||
|
||||
public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, ResourceLocation texture, int textureWidth, int textureHeight, OnPress pressAction, OnTooltip tooltipSupplier, Component text) {
|
||||
super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, tooltipSupplier, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) {
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, WIDGETS_LOCATION);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, this.alpha);
|
||||
int i = this.getYImage(this.isHovered());
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.enableDepthTest();
|
||||
this.blit(matrices, this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height);
|
||||
this.blit(matrices, this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
|
||||
|
||||
super.renderButton(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
}
|
||||
+26
-6
@@ -1,8 +1,10 @@
|
||||
package com.seibel.lod.fabric.wrappers.minecraft;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.mojang.math.Vector3d;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.seibel.lod.core.objects.math.Mat4f;
|
||||
import com.seibel.lod.core.objects.math.Vec3d;
|
||||
@@ -18,17 +20,19 @@ import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.LevelRenderer;
|
||||
import net.minecraft.client.renderer.LevelRenderer.RenderChunkInfo;
|
||||
import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher.CompiledChunk;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
|
||||
/**
|
||||
* A singleton that contains everything
|
||||
* related to rendering in Minecraft.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 11-18-2021
|
||||
* @version 11-26-2021
|
||||
*/
|
||||
public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
{
|
||||
@@ -73,8 +77,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public Mat4f getDefaultProjectionMatrix(float partialTicks)
|
||||
{
|
||||
// return McObjectConverter.Convert(gameRenderer.getProjectionMatrix(gameRenderer.getMainCamera(), partialTicks, true));
|
||||
return McObjectConverter.Convert(gameRenderer.getProjectionMatrix(partialTicks));
|
||||
return McObjectConverter.Convert(gameRenderer.getProjectionMatrix(gameRenderer.getFov(gameRenderer.getMainCamera(), partialTicks, true)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,7 +85,23 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
{
|
||||
return mc.options.gamma;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Color getFogColor() {
|
||||
float[] colorValues = new float[4];
|
||||
GL20.glGetFloatv(GL20.GL_FOG_COLOR, colorValues);
|
||||
return new Color(colorValues[0], colorValues[1], colorValues[2], colorValues[3]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getSkyColor() {
|
||||
if (mc.level.dimensionType().hasSkyLight()) {
|
||||
Vec3 colorValues = mc.level.getSkyColor(mc.gameRenderer.getMainCamera().getPosition(), mc.getFrameTime());
|
||||
return new Color((float) colorValues.x, (float) colorValues.y, (float) colorValues.z);
|
||||
} else
|
||||
return new Color(0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFov(float partialTicks)
|
||||
{
|
||||
@@ -124,7 +143,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
|
||||
// go through every RenderInfo to get the compiled chunks
|
||||
LevelRenderer renderer = mc.levelRenderer;
|
||||
for (LevelRenderer.RenderChunkInfo worldRenderer$LocalRenderInformationContainer : renderer.renderChunks)
|
||||
for (RenderChunkInfo worldRenderer$LocalRenderInformationContainer : renderer.renderChunks)
|
||||
{
|
||||
CompiledChunk compiledChunk = worldRenderer$LocalRenderInformationContainer.chunk.getCompiledChunk();
|
||||
if (!compiledChunk.hasNoRenderableLayers())
|
||||
@@ -138,4 +157,5 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
|
||||
return loadedPos;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+48
-19
@@ -58,7 +58,9 @@ import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.dimension.DimensionType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* A singleton that wraps the Minecraft class
|
||||
@@ -114,12 +116,15 @@ public class MinecraftWrapper implements IMinecraftWrapper
|
||||
//=================//
|
||||
|
||||
@Override
|
||||
public float getShade(LodDirection lodDirection)
|
||||
{
|
||||
Direction mcDir = McObjectConverter.Convert(lodDirection);
|
||||
return mc.level.getShade(mcDir, true);
|
||||
public float getShade(LodDirection lodDirection) {
|
||||
if (mc.level != null)
|
||||
{
|
||||
Direction mcDir = McObjectConverter.Convert(lodDirection);
|
||||
return mc.level.getShade(mcDir, true);
|
||||
}
|
||||
else return 0.0f;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasSinglePlayerServer()
|
||||
{
|
||||
@@ -211,7 +216,7 @@ public class MinecraftWrapper implements IMinecraftWrapper
|
||||
{
|
||||
return mc.player;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean playerExists()
|
||||
{
|
||||
@@ -228,7 +233,8 @@ public class MinecraftWrapper implements IMinecraftWrapper
|
||||
@Override
|
||||
public ChunkPosWrapper getPlayerChunkPos()
|
||||
{
|
||||
return new ChunkPosWrapper(getPlayer().chunkPosition().x, getPlayer().chunkPosition().z);
|
||||
ChunkPos playerPos = getPlayer().chunkPosition();
|
||||
return new ChunkPosWrapper(playerPos.x, playerPos.z);
|
||||
}
|
||||
|
||||
public Options getOptions()
|
||||
@@ -241,16 +247,11 @@ public class MinecraftWrapper implements IMinecraftWrapper
|
||||
return mc.getModelManager();
|
||||
}
|
||||
|
||||
public ClientLevel getClientWorld()
|
||||
public ClientLevel getClientLevel()
|
||||
{
|
||||
return mc.level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to get the ServerWorld for the dimension
|
||||
* the user is currently in.
|
||||
* @returns null if no ServerWorld is available
|
||||
*/
|
||||
@Override
|
||||
public IWorldWrapper getWrappedServerWorld()
|
||||
{
|
||||
@@ -276,6 +277,37 @@ public class MinecraftWrapper implements IMinecraftWrapper
|
||||
return WorldWrapper.getWorldWrapper(serverWorld);
|
||||
}
|
||||
|
||||
public WorldWrapper getWrappedClientLevel()
|
||||
{
|
||||
return WorldWrapper.getWorldWrapper(mc.level);
|
||||
}
|
||||
|
||||
public WorldWrapper getWrappedServerLevel()
|
||||
{
|
||||
|
||||
if (mc.level == null)
|
||||
return null;
|
||||
DimensionType dimension = mc.level.dimensionType();
|
||||
IntegratedServer server = mc.getSingleplayerServer();
|
||||
if (server == null)
|
||||
return null;
|
||||
|
||||
Iterable<ServerLevel> worlds = server.getAllLevels();
|
||||
ServerLevel returnWorld = null;
|
||||
|
||||
for (ServerLevel world : worlds)
|
||||
{
|
||||
if (world.dimensionType() == dimension)
|
||||
{
|
||||
returnWorld = world;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return WorldWrapper.getWorldWrapper(returnWorld);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IWorldWrapper getWrappedClientWorld()
|
||||
{
|
||||
@@ -296,8 +328,7 @@ public class MinecraftWrapper implements IMinecraftWrapper
|
||||
else if (mc.getProfiler() != profilerWrapper.profiler)
|
||||
profilerWrapper.profiler = mc.getProfiler();
|
||||
|
||||
return profilerWrapper;
|
||||
}
|
||||
return profilerWrapper; }
|
||||
|
||||
public ClientPacketListener getConnection()
|
||||
{
|
||||
@@ -384,11 +415,9 @@ public class MinecraftWrapper implements IMinecraftWrapper
|
||||
CrashReport report = new CrashReport(errorMessage, exception);
|
||||
Minecraft.crash(report);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@ import com.seibel.lod.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 11-20-2021
|
||||
*/
|
||||
|
||||
@@ -3,24 +3,22 @@ package com.seibel.lod.fabric.wrappers.misc;
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import com.seibel.lod.core.wrapperInterfaces.misc.ILightMapWrapper;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Leonardo Amato
|
||||
* @version 11-13-2021
|
||||
* @author James Seibel
|
||||
* @version 11-21-2021
|
||||
*/
|
||||
public class LightMapWrapper implements ILightMapWrapper
|
||||
{
|
||||
private NativeImage lightMap = null;
|
||||
static NativeImage lightMap = null;
|
||||
|
||||
public LightMapWrapper(NativeImage newlightMap)
|
||||
public LightMapWrapper(NativeImage newLightMap)
|
||||
{
|
||||
lightMap = newlightMap;
|
||||
lightMap = newLightMap;
|
||||
}
|
||||
|
||||
public void setLightMap(NativeImage newlightMap)
|
||||
public static void setLightMap(NativeImage newLightMap)
|
||||
{
|
||||
lightMap = newlightMap;
|
||||
lightMap = newLightMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
-2
@@ -26,9 +26,7 @@ import com.seibel.lod.fabric.wrappers.block.BlockPosWrapper;
|
||||
|
||||
import net.minecraft.client.renderer.BiomeColors;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Cola?
|
||||
* @version 11-15-2021
|
||||
*/
|
||||
|
||||
@@ -1,34 +1,49 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
||||
* licensed under the GNU GPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.fabric.wrappers.world;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import com.seibel.lod.core.util.ColorUtil;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IBiomeWrapper;
|
||||
import com.seibel.lod.fabric.wrappers.block.BlockColorSingletonWrapper;
|
||||
import com.seibel.lod.fabric.wrappers.block.BlockColorWrapper;
|
||||
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.material.MaterialColor;
|
||||
|
||||
|
||||
/**
|
||||
* This class wraps the minecraft BlockPos.Mutable (and BlockPos) class
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 11-15-2021
|
||||
*/
|
||||
//This class wraps the minecraft BlockPos.Mutable (and BlockPos) class
|
||||
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)
|
||||
{
|
||||
this.biome = biome;
|
||||
}
|
||||
|
||||
static public BiomeWrapper getBiomeWrapper(Biome biome)
|
||||
static public IBiomeWrapper getBiomeWrapper(Biome biome)
|
||||
{
|
||||
//first we check if the biome has already been wrapped
|
||||
if(biomeWrapperMap.containsKey(biome) && biomeWrapperMap.get(biome) != null)
|
||||
@@ -49,72 +64,57 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
public int getColorForBiome(int x, int z)
|
||||
{
|
||||
int colorInt;
|
||||
int tintValue = 0;
|
||||
|
||||
switch (biome.getBiomeCategory())
|
||||
{
|
||||
|
||||
case NETHER:
|
||||
colorInt = BlockColorWrapper.getBlockColorWrapper(Blocks.NETHERRACK).getColor();
|
||||
colorInt = Blocks.NETHERRACK.defaultBlockState().getMaterial().getColor().col;
|
||||
break;
|
||||
|
||||
case THEEND:
|
||||
colorInt = BlockColorWrapper.getBlockColorWrapper(Blocks.END_STONE).getColor();
|
||||
colorInt = Blocks.END_STONE.defaultBlockState().getMaterial().getColor().col;
|
||||
break;
|
||||
|
||||
case BEACH:
|
||||
case DESERT:
|
||||
colorInt = BlockColorWrapper.getBlockColorWrapper(Blocks.SAND).getColor();
|
||||
colorInt = Blocks.SAND.defaultBlockState().getMaterial().getColor().col;
|
||||
break;
|
||||
|
||||
case EXTREME_HILLS:
|
||||
colorInt = BlockColorWrapper.getBlockColorWrapper(Blocks.STONE).getColor();
|
||||
colorInt = Blocks.STONE.defaultMaterialColor().col;
|
||||
break;
|
||||
|
||||
case MUSHROOM:
|
||||
colorInt = BlockColorWrapper.getBlockColorWrapper(Blocks.MYCELIUM).getColor();
|
||||
colorInt = MaterialColor.COLOR_LIGHT_GRAY.col;
|
||||
break;
|
||||
|
||||
case ICY:
|
||||
colorInt = BlockColorWrapper.getBlockColorWrapper(Blocks.SNOW).getColor();
|
||||
colorInt = Blocks.SNOW.defaultMaterialColor().col;
|
||||
break;
|
||||
|
||||
case MESA:
|
||||
colorInt = BlockColorWrapper.getBlockColorWrapper(Blocks.RED_SAND).getColor();
|
||||
colorInt = Blocks.RED_SAND.defaultMaterialColor().col;
|
||||
break;
|
||||
|
||||
case OCEAN:
|
||||
case RIVER:
|
||||
colorInt = BlockColorSingletonWrapper.INSTANCE.getWaterColor().getColor();
|
||||
tintValue = biome.getWaterColor();
|
||||
break;
|
||||
|
||||
case PLAINS:
|
||||
case SAVANNA:
|
||||
colorInt = BlockColorWrapper.getBlockColorWrapper(Blocks.GRASS_BLOCK).getColor();
|
||||
tintValue = biome.getGrassColor(x, z);
|
||||
colorInt = ColorUtil.multiplyRGBcolors(colorInt,tintValue);
|
||||
break;
|
||||
|
||||
case TAIGA:
|
||||
colorInt = BlockColorWrapper.getBlockColorWrapper(Blocks.SPRUCE_LEAVES).getColor();
|
||||
tintValue = biome.getFoliageColor();
|
||||
colorInt = ColorUtil.multiplyRGBcolors(colorInt,tintValue);
|
||||
break;
|
||||
case JUNGLE:
|
||||
colorInt = BlockColorWrapper.getBlockColorWrapper(Blocks.JUNGLE_LEAVES).getColor();
|
||||
tintValue = biome.getFoliageColor();
|
||||
colorInt = ColorUtil.multiplyRGBcolors(colorInt,tintValue);
|
||||
colorInt = biome.getWaterColor();
|
||||
break;
|
||||
|
||||
case NONE:
|
||||
default:
|
||||
case SWAMP:
|
||||
case FOREST:
|
||||
colorInt = BlockColorWrapper.getBlockColorWrapper(Blocks.OAK_LEAVES).getColor();
|
||||
tintValue = biome.getFoliageColor();
|
||||
colorInt = ColorUtil.multiplyRGBcolors(colorInt,tintValue);
|
||||
case TAIGA:
|
||||
case JUNGLE:
|
||||
case PLAINS:
|
||||
case SAVANNA:
|
||||
case SWAMP:
|
||||
default:
|
||||
Color tmp = LodUtil.intToColor(biome.getGrassColor(x, z));
|
||||
tmp = tmp.darker();
|
||||
colorInt = LodUtil.colorToInt(tmp);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return colorInt;
|
||||
@@ -139,13 +139,13 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
}
|
||||
|
||||
|
||||
@Override public boolean equals(Object o)
|
||||
@Override public boolean equals(Object obj)
|
||||
{
|
||||
if (this == o)
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (!(o instanceof BiomeWrapper))
|
||||
if (!(obj instanceof BiomeWrapper))
|
||||
return false;
|
||||
BiomeWrapper that = (BiomeWrapper) o;
|
||||
BiomeWrapper that = (BiomeWrapper) obj;
|
||||
return Objects.equals(biome, that.biome);
|
||||
}
|
||||
|
||||
|
||||
+30
-4
@@ -1,20 +1,40 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
||||
* licensed under the GNU GPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.fabric.wrappers.world;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IDimensionTypeWrapper;
|
||||
|
||||
import net.minecraft.world.level.dimension.DimensionType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ??
|
||||
* @version 11-15-2021
|
||||
* @author James Seibel
|
||||
* @version 11-21-2021
|
||||
*/
|
||||
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)
|
||||
{
|
||||
@@ -36,12 +56,18 @@ public class DimensionTypeWrapper implements IDimensionTypeWrapper
|
||||
return dimensionTypeWrapper;
|
||||
}
|
||||
|
||||
public static void clearMap()
|
||||
{
|
||||
dimensionTypeWrapperMap.clear();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getDimensionName()
|
||||
{
|
||||
return dimensionType.effectsLocation().getPath();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasCeiling()
|
||||
{
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
||||
* licensed under the GNU GPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.fabric.wrappers.world;
|
||||
|
||||
import java.io.File;
|
||||
@@ -6,28 +25,30 @@ 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.world.IBiomeWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IWorldWrapper;
|
||||
import com.seibel.lod.fabric.wrappers.block.BlockPosWrapper;
|
||||
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.server.level.ServerChunkCache;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author James Seibel
|
||||
* @author ??
|
||||
* @version 11-15-2021
|
||||
* @version 11-21-2021
|
||||
*/
|
||||
public class WorldWrapper implements IWorldWrapper
|
||||
{
|
||||
private static final ConcurrentMap<Level, WorldWrapper> worldWrapperMap = new ConcurrentHashMap<>();
|
||||
private final Level world;
|
||||
private static final ConcurrentMap<LevelAccessor, WorldWrapper> worldWrapperMap = new ConcurrentHashMap<>();
|
||||
private final LevelAccessor world;
|
||||
public final WorldType worldType;
|
||||
|
||||
|
||||
public WorldWrapper(Level newWorld)
|
||||
public WorldWrapper(LevelAccessor newWorld)
|
||||
{
|
||||
world = newWorld;
|
||||
|
||||
@@ -40,8 +61,8 @@ public class WorldWrapper implements IWorldWrapper
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static WorldWrapper getWorldWrapper(Level world)
|
||||
@Nullable
|
||||
public static WorldWrapper getWorldWrapper(LevelAccessor world)
|
||||
{
|
||||
if (world == null) return null;
|
||||
//first we check if the biome has already been wrapped
|
||||
@@ -61,9 +82,10 @@ public class WorldWrapper implements IWorldWrapper
|
||||
{
|
||||
worldWrapperMap.clear();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WorldType getWorldType() {
|
||||
public WorldType getWorldType()
|
||||
{
|
||||
return worldType;
|
||||
}
|
||||
|
||||
@@ -72,26 +94,26 @@ public class WorldWrapper implements IWorldWrapper
|
||||
{
|
||||
return DimensionTypeWrapper.getDimensionTypeWrapper(world.dimensionType());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getBlockLight(AbstractBlockPosWrapper blockPos)
|
||||
{
|
||||
return world.getLightEngine().blockEngine.getLightValue(((BlockPosWrapper) blockPos).getBlockPos());
|
||||
return world.getBrightness(LightLayer.BLOCK, ((BlockPosWrapper) blockPos).getBlockPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight(AbstractBlockPosWrapper blockPos)
|
||||
{
|
||||
return world.getLightEngine().skyEngine.getLightValue(((BlockPosWrapper) blockPos).getBlockPos());
|
||||
return world.getBrightness(LightLayer.SKY, ((BlockPosWrapper) blockPos).getBlockPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeWrapper getBiome(AbstractBlockPosWrapper blockPos)
|
||||
public IBiomeWrapper getBiome(AbstractBlockPosWrapper blockPos)
|
||||
{
|
||||
return BiomeWrapper.getBiomeWrapper(world.getBiome(((BlockPosWrapper) blockPos).getBlockPos()));
|
||||
}
|
||||
|
||||
public Level getWorld()
|
||||
public LevelAccessor getWorld()
|
||||
{
|
||||
return world;
|
||||
}
|
||||
@@ -128,7 +150,7 @@ public class WorldWrapper implements IWorldWrapper
|
||||
throw new UnsupportedOperationException("getSaveFolder can only be called for ServerWorlds.");
|
||||
|
||||
ServerChunkCache chunkSource = ((ServerLevel) world).getChunkSource();
|
||||
return chunkSource.dataStorage.dataFolder;
|
||||
return chunkSource.getDataStorage().dataFolder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+9
-10
@@ -27,8 +27,6 @@ import java.util.stream.Stream;
|
||||
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.fabric.wrappers.WrapperUtil;
|
||||
|
||||
import com.sun.jna.Structure;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
@@ -60,6 +58,7 @@ import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
import net.minecraft.world.level.levelgen.structure.StructureStart;
|
||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.storage.LevelData;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
@@ -136,8 +135,8 @@ public class LodServerWorld implements WorldGenLevel
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFluidAtPosition(BlockPos pos, Predicate<FluidState> state) {
|
||||
return state.test(chunk.getFluidState(pos));
|
||||
public boolean isFluidAtPosition(BlockPos blockPos, Predicate<FluidState> predicate) {
|
||||
return predicate.test(chunk.getFluidState(blockPos));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -157,9 +156,9 @@ public class LodServerWorld implements WorldGenLevel
|
||||
{
|
||||
return serverWorld.startsForFeature(p_241827_1_, p_241827_2_);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TickList getLiquidTicks()
|
||||
public TickList<Fluid> getLiquidTicks()
|
||||
{
|
||||
return EmptyTickList.empty();
|
||||
}
|
||||
@@ -194,7 +193,7 @@ public class LodServerWorld implements WorldGenLevel
|
||||
{
|
||||
throw new UnsupportedOperationException("Not Implemented");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void playSound(Player player, BlockPos pos, SoundEvent soundIn, SoundSource category, float volume,
|
||||
float pitch)
|
||||
@@ -220,13 +219,13 @@ public class LodServerWorld implements WorldGenLevel
|
||||
{
|
||||
throw new UnsupportedOperationException("Not Implemented");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float getShade(Direction p_230487_1_, boolean p_230487_2_)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not Implemented");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WorldBorder getWorldBorder()
|
||||
{
|
||||
@@ -287,13 +286,13 @@ public class LodServerWorld implements WorldGenLevel
|
||||
|
||||
}
|
||||
|
||||
// TODO: Check if this causes any issues
|
||||
@Override
|
||||
public void gameEvent(@Nullable Entity entity, GameEvent gameEvent, BlockPos blockPos) {
|
||||
throw new UnsupportedOperationException("Not Implemented");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<Entity> getEntities(Entity arg0, AABB arg1, Predicate<? super Entity> arg2)
|
||||
{
|
||||
|
||||
+41
-43
@@ -5,6 +5,9 @@ import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.seibel.lod.core.builders.lodBuilding.LodBuilder;
|
||||
@@ -26,20 +29,16 @@ import net.minecraft.core.Registry;
|
||||
import net.minecraft.server.level.ServerChunkCache;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ThreadedLevelLightEngine;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.chunk.*;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.SnowAndFreezeFeature;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
|
||||
|
||||
/**
|
||||
* This is used for generating chunks
|
||||
* in a variety of detail and threading levels.
|
||||
*
|
||||
* @author coolGi2007
|
||||
* @author James Seibel
|
||||
* @version 11-23-2021
|
||||
* @version 11-13-2021
|
||||
*/
|
||||
public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
|
||||
{
|
||||
@@ -51,6 +50,8 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
|
||||
* features that could cause issues down the line.
|
||||
*/
|
||||
private static final ConcurrentHashMap<Integer, ConfiguredFeature<?, ?>> FEATURES_TO_AVOID = new ConcurrentHashMap<>();
|
||||
|
||||
private static ExecutorService Executor = Executors.newSingleThreadExecutor();
|
||||
|
||||
|
||||
public final ServerLevel serverWorld;
|
||||
@@ -76,30 +77,29 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
|
||||
@Override
|
||||
public void generateBiomesOnly(AbstractChunkPosWrapper pos, DistanceGenerationMode generationMode)
|
||||
{
|
||||
/*
|
||||
List<ChunkAccess> chunkList = new LinkedList<>();
|
||||
ProtoChunk chunk = new ProtoChunk((ChunkPosWrapper) pos, UpgradeData.EMPTY, serverWorld);
|
||||
ProtoChunk chunk = new ProtoChunk(((ChunkPosWrapper) pos).getChunkPos(), UpgradeData.EMPTY, serverWorld);
|
||||
chunkList.add(chunk);
|
||||
|
||||
ServerChunkCache chunkSource = serverWorld.getChunkSource();
|
||||
ChunkGenerator chunkGen = chunkSource.getGenerator();
|
||||
|
||||
|
||||
// generate the terrain (this is thread safe)
|
||||
// ChunkStatus.EMPTY.generate(serverWorld, chunkGen, serverWorld.getStructureManager(), (ThreadedLevelLightEngine) serverWorld.getLightEngine(), null, chunkList);
|
||||
ChunkStatus.EMPTY.generate(Executor, serverWorld, chunkGen, serverWorld.getStructureManager(), (ThreadedLevelLightEngine) serverWorld.getLightEngine(), null, chunkList);
|
||||
// override the chunk status, so we can run the next generator stage
|
||||
chunk.setStatus(ChunkStatus.STRUCTURE_REFERENCES);
|
||||
chunkGen.createBiomes(serverWorld.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), chunk);
|
||||
chunk.setStatus(ChunkStatus.STRUCTURE_REFERENCES);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// generate fake height data for this LOD
|
||||
int seaLevel = serverWorld.getSeaLevel();
|
||||
|
||||
|
||||
boolean simulateHeight = generationMode == DistanceGenerationMode.BIOME_ONLY_SIMULATE_HEIGHT;
|
||||
boolean inTheEnd = false;
|
||||
|
||||
|
||||
// add fake heightmap data so our LODs aren't at height 0
|
||||
Heightmap heightmap = new Heightmap(chunk, WrapperUtil.DEFAULT_HEIGHTMAP);
|
||||
for (int x = 0; x < LodUtil.CHUNK_WIDTH && !inTheEnd; x++)
|
||||
@@ -115,7 +115,7 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
|
||||
case NETHER:
|
||||
heightmap.setHeight(x, z, serverWorld.getHeight() / 2);
|
||||
break;
|
||||
|
||||
|
||||
case EXTREME_HILLS:
|
||||
heightmap.setHeight(x, z, seaLevel + 30);
|
||||
break;
|
||||
@@ -129,16 +129,16 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
|
||||
case NONE:
|
||||
heightmap.setHeight(x, z, 0);
|
||||
break;
|
||||
|
||||
|
||||
case OCEAN:
|
||||
case RIVER:
|
||||
heightmap.setHeight(x, z, seaLevel);
|
||||
break;
|
||||
|
||||
|
||||
case THEEND:
|
||||
inTheEnd = true;
|
||||
break;
|
||||
|
||||
|
||||
// DESERT
|
||||
// FOREST
|
||||
// ICY
|
||||
@@ -160,10 +160,10 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
|
||||
}
|
||||
}// z
|
||||
}// x
|
||||
|
||||
|
||||
chunk.setHeightmap(WrapperUtil.DEFAULT_HEIGHTMAP, heightmap.getRawData());
|
||||
|
||||
|
||||
|
||||
|
||||
if (!inTheEnd)
|
||||
{
|
||||
lodBuilder.generateLodNodeFromChunk(lodDim, new ChunkWrapper(chunk), new LodBuilderConfig(true, true, false));
|
||||
@@ -181,7 +181,6 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
|
||||
// long startTime = System.currentTimeMillis();
|
||||
// long endTime = System.currentTimeMillis();
|
||||
// System.out.println(endTime - startTime);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -189,9 +188,8 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
|
||||
@Override
|
||||
public void generateSurface(AbstractChunkPosWrapper pos)
|
||||
{
|
||||
/*
|
||||
List<ChunkAccess> chunkList = new LinkedList<>();
|
||||
ProtoChunk chunk = new ProtoChunk(((ChunkPosWrapper) pos).getChunkPos(), UpgradeData.EMPTY);
|
||||
ProtoChunk chunk = new ProtoChunk(((ChunkPosWrapper) pos).getChunkPos(), UpgradeData.EMPTY, serverWorld);
|
||||
chunkList.add(chunk);
|
||||
LodServerWorld lodServerWorld = new LodServerWorld(serverWorld, chunk);
|
||||
|
||||
@@ -202,17 +200,18 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
|
||||
|
||||
|
||||
// generate the terrain (this is thread safe)
|
||||
ChunkStatus.EMPTY.generate(serverWorld, chunkGen, templateManager, lightEngine, null, chunkList);
|
||||
ChunkStatus.EMPTY.generate(Executor, serverWorld, chunkGen, templateManager, lightEngine, null, chunkList);
|
||||
// override the chunk status, so we can run the next generator stage
|
||||
chunk.setStatus(ChunkStatus.STRUCTURE_REFERENCES);
|
||||
chunkGen.createBiomes(serverWorld.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), chunk);
|
||||
ChunkStatus.NOISE.generate(serverWorld, chunkGen, templateManager, lightEngine, null, chunkList);
|
||||
ChunkStatus.SURFACE.generate(serverWorld, chunkGen, templateManager, lightEngine, null, chunkList);
|
||||
ChunkStatus.NOISE.generate(Executor, serverWorld, chunkGen, templateManager, lightEngine, null, chunkList);
|
||||
// TODO[FABRIC]: Find whay this dosnt work
|
||||
ChunkStatus.SURFACE.generate(Executor, serverWorld, chunkGen, templateManager, lightEngine, null, chunkList);
|
||||
|
||||
// this feature has been proven to be thread safe,
|
||||
// so we will add it
|
||||
IceAndSnowFeature snowFeature = new IceAndSnowFeature(NoFeatureConfig.CODEC);
|
||||
snowFeature.place(lodServerWorld, chunkGen, serverWorld.random, chunk.getPos().getWorldPosition(), null);
|
||||
// SnowAndFreezeFeature snowFeature = new SnowAndFreezeFeature(NoFeatureConfig.CODEC);
|
||||
// snowFeature.place(lodServerWorld, chunkGen, serverWorld.random, chunk.getPos().getWorldPosition(), null);
|
||||
|
||||
|
||||
lodBuilder.generateLodNodeFromChunk(lodDim, new ChunkWrapper(chunk), new LodBuilderConfig(DistanceGenerationMode.SURFACE));
|
||||
@@ -220,8 +219,8 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
|
||||
/*TODO if we want to use Biome utils and terrain utils for overworld
|
||||
* lodBuilder.generateLodNodeFromChunk(lodDim, pos ,detailLevel, serverWorld.getSeed());*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* takes about 15 - 20 ms
|
||||
* <p>
|
||||
@@ -231,25 +230,25 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
|
||||
@Override
|
||||
public void generateFeatures(AbstractChunkPosWrapper pos)
|
||||
{
|
||||
/*
|
||||
List<ChunkAccess> chunkList = new LinkedList<>();
|
||||
ProtoChunk chunk = new ProtoChunk(((ChunkPosWrapper) pos).getChunkPos(), UpgradeData.EMPTY);
|
||||
ProtoChunk chunk = new ProtoChunk(((ChunkPosWrapper) pos).getChunkPos(), UpgradeData.EMPTY, serverWorld);
|
||||
chunkList.add(chunk);
|
||||
LodServerWorld lodServerWorld = new LodServerWorld(serverWorld, chunk);
|
||||
|
||||
ServerChunkProvider chunkSource = serverWorld.getChunkSource();
|
||||
ServerWorldLightManager lightEngine = (ServerWorldLightManager) serverWorld.getLightEngine();
|
||||
TemplateManager templateManager = serverWorld.getStructureManager();
|
||||
ChunkGenerator chunkGen = chunkSource.generator;
|
||||
ServerChunkCache chunkSource = serverWorld.getChunkSource();
|
||||
ThreadedLevelLightEngine lightEngine = (ThreadedLevelLightEngine) serverWorld.getLightEngine();
|
||||
StructureManager templateManager = serverWorld.getStructureManager();
|
||||
ChunkGenerator chunkGen = chunkSource.getGenerator();
|
||||
|
||||
|
||||
// generate the terrain (this is thread safe)
|
||||
ChunkStatus.EMPTY.generate(serverWorld, chunkGen, templateManager, lightEngine, null, chunkList);
|
||||
ChunkStatus.EMPTY.generate(Executor, serverWorld, chunkGen, templateManager, lightEngine, null, chunkList);
|
||||
// override the chunk status, so we can run the next generator stage
|
||||
chunk.setStatus(ChunkStatus.STRUCTURE_REFERENCES);
|
||||
chunkGen.createBiomes(serverWorld.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), chunk);
|
||||
ChunkStatus.NOISE.generate(serverWorld, chunkGen, templateManager, lightEngine, null, chunkList);
|
||||
ChunkStatus.SURFACE.generate(serverWorld, chunkGen, templateManager, lightEngine, null, chunkList);
|
||||
ChunkStatus.NOISE.generate(Executor, serverWorld, chunkGen, templateManager, lightEngine, null, chunkList);
|
||||
// TODO[FABRIC]: Find whay this dosnt work
|
||||
ChunkStatus.SURFACE.generate(Executor, serverWorld, chunkGen, templateManager, lightEngine, null, chunkList);
|
||||
|
||||
|
||||
// get all the biomes in the chunk
|
||||
@@ -337,7 +336,6 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
|
||||
|
||||
// generate a Lod like normal
|
||||
lodBuilder.generateLodNodeFromChunk(lodDim, new ChunkWrapper(chunk), new LodBuilderConfig(DistanceGenerationMode.FEATURES));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2021.
|
||||
*
|
||||
* This library 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 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library 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 library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WorldWorkerManager
|
||||
{
|
||||
private static List<IWorker> workers = new ArrayList<IWorker>();
|
||||
private static long startTime = -1;
|
||||
private static int index = 0;
|
||||
|
||||
public static void tick(boolean start)
|
||||
{
|
||||
if (start)
|
||||
{
|
||||
startTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
|
||||
index = 0;
|
||||
IWorker task = getNext();
|
||||
if (task == null)
|
||||
return;
|
||||
|
||||
long time = 50 - (System.currentTimeMillis() - startTime);
|
||||
if (time < 10)
|
||||
time = 10; //If ticks are lagging, give us at least 10ms to do something.
|
||||
time += System.currentTimeMillis();
|
||||
|
||||
while (System.currentTimeMillis() < time && task != null)
|
||||
{
|
||||
boolean again = task.doWork();
|
||||
|
||||
if (!task.hasWork())
|
||||
{
|
||||
remove(task);
|
||||
task = getNext();
|
||||
}
|
||||
else if (!again)
|
||||
{
|
||||
task = getNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized void addWorker(IWorker worker)
|
||||
{
|
||||
workers.add(worker);
|
||||
}
|
||||
|
||||
private static synchronized IWorker getNext()
|
||||
{
|
||||
return workers.size() > index ? workers.get(index++) : null;
|
||||
}
|
||||
|
||||
private static synchronized void remove(IWorker worker)
|
||||
{
|
||||
workers.remove(worker);
|
||||
index--;
|
||||
}
|
||||
|
||||
//Internal only, used to clear everything when the server shuts down.
|
||||
public static synchronized void clear()
|
||||
{
|
||||
workers.clear();
|
||||
}
|
||||
|
||||
public static interface IWorker
|
||||
{
|
||||
boolean hasWork();
|
||||
|
||||
/**
|
||||
* Perform a task, returning true from this will have the manager call this function again this tick if there is time left.
|
||||
* Returning false will skip calling this worker until next tick.
|
||||
*/
|
||||
boolean doWork();
|
||||
}
|
||||
}
|
||||
@@ -19,28 +19,14 @@
|
||||
|
||||
package com.seibel.lod.forge;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
import com.electronwill.nightconfig.core.io.WritingMode;
|
||||
import com.seibel.lod.core.ModInfo;
|
||||
import com.seibel.lod.core.enums.config.BlocksToAvoid;
|
||||
import com.seibel.lod.core.enums.config.BufferRebuildTimes;
|
||||
import com.seibel.lod.core.enums.config.DistanceGenerationMode;
|
||||
import com.seibel.lod.core.enums.config.GenerationPriority;
|
||||
import com.seibel.lod.core.enums.config.GpuUploadMethod;
|
||||
import com.seibel.lod.core.enums.config.HorizontalQuality;
|
||||
import com.seibel.lod.core.enums.config.HorizontalResolution;
|
||||
import com.seibel.lod.core.enums.config.HorizontalScale;
|
||||
import com.seibel.lod.core.enums.config.LodTemplate;
|
||||
import com.seibel.lod.core.enums.config.VanillaOverdraw;
|
||||
import com.seibel.lod.core.enums.config.VerticalQuality;
|
||||
import com.seibel.lod.core.enums.config.*;
|
||||
import com.seibel.lod.core.enums.rendering.DebugMode;
|
||||
import com.seibel.lod.core.enums.rendering.FogColorMode;
|
||||
import com.seibel.lod.core.enums.rendering.FogDistance;
|
||||
import com.seibel.lod.core.enums.rendering.FogDrawOverride;
|
||||
import com.seibel.lod.core.enums.rendering.FogDrawMode;
|
||||
import com.seibel.lod.core.objects.MinDefaultMax;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IAdvanced;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IAdvanced.IBuffers;
|
||||
@@ -51,15 +37,21 @@ import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.I
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IGraphics.IQuality;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IWorldGenerator;
|
||||
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.config.ModConfigEvent;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
/**
|
||||
* This handles any configuration the user has access to.
|
||||
* @author Leonardo Amato
|
||||
* @author James Seibel
|
||||
* @version 11-16-2021
|
||||
* @version 11-29-2021
|
||||
*/
|
||||
@Mod.EventBusSubscriber
|
||||
public class ForgeConfig
|
||||
@@ -78,16 +70,16 @@ public class ForgeConfig
|
||||
// |-> Threads
|
||||
// |-> Buffers
|
||||
// |-> Debugging
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static class Client
|
||||
{
|
||||
public final Graphics graphics;
|
||||
public final WorldGenerator worldGenerator;
|
||||
public final Advanced advanced;
|
||||
|
||||
|
||||
public final AdvancedModOptions advancedModOptions;
|
||||
|
||||
|
||||
//================//
|
||||
// Client Configs //
|
||||
//================//
|
||||
@@ -97,160 +89,173 @@ public class ForgeConfig
|
||||
{
|
||||
graphics = new Graphics(builder);
|
||||
worldGenerator = new WorldGenerator(builder);
|
||||
advanced = new Advanced(builder);
|
||||
advancedModOptions = new AdvancedModOptions(builder);
|
||||
}
|
||||
builder.pop();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//==================//
|
||||
// Graphics Configs //
|
||||
//==================//
|
||||
public static class Graphics
|
||||
{
|
||||
public final Quality quality;
|
||||
public final FogQuality fogQuality;
|
||||
public final AdvancedGraphics advancedGraphics;
|
||||
|
||||
public final QualityOption qualityOption;
|
||||
public final FogQualityOption fogQuality;
|
||||
public final AdvancedGraphicsOption advancedGraphicsOption;
|
||||
|
||||
Graphics(ForgeConfigSpec.Builder builder)
|
||||
{
|
||||
builder.comment(IGraphics.DESC).push("Graphics");
|
||||
{
|
||||
quality = new Quality(builder);
|
||||
advancedGraphics = new AdvancedGraphics(builder);
|
||||
fogQuality = new FogQuality(builder);
|
||||
qualityOption = new QualityOption(builder);
|
||||
advancedGraphicsOption = new AdvancedGraphicsOption(builder);
|
||||
fogQuality = new FogQualityOption(builder);
|
||||
}
|
||||
builder.pop();
|
||||
}
|
||||
|
||||
|
||||
public static class Quality
|
||||
|
||||
|
||||
public static class QualityOption
|
||||
{
|
||||
public final ForgeConfigSpec.EnumValue<HorizontalResolution> drawResolution;
|
||||
public final ForgeConfigSpec.IntValue lodChunkRenderDistance;
|
||||
public final ForgeConfigSpec.EnumValue<VerticalQuality> verticalQuality;
|
||||
public final ForgeConfigSpec.EnumValue<HorizontalScale> horizontalScale;
|
||||
public final ForgeConfigSpec.EnumValue<HorizontalQuality> horizontalQuality;
|
||||
|
||||
Quality(ForgeConfigSpec.Builder builder)
|
||||
|
||||
QualityOption(ForgeConfigSpec.Builder builder)
|
||||
{
|
||||
builder.comment(IQuality.DESC).push(this.getClass().getSimpleName());
|
||||
|
||||
|
||||
verticalQuality = builder
|
||||
.comment("\n\n"
|
||||
+ IQuality.VERTICAL_QUALITY_DESC)
|
||||
.defineEnum("Vertical Quality", IQuality.VERTICAL_QUALITY_DEFAULT);
|
||||
|
||||
|
||||
horizontalScale = builder
|
||||
.comment("\n\n"
|
||||
+ IQuality.HORIZONTAL_SCALE_DESC)
|
||||
.defineEnum("Horizontal Scale", IQuality.HORIZONTAL_SCALE_DEFAULT);
|
||||
|
||||
|
||||
horizontalQuality = builder
|
||||
.comment("\n\n"
|
||||
+ IQuality.HORIZONTAL_QUALITY_DESC)
|
||||
.defineEnum("Horizontal Quality", IQuality.HORIZONTAL_QUALITY_DEFAULT);
|
||||
|
||||
|
||||
drawResolution = builder
|
||||
.comment("\n\n"
|
||||
+ IQuality.DRAW_RESOLUTION_DESC)
|
||||
.defineEnum("Block size", IQuality.DRAW_RESOLUTION_DEFAULT);
|
||||
|
||||
|
||||
MinDefaultMax<Integer> minDefaultMax = IQuality.LOD_CHUNK_RENDER_DISTANCE_MIN_DEFAULT_MAX;
|
||||
lodChunkRenderDistance = builder
|
||||
.comment("\n\n"
|
||||
+ IQuality.LOD_CHUNK_RENDER_DISTANCE_DESC)
|
||||
.defineInRange("Lod Render Distance", minDefaultMax.defaultValue, minDefaultMax.minValue, minDefaultMax.maxValue);
|
||||
|
||||
|
||||
builder.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class FogQuality
|
||||
|
||||
|
||||
public static class FogQualityOption
|
||||
{
|
||||
public final ForgeConfigSpec.EnumValue<FogDistance> fogDistance;
|
||||
public final ForgeConfigSpec.EnumValue<FogDrawOverride> fogDrawOverride;
|
||||
public final ForgeConfigSpec.EnumValue<FogDrawMode> fogDrawMode;
|
||||
public final ForgeConfigSpec.EnumValue<FogColorMode> fogColorMode;
|
||||
public final ForgeConfigSpec.BooleanValue disableVanillaFog;
|
||||
|
||||
FogQuality(ForgeConfigSpec.Builder builder)
|
||||
|
||||
FogQualityOption(ForgeConfigSpec.Builder builder)
|
||||
{
|
||||
builder.comment(IFogQuality.DESC).push(this.getClass().getSimpleName());
|
||||
|
||||
|
||||
fogDistance = builder
|
||||
.comment("\n\n"
|
||||
+ IFogQuality.FOG_DISTANCE_DESC)
|
||||
.defineEnum("Fog Distance", IFogQuality.FOG_DISTANCE_DEFAULT);
|
||||
|
||||
fogDrawOverride = builder
|
||||
|
||||
fogDrawMode = builder
|
||||
.comment("\n\n"
|
||||
+ IFogQuality.FOG_DRAW_OVERRIDE_DESC)
|
||||
.defineEnum("Fog Draw Override", IFogQuality.FOG_DRAW_OVERRIDE_DEFAULT);
|
||||
|
||||
+ IFogQuality.FOG_DRAW_MODE_DESC)
|
||||
.defineEnum("Fog Draw Mode", IFogQuality.FOG_DRAW_MODE_DEFAULT);
|
||||
|
||||
fogColorMode = builder
|
||||
.comment("\n\n"
|
||||
+ IFogQuality.FOG_COLOR_MODE_DESC)
|
||||
.defineEnum("Fog Color Mode", IFogQuality.FOG_COLOR_MODE_DEFAULT);
|
||||
|
||||
disableVanillaFog = builder
|
||||
.comment("\n\n"
|
||||
+ IFogQuality.DISABLE_VANILLA_FOG_DESC)
|
||||
.define("Experimental Disable Vanilla Fog", IFogQuality.DISABLE_VANILLA_FOG_DEFAULT);
|
||||
|
||||
|
||||
builder.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class AdvancedGraphics
|
||||
|
||||
|
||||
public static class AdvancedGraphicsOption
|
||||
{
|
||||
public final ForgeConfigSpec.EnumValue<LodTemplate> lodTemplate;
|
||||
public final ForgeConfigSpec.BooleanValue disableDirectionalCulling;
|
||||
public final ForgeConfigSpec.BooleanValue alwaysDrawAtMaxQuality;
|
||||
public final ForgeConfigSpec.EnumValue<VanillaOverdraw> vanillaOverdraw;
|
||||
public final ForgeConfigSpec.EnumValue<GpuUploadMethod> gpuUploadMethod;
|
||||
public final ForgeConfigSpec.IntValue gpuUploadTimeoutInMilleseconds;
|
||||
public final ForgeConfigSpec.BooleanValue useExtendedNearClipPlane;
|
||||
|
||||
AdvancedGraphics(ForgeConfigSpec.Builder builder)
|
||||
|
||||
AdvancedGraphicsOption(ForgeConfigSpec.Builder builder)
|
||||
{
|
||||
builder.comment(IAdvancedGraphics.DESC).push(this.getClass().getSimpleName());
|
||||
|
||||
|
||||
lodTemplate = builder
|
||||
.comment("\n\n"
|
||||
+ IAdvancedGraphics.LOD_TEMPLATE_DESC)
|
||||
.defineEnum("LOD Template", IAdvancedGraphics.LOD_TEMPLATE_DEFAULT);
|
||||
|
||||
|
||||
disableDirectionalCulling = builder
|
||||
.comment("\n\n"
|
||||
+ IAdvancedGraphics.DISABLE_DIRECTIONAL_CULLING_DESC)
|
||||
.define("Disable Directional Culling", IAdvancedGraphics.DISABLE_DIRECTIONAL_CULLING_DEFAULT);
|
||||
|
||||
|
||||
alwaysDrawAtMaxQuality = builder
|
||||
.comment("\n\n"
|
||||
+ IAdvancedGraphics.ALWAYS_DRAW_AT_MAD_QUALITY_DESC)
|
||||
.define("Always Use Max Quality", IAdvancedGraphics.ALWAYS_DRAW_AT_MAD_QUALITY_DEFAULT);
|
||||
|
||||
|
||||
vanillaOverdraw = builder
|
||||
.comment("\n\n"
|
||||
+ IAdvancedGraphics.VANILLA_OVERDRAW_DESC)
|
||||
.defineEnum("Vanilla Overdraw", IAdvancedGraphics.VANILLA_OVERDRAW_DEFAULT);
|
||||
|
||||
|
||||
gpuUploadMethod = builder
|
||||
.comment("\n\n"
|
||||
+ IAdvancedGraphics.GPU_UPLOAD_METHOD_DESC)
|
||||
.defineEnum("GPU Upload Method", IAdvancedGraphics.GPU_UPLOAD_METHOD_DEFAULT);
|
||||
|
||||
|
||||
MinDefaultMax<Integer> minDefaultMax = IAdvancedGraphics.GPU_UPLOAD_TIMEOUT_IN_MILLISECONDS_DEFAULT;
|
||||
gpuUploadTimeoutInMilleseconds = builder
|
||||
.comment("\n\n"
|
||||
+ IAdvancedGraphics.GPU_UPLOAD_TIMEOUT_IN_MILLISECONDS_DESC)
|
||||
.defineInRange("GPU Upload Timeout in Milleseconds", minDefaultMax.defaultValue, minDefaultMax.minValue, minDefaultMax.maxValue);
|
||||
|
||||
// This is a temporary fix (like vanilla overdraw)
|
||||
// hopefully we can remove both once we get individual chunk rendering figured out
|
||||
useExtendedNearClipPlane = builder
|
||||
.comment("\n\n"
|
||||
+ IAdvancedGraphics.USE_EXTENDED_NEAR_CLIP_PLANE_DESC)
|
||||
.define("Use Extended Near Clip Plane", IAdvancedGraphics.USE_EXTENDED_NEAR_CLIP_PLANE_DEFAULT);
|
||||
|
||||
|
||||
|
||||
|
||||
builder.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//========================//
|
||||
// WorldGenerator Configs //
|
||||
//========================//
|
||||
@@ -261,31 +266,31 @@ public class ForgeConfig
|
||||
public final ForgeConfigSpec.BooleanValue allowUnstableFeatureGeneration;
|
||||
public final ForgeConfigSpec.EnumValue<BlocksToAvoid> blocksToAvoid;
|
||||
//public final ForgeConfigSpec.BooleanValue useExperimentalPreGenLoading;
|
||||
|
||||
|
||||
WorldGenerator(ForgeConfigSpec.Builder builder)
|
||||
{
|
||||
builder.comment(IWorldGenerator.DESC).push("Generation");
|
||||
|
||||
|
||||
generationPriority = builder
|
||||
.comment("\n\n"
|
||||
+ IWorldGenerator.GENERATION_PRIORITY_DESC)
|
||||
.defineEnum("Generation Priority", IWorldGenerator.GENERATION_PRIORITY_DEFAULT);
|
||||
|
||||
|
||||
distanceGenerationMode = builder
|
||||
.comment("\n\n"
|
||||
+ IWorldGenerator.DISTANCE_GENERATION_MODE_DESC)
|
||||
.defineEnum("Distance Generation Mode", IWorldGenerator.DISTANCE_GENERATION_MODE_DEFAULT);
|
||||
|
||||
|
||||
allowUnstableFeatureGeneration = builder
|
||||
.comment("\n\n"
|
||||
+ IWorldGenerator.ALLOW_UNSTABLE_FEATURE_GENERATION_DESC)
|
||||
.define("Allow Unstable Feature Generation", IWorldGenerator.ALLOW_UNSTABLE_FEATURE_GENERATION_DEFAULT);
|
||||
|
||||
|
||||
blocksToAvoid = builder
|
||||
.comment("\n\n"
|
||||
+ IWorldGenerator.BLOCKS_TO_AVOID_DESC)
|
||||
.defineEnum("Blocks to avoid", IWorldGenerator.BLOCKS_TO_AVOID_DEFAULT);
|
||||
|
||||
|
||||
/*useExperimentalPreGenLoading = builder
|
||||
.comment("\n\n"
|
||||
+ " if a chunk has been pre-generated, then the mod would use the real chunk for the \n"
|
||||
@@ -294,20 +299,20 @@ public class ForgeConfig
|
||||
builder.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//============================//
|
||||
// AdvancedModOptions Configs //
|
||||
//============================//
|
||||
public static class Advanced
|
||||
public static class AdvancedModOptions
|
||||
{
|
||||
public final Threading threading;
|
||||
public final Debugging debugging;
|
||||
public final Buffers buffers;
|
||||
|
||||
public Advanced(ForgeConfigSpec.Builder builder)
|
||||
|
||||
public AdvancedModOptions(ForgeConfigSpec.Builder builder)
|
||||
{
|
||||
builder.comment(IAdvanced.DESC).push(this.getClass().getSimpleName());
|
||||
{
|
||||
@@ -317,36 +322,36 @@ public class ForgeConfig
|
||||
}
|
||||
builder.pop();
|
||||
}
|
||||
|
||||
|
||||
public static class Threading
|
||||
{
|
||||
public final ForgeConfigSpec.IntValue numberOfWorldGenerationThreads;
|
||||
public final ForgeConfigSpec.IntValue numberOfBufferBuilderThreads;
|
||||
|
||||
|
||||
Threading(ForgeConfigSpec.Builder builder)
|
||||
{
|
||||
builder.comment(IThreading.DESC).push(this.getClass().getSimpleName());
|
||||
|
||||
|
||||
MinDefaultMax<Integer> minDefaultMax = IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DEFAULT;
|
||||
numberOfWorldGenerationThreads = builder
|
||||
.comment("\n\n"
|
||||
+ IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DESC)
|
||||
.defineInRange("numberOfWorldGenerationThreads", minDefaultMax.defaultValue, minDefaultMax.minValue, minDefaultMax.maxValue);
|
||||
|
||||
|
||||
|
||||
|
||||
minDefaultMax = IThreading.NUMBER_OF_BUFFER_BUILDER_THREADS_MIN_DEFAULT_MAX;
|
||||
numberOfBufferBuilderThreads = builder
|
||||
.comment("\n\n"
|
||||
+ IThreading.NUMBER_OF_BUFFER_BUILDER_THREADS_MIN_DEFAULT_MAX)
|
||||
.defineInRange("numberOfBufferBuilderThreads", minDefaultMax.defaultValue, minDefaultMax.minValue, minDefaultMax.maxValue);
|
||||
|
||||
|
||||
builder.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//===============//
|
||||
// Debug Options //
|
||||
//===============//
|
||||
@@ -355,57 +360,57 @@ public class ForgeConfig
|
||||
public final ForgeConfigSpec.BooleanValue drawLods;
|
||||
public final ForgeConfigSpec.EnumValue<DebugMode> debugMode;
|
||||
public final ForgeConfigSpec.BooleanValue enableDebugKeybindings;
|
||||
|
||||
|
||||
Debugging(ForgeConfigSpec.Builder builder)
|
||||
{
|
||||
builder.comment(IDebugging.DESC).push(this.getClass().getSimpleName());
|
||||
|
||||
|
||||
drawLods = builder
|
||||
.comment("\n\n"
|
||||
+ IDebugging.DRAW_LODS_DESC)
|
||||
.define("Enable Rendering", IDebugging.DRAW_LODS_DEFAULT);
|
||||
|
||||
|
||||
debugMode = builder
|
||||
.comment("\n\n"
|
||||
+ IDebugging.DEBUG_MODE_DESC)
|
||||
.defineEnum("Debug Mode", IDebugging.DEBUG_MODE_DEFAULT);
|
||||
|
||||
|
||||
enableDebugKeybindings = builder
|
||||
.comment("\n\n"
|
||||
+ IDebugging.DEBUG_KEYBINDINGS_ENABLED_DESC)
|
||||
.define("Enable Debug Keybinding", IDebugging.DEBUG_KEYBINDINGS_ENABLED_DEFAULT);
|
||||
|
||||
|
||||
builder.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static class Buffers
|
||||
{
|
||||
public final ForgeConfigSpec.EnumValue<BufferRebuildTimes> rebuildTimes;
|
||||
|
||||
|
||||
Buffers(ForgeConfigSpec.Builder builder)
|
||||
{
|
||||
builder.comment(IBuffers.DESC).push(this.getClass().getSimpleName());
|
||||
|
||||
|
||||
rebuildTimes = builder
|
||||
.comment("\n\n"
|
||||
+ IBuffers.REBUILD_TIMES_DESC)
|
||||
.defineEnum("rebuildFrequency", IBuffers.REBUILD_TIMES_DEFAULT);
|
||||
|
||||
|
||||
builder.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/** {@link Path} to the configuration file of this mod */
|
||||
private static final Path CONFIG_PATH = Paths.get("config", ModInfo.NAME + ".toml");
|
||||
|
||||
|
||||
public static final ForgeConfigSpec CLIENT_SPEC;
|
||||
public static final Client CLIENT;
|
||||
|
||||
|
||||
static
|
||||
{
|
||||
final Pair<Client, ForgeConfigSpec> specPair = new ForgeConfigSpec.Builder().configure(Client::new);
|
||||
@@ -418,5 +423,18 @@ public class ForgeConfig
|
||||
clientConfig.save();
|
||||
CLIENT_SPEC.setConfig(clientConfig);
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onLoad(final ModConfigEvent.Loading configEvent)
|
||||
{
|
||||
LogManager.getLogger().debug(ModInfo.NAME, "Loaded forge config file {}", configEvent.getConfig().getFileName());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onFileChange(final ModConfigEvent.Reloading configEvent)
|
||||
{
|
||||
LogManager.getLogger().debug(ModInfo.NAME, "Forge config just got changed on the file system!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+142
-116
@@ -31,54 +31,55 @@ import com.seibel.lod.core.enums.config.LodTemplate;
|
||||
import com.seibel.lod.core.enums.config.VanillaOverdraw;
|
||||
import com.seibel.lod.core.enums.config.VerticalQuality;
|
||||
import com.seibel.lod.core.enums.rendering.DebugMode;
|
||||
import com.seibel.lod.core.enums.rendering.FogColorMode;
|
||||
import com.seibel.lod.core.enums.rendering.FogDistance;
|
||||
import com.seibel.lod.core.enums.rendering.FogDrawOverride;
|
||||
import com.seibel.lod.core.enums.rendering.FogDrawMode;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
import com.seibel.lod.forge.ForgeConfig;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 11-16-2021
|
||||
* @version 11-29-2021
|
||||
*/
|
||||
public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
public static final LodConfigWrapperSingleton INSTANCE = new LodConfigWrapperSingleton();
|
||||
|
||||
|
||||
|
||||
|
||||
private static final Client client = new Client();
|
||||
@Override
|
||||
public IClient client()
|
||||
{
|
||||
return client;
|
||||
}
|
||||
|
||||
|
||||
public static class Client implements IClient
|
||||
{
|
||||
public final IGraphics graphics;
|
||||
public final IWorldGenerator worldGenerator;
|
||||
public final IAdvanced advanced;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IGraphics graphics()
|
||||
{
|
||||
return graphics;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IWorldGenerator worldGenerator()
|
||||
{
|
||||
return worldGenerator;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IAdvanced advanced()
|
||||
{
|
||||
return advanced;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//================//
|
||||
// Client Configs //
|
||||
//================//
|
||||
@@ -88,8 +89,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
worldGenerator = new WorldGenerator();
|
||||
advanced = new Advanced();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//==================//
|
||||
// Graphics Configs //
|
||||
//==================//
|
||||
@@ -98,8 +99,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
public final IQuality quality;
|
||||
public final IFogQuality fogQuality;
|
||||
public final IAdvancedGraphics advancedGraphics;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IQuality quality()
|
||||
@@ -118,79 +119,79 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
return advancedGraphics;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Graphics()
|
||||
{
|
||||
quality = new Quality();
|
||||
advancedGraphics = new AdvancedGraphics();
|
||||
fogQuality = new FogQuality();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static class Quality implements IQuality
|
||||
{
|
||||
@Override
|
||||
public HorizontalResolution getDrawResolution()
|
||||
{
|
||||
return ForgeConfig.CLIENT.graphics.quality.drawResolution.get();
|
||||
return ForgeConfig.CLIENT.graphics.qualityOption.drawResolution.get();
|
||||
}
|
||||
@Override
|
||||
public void setDrawResolution(HorizontalResolution newHorizontalResolution)
|
||||
{
|
||||
ForgeConfig.CLIENT.graphics.quality.drawResolution.set(newHorizontalResolution);
|
||||
ForgeConfig.CLIENT.graphics.qualityOption.drawResolution.set(newHorizontalResolution);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getLodChunkRenderDistance()
|
||||
{
|
||||
return ForgeConfig.CLIENT.graphics.quality.lodChunkRenderDistance.get();
|
||||
return ForgeConfig.CLIENT.graphics.qualityOption.lodChunkRenderDistance.get();
|
||||
}
|
||||
@Override
|
||||
public void setLodChunkRenderDistance(int newLodChunkRenderDistance)
|
||||
{
|
||||
ForgeConfig.CLIENT.graphics.quality.lodChunkRenderDistance.set(newLodChunkRenderDistance);
|
||||
ForgeConfig.CLIENT.graphics.qualityOption.lodChunkRenderDistance.set(newLodChunkRenderDistance);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public VerticalQuality getVerticalQuality()
|
||||
{
|
||||
return ForgeConfig.CLIENT.graphics.quality.verticalQuality.get();
|
||||
return ForgeConfig.CLIENT.graphics.qualityOption.verticalQuality.get();
|
||||
}
|
||||
@Override
|
||||
public void setVerticalQuality(VerticalQuality newVerticalQuality)
|
||||
{
|
||||
ForgeConfig.CLIENT.graphics.quality.verticalQuality.set(newVerticalQuality);
|
||||
ForgeConfig.CLIENT.graphics.qualityOption.verticalQuality.set(newVerticalQuality);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public HorizontalScale getHorizontalScale()
|
||||
{
|
||||
return ForgeConfig.CLIENT.graphics.quality.horizontalScale.get();
|
||||
return ForgeConfig.CLIENT.graphics.qualityOption.horizontalScale.get();
|
||||
}
|
||||
@Override
|
||||
public void setHorizontalScale(HorizontalScale newHorizontalScale)
|
||||
{
|
||||
ForgeConfig.CLIENT.graphics.quality.horizontalScale.set(newHorizontalScale);
|
||||
ForgeConfig.CLIENT.graphics.qualityOption.horizontalScale.set(newHorizontalScale);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public HorizontalQuality getHorizontalQuality()
|
||||
{
|
||||
return ForgeConfig.CLIENT.graphics.quality.horizontalQuality.get();
|
||||
return ForgeConfig.CLIENT.graphics.qualityOption.horizontalQuality.get();
|
||||
}
|
||||
@Override
|
||||
public void setHorizontalQuality(HorizontalQuality newHorizontalQuality)
|
||||
{
|
||||
ForgeConfig.CLIENT.graphics.quality.horizontalQuality.set(newHorizontalQuality);
|
||||
ForgeConfig.CLIENT.graphics.qualityOption.horizontalQuality.set(newHorizontalQuality);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static class FogQuality implements IFogQuality
|
||||
{
|
||||
@Override
|
||||
@@ -203,20 +204,32 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
ForgeConfig.CLIENT.graphics.fogQuality.fogDistance.set(newFogDistance);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public FogDrawOverride getFogDrawOverride()
|
||||
public FogDrawMode getFogDrawMode()
|
||||
{
|
||||
return ForgeConfig.CLIENT.graphics.fogQuality.fogDrawOverride.get();
|
||||
return ForgeConfig.CLIENT.graphics.fogQuality.fogDrawMode.get();
|
||||
}
|
||||
@Override
|
||||
public void setFogDrawOverride(FogDrawOverride newFogDrawOverride)
|
||||
public void setFogDrawMode(FogDrawMode newFogDrawMode)
|
||||
{
|
||||
ForgeConfig.CLIENT.graphics.fogQuality.fogDrawOverride.set(newFogDrawOverride);
|
||||
ForgeConfig.CLIENT.graphics.fogQuality.fogDrawMode.set(newFogDrawMode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public FogColorMode getFogColorMode()
|
||||
{
|
||||
return ForgeConfig.CLIENT.graphics.fogQuality.fogColorMode.get();
|
||||
}
|
||||
@Override
|
||||
public void setFogColorMode(FogColorMode newFogColorMode)
|
||||
{
|
||||
ForgeConfig.CLIENT.graphics.fogQuality.fogColorMode.set(newFogColorMode);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getDisableVanillaFog()
|
||||
{
|
||||
@@ -228,86 +241,98 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
ForgeConfig.CLIENT.graphics.fogQuality.disableVanillaFog.set(newDisableVanillaFog);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static class AdvancedGraphics implements IAdvancedGraphics
|
||||
{
|
||||
@Override
|
||||
public LodTemplate getLodTemplate()
|
||||
{
|
||||
return ForgeConfig.CLIENT.graphics.advancedGraphics.lodTemplate.get();
|
||||
return ForgeConfig.CLIENT.graphics.advancedGraphicsOption.lodTemplate.get();
|
||||
}
|
||||
@Override
|
||||
public void setLodTemplate(LodTemplate newLodTemplate)
|
||||
{
|
||||
ForgeConfig.CLIENT.graphics.advancedGraphics.lodTemplate.set(newLodTemplate);
|
||||
ForgeConfig.CLIENT.graphics.advancedGraphicsOption.lodTemplate.set(newLodTemplate);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getDisableDirectionalCulling()
|
||||
{
|
||||
return ForgeConfig.CLIENT.graphics.advancedGraphics.disableDirectionalCulling.get();
|
||||
return ForgeConfig.CLIENT.graphics.advancedGraphicsOption.disableDirectionalCulling.get();
|
||||
}
|
||||
@Override
|
||||
public void setDisableDirectionalCulling(boolean newDisableDirectionalCulling)
|
||||
{
|
||||
ForgeConfig.CLIENT.graphics.advancedGraphics.disableDirectionalCulling.set(newDisableDirectionalCulling);
|
||||
ForgeConfig.CLIENT.graphics.advancedGraphicsOption.disableDirectionalCulling.set(newDisableDirectionalCulling);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getAlwaysDrawAtMaxQuality()
|
||||
{
|
||||
return ForgeConfig.CLIENT.graphics.advancedGraphics.alwaysDrawAtMaxQuality.get();
|
||||
return ForgeConfig.CLIENT.graphics.advancedGraphicsOption.alwaysDrawAtMaxQuality.get();
|
||||
}
|
||||
@Override
|
||||
public void setAlwaysDrawAtMaxQuality(boolean newAlwaysDrawAtMaxQuality)
|
||||
{
|
||||
ForgeConfig.CLIENT.graphics.advancedGraphics.alwaysDrawAtMaxQuality.set(newAlwaysDrawAtMaxQuality);
|
||||
ForgeConfig.CLIENT.graphics.advancedGraphicsOption.alwaysDrawAtMaxQuality.set(newAlwaysDrawAtMaxQuality);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public VanillaOverdraw getVanillaOverdraw()
|
||||
{
|
||||
return ForgeConfig.CLIENT.graphics.advancedGraphics.vanillaOverdraw.get();
|
||||
return ForgeConfig.CLIENT.graphics.advancedGraphicsOption.vanillaOverdraw.get();
|
||||
}
|
||||
@Override
|
||||
public void setVanillaOverdraw(VanillaOverdraw newVanillaOverdraw)
|
||||
{
|
||||
ForgeConfig.CLIENT.graphics.advancedGraphics.vanillaOverdraw.set(newVanillaOverdraw);
|
||||
ForgeConfig.CLIENT.graphics.advancedGraphicsOption.vanillaOverdraw.set(newVanillaOverdraw);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public GpuUploadMethod getGpuUploadMethod()
|
||||
{
|
||||
return ForgeConfig.CLIENT.graphics.advancedGraphics.gpuUploadMethod.get();
|
||||
return ForgeConfig.CLIENT.graphics.advancedGraphicsOption.gpuUploadMethod.get();
|
||||
}
|
||||
@Override
|
||||
public void setGpuUploadMethod(GpuUploadMethod newDisableVanillaFog)
|
||||
{
|
||||
ForgeConfig.CLIENT.graphics.advancedGraphics.gpuUploadMethod.set(newDisableVanillaFog);
|
||||
ForgeConfig.CLIENT.graphics.advancedGraphicsOption.gpuUploadMethod.set(newDisableVanillaFog);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getGpuUploadTimeoutInMilliseconds()
|
||||
{
|
||||
return ForgeConfig.CLIENT.graphics.advancedGraphicsOption.gpuUploadTimeoutInMilleseconds.get();
|
||||
}
|
||||
@Override
|
||||
public void setGpuUploadTimeoutInMilliseconds(int newTimeoutInMilliseconds)
|
||||
{
|
||||
ForgeConfig.CLIENT.graphics.advancedGraphicsOption.gpuUploadTimeoutInMilleseconds.set(newTimeoutInMilliseconds);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getUseExtendedNearClipPlane()
|
||||
{
|
||||
return ForgeConfig.CLIENT.graphics.advancedGraphics.useExtendedNearClipPlane.get();
|
||||
return ForgeConfig.CLIENT.graphics.advancedGraphicsOption.useExtendedNearClipPlane.get();
|
||||
}
|
||||
@Override
|
||||
public void setUseExtendedNearClipPlane(boolean newUseExtendedNearClipPlane)
|
||||
{
|
||||
ForgeConfig.CLIENT.graphics.advancedGraphics.useExtendedNearClipPlane.set(newUseExtendedNearClipPlane);
|
||||
ForgeConfig.CLIENT.graphics.advancedGraphicsOption.useExtendedNearClipPlane.set(newUseExtendedNearClipPlane);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//========================//
|
||||
// WorldGenerator Configs //
|
||||
//========================//
|
||||
@@ -323,8 +348,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
ForgeConfig.CLIENT.worldGenerator.generationPriority.set(newGenerationPriority);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public DistanceGenerationMode getDistanceGenerationMode()
|
||||
{
|
||||
@@ -335,8 +360,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
ForgeConfig.CLIENT.worldGenerator.distanceGenerationMode.set(newDistanceGenerationMode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getAllowUnstableFeatureGeneration()
|
||||
{
|
||||
@@ -347,8 +372,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
ForgeConfig.CLIENT.worldGenerator.allowUnstableFeatureGeneration.set(newAllowUnstableFeatureGeneration);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public BlocksToAvoid getBlocksToAvoid()
|
||||
{
|
||||
@@ -360,10 +385,10 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
ForgeConfig.CLIENT.worldGenerator.blocksToAvoid.set(newBlockToAvoid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//============================//
|
||||
// AdvancedModOptions Configs //
|
||||
//============================//
|
||||
@@ -372,8 +397,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
public final IThreading threading;
|
||||
public final IDebugging debugging;
|
||||
public final IBuffers buffers;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IThreading threading()
|
||||
{
|
||||
@@ -393,44 +418,44 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
return buffers;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public Advanced()
|
||||
{
|
||||
threading = new Threading();
|
||||
debugging = new Debugging();
|
||||
buffers = new Buffers();
|
||||
}
|
||||
|
||||
|
||||
public static class Threading implements IThreading
|
||||
{
|
||||
@Override
|
||||
public int getNumberOfWorldGenerationThreads()
|
||||
{
|
||||
return ForgeConfig.CLIENT.advanced.threading.numberOfWorldGenerationThreads.get();
|
||||
return ForgeConfig.CLIENT.advancedModOptions.threading.numberOfWorldGenerationThreads.get();
|
||||
}
|
||||
@Override
|
||||
public void setNumberOfWorldGenerationThreads(int newNumberOfWorldGenerationThreads)
|
||||
{
|
||||
ForgeConfig.CLIENT.advanced.threading.numberOfWorldGenerationThreads.set(newNumberOfWorldGenerationThreads);
|
||||
ForgeConfig.CLIENT.advancedModOptions.threading.numberOfWorldGenerationThreads.set(newNumberOfWorldGenerationThreads);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getNumberOfBufferBuilderThreads()
|
||||
{
|
||||
return ForgeConfig.CLIENT.advanced.threading.numberOfBufferBuilderThreads.get();
|
||||
return ForgeConfig.CLIENT.advancedModOptions.threading.numberOfBufferBuilderThreads.get();
|
||||
}
|
||||
@Override
|
||||
public void setNumberOfBufferBuilderThreads(int newNumberOfWorldBuilderThreads)
|
||||
{
|
||||
ForgeConfig.CLIENT.advanced.threading.numberOfBufferBuilderThreads.set(newNumberOfWorldBuilderThreads);
|
||||
ForgeConfig.CLIENT.advancedModOptions.threading.numberOfBufferBuilderThreads.set(newNumberOfWorldBuilderThreads);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//===============//
|
||||
// Debug Options //
|
||||
//===============//
|
||||
@@ -439,53 +464,54 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public boolean getDrawLods()
|
||||
{
|
||||
return ForgeConfig.CLIENT.advanced.debugging.drawLods.get();
|
||||
return ForgeConfig.CLIENT.advancedModOptions.debugging.drawLods.get();
|
||||
}
|
||||
@Override
|
||||
public void setDrawLods(boolean newDrawLods)
|
||||
{
|
||||
ForgeConfig.CLIENT.advanced.debugging.drawLods.set(newDrawLods);
|
||||
ForgeConfig.CLIENT.advancedModOptions.debugging.drawLods.set(newDrawLods);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public DebugMode getDebugMode()
|
||||
{
|
||||
return ForgeConfig.CLIENT.advanced.debugging.debugMode.get();
|
||||
return ForgeConfig.CLIENT.advancedModOptions.debugging.debugMode.get();
|
||||
}
|
||||
@Override
|
||||
public void setDebugMode(DebugMode newDebugMode)
|
||||
{
|
||||
ForgeConfig.CLIENT.advanced.debugging.debugMode.set(newDebugMode);
|
||||
ForgeConfig.CLIENT.advancedModOptions.debugging.debugMode.set(newDebugMode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getDebugKeybindingsEnabled()
|
||||
{
|
||||
return ForgeConfig.CLIENT.advanced.debugging.enableDebugKeybindings.get();
|
||||
return ForgeConfig.CLIENT.advancedModOptions.debugging.enableDebugKeybindings.get();
|
||||
}
|
||||
@Override
|
||||
public void setDebugKeybindingsEnabled(boolean newEnableDebugKeybindings)
|
||||
{
|
||||
ForgeConfig.CLIENT.advanced.debugging.enableDebugKeybindings.set(newEnableDebugKeybindings);
|
||||
ForgeConfig.CLIENT.advancedModOptions.debugging.enableDebugKeybindings.set(newEnableDebugKeybindings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static class Buffers implements IBuffers
|
||||
{
|
||||
@Override
|
||||
public BufferRebuildTimes getRebuildTimes()
|
||||
{
|
||||
return ForgeConfig.CLIENT.advanced.buffers.rebuildTimes.get();
|
||||
return ForgeConfig.CLIENT.advancedModOptions.buffers.rebuildTimes.get();
|
||||
}
|
||||
@Override
|
||||
public void setRebuildTimes(BufferRebuildTimes newBufferRebuildTimes)
|
||||
{
|
||||
ForgeConfig.CLIENT.advanced.buffers.rebuildTimes.set(newBufferRebuildTimes);
|
||||
ForgeConfig.CLIENT.advancedModOptions.buffers.rebuildTimes.set(newBufferRebuildTimes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ modId="lod" #mandatory
|
||||
#// The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
||||
#//${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
|
||||
#// see the associated build.gradle script for how to populate this completely automatically during a build
|
||||
version="1.5.3a" #mandatory
|
||||
version="1.5.4a" #mandatory
|
||||
|
||||
#// A display name for the mod
|
||||
displayName="Distant Horizons" #mandatory
|
||||
|
||||
+2
-1
@@ -1,9 +1,10 @@
|
||||
org.gradle.jvmargs=-Xmx2048M
|
||||
|
||||
# TODO: HEY REMEMBER TO UPDATE THE lod.accesswidener WHEN UPDATING TO 1.18
|
||||
minecraft_version=1.17.1
|
||||
|
||||
archives_base_name=DistantHorizons
|
||||
mod_version=1.5.3a
|
||||
mod_version=1.5.4a
|
||||
maven_group=com.seibel.lod
|
||||
|
||||
fabric_loader_version=0.11.6
|
||||
|
||||
Reference in New Issue
Block a user