Merge branch 'main' of gitlab.com:jeseibel/minecraft-lod-mod
This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@ build:
|
||||
stage: build
|
||||
parallel:
|
||||
matrix:
|
||||
- MC_VER: ["1.16.5", "1.17.1", "1.18.2", "1.19.2", "1.19.4", "1.20.1"]
|
||||
- MC_VER: ["1.16.5", "1.17.1", "1.18.2", "1.19.2", "1.19.4", "1.20.1", "1.20.2"]
|
||||
script:
|
||||
# this both runs the unit tests and assembles the code
|
||||
- ./gradlew clean -PmcVer="${MC_VER}" -PgitMainBranch="${CI_COMMIT_BRANCH}" -PgitMainCommit="${CI_COMMIT_SHA}" -PgitCoreCommit="Unavailable (built by Gitlab CI)" --gradle-user-home cache/;
|
||||
|
||||
@@ -20,6 +20,13 @@ If you want to see a quick demo, check out a video covering the mod here:
|
||||
|
||||
### This branch supports the following versions of Minecraft:
|
||||
|
||||
#### 1.20.2
|
||||
Fabric: 0.14.22\
|
||||
Fabric API: 0.89.2+1.20.2\
|
||||
Forge: 48.0.13\
|
||||
Parchment: 1.19.3:2023.03.25\
|
||||
Modmenu: 8.0.0
|
||||
|
||||
#### 1.20.1, 1.20 (Default)
|
||||
Fabric: 0.14.21\
|
||||
Fabric API: 0.85.0+1.20.1\
|
||||
|
||||
+7
-1
@@ -387,12 +387,16 @@ public class ClassicConfigGUI
|
||||
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||
#endif
|
||||
{
|
||||
#if PRE_MC_1_20_2 // 1.20.2 now enables this by default in the `this.list.render` function
|
||||
this.renderBackground(matrices); // Renders background
|
||||
#else
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
#endif
|
||||
this.list.render(matrices, mouseX, mouseY, delta); // Render buttons
|
||||
|
||||
DhDrawCenteredString(matrices, font, title, width / 2, 15, 0xFFFFFF); // Render title
|
||||
|
||||
if (this.configBase.modID == "distanthorizons")
|
||||
if (this.configBase.modID.equals("distanthorizons"))
|
||||
{
|
||||
// Display version
|
||||
DhDrawString(matrices, font, TextOrLiteral(ModInfo.VERSION), 2, height - 10, 0xAAAAAA);
|
||||
@@ -439,7 +443,9 @@ public class ClassicConfigGUI
|
||||
}
|
||||
}
|
||||
}
|
||||
#if PRE_MC_1_20_2
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
@@ -72,7 +72,11 @@ public class MinecraftScreen
|
||||
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||
#endif
|
||||
{
|
||||
#if MC_1_20_2
|
||||
this.renderBackground(matrices, mouseX, mouseY, delta); // Render background
|
||||
#else
|
||||
this.renderBackground(matrices); // Render background
|
||||
#endif
|
||||
this.list.render(matrices, mouseX, mouseY, delta); // Renders the items in the render list (currently only used to tint background darker)
|
||||
|
||||
screen.mouseX = mouseX;
|
||||
|
||||
+137
-45
@@ -19,67 +19,159 @@
|
||||
|
||||
package com.seibel.distanthorizons.common.wrappers.gui;
|
||||
|
||||
/**
|
||||
* Creates a button with a texture on it (and a background) that works with all mc versions
|
||||
*
|
||||
* @author coolGi
|
||||
* @version 2023-10-03
|
||||
*/
|
||||
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.components.AbstractButton;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.components.ImageButton;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
#if PRE_MC_1_17_1
|
||||
import net.minecraft.client.Minecraft;
|
||||
#else
|
||||
#if POST_MC_1_17_1
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
#endif
|
||||
#if PRE_MC_1_20_1
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
#else
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Creates a button with a texture on it
|
||||
*/
|
||||
// TODO: Is this still needed? Can we switch to vanilla's ImageButton?
|
||||
#if PRE_MC_1_20_2
|
||||
public class TexturedButtonWidget extends ImageButton
|
||||
#else
|
||||
public class TexturedButtonWidget extends Button
|
||||
#endif
|
||||
{
|
||||
#if POST_MC_1_17_1
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
public final boolean renderBackground;
|
||||
|
||||
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);
|
||||
}
|
||||
#if POST_MC_1_20_2
|
||||
private final int u;
|
||||
private final int v;
|
||||
private final int hoveredVOffset;
|
||||
|
||||
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)
|
||||
private final ResourceLocation texture;
|
||||
|
||||
private final int textureWidth;
|
||||
private final int textureHeight;
|
||||
#endif
|
||||
|
||||
|
||||
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) {
|
||||
this(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, text, true);
|
||||
}
|
||||
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, boolean renderBackground)
|
||||
{
|
||||
#if PRE_MC_1_20_2
|
||||
super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, text);
|
||||
}
|
||||
|
||||
#if PRE_MC_1_19_2
|
||||
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)
|
||||
{
|
||||
#if PRE_MC_1_17_1
|
||||
Minecraft.getInstance().getTextureManager().bind(WIDGETS_LOCATION);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha);
|
||||
#else
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, WIDGETS_LOCATION);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, this.alpha);
|
||||
#endif
|
||||
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);
|
||||
#else
|
||||
// We don't pass on the text option as otherwise it will render (we normally pass it for narration)
|
||||
// TODO: Find a fix for it
|
||||
super(x, y, width, height, Component.empty(), pressAction, DEFAULT_NARRATION);
|
||||
|
||||
this.u = u;
|
||||
this.v = v;
|
||||
this.hoveredVOffset = hoveredVOffset;
|
||||
|
||||
this.texture = texture;
|
||||
|
||||
this.textureWidth = textureWidth;
|
||||
this.textureHeight = textureHeight;
|
||||
#endif
|
||||
|
||||
this.renderBackground = renderBackground;
|
||||
}
|
||||
|
||||
#if PRE_MC_1_20_2
|
||||
#if PRE_MC_1_19_4
|
||||
@Override
|
||||
public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) {
|
||||
if (this.renderBackground) // Renders the background of the button
|
||||
{
|
||||
#if PRE_MC_1_17_1
|
||||
Minecraft.getInstance().getTextureManager().bind(WIDGETS_LOCATION);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha);
|
||||
#else
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, WIDGETS_LOCATION);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, this.alpha);
|
||||
#endif
|
||||
|
||||
int i = this.getYImage(this.isHovered);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.enableDepthTest();
|
||||
#if PRE_MC_1_19_4
|
||||
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);
|
||||
#else
|
||||
this.blit(matrices, this.getX(), this.getY(), 0, 46 + i * 20, this.getWidth() / 2, this.getHeight());
|
||||
this.blit(matrices, this.getX() + this.getWidth() / 2, this.getY(), 200 - this.width / 2, 46 + i * 20, this.getWidth() / 2, this.getHeight());
|
||||
#endif
|
||||
}
|
||||
|
||||
super.renderButton(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
#else
|
||||
#if PRE_MC_1_20_1
|
||||
@Override
|
||||
public void renderWidget(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);
|
||||
#else
|
||||
@Override
|
||||
public void renderWidget(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||
{
|
||||
#endif
|
||||
if (this.renderBackground) // Renders the background of the button
|
||||
{
|
||||
int i = 1;
|
||||
if (!this.active) i = 0;
|
||||
else if (this.isHovered) i = 2;
|
||||
|
||||
#if PRE_MC_1_20_1
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.enableDepthTest();
|
||||
|
||||
this.blit(matrices, this.getX(), this.getY(), 0, 46 + i * 20, this.getWidth() / 2, this.getHeight());
|
||||
this.blit(matrices, this.getX() + this.getWidth() / 2, this.getY(), 200 - this.width / 2, 46 + i * 20, this.getWidth() / 2, this.getHeight());
|
||||
#else
|
||||
matrices.blit(WIDGETS_LOCATION, this.getX(), this.getY(), 0, 46 + i * 20, this.getWidth() / 2, this.getHeight());
|
||||
matrices.blit(WIDGETS_LOCATION, this.getX() + this.getWidth() / 2, this.getY(), 200 - this.width / 2, 46 + i * 20, this.getWidth() / 2, this.getHeight());
|
||||
#endif
|
||||
}
|
||||
|
||||
super.renderWidget(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
@Override
|
||||
public void renderWidget(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||
{
|
||||
if (this.renderBackground)
|
||||
{
|
||||
//RenderSystem.enableBlend();
|
||||
//RenderSystem.enableDepthTest();
|
||||
matrices.blitSprite(SPRITES.get(this.active, this.isHoveredOrFocused()), this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
||||
}
|
||||
|
||||
|
||||
// Renders the sprite
|
||||
int i = 0;
|
||||
if (!this.active) i = 2;
|
||||
else if (this.isHovered) i = 1;
|
||||
|
||||
matrices.blit(this.texture, this.getX(), this.getY(), this.u, this.v + (this.hoveredVOffset * i), this.width, this.height, this.textureWidth, this.textureHeight);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+4
@@ -150,7 +150,11 @@ public class ChangelogScreen extends DhScreen
|
||||
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||
#endif
|
||||
{
|
||||
#if MC_1_20_2
|
||||
this.renderBackground(matrices, mouseX, mouseY, delta); // Render background
|
||||
#else
|
||||
this.renderBackground(matrices); // Render background
|
||||
#endif
|
||||
if (!usable)
|
||||
return;
|
||||
|
||||
|
||||
+8
-2
@@ -77,7 +77,7 @@ public class UpdateModScreen extends DhScreen
|
||||
|
||||
|
||||
// Logo image
|
||||
this.addBtn(new ImageButton(
|
||||
this.addBtn(new TexturedButtonWidget(
|
||||
// Where the button is on the screen
|
||||
this.width / 2 - 65, this.height / 2 - 110,
|
||||
// Width and height of the button
|
||||
@@ -90,7 +90,9 @@ public class UpdateModScreen extends DhScreen
|
||||
// For now it goes to the client option by default
|
||||
(buttonWidget) -> System.out.println("Nice, you found an easter egg :)"), // TODO: Add a proper easter egg to pressing the logo (maybe with confetti)
|
||||
// Add a title to the button
|
||||
Translatable(ModInfo.ID + ".updater.title")
|
||||
Translatable(ModInfo.ID + ".updater.title"),
|
||||
// Dont render the background of the button
|
||||
false
|
||||
));
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -151,7 +153,11 @@ public class UpdateModScreen extends DhScreen
|
||||
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||
#endif
|
||||
{
|
||||
#if MC_1_20_2
|
||||
this.renderBackground(matrices, mouseX, mouseY, delta); // Render background
|
||||
#else
|
||||
this.renderBackground(matrices); // Render background
|
||||
#endif
|
||||
|
||||
|
||||
// Render the text's
|
||||
|
||||
+14
@@ -42,6 +42,9 @@ import com.mojang.math.Vector3f;
|
||||
#else
|
||||
import org.joml.Vector3f;
|
||||
#endif
|
||||
#if MC_1_20_2
|
||||
import net.minecraft.client.renderer.chunk.SectionRenderDispatcher;
|
||||
#endif
|
||||
|
||||
import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
|
||||
import com.seibel.distanthorizons.coreapi.util.math.Vec3d;
|
||||
@@ -294,6 +297,16 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
{
|
||||
try
|
||||
{
|
||||
#if MC_1_20_2
|
||||
LevelRenderer levelRenderer = MC.levelRenderer;
|
||||
Collection<SectionRenderDispatcher.RenderSection> chunks = levelRenderer.visibleSections;
|
||||
|
||||
return (chunks.stream().map((chunk) -> {
|
||||
AABB chunkBoundingBox = chunk.getBoundingBox();
|
||||
return new DhChunkPos(Math.floorDiv((int) chunkBoundingBox.minX, 16),
|
||||
Math.floorDiv((int) chunkBoundingBox.minZ, 16));
|
||||
}).collect(Collectors.toCollection(HashSet::new)));
|
||||
#else
|
||||
LevelRenderer levelRenderer = MC.levelRenderer;
|
||||
Collection<LevelRenderer.RenderChunkInfo> chunks =
|
||||
#if PRE_MC_1_18_2 levelRenderer.renderChunks;
|
||||
@@ -306,6 +319,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
return new DhChunkPos(Math.floorDiv((int) chunkBoundingBox.minX, 16),
|
||||
Math.floorDiv((int) chunkBoundingBox.minZ, 16));
|
||||
}).collect(Collectors.toCollection(HashSet::new)));
|
||||
#endif
|
||||
}
|
||||
catch (LinkageError e)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
accessWidener v1 named
|
||||
|
||||
# used when determining where to save files to
|
||||
accessible field net/minecraft/world/level/storage/DimensionDataStorage dataFolder Ljava/io/File;
|
||||
|
||||
# used when rendering
|
||||
accessible method net/minecraft/client/renderer/GameRenderer getFov (Lnet/minecraft/client/Camera;FZ)D
|
||||
|
||||
# used for grabbing vanilla rendered chunks
|
||||
accessible field net/minecraft/client/renderer/LevelRenderer visibleSections Lit/unimi/dsi/fastutil/objects/ObjectArrayList;
|
||||
|
||||
#accessible method net/minecraft/client/renderer/LevelRenderer renderSectionLayer (Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V
|
||||
|
||||
# world generation
|
||||
# accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V
|
||||
accessible field net/minecraft/world/level/chunk/LevelChunk loaded Z
|
||||
accessible field net/minecraft/world/level/lighting/LightEngine storage Lnet/minecraft/world/level/lighting/LayerLightSectionStorage;
|
||||
accessible method net/minecraft/world/level/lighting/LayerLightSectionStorage lightOnInSection (J)Z
|
||||
|
||||
# lod generation from save file
|
||||
accessible field net/minecraft/world/level/chunk/storage/ChunkStorage worker Lnet/minecraft/world/level/chunk/storage/IOWorker;
|
||||
accessible field net/minecraft/world/level/chunk/storage/IOWorker storage Lnet/minecraft/world/level/chunk/storage/RegionFileStorage;
|
||||
accessible field net/minecraft/world/level/chunk/storage/RegionFileStorage regionCache Lit/unimi/dsi/fastutil/longs/Long2ObjectLinkedOpenHashMap;
|
||||
accessible field net/minecraft/world/level/chunk/storage/RegionFileStorage folder Ljava/nio/file/Path;
|
||||
|
||||
# grabbing textures
|
||||
accessible class net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture
|
||||
accessible method net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture getFrameX (I)I
|
||||
accessible method net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture getFrameY (I)I
|
||||
accessible field net/minecraft/client/renderer/texture/SpriteContents animatedTexture Lnet/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture;
|
||||
accessible field net/minecraft/client/renderer/texture/SpriteContents originalImage Lcom/mojang/blaze3d/platform/NativeImage;
|
||||
|
||||
# UI stuff
|
||||
accessible field net/minecraft/client/gui/components/AbstractButton SPRITES Lnet/minecraft/client/gui/components/WidgetSprites;
|
||||
|
||||
# hacky stuff
|
||||
accessible field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore;
|
||||
mutable field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore;
|
||||
accessible field net/minecraft/client/gui/components/AbstractSelectionList scrollAmount D # Hack to bypass vanilla's setScrollAmount's clamp
|
||||
+1
-1
Submodule coreSubProjects updated: 94f1d99672...1a5bd288c8
+2
-2
@@ -11,13 +11,13 @@ loom {
|
||||
client()
|
||||
setConfigName("Fabric Client")
|
||||
ideConfigGenerated(true)
|
||||
runDir("run")
|
||||
runDir("../run")
|
||||
}
|
||||
server {
|
||||
server()
|
||||
setConfigName("Fabric Server")
|
||||
ideConfigGenerated(true)
|
||||
runDir("run")
|
||||
runDir("../run")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -94,11 +94,16 @@ public class MixinLevelRenderer
|
||||
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V",
|
||||
cancellable = true)
|
||||
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||
#else
|
||||
#elif PRE_MC_1_20_2
|
||||
@Inject(at = @At("HEAD"),
|
||||
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
||||
cancellable = true)
|
||||
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||
#else
|
||||
@Inject(at = @At("HEAD"),
|
||||
method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
||||
cancellable = true)
|
||||
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double camX, double camY, double camZ, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||
#endif
|
||||
{
|
||||
// FIXME completely disables rendering when sodium is installed
|
||||
|
||||
+30
-3
@@ -25,16 +25,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@Mixin(Minecraft.class)
|
||||
public class MixinMinecraft
|
||||
{
|
||||
#if PRE_MC_1_20_1
|
||||
#if PRE_MC_1_20_2
|
||||
#if MC_1_20_1
|
||||
@Redirect(
|
||||
method = "<init>(Lnet/minecraft/client/main/GameConfig;)V",
|
||||
method = "Lnet/minecraft/client/Minecraft;setInitialScreen(Lcom/mojang/realmsclient/client/RealmsClient;Lnet/minecraft/server/packs/resources/ReloadInstance;Lnet/minecraft/client/main/GameConfig$QuickPlayData;)V",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V")
|
||||
)
|
||||
public void onOpenScreen(Minecraft instance, Screen guiScreen)
|
||||
{
|
||||
#else
|
||||
@Redirect(
|
||||
method = "Lnet/minecraft/client/Minecraft;setInitialScreen(Lcom/mojang/realmsclient/client/RealmsClient;Lnet/minecraft/server/packs/resources/ReloadInstance;Lnet/minecraft/client/main/GameConfig$QuickPlayData;)V",
|
||||
method = "<init>(Lnet/minecraft/client/main/GameConfig;)V",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V")
|
||||
)
|
||||
public void onOpenScreen(Minecraft instance, Screen guiScreen)
|
||||
@@ -58,6 +59,32 @@ public class MixinMinecraft
|
||||
instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if POST_MC_1_20_2
|
||||
@Redirect(
|
||||
method = "Lnet/minecraft/client/Minecraft;onGameLoadFinished(Lnet/minecraft/client/Minecraft$GameLoadCookie;)V",
|
||||
at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V")
|
||||
)
|
||||
private void buildInitialScreens(Runnable runnable)
|
||||
{
|
||||
if (
|
||||
Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() // Don't do anything if the user doesn't want it
|
||||
&& SelfUpdater.onStart()
|
||||
)
|
||||
{
|
||||
runnable = () -> {
|
||||
Minecraft.getInstance().setScreen(new UpdateModScreen(
|
||||
// TODO: Change to runnable, instead of tittle screen
|
||||
new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons
|
||||
(Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"))
|
||||
));
|
||||
};
|
||||
}
|
||||
|
||||
runnable.run();
|
||||
}
|
||||
#endif
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "close()V")
|
||||
public void close(CallbackInfo ci) { SelfUpdater.onClose(); }
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
"schemaVersion": 1,
|
||||
"id": "distanthorizons",
|
||||
"version": "${version}",
|
||||
|
||||
"provides": [ "lod" ],
|
||||
|
||||
|
||||
"name": "${mod_name}",
|
||||
"description": "${description}",
|
||||
|
||||
+2
-2
@@ -35,14 +35,14 @@ loom {
|
||||
client()
|
||||
setConfigName("Forge Client")
|
||||
ideConfigGenerated(true)
|
||||
runDir("run")
|
||||
runDir("../run")
|
||||
vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg)
|
||||
}
|
||||
server {
|
||||
server()
|
||||
setConfigName("Forge Server")
|
||||
ideConfigGenerated(true)
|
||||
runDir("run")
|
||||
runDir("../run")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -109,11 +109,16 @@ public class MixinLevelRenderer
|
||||
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V",
|
||||
cancellable = true)
|
||||
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||
#else
|
||||
#elif PRE_MC_1_20_2
|
||||
@Inject(at = @At("HEAD"),
|
||||
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
||||
cancellable = true)
|
||||
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||
#else
|
||||
@Inject(at = @At("HEAD"),
|
||||
method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
||||
cancellable = true)
|
||||
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double camX, double camY, double camZ, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||
#endif
|
||||
{
|
||||
// get MC's model view and projection matrices
|
||||
|
||||
+30
-3
@@ -25,16 +25,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@Mixin(Minecraft.class)
|
||||
public class MixinMinecraft
|
||||
{
|
||||
#if PRE_MC_1_20
|
||||
#if PRE_MC_1_20_2
|
||||
#if MC_1_20_1
|
||||
@Redirect(
|
||||
method = "<init>(Lnet/minecraft/client/main/GameConfig;)V",
|
||||
method = "Lnet/minecraft/client/Minecraft;setInitialScreen(Lcom/mojang/realmsclient/client/RealmsClient;Lnet/minecraft/server/packs/resources/ReloadInstance;Lnet/minecraft/client/main/GameConfig$QuickPlayData;)V",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V")
|
||||
)
|
||||
public void onOpenScreen(Minecraft instance, Screen guiScreen)
|
||||
{
|
||||
#else
|
||||
@Redirect(
|
||||
method = "Lnet/minecraft/client/Minecraft;setInitialScreen(Lcom/mojang/realmsclient/client/RealmsClient;Lnet/minecraft/server/packs/resources/ReloadInstance;Lnet/minecraft/client/main/GameConfig$QuickPlayData;)V",
|
||||
method = "<init>(Lnet/minecraft/client/main/GameConfig;)V",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V")
|
||||
)
|
||||
public void onOpenScreen(Minecraft instance, Screen guiScreen)
|
||||
@@ -58,6 +59,32 @@ public class MixinMinecraft
|
||||
instance.setScreen(guiScreen); // Sets the screen back to the vanilla screen as if nothing ever happened
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if POST_MC_1_20_2
|
||||
@Redirect(
|
||||
method = "Lnet/minecraft/client/Minecraft;onGameLoadFinished(Lnet/minecraft/client/Minecraft$GameLoadCookie;)V",
|
||||
at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V")
|
||||
)
|
||||
private void buildInitialScreens(Runnable runnable)
|
||||
{
|
||||
if (
|
||||
Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() // Don't do anything if the user doesn't want it
|
||||
&& SelfUpdater.onStart()
|
||||
)
|
||||
{
|
||||
runnable = () -> {
|
||||
Minecraft.getInstance().setScreen(new UpdateModScreen(
|
||||
// TODO: Change to runnable, instead of tittle screen
|
||||
new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons
|
||||
(Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"))
|
||||
));
|
||||
};
|
||||
}
|
||||
|
||||
runnable.run();
|
||||
}
|
||||
#endif
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "close()V", remap = false)
|
||||
public void close(CallbackInfo ci)
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ mod_issues=https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues
|
||||
mod_discord=https://discord.gg/xAB8G4cENx
|
||||
|
||||
# Global Plugin Versions
|
||||
manifold_version=2023.1.26
|
||||
manifold_version=2023.1.28
|
||||
toml_version=3.6.4
|
||||
lz4_version=1.8.0
|
||||
nightconfig_version=3.6.6
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
# 1.20.2 version
|
||||
java_version=17
|
||||
minecraft_version=1.20.2
|
||||
parchment_version=1.19.3:2023.06.25
|
||||
compatible_minecraft_versions=["1.20.2"]
|
||||
accessWidenerVersion=1_20_2
|
||||
builds_for=fabric,forge
|
||||
|
||||
# Fabric loader
|
||||
fabric_loader_version=0.14.22
|
||||
fabric_api_version=0.89.2+1.20.2
|
||||
# Fabric mod versions
|
||||
modmenu_version=8.0.0
|
||||
starlight_version_fabric=
|
||||
phosphor_version_fabric=
|
||||
lithium_version=
|
||||
sodium_version=mc1.20.2-0.5.3
|
||||
iris_version=1.6.9+1.20.2
|
||||
bclib_version=3.0.13
|
||||
immersive_portals_version=
|
||||
canvas_version=
|
||||
|
||||
fabric_incompatibility_list={ }
|
||||
fabric_recommend_list={ "indium": "*" }
|
||||
|
||||
# Fabric mod run
|
||||
# 0 = Don't enable and don't run
|
||||
# 1 = Can be referenced in code but doesn't run
|
||||
# 2 = Can be referenced in code and runs in client
|
||||
enable_starlight=0
|
||||
enable_phosphor=0
|
||||
enable_sodium=1
|
||||
enable_lithium=0
|
||||
enable_iris=1
|
||||
enable_bclib=1
|
||||
enable_immersive_portals=0
|
||||
enable_canvas=0
|
||||
|
||||
# Forge loader
|
||||
forge_version=48.0.13
|
||||
# Forge mod versions
|
||||
starlight_version_forge=
|
||||
terraforged_version=
|
||||
|
||||
# Forge mod run
|
||||
# 0 = Don't enable and don't run
|
||||
# 1 = Can be referenced in code but doesn't run
|
||||
# 2 = Can be referenced in code and runs in client
|
||||
enable_starlight_forge=0
|
||||
enable_terraforged=0
|
||||
enable_terrafirmacraft=0
|
||||
Reference in New Issue
Block a user