Merge remote-tracking branch 'origin/1.17.1' into 1.17.1
This commit is contained in:
@@ -27,3 +27,10 @@ publishing {
|
||||
// Add repositories to publish to here.
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("com.moandjiezana.toml:toml4j:${rootProject.toml_version}")
|
||||
shadowMe("com.moandjiezana.toml:toml4j:${rootProject.toml_version}") {
|
||||
exclude(module: "gson")
|
||||
}
|
||||
}
|
||||
@@ -52,37 +52,37 @@ public class Config extends ConfigGui
|
||||
// Since the original config system uses forge stuff, that means we have to rewrite the whole config system
|
||||
|
||||
@ScreenEntry(to = "client")
|
||||
public static ScreenEntry client;
|
||||
public static Client client;
|
||||
|
||||
|
||||
public static class Client
|
||||
{
|
||||
@Category("client")
|
||||
@ScreenEntry(to = "graphics")
|
||||
public static ScreenEntry graphics;
|
||||
public static Graphics graphics;
|
||||
|
||||
@Category("client")
|
||||
@ScreenEntry(to = "worldGenerator")
|
||||
public static ScreenEntry worldGenerator;
|
||||
public static WorldGenerator worldGenerator;
|
||||
|
||||
@Category("client")
|
||||
@ScreenEntry(to = "advanced")
|
||||
public static ScreenEntry advanced;
|
||||
public static Advanced advanced;
|
||||
|
||||
|
||||
public static class Graphics
|
||||
{
|
||||
@Category("client.graphics")
|
||||
@ScreenEntry(to = "quality")
|
||||
public static ScreenEntry quality;
|
||||
public static Quality quality;
|
||||
|
||||
@Category("client.graphics")
|
||||
@ScreenEntry(to = "fogQuality")
|
||||
public static ScreenEntry fogQuality;
|
||||
public static FogQuality fogQuality;
|
||||
|
||||
@Category("client.graphics")
|
||||
@ScreenEntry(to = "advancedGraphics")
|
||||
public static ScreenEntry advancedGraphics;
|
||||
public static AdvancedGraphics advancedGraphics;
|
||||
|
||||
|
||||
public static class Quality
|
||||
@@ -179,15 +179,15 @@ public class Config extends ConfigGui
|
||||
{
|
||||
@Category("client.advanced")
|
||||
@ScreenEntry(to = "threading")
|
||||
public static ScreenEntry threading;
|
||||
public static Threading threading;
|
||||
|
||||
@Category("client.advanced")
|
||||
@ScreenEntry(to = "debugging")
|
||||
public static ScreenEntry debugging;
|
||||
public static Debugging debugging;
|
||||
|
||||
@Category("client.advanced")
|
||||
@ScreenEntry(to = "buffers")
|
||||
public static ScreenEntry buffers;
|
||||
public static Buffers buffers;
|
||||
|
||||
|
||||
public static class Threading
|
||||
|
||||
@@ -23,18 +23,7 @@ public class LodCommonMain {
|
||||
}
|
||||
|
||||
|
||||
// TODO[CONFIG]: Find a better way to initialise everything
|
||||
public static void initConfig() {
|
||||
ConfigGui.init(ModInfo.ID, Config.class);
|
||||
ConfigGui.init(ModInfo.ID, Config.Client.class);
|
||||
ConfigGui.init(ModInfo.ID, Config.Client.Graphics.class);
|
||||
ConfigGui.init(ModInfo.ID, Config.Client.Graphics.Quality.class);
|
||||
ConfigGui.init(ModInfo.ID, Config.Client.Graphics.FogQuality.class);
|
||||
ConfigGui.init(ModInfo.ID, Config.Client.Graphics.AdvancedGraphics.class);
|
||||
ConfigGui.init(ModInfo.ID, Config.Client.WorldGenerator.class);
|
||||
ConfigGui.init(ModInfo.ID, Config.Client.Advanced.class);
|
||||
ConfigGui.init(ModInfo.ID, Config.Client.Advanced.Threading.class);
|
||||
ConfigGui.init(ModInfo.ID, Config.Client.Advanced.Debugging.class);
|
||||
ConfigGui.init(ModInfo.ID, Config.Client.Advanced.Buffers.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,10 @@ package com.seibel.lod.common.wrappers.config;
|
||||
|
||||
import com.google.gson.ExclusionStrategy;
|
||||
import com.google.gson.FieldAttributes;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.moandjiezana.toml.Toml;
|
||||
import com.moandjiezana.toml.TomlWriter;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.seibel.lod.core.ModInfo;
|
||||
//import net.fabricmc.api.EnvType;
|
||||
//import net.fabricmc.api.Environment;
|
||||
//import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
@@ -26,6 +23,8 @@ import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -39,15 +38,14 @@ import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* which is based upon TinyConfig
|
||||
* Based upon TinyConfig
|
||||
* https://github.com/Minenash/TinyConfig
|
||||
*
|
||||
* Credits to Motschen
|
||||
*
|
||||
* @author coolGi2007
|
||||
* @version 12-06-2021
|
||||
* @version 12-09-2021
|
||||
*/
|
||||
// Everything required is packed into 1 class, so it is easier to copy
|
||||
// This config should work for both Fabric and Forge as long as you use Mojang mappings
|
||||
@@ -106,6 +104,13 @@ public abstract class ConfigGui {
|
||||
To make a textured button to the options screen look in the mixins/MixinOptionsScreen class and TexturedButtonWidget class
|
||||
Remember to add the MixinOptionsScreen to your ModID.mixins.json
|
||||
*/
|
||||
|
||||
/*
|
||||
This is a small to do list for the config
|
||||
|
||||
Make config save
|
||||
Add a way to add min and max from another variable
|
||||
*/
|
||||
private static final Pattern INTEGER_ONLY = Pattern.compile("(-?[0-9]*)");
|
||||
private static final Pattern DECIMAL_ONLY = Pattern.compile("-?([\\d]+\\.?[\\d]*|[\\d]*\\.?[\\d]+|\\.)");
|
||||
|
||||
@@ -114,14 +119,14 @@ public abstract class ConfigGui {
|
||||
protected static class EntryInfo {
|
||||
Field field;
|
||||
Object widget;
|
||||
int width;
|
||||
int width = 0;
|
||||
int max;
|
||||
Map.Entry<EditBox, Component> error;
|
||||
Object defaultValue;
|
||||
Object value;
|
||||
String tempValue;
|
||||
boolean inLimits = true;
|
||||
String id;
|
||||
String id; // ModID
|
||||
TranslatableComponent name;
|
||||
int index;
|
||||
boolean button = false; // This asks if it is a button to goto a new screen
|
||||
@@ -132,28 +137,29 @@ public abstract class ConfigGui {
|
||||
public static final Map<String,Class<?>> configClass = new HashMap<>();
|
||||
private static Path path;
|
||||
|
||||
private static final Gson gson = new GsonBuilder().excludeFieldsWithModifiers(Modifier.TRANSIENT).excludeFieldsWithModifiers(Modifier.PRIVATE).addSerializationExclusionStrategy(new HiddenAnnotationExclusionStrategy()).setPrettyPrinting().create();
|
||||
|
||||
public static void init(String modid, Class<?> config) {
|
||||
path = Minecraft.getInstance().gameDirectory.toPath().resolve("config").resolve(modid + ".json");
|
||||
path = Minecraft.getInstance().gameDirectory.toPath().resolve("config").resolve(modid + ".toml");
|
||||
configClass.put(modid, config);
|
||||
|
||||
for (Field field : config.getFields()) {
|
||||
EntryInfo info = new EntryInfo();
|
||||
if (field.isAnnotationPresent(Entry.class) || field.isAnnotationPresent(Comment.class) || field.isAnnotationPresent(ScreenEntry.class))
|
||||
// TODO: Fix the check for client/server
|
||||
// TODO[CONFIG]: Fix the check for client/server
|
||||
// if (Minecraft.getInstance().getEnvironmentType() == EnvType.CLIENT)
|
||||
initClient(modid, field, info);
|
||||
if (field.isAnnotationPresent(Entry.class))
|
||||
try {
|
||||
info.defaultValue = field.get(null);
|
||||
} catch (IllegalAccessException ignored) {}
|
||||
if (field.isAnnotationPresent(ScreenEntry.class)) {
|
||||
ConfigGui.init(modid, field.getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// File saving stuff
|
||||
// TODO[CONFIG]: Change to .toml
|
||||
try {
|
||||
gson.fromJson(Files.newBufferedReader(path), config);
|
||||
new Toml().read(Files.newBufferedReader(path)).to(config);
|
||||
} catch (Exception e) {
|
||||
write(modid);
|
||||
}
|
||||
@@ -168,11 +174,15 @@ public abstract class ConfigGui {
|
||||
}
|
||||
}
|
||||
private static void initClient(String modid, Field field, EntryInfo info) {
|
||||
// This adds the buttons to the queue to be rendered
|
||||
Class<?> type = field.getType();
|
||||
Category c = field.getAnnotation(Category.class);
|
||||
Entry e = field.getAnnotation(Entry.class);
|
||||
ScreenEntry s = field.getAnnotation(ScreenEntry.class);
|
||||
info.width = e != null ? e.width() : 0;
|
||||
if (e!=null)
|
||||
info.width = e.width();
|
||||
else if (s!=null)
|
||||
info.width = s.width();
|
||||
info.field = field;
|
||||
info.id = modid;
|
||||
info.category = c != null ? c.value() : "";
|
||||
@@ -180,20 +190,20 @@ public abstract class ConfigGui {
|
||||
if (e != null) {
|
||||
if (!e.name().equals(""))
|
||||
info.name = new TranslatableComponent(e.name());
|
||||
if (type == int.class)
|
||||
if (type == int.class) // For int
|
||||
textField(info, Integer::parseInt, INTEGER_ONLY, e.min(), e.max(), true);
|
||||
else if (type == double.class)
|
||||
else if (type == double.class) // For double
|
||||
textField(info, Double::parseDouble, DECIMAL_ONLY, e.min(), e.max(), false);
|
||||
else if (type == String.class || type == List.class) {
|
||||
else if (type == String.class || type == List.class) { // For string or list
|
||||
info.max = e.max() == Double.MAX_VALUE ? Integer.MAX_VALUE : (int) e.max();
|
||||
textField(info, String::length, null, Math.min(e.min(), 0), Math.max(e.max(), 1), true);
|
||||
} else if (type == boolean.class) {
|
||||
} else if (type == boolean.class) { // For boolean
|
||||
Function<Object, Component> func = value -> new TextComponent((Boolean) value ? "True" : "False").withStyle((Boolean) value ? ChatFormatting.GREEN : ChatFormatting.RED);
|
||||
info.widget = new AbstractMap.SimpleEntry<Button.OnPress, Function<Object, Component>>(button -> {
|
||||
info.value = !(Boolean) info.value;
|
||||
button.setMessage(func.apply(info.value));
|
||||
}, func);
|
||||
} else if (type.isEnum()) {
|
||||
} else if (type.isEnum()) { // For enum
|
||||
List<?> values = Arrays.asList(field.getType().getEnumConstants());
|
||||
Function<Object, Component> func = value -> new TranslatableComponent(modid + ".config." + "enum." + type.getSimpleName() + "." + info.value.toString());
|
||||
info.widget = new AbstractMap.SimpleEntry<Button.OnPress, Function<Object, Component>>(button -> {
|
||||
@@ -244,13 +254,13 @@ public abstract class ConfigGui {
|
||||
};
|
||||
}
|
||||
|
||||
// Creates the modid.json
|
||||
// Creates the modid.toml
|
||||
public static void write(String modid) {
|
||||
path = Minecraft.getInstance().gameDirectory.toPath().resolve("config").resolve(modid + ".json");
|
||||
path = Minecraft.getInstance().gameDirectory.toPath().resolve("config").resolve(modid + ".toml");
|
||||
try {
|
||||
if (!Files.exists(path))
|
||||
Files.createFile(path);
|
||||
Files.write(path, gson.toJson(configClass.get(modid).getDeclaredConstructor().newInstance()).getBytes());
|
||||
new TomlWriter().write(configClass.get(modid).getDeclaredConstructor().newInstance(), path.toFile());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -284,7 +294,7 @@ public abstract class ConfigGui {
|
||||
}
|
||||
private void loadValues() {
|
||||
try {
|
||||
gson.fromJson(Files.newBufferedReader(path), configClass.get(modid));
|
||||
new Toml().read(Files.newBufferedReader(path)).to(configClass.get(modid));
|
||||
} catch (Exception e) {
|
||||
write(modid);
|
||||
}
|
||||
@@ -368,7 +378,7 @@ public abstract class ConfigGui {
|
||||
widget.setFilter(processor);
|
||||
this.list.addButton(widget, resetButton, null, name);
|
||||
} else if (info.button) {
|
||||
Button widget = new Button(this.width / 2 - 100, this.height - 28, 200, 20, name, (button -> {
|
||||
Button widget = new Button(this.width / 2 - info.width, this.height - 28, info.width*2, 20, name, (button -> {
|
||||
Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, ModInfo.ID, info.gotoScreen));
|
||||
}));
|
||||
this.list.addButton(widget, null, null, null);
|
||||
@@ -493,6 +503,7 @@ public abstract class ConfigGui {
|
||||
public @interface ScreenEntry {
|
||||
String to();
|
||||
String name() default "";
|
||||
int width() default 100;
|
||||
}
|
||||
|
||||
// Where the @Category is defined
|
||||
|
||||
+119
-16
@@ -3,6 +3,10 @@ package com.seibel.lod.common.wrappers.minecraft;
|
||||
import java.awt.*;
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import com.seibel.lod.common.wrappers.misc.LightMapWrapper;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
@@ -32,21 +36,22 @@ import net.minecraft.world.phys.Vec3;
|
||||
* related to rendering in Minecraft.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 11-26-2021
|
||||
* @version 12-05-2021
|
||||
*/
|
||||
public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
{
|
||||
public static final MinecraftRenderWrapper INSTANCE = new MinecraftRenderWrapper();
|
||||
public static final MinecraftWrapper MC_WRAPPER = MinecraftWrapper.INSTANCE;
|
||||
|
||||
private final GameRenderer gameRenderer = Minecraft.getInstance().gameRenderer;
|
||||
private final static Minecraft mc = Minecraft.getInstance();
|
||||
private static final Minecraft MC = Minecraft.getInstance();
|
||||
private static final GameRenderer GAME_RENDERER = MC.gameRenderer;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Vec3f getLookAtVector()
|
||||
{
|
||||
Camera camera = gameRenderer.getMainCamera();
|
||||
Camera camera = GAME_RENDERER.getMainCamera();
|
||||
Vector3f cameraDir = camera.getLookVector();
|
||||
return new Vec3f(cameraDir.x(), cameraDir.y(), cameraDir.z());
|
||||
}
|
||||
@@ -54,7 +59,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public AbstractBlockPosWrapper getCameraBlockPosition()
|
||||
{
|
||||
Camera camera = gameRenderer.getMainCamera();
|
||||
Camera camera = GAME_RENDERER.getMainCamera();
|
||||
BlockPos blockPos = camera.getBlockPosition();
|
||||
return new BlockPosWrapper(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
}
|
||||
@@ -62,13 +67,13 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public boolean playerHasBlindnessEffect()
|
||||
{
|
||||
return mc.player.getActiveEffectsMap().get(MobEffects.BLINDNESS) != null;
|
||||
return MC.player.getActiveEffectsMap().get(MobEffects.BLINDNESS) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3d getCameraExactPosition()
|
||||
{
|
||||
Camera camera = gameRenderer.getMainCamera();
|
||||
Camera camera = GAME_RENDERER.getMainCamera();
|
||||
Vec3 projectedView = camera.getPosition();
|
||||
|
||||
return new Vec3d(projectedView.x, projectedView.y, projectedView.z);
|
||||
@@ -77,13 +82,13 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public Mat4f getDefaultProjectionMatrix(float partialTicks)
|
||||
{
|
||||
return McObjectConverter.Convert(gameRenderer.getProjectionMatrix(gameRenderer.getFov(gameRenderer.getMainCamera(), partialTicks, true)));
|
||||
return McObjectConverter.Convert(GAME_RENDERER.getProjectionMatrix(GAME_RENDERER.getFov(GAME_RENDERER.getMainCamera(), partialTicks, true)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getGamma()
|
||||
{
|
||||
return mc.options.gamma;
|
||||
return MC.options.gamma;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,8 +100,8 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
|
||||
@Override
|
||||
public Color getSkyColor() {
|
||||
if (mc.level.dimensionType().hasSkyLight()) {
|
||||
Vec3 colorValues = mc.level.getSkyColor(mc.gameRenderer.getMainCamera().getPosition(), mc.getFrameTime());
|
||||
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);
|
||||
@@ -105,25 +110,25 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public double getFov(float partialTicks)
|
||||
{
|
||||
return gameRenderer.getFov(gameRenderer.getMainCamera(), partialTicks, true);
|
||||
return GAME_RENDERER.getFov(GAME_RENDERER.getMainCamera(), partialTicks, true);
|
||||
}
|
||||
|
||||
/** Measured in chunks */
|
||||
@Override
|
||||
public int getRenderDistance()
|
||||
{
|
||||
return mc.options.renderDistance;
|
||||
return MC.options.renderDistance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getScreenWidth()
|
||||
{
|
||||
return mc.getWindow().getWidth();
|
||||
return MC.getWindow().getWidth();
|
||||
}
|
||||
@Override
|
||||
public int getScreenHeight()
|
||||
{
|
||||
return mc.getWindow().getHeight();
|
||||
return MC.getWindow().getHeight();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,7 +147,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
// Wow, those are some long names!
|
||||
|
||||
// go through every RenderInfo to get the compiled chunks
|
||||
LevelRenderer renderer = mc.levelRenderer;
|
||||
LevelRenderer renderer = MC.levelRenderer;
|
||||
for (RenderChunkInfo worldRenderer$LocalRenderInformationContainer : renderer.renderChunks)
|
||||
{
|
||||
CompiledChunk compiledChunk = worldRenderer$LocalRenderInformationContainer.chunk.getCompiledChunk();
|
||||
@@ -158,4 +163,102 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
return loadedPos;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int[] getLightmapPixels()
|
||||
{
|
||||
LightTexture tex = GAME_RENDERER.lightTexture();
|
||||
NativeImage lightMapPixels = tex.lightPixels;
|
||||
LightMapWrapper lightMap = new LightMapWrapper(lightMapPixels);
|
||||
|
||||
|
||||
int lightMapHeight = getLightmapTextureHeight();
|
||||
int lightMapWidth = getLightmapTextureWidth();
|
||||
|
||||
int pixels[] = new int[lightMapWidth * lightMapHeight];
|
||||
for (int u = 0; u < lightMapWidth; u++)
|
||||
{
|
||||
for (int v = 0; v < lightMapWidth; v++)
|
||||
{
|
||||
// this could probably be kept as a int, but
|
||||
// it is easier to test and see the colors when debugging this way.
|
||||
// When creating a new release this should be changed to the int version.
|
||||
Color c = LodUtil.intToColor(lightMap.getLightValue(u, v));
|
||||
|
||||
// these should both create a totally white image
|
||||
// int col =
|
||||
// Integer.MAX_VALUE;
|
||||
// int col =
|
||||
// 0b11111111 + // red
|
||||
// (0b11111111 << 8) + // green
|
||||
// (0b11111111 << 16) + // blue
|
||||
// (0b11111111 << 24); // blue
|
||||
|
||||
int col =
|
||||
(c.getRed() & 0b11111111) + // red
|
||||
((c.getGreen() & 0b11111111) << 8) + // green
|
||||
((c.getBlue() & 0b11111111) << 16) + // blue
|
||||
((c.getAlpha() & 0b11111111) << 24); // alpha
|
||||
|
||||
// 2D array stored in a 1D array.
|
||||
// Thank you Tim from College ;)
|
||||
pixels[u * lightMapWidth + v] = col;
|
||||
}
|
||||
}
|
||||
|
||||
return pixels;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getLightmapTextureHeight()
|
||||
{
|
||||
int height = -1;
|
||||
|
||||
LightTexture lightTexture = GAME_RENDERER.lightTexture();
|
||||
if (lightTexture != null)
|
||||
{
|
||||
NativeImage tex = lightTexture.lightPixels;
|
||||
if (tex != null)
|
||||
{
|
||||
height = tex.getHeight();
|
||||
}
|
||||
}
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightmapTextureWidth()
|
||||
{
|
||||
int width = -1;
|
||||
|
||||
LightTexture lightTexture = GAME_RENDERER.lightTexture();
|
||||
if (lightTexture != null)
|
||||
{
|
||||
NativeImage tex = lightTexture.lightPixels;
|
||||
if (tex != null)
|
||||
{
|
||||
width = tex.getWidth();
|
||||
}
|
||||
}
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getLightmapGLFormat() {
|
||||
int glFormat = -1;
|
||||
|
||||
LightTexture lightTexture = GAME_RENDERER.lightTexture();
|
||||
if (lightTexture != null) {
|
||||
NativeImage tex = lightTexture.lightPixels;
|
||||
if (tex != null) {
|
||||
glFormat = tex.format().glFormat();
|
||||
}
|
||||
}
|
||||
|
||||
return glFormat;
|
||||
}
|
||||
}
|
||||
|
||||
+15
-10
@@ -73,7 +73,7 @@ public class MinecraftWrapper implements IMinecraftWrapper
|
||||
{
|
||||
public static final MinecraftWrapper INSTANCE = new MinecraftWrapper();
|
||||
|
||||
private final Minecraft mc = Minecraft.getInstance();
|
||||
public final Minecraft mc = Minecraft.getInstance();
|
||||
|
||||
/**
|
||||
* The lightmap for the current:
|
||||
@@ -178,31 +178,36 @@ public class MinecraftWrapper implements IMinecraftWrapper
|
||||
/**
|
||||
* Returns the color int at the given pixel coordinates
|
||||
* from the current lightmap.
|
||||
* @param u x location in texture space
|
||||
* @param v z location in texture space
|
||||
* @param blockLight x location in texture space
|
||||
* @param skyLight z location in texture space
|
||||
*/
|
||||
@Override
|
||||
public int getColorIntFromLightMap(int u, int v)
|
||||
public int getColorIntFromLightMap(int blockLight, int skyLight)
|
||||
{
|
||||
if (lightMap == null)
|
||||
{
|
||||
sendChatMessage("new");
|
||||
// make sure the lightMap is up-to-date
|
||||
getCurrentLightMap();
|
||||
}
|
||||
|
||||
return lightMap.getPixelRGBA(u, v);
|
||||
return lightMap.getPixelRGBA(blockLight, skyLight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Color at the given pixel coordinates
|
||||
* from the current lightmap.
|
||||
* @param u x location in texture space
|
||||
* @param v z location in texture space
|
||||
* @param blockLight x location in texture space
|
||||
* @param skyLight z location in texture space
|
||||
*/
|
||||
@Override
|
||||
public Color getColorFromLightMap(int u, int v)
|
||||
{
|
||||
return LodUtil.intToColor(lightMap.getPixelRGBA(u, v));
|
||||
public Color getColorFromLightMap(int blockLight, int skyLight) {
|
||||
if (lightMap == null) {
|
||||
// make sure the lightMap is up-to-date
|
||||
getCurrentLightMap();
|
||||
}
|
||||
|
||||
return LodUtil.intToColor(lightMap.getPixelRGBA(blockLight, skyLight));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -116,9 +116,5 @@
|
||||
"lod.config.enum.GpuUploadMethod.DATA": "Data",
|
||||
"lod.config.enum.BufferRebuildTimes.FREQUENT": "Frequent",
|
||||
"lod.config.enum.BufferRebuildTimes.NORMAL": "Normal",
|
||||
"lod.config.enum.BufferRebuildTimes.RARE": "Rare",
|
||||
"toast.lod.title": "Distant Horizons",
|
||||
"key.lod.category": "Distant Horizons",
|
||||
"key.lod.DebugToggle": "Debug toggle",
|
||||
"key.lod.DrawToggle": "Draw toggle"
|
||||
"lod.config.enum.BufferRebuildTimes.RARE": "Rare"
|
||||
}
|
||||
|
||||
+1
-1
Submodule core updated: e4e21d2dc8...5c31927d54
@@ -35,6 +35,11 @@ dependencies {
|
||||
exclude(group: "net.fabricmc.fabric-api")
|
||||
}
|
||||
|
||||
implementation("com.moandjiezana.toml:toml4j:${rootProject.toml_version}")
|
||||
shadowMe("com.moandjiezana.toml:toml4j:${rootProject.toml_version}") {
|
||||
exclude(module: "gson")
|
||||
}
|
||||
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
shadowMe(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
||||
|
||||
@@ -83,6 +88,7 @@ shadowJar {
|
||||
configurations = [project.configurations.shadowMe]
|
||||
relocate 'org.tukaani', 'shaded.tukaani'
|
||||
relocate 'org.apache.commons.compress', 'shaded.apache.commons.compress'
|
||||
relocate 'com.moandjiezana.toml', 'shaded.moandjiezana.toml'
|
||||
|
||||
classifier "dev-shadow"
|
||||
}
|
||||
|
||||
@@ -42,8 +42,6 @@ public class Main implements ClientModInitializer
|
||||
// This is a client mod so it should implement ClientModInitializer and in fabric.mod.json it should have "environment": "client"
|
||||
// Once it works on servers change the implement to ModInitializer and in fabric.mod.json it should be "environment": "*"
|
||||
|
||||
public static Main instance;
|
||||
|
||||
public static ClientProxy client_proxy;
|
||||
|
||||
|
||||
|
||||
@@ -29,6 +29,11 @@ dependencies {
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
shadowMe(project(path: ":common", configuration: "transformProductionForge")) { transitive = false }
|
||||
|
||||
implementation("com.moandjiezana.toml:toml4j:${rootProject.toml_version}")
|
||||
forgeDependencies(shadowMe("com.moandjiezana.toml:toml4j:${rootProject.toml_version}") {
|
||||
exclude(module: "gson")
|
||||
})
|
||||
|
||||
// forgeDependencies(project(":core")) { transitive false }
|
||||
|
||||
forgeDependencies('org.tukaani:xz:1.9')
|
||||
@@ -60,6 +65,7 @@ shadowJar {
|
||||
configurations = [project.configurations.shadowMe]
|
||||
relocate 'org.tukaani', 'shaded.tukaani'
|
||||
relocate 'org.apache.commons.compress', 'shaded.apache.commons.compress'
|
||||
relocate 'com.moandjiezana.toml', 'shaded.moandjiezana.toml'
|
||||
|
||||
classifier "dev-shadow"
|
||||
}
|
||||
|
||||
@@ -41,7 +41,8 @@ public class MixinOptionsScreen extends Screen {
|
||||
// Some textuary stuff
|
||||
20, ICON_TEXTURE, 20, 40,
|
||||
// Create the button and tell it where to go
|
||||
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, ModInfo.ID, "")),
|
||||
// For now it goes to the client option by default
|
||||
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, ModInfo.ID, "client")),
|
||||
// Add a title to the screen
|
||||
new TranslatableComponent("text.autoconfig." + ModInfo.ID + ".title")));
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ minecraft_version=1.17.1
|
||||
archives_base_name=DistantHorizons
|
||||
mod_version=1.5.4a
|
||||
maven_group=com.seibel.lod
|
||||
toml_version=0.7.2
|
||||
|
||||
fabric_loader_version=0.11.6
|
||||
fabric_api_version=0.37.1+1.17
|
||||
|
||||
Reference in New Issue
Block a user