Skip to content

Commit

Permalink
Begin 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EnnuiL committed Oct 23, 2024
1 parent 7e7213f commit ff04c47
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 29 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
java-version: '21'
- name: Build with Gradle
run: gradle build
- name: Detonate JARs
run: python ./ci/hissboom.py "./build/libs/*.jar"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ group = project.maven_group

repositories {
maven { url 'https://maven.terraformersmc.com/releases/' }
maven { url 'https://www.jitpack.io' }
maven { url 'https://maven.uuid.gg/releases' }
}

loom {
Expand Down Expand Up @@ -38,7 +38,7 @@ dependencies {
modImplementation(libs.mod.menu) {
transitive = false
}
modImplementation libs.wrench.wrapper
modCompileOnly libs.wrench.wrapper

implementation libs.quilt.parsers.json
shadow(libs.quilt.parsers.json) {
Expand Down
35 changes: 35 additions & 0 deletions ci/hissboom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright © 2024 Ennui Langeweile, All rights reserved.
#
# ..It ain't rocket science though, expect this to be open-sourced somewhere else

from typing import IO
import argparse
import glob
import tempfile
import zipfile

def hissboomify_zip(origin: IO[bytes], target: IO[bytes], is_jij: bool):
zip = zipfile.ZipFile(file=origin, mode="r")
new_zip = zipfile.ZipFile(file=target, mode="w", compression=zipfile.ZIP_DEFLATED, compresslevel=0 if is_jij else 9, allowZip64=False)
for file in zip.filelist:
if file.is_dir():
new_zip.mkdir(file.filename)
else:
data = zip.open(file.filename)
if file.filename.endswith(".jar"):
hissboomify_zip(data, new_zip.open(file.filename, "w"), True)
else:
new_zip.open(file.filename, "w").write(data.read())
zip.close()

parser = argparse.ArgumentParser()
parser.add_argument("path", help="The path of the files you want to detonate")
args = parser.parse_args()

for path in glob.glob(args.path):
input = open(file=path, mode="r+b").read()
input_temp = tempfile.TemporaryFile()
input_temp.write(input)

output = open(file=path, mode="w+b")
hissboomify_zip(input_temp, output, False)
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs = -Xmx1G
org.gradle.parallel = true

# Mod Properties
version = 1.1.0
version = 1.2.0
maven_group = io.github.ennuil
archives_base_name = boring_default_game_rules

Expand Down
16 changes: 8 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# The latest versions are available at https://quiltmc.org/en/usage/latest-versions
[versions]
minecraft = "1.20.6"
quilt_mappings = "1.20.6+build.6"
minecraft = "1.21.1"
quilt_mappings = "1.21.1+build.3"

quilt_loom = "1.6.8"
quilt_loader = "0.26.0"
quilt_loom = "1.8.4"
quilt_loader = "0.27.0-beta.1"
shadow = "8.1.7"

fabric_api = "0.100.0+1.20.6"
mod_menu = "10.0.0-beta.1"
fabric_api = "0.106.0+1.21.1"
mod_menu = "11.0.3"
quilt_parsers_json = "0.3.0"
wrench_wrapper = "a29721e25d" # 0.1.0+1.20.4
wrench_wrapper = "0.5.0"

[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
Expand All @@ -20,7 +20,7 @@ quilt_loader = { module = "org.quiltmc:quilt-loader", version.ref = "quilt_loade
quilted_fabric_api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric_api" }
mod_menu = { module = "com.terraformersmc:modmenu", version.ref = "mod_menu" }
quilt_parsers_json = { module = "org.quiltmc.parsers:json", version.ref = "quilt_parsers_json" }
wrench_wrapper = { module = "com.github.Up-Mods:wrench_wrapper", version.ref = "wrench_wrapper" }
wrench_wrapper = { module = "io.github.ennuil:wrench_wrapper", version.ref = "wrench_wrapper" }

[plugins]
quilt_loom = { id = "org.quiltmc.loom", version.ref = "quilt_loom" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
public class ModConfigManager {
public static final String GENERATE_ME = "GENERATE_ME";
public static final String GENERATE_ME_MAYBE = "GENERATE_ME_MAYBE";
public static final String SCHEMA_FILE_NAME = "config.schema.json";
public static final Path SCHEMA_DIRECTORY_PATH = WrenchWrapper.getConfigDir().resolve("boring_default_game_rules");
public static final Path SCHEMA_PATH = SCHEMA_DIRECTORY_PATH.resolve("config.schema.json");
public static final Path SCHEMA_PATH = SCHEMA_DIRECTORY_PATH.resolve(SCHEMA_FILE_NAME);
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();

public static final ModConfig CONFIG = WrenchWrapper.create("boring_default_game_rules", "config", ModConfig.class);
Expand Down Expand Up @@ -82,8 +83,8 @@ public static void prepareSchema(boolean client) {
}

switch (CONFIG.schema.value()) {
case GENERATE_ME -> CONFIG.schema.setValue(SCHEMA_PATH.toUri().toString(), false);
case GENERATE_ME_MAYBE -> CONFIG.schema.setValue(CONFIG.generateJsonSchema.value() ? SCHEMA_PATH.toUri().toString() : "", false);
case GENERATE_ME -> CONFIG.schema.setValue(SCHEMA_FILE_NAME, false);
case GENERATE_ME_MAYBE -> CONFIG.schema.setValue(CONFIG.generateJsonSchema.value() ? SCHEMA_FILE_NAME : "", false);
}

if (generateNewSchema) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.ennuil.boring_default_game_rules.mixin.client;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import io.github.ennuil.boring_default_game_rules.config.ModConfigManager;
import io.github.ennuil.boring_default_game_rules.screen.EditDefaultGameRulesScreen;
import net.minecraft.client.gui.Element;
Expand Down Expand Up @@ -29,12 +30,7 @@ private EditGameRulesScreenMixin(Text text) {
}

@Shadow
private EditGameRulesScreen.GameRuleElementListWidget field_49903;

@Shadow
@Final
@Mutable
private GameRules gameRules;
public EditGameRulesScreen.GameRuleElementListWidget rulesList;

@Shadow
@Final
Expand All @@ -44,11 +40,11 @@ private EditGameRulesScreenMixin(Text text) {
private void addEditDefaultsButton(CallbackInfo ci) {
// Don't let the button appear on screens that extends this screen
if (((EditGameRulesScreen) (Object) this).getClass() == EditGameRulesScreen.class) {
this.field_49903.children().add(new EditDefaultsButtonWidget());
this.rulesList.children().add(new EditDefaultsButtonWidget());
}
}

@ModifyArg(method = "init()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/layout/HeaderFooterLayoutWidget;method_57726(Lnet/minecraft/text/Text;Lnet/minecraft/client/font/TextRenderer;)V"))
@ModifyExpressionValue(method = "init()V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/world/EditGameRulesScreen;TITLE:Lnet/minecraft/text/Text;"))
private Text modifyTitle(Text original) {
return this.title;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.minecraft.text.Text;
import net.minecraft.world.GameRules;

// By having a fake screen, the screen caching, which is undesirable for us, is busted. Thanks for the code, ARRFAB!
// By having a fake screen, the screen caching, which is undesirable for us, is busted.
public class ModMenuFakeScreen extends Screen {
private final Screen parent;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public EditDefaultGameRulesScreen(GameRules gameRules, Consumer<Optional<GameRul
protected void init() {
super.init();
var button = new ResetButtonWidget();
EditDefaultGameRulesScreen.this.field_49903.children().add(button);
EditDefaultGameRulesScreen.this.rulesList.children().add(button);
}

public class ResetButtonWidget extends EditGameRulesScreen.AbstractEntry {
Expand All @@ -38,11 +38,11 @@ public ResetButtonWidget() {
this.resetButton = ButtonWidget.builder(
Text.translatable("boring_default_game_rules.edit_default_game_rules.reset_defaults"),
button -> {
double scrollAmount = EditDefaultGameRulesScreen.this.field_49903.getScrollAmount();
double scrollAmount = EditDefaultGameRulesScreen.this.rulesList.getScrollAmount();
ModConfigManager.resetDefaults();
EditDefaultGameRulesScreen.this.gameRules = new GameRules();
EditDefaultGameRulesScreen.this.repositionElements();
EditDefaultGameRulesScreen.this.field_49903.setScrollAmount(scrollAmount);
EditDefaultGameRulesScreen.this.rulesList.setScrollAmount(scrollAmount);
}
).position(10, 5)
.size(150, 20)
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/boring_default_game_rules.accesswidener
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
accessWidener v2 named

accessible field net/minecraft/client/gui/screen/world/EditGameRulesScreen field_49903 Lnet/minecraft/client/gui/screen/world/EditGameRulesScreen$GameRuleElementListWidget;
accessible field net/minecraft/client/gui/screen/world/EditGameRulesScreen rulesList Lnet/minecraft/client/gui/screen/world/EditGameRulesScreen$GameRuleElementListWidget;
accessible field net/minecraft/client/gui/screen/world/EditGameRulesScreen gameRules Lnet/minecraft/world/GameRules;
accessible field net/minecraft/client/gui/screen/Screen title Lnet/minecraft/text/Text;
accessible field net/minecraft/world/GameRules GAME_RULE_TYPES Ljava/util/Map;
Expand Down

0 comments on commit ff04c47

Please sign in to comment.