This commit is contained in:
s809
2023-07-19 12:21:35 +05:00
16 changed files with 91 additions and 133 deletions
+2
View File
@@ -22,6 +22,8 @@ hs_err_pid*
**/src/generated/
Merged/
# Folder created by the buildAll scripts
buildAllJars/
# file from notepad++
*.bak
+28 -100
View File
@@ -7,9 +7,9 @@ image: gradle:eclipse-temurin
stages:
# TODO: Make stages depending on what is in versionProperties
- build_1_18_2
- build_1_19_2
- build_1_19_4
- build_1_20_1
- build_1_19_2
- api
- pages
@@ -18,17 +18,16 @@ variables:
GIT_SUBMODULE_STRATEGY: recursive
# 1.18.2 build
build_1_18_2:
stage: build_1_18_2
# This can be extended so code is a bit less duplicated
.build_mc:
script:
# this both runs the unit tests and assembles the code
- ./gradlew clean -PmcVer="1.18.2" --gradle-user-home cache/;
- ./gradlew build -PmcVer="1.18.2" --gradle-user-home cache/;
- ./gradlew mergeJars -PmcVer="1.18.2" --gradle-user-home cache/;
- ./gradlew clean -PmcVer="${MC_VER}" --gradle-user-home cache/;
- ./gradlew build -PmcVer="${MC_VER}" --gradle-user-home cache/;
- ./gradlew mergeJars -PmcVer="${MC_VER}" --gradle-user-home cache/;
image: eclipse-temurin:17
artifacts:
name: "NightlyBuild_1_18_2-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
name: "NightlyBuild_${MC_VER}-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
paths:
- Merged/*.jar
- fabric/build/libs/*.jar
@@ -52,108 +51,37 @@ build_1_18_2:
- cache/
allow_failure: true
# 1.18.2 build
build_1_18_2:
stage: build_1_18_2
variables:
MC_VER: "1.18.2"
extends: .build_mc
# 1.19.2 build
build_1_19_2:
stage: build_1_19_2
script:
# this both runs the unit tests and assembles the code
- ./gradlew clean -PmcVer="1.19.2" --gradle-user-home cache/;
- ./gradlew build -PmcVer="1.19.2" --gradle-user-home cache/;
- ./gradlew mergeJars -PmcVer="1.19.2" --gradle-user-home cache/;
image: eclipse-temurin:17
artifacts:
name: "NightlyBuild_1_19_2-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
paths:
- Merged/*.jar
- fabric/build/libs/*.jar
- forge/build/libs/*.jar
- quilt/build/libs/*.jar
exclude:
# TODO: There is a lot of duplicate stuff here, fix it later to be smaller
- fabric/build/libs/*-all.jar
- fabric/build/libs/*-sources.jar
- forge/build/libs/*-all.jar
- forge/build/libs/*-sources.jar
- quilt/build/libs/*-all.jar
- quilt/build/libs/*-sources.jar
expire_in: 1 day
when: always
cache:
key: "gradleCache"
policy: pull-push
paths:
- .gradle
- cache/
allow_failure: true
variables:
MC_VER: "1.19.2"
extends: .build_mc
# 1.19.4 build
# 1.19.2 build
build_1_19_4:
stage: build_1_19_4
script:
# this both runs the unit tests and assembles the code
- ./gradlew clean -PmcVer="1.19.4" --gradle-user-home cache/;
- ./gradlew build -PmcVer="1.19.4" --gradle-user-home cache/;
- ./gradlew mergeJars -PmcVer="1.19.4" --gradle-user-home cache/;
image: eclipse-temurin:17
artifacts:
name: "NightlyBuild_1_19_4-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
paths:
- Merged/*.jar
- fabric/build/libs/*.jar
- forge/build/libs/*.jar
- quilt/build/libs/*.jar
exclude:
# TODO: There is a lot of duplicate stuff here, fix it later to be smaller
- fabric/build/libs/*-all.jar
- fabric/build/libs/*-sources.jar
- forge/build/libs/*-all.jar
- forge/build/libs/*-sources.jar
- quilt/build/libs/*-all.jar
- quilt/build/libs/*-sources.jar
expire_in: 1 day
when: always
cache:
key: "gradleCache"
policy: pull-push
paths:
- .gradle
- cache/
allow_failure: true
variables:
MC_VER: "1.19.4"
extends: .build_mc
# 1.20.1 build
build_1_20_1:
stage: build_1_20_1
script:
# this both runs the unit tests and assembles the code
- ./gradlew clean -PmcVer="1.20.1" --gradle-user-home cache/;
- ./gradlew build -PmcVer="1.20.1" --gradle-user-home cache/;
- ./gradlew mergeJars -PmcVer="1.20.1" --gradle-user-home cache/;
image: eclipse-temurin:17
artifacts:
name: "NightlyBuild_1_20_1-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
paths:
- Merged/*.jar
- fabric/build/libs/*.jar
- forge/build/libs/*.jar
- quilt/build/libs/*.jar
exclude:
# TODO: There is a lot of duplicate stuff here, fix it later to be smaller
- fabric/build/libs/*-all.jar
- fabric/build/libs/*-sources.jar
- forge/build/libs/*-all.jar
- forge/build/libs/*-sources.jar
- quilt/build/libs/*-all.jar
- quilt/build/libs/*-sources.jar
expire_in: 1 day
when: always
cache:
key: "gradleCache"
policy: pull-push
paths:
- .gradle
- cache/
allow_failure: true
variables:
MC_VER: "1.20.1"
extends: .build_mc
api:
+11 -5
View File
@@ -232,7 +232,7 @@ subprojects { p ->
// Netty
forgeShadowMe("io.netty:netty-all:${rootProject.netty_version}")
// Remember, for lwjgl dependancies that arent included in Minecraft, you need to also need to add it to the ShadowJar thing
// Remember, for lwjgl dependencies that arent included in Minecraft, you need to also need to add it to the ShadowJar thing
forgeShadowMe("org.lwjgl:lwjgl-jawt:3.2.2") {
exclude group: "org.lwjgl", module: "lwjgl" // This module is imported by Minecraft so exclude it
}
@@ -311,6 +311,9 @@ subprojects { p ->
// SVG
relocate "com.kitfox.svg", "${librariesLocation}.kitfox.svg"
// Netty
relocate "io.netty", "${librariesLocation}.netty"
mergeServiceFiles()
}
@@ -389,12 +392,14 @@ subprojects { p ->
// Delete un-needed files
// ==================== Delete un-needed files ====================
exclude "DistantHorizons.fabricLike.mixins.json" // This isnt required atm, but we will be using it later
// exclude "*.distanthorizons.accesswidener"
//// include "${accessWidenerVersion}.distanthorizons.accesswidener"
// Jank solution to remove all unused accesswideners
// The line above would work..., except forge requires the original accesswidener, meaning we require this jank solution
// The line above would work..., except forge requires the original accesswidener file, meaning we require this jank solution to keep it
exclude { file ->
if (file.name.contains(".distanthorizons.accesswidener") && file.name != "${accessWidenerVersion}.distanthorizons.accesswidener") {
return true
@@ -530,10 +535,11 @@ allprojects { p ->
// Set the OS lwjgl is using to the current os
project.ext.lwjglNatives = "natives-" + os.toFamilyName()
dependencies { // All of these dependancies are in Vanilla Minecraft, but we need to depend on it as we arent importing Minecraft in the core
dependencies { // All of these dependencies are in Vanilla Minecraft, but we need to depend on it as we arent importing Minecraft in the core
// Imports most of lwjgl's libraries (well, only the ones that we need)
implementation platform("org.lwjgl:lwjgl-bom:${rootProject.lwjgl_version}") // TODO: Use Minecraft's version for lwjgl_version (which changes each version) instead of a hard defined version for all versions
implementation platform("org.lwjgl:lwjgl-bom:${rootProject.lwjgl_version}") // TODO: Use Minecraft's version for lwjgl_version (which changes in nearly every version) instead of a hard defined version for all versions
// REMEMBER: Dont shadow stuff here, these are just the libs that are included in Minecraft so that the core can use
implementation "org.lwjgl:lwjgl"
implementation "org.lwjgl:lwjgl-assimp"
implementation "org.lwjgl:lwjgl-glfw"
+13 -6
View File
@@ -1,15 +1,22 @@
#!/bin/sh
echo "==================== Note: All build jars will be in the folder called 'buildAllJars' ===================="
mkdir -p buildAllJars | true
# Loop trough everything in the version properties folder
for d in versionProperties/*; do
# Get the name of the version that is going to be compiled
version=$(echo "$d" | sed "s/versionProperties\///" | sed "s/.properties//")
# Clean out the folders and build it
# Clean out the folders, build it, and merge it
# (We could use "./" to run gradlew, but as it is a shell script im going to be running it with the "sh" command)
echo "Cleaning workspace to build $version"
sh gradlew clean -PmcVer=$version --no-daemon | true
echo "Building $version"
sh gradlew build -PmcVer=$version --no-daemon | true
# The "| true" at the end of those 2 are just to make sure the script continues even if a build fails
echo "==================== Cleaning workspace to build $version ===================="
sh gradlew clean -PmcVer=$version --no-daemon || true
echo "====================Building $version ===================="
sh gradlew build -PmcVer=$version --no-daemon || true
echo "==================== Merging $version ===================="
sh gradlew mergeJars -PmcVer=$version --no-daemon || true
echo "==================== Moving jar ===================="
mv Merged/*.jar buildAllJars/ || true
# The "| true" at the end of those are just to make sure the script continues even if a build fails
done
+13 -3
View File
@@ -1,15 +1,25 @@
@echo off & setlocal enabledelayedexpansion
@rem Note for devs: If this script doesnt work, please look at the unix buildAll script
@rem This script was originally created on linux, so there may be some problems with this translation
echo ==================== Note: All build jars will be in the folder called 'buildAllJars' ====================
mkdir buildAllJars
@rem Loop trough everything in the version properties folder
for %%f in (versionProperties\*) do (
@rem Get the name of the version that is going to be compiled
set version=%%~nf
@rem Clean out the folders and build it
echo Cleaning workspace to build !version!
@rem Clean out the folders, build it, and merge it
echo ==================== Cleaning workspace to build !version! ====================
call .\gradlew.bat clean -PmcVer="!version!" --no-daemon
echo Building !version!
echo ==================== Building !version! ====================
call .\gradlew.bat build -PmcVer="!version!" --no-daemon
echo ==================== Merging !version! ====================
call .\gradlew.bat mergeJars -PmcVer="!version!" --no-daemon
echo ==================== Moving jar ====================
move Merged\*.jar buildAllJars\
)
endlocal
@@ -118,12 +118,19 @@ public class ClassicConfigGUI
Number value = 0;
((EntryInfo) info.guiValue).error = null;
if (isNumber && !stringValue.isEmpty() && !stringValue.equals("-") && !stringValue.equals(".")) {
value = func.apply(stringValue);
try {
value = func.apply(stringValue);
} catch (Exception e) {
value = null;
}
byte isValid = ((ConfigEntry) info).isValid(value);
((EntryInfo) info.guiValue).error = isValid == 0 ? null :
new AbstractMap.SimpleEntry<>(editBox, TextOrTranslatable(isValid == -1 ?
"§cMinimum " + "length" + (cast ? " is " + (int) ((ConfigEntry) info).getMin() : " is " + ((ConfigEntry) info).getMin()) :
"§cMaximum " + "length" + (cast ? " is " + (int) ((ConfigEntry) info).getMax() : " is " + ((ConfigEntry) info).getMax())));
switch (isValid) {
case 0: ((EntryInfo) info.guiValue).error = null; break;
case -1: ((EntryInfo) info.guiValue).error = new AbstractMap.SimpleEntry<>(editBox, TextOrTranslatable("§cMinimum length is " + ((ConfigEntry) info).getMin())); break;
case 1: ((EntryInfo) info.guiValue).error = new AbstractMap.SimpleEntry<>(editBox, TextOrTranslatable("§cMaximum length is " + ((ConfigEntry) info).getMax())); break;
case 2: ((EntryInfo) info.guiValue).error = new AbstractMap.SimpleEntry<>(editBox, TextOrTranslatable("§cValue is invalid")); break;
}
}
((EntryInfo) info.guiValue).tempValue = stringValue;
@@ -29,6 +29,7 @@ import net.minecraft.resources.ResourceLocation;
/**
* Creates a button with a texture on it
*/
// TODO: Is this still needed? Can we switch to vanilla's ImageButton?
public class TexturedButtonWidget extends ImageButton {
#if POST_MC_1_17_1
public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, ResourceLocation texture, OnPress pressAction) {
@@ -92,7 +92,6 @@ public class UpdateModScreen extends DhScreen {
this.addBtn( // Update
MakeBtn(Translatable(ModInfo.ID + ".updater.update"), this.width / 2 - 75, this.height / 2 + 8, 150, 20, (btn) -> {
SelfUpdater.deleteOldOnClose = true;
SelfUpdater.updateMod();
this.onClose();
})
@@ -36,6 +36,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.ISodiumAcce
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
import com.seibel.distanthorizons.fabric.wrappers.modAccessor.ImmersivePortalsAccessor;
import com.seibel.distanthorizons.fabric.wrappers.modAccessor.SodiumAccessor;
import io.netty.buffer.ByteBuf;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientChunkEvents;
@@ -235,7 +236,9 @@ public class FabricClientProxy
ClientPlayNetworking.registerGlobalReceiver(new ResourceLocation("distant_horizons", "world_control"), // TODO move these strings into a constant somewhere
(Minecraft client, ClientPacketListener handler, FriendlyByteBuf byteBuffer, PacketSender responseSender) ->
{
ClientApi.INSTANCE.serverMessageReceived(byteBuffer);
// converting to a ByteBuf is necessary otherwise Fabric will complain when the game boots
ByteBuf nettyByteBuf = byteBuffer.asByteBuf();
ClientApi.INSTANCE.serverMessageReceived(nettyByteBuf);
});
}
@@ -10,19 +10,14 @@ import com.seibel.distanthorizons.core.api.internal.ServerApi;
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerChunkEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents;
import net.fabricmc.fabric.api.networking.v1.PacketSender;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.TitleScreen;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import org.apache.logging.log4j.Logger;
+1 -1
View File
@@ -12,7 +12,7 @@ mod_readable_name=Distant Horizons
mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow.
# Note: In forge's mods.toml this is hard coded because Architectury throws an error with setting it as a varuable
mod_authors=["James Seibel", "Leonardo Amato", "Cola", "coolGi", "Ran", "Leetom"]
mod_homepage=https://www.curseforge.com/minecraft/mc-mods/distant-horizons
mod_homepage=https://modrinth.com/mod/distanthorizons
mod_source=https://gitlab.com/jeseibel/minecraft-lod-mod/
mod_issues=https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues
mod_discord=https://discord.gg/xAB8G4cENx
+1 -1
View File
@@ -1,5 +1,5 @@
# 1.18.2 version based stuff
java_version = 17
java_version=17
minecraft_version=1.18.2
parchment_version=1.18.2:2022.11.06
compatible_minecraft_versions=["1.18.2"]
+1 -1
View File
@@ -1,5 +1,5 @@
# 1.19.2 version
java_version = 17
java_version=17
minecraft_version=1.19.2
parchment_version=1.19.2:2022.11.27
compatible_minecraft_versions=["1.19.2"]
+1 -1
View File
@@ -1,5 +1,5 @@
# 1.19.4 version
java_version = 17
java_version=17
minecraft_version=1.19.4
parchment_version=1.19.3:2023.03.12
compatible_minecraft_versions=["1.19.4"]
+2 -2
View File
@@ -1,5 +1,5 @@
# 1.20.1 version
java_version = 17
java_version=17
minecraft_version=1.20.1
parchment_version=1.19.3:2023.03.12
compatible_minecraft_versions=["1.20", "1.20.1"]
@@ -8,7 +8,7 @@ builds_for=fabric,forge
# Fabric loader
fabric_loader_version=0.14.21
fabric_api_version=0.83.1+1.20.1
fabric_api_version=0.85.0+1.20.1
# Fabric mod versions
modmenu_version=7.0.1
starlight_version_fabric=