Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ on:
required: false
default: false
type: boolean
separate_forge:
description: 'If false, separate Modrinth Forge mod version will not be uploaded'
required: false
default: true
type: boolean

jobs:
deploy:
Expand Down Expand Up @@ -254,7 +259,7 @@ jobs:
- name: Upload Forge mod version to Modrinth # Forge mod version is uploaded separately atm due to it not being compatible with Minecraft 1.21.6 or above
id: upload_forge_modrinth_mod
uses: Kir-Antipov/mc-publish@v3.3
if: steps.check_mod_folder.outputs.files_exists == 'true' && github.event.inputs.dry_run == 'false'
if: steps.check_mod_folder.outputs.files_exists == 'true' && github.event.inputs.dry_run == 'false' && github.event.inputs.separate_forge == 'true'
with:
modrinth-id: 7YjclEGc
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
Expand Down
6 changes: 2 additions & 4 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
- **Added support for Minecraft 1.21.11** 🐎
- Updated rain detection to use our own `#is_dry` biome tag combo instead of the now removed `#snow_golem_melts` tag
- Removed broken hide feedback code for 1.21+
- **Added support for Minecraft 26.1x** 🐤
- Added router to handle [unobfuscated code](https://www.minecraft.net/en-us/article/removing-obfuscation-in-java-edition)
- Bumped pack format and protocol version
- Reduced non-player entity cap from 1000 to 750 ([#91](https://github.com/Tschipcraft/dynamiclights/issues/91))
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

scoreboard objectives add ts.dl.version dummy
execute store result score $global ts.dl.version run data get entity @r DataVersion
execute unless score $global tvc_ignore matches 1 if score $global ts.dl.version matches 4700.. run tellraw @a [{"text":"[Dynamic Lights] ","color":"gray"},{"text":"?","bold":true,"color":"gold"},{"text":" Future unknown Minecraft version above 1.21.11 detected! This data pack/mod may not work correctly anymore! Please make sure to check for updates in the menu! (","color":"gold"},{"text":"/trigger tschipcraft.menu","underlined":true,"color":"gold","click_event":{"action":"run_command","command":"trigger tschipcraft.menu"},"hover_event":{"action":"show_text","value":"Click here","text":"Click here"}},{"text":")","color":"gold"}]
execute unless score $global tvc_ignore matches 1 if score $global ts.dl.version matches 4800.. run tellraw @a [{"text":"[Dynamic Lights] ","color":"gray"},{"text":"?","bold":true,"color":"gold"},{"text":" Future unknown Minecraft version above 26.1 detected! This data pack/mod may not work correctly anymore! Please make sure to check for updates in the menu! (","color":"gold"},{"text":"/trigger tschipcraft.menu","underlined":true,"color":"gold","click_event":{"action":"run_command","command":"trigger tschipcraft.menu"},"hover_event":{"action":"show_text","value":"Click here","text":"Click here"}},{"text":")","color":"gold"}]
# Note: 1.17x-1.20x uses the old folder names (function -> functions)

# Announce escape sequence handling changes
Expand Down
1 change: 0 additions & 1 deletion fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
},
"depends": {
"minecraft": "${mc_version_range_fabric}",
"fabric": ">=0.34.0",
"java": ">=8"
},
"recommends": {
Expand Down
Binary file modified net/tschipcraft/dynamiclights/fabric/Init.class
Binary file not shown.
Binary file modified net/tschipcraft/dynamiclights/fabric/sendConfig.class
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions pack.mcmeta
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"id": "dynamiclights",
"pack": {
"pack_format": 15,
"supported_formats": [7,94],
"supported_formats": [7,101],
"min_format": 7,
"max_format": 94,
"max_format": 101,
"description": "Tschipcraft's Dynamic Lights \n└ v${version} ● mc${mc_human_version_range}"
},
"overlays": {
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/net/tschipcraft/dynamiclights/fabric/Init.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ public void onInitialize() {
if (FabricLoader.getInstance().isModLoaded("midnightlib")) {
// Use MidnightLib features
LOGGER.info("[Dynamic Lights] Sending global config to world ...");
sendConfig.sendConfig(server);
try {
// Check for obfuscated class name to determine if we're running a pre 26.1 version
Class.forName("net.minecraft.class_2168");
sendConfigObf.sendConfig(server);
} catch (ClassNotFoundException e) {
sendConfig.sendConfig(server);
}
}
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package net.tschipcraft.dynamiclights.fabric;

import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.command.ServerCommandSource;

public class sendConfig {

Expand Down Expand Up @@ -118,9 +118,9 @@ public static void sendConfig(MinecraftServer server) {
}

public static void sendCommand(String command, MinecraftServer server) {
ServerCommandSource commandSource = server.getCommandSource();
CommandSourceStack commandSource = server.createCommandSourceStack();
try {
server.getCommandManager().getDispatcher().execute(command, commandSource);
server.getCommands().getDispatcher().execute(command, commandSource);
} catch (CommandSyntaxException ignored) {
}
}
Expand Down
128 changes: 128 additions & 0 deletions src/main/java/net/tschipcraft/dynamiclights/fabric/sendConfigObf.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
package net.tschipcraft.dynamiclights.fabric;

import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.command.ServerCommandSource;

public class sendConfigObf {

public static void sendConfig(MinecraftServer server) {
sendCommand("scoreboard objectives add ts.dl.settings dummy", server);
if (Config.enable == Config.bool.YES) {
sendCommand("scoreboard players set $enable ts.dl.settings 2", server);
} else if (Config.enable == Config.bool.NO) {
sendCommand("scoreboard players set $enable ts.dl.settings -1", server);
} else {
sendCommand("execute if score $enable ts.dl.settings matches -1 run scoreboard players set $enable ts.dl.settings 0", server);
sendCommand("execute if score $enable ts.dl.settings matches 2 run scoreboard players set $enable ts.dl.settings 1", server);
}

if (Config.enable_on_fire == Config.bool.YES) {
sendCommand("scoreboard players set $enable_on_fire ts.dl.settings 2", server);
} else if (Config.enable_on_fire == Config.bool.NO) {
sendCommand("scoreboard players set $enable_on_fire ts.dl.settings -1", server);
} else {
sendCommand("execute if score $enable_on_fire ts.dl.settings matches -1 run scoreboard players set $enable_on_fire ts.dl.settings 0", server);
sendCommand("execute if score $enable_on_fire ts.dl.settings matches 2 run scoreboard players set $enable_on_fire ts.dl.settings 1", server);
}

if (Config.enable_glowing == Config.bool.YES) {
sendCommand("scoreboard players set $enable_glowing ts.dl.settings 2", server);
} else if (Config.enable_glowing == Config.bool.NO) {
sendCommand("scoreboard players set $enable_glowing ts.dl.settings -1", server);
} else {
sendCommand("execute if score $enable_glowing ts.dl.settings matches -1 run scoreboard players set $enable_glowing ts.dl.settings 0", server);
sendCommand("execute if score $enable_glowing ts.dl.settings matches 2 run scoreboard players set $enable_glowing ts.dl.settings 1", server);
}

if (Config.enable_ghast == Config.bool.YES) {
sendCommand("scoreboard players set $enable_ghast ts.dl.settings 2", server);
} else if (Config.enable_ghast == Config.bool.NO) {
sendCommand("scoreboard players set $enable_ghast ts.dl.settings -1", server);
} else {
sendCommand("execute if score $enable_ghast ts.dl.settings matches -1 run scoreboard players set $enable_ghast ts.dl.settings 0", server);
sendCommand("execute if score $enable_ghast ts.dl.settings matches 2 run scoreboard players set $enable_ghast ts.dl.settings 1", server);
}

if (Config.enable_enchanted_items == Config.bool.YES) {
sendCommand("scoreboard players set $enchanted_items ts.dl.settings 2", server);
} else if (Config.enable_enchanted_items == Config.bool.NO) {
sendCommand("scoreboard players set $enchanted_items ts.dl.settings -1", server);
} else {
sendCommand("execute if score $enchanted_items ts.dl.settings matches -1 run scoreboard players set $enchanted_items ts.dl.settings 0", server);
sendCommand("execute if score $enchanted_items ts.dl.settings matches 2 run scoreboard players set $enchanted_items ts.dl.settings 1", server);
}

if (Config.enable_amethyst_trimmed == Config.bool.YES) {
sendCommand("scoreboard players set $amethyst_trimmed ts.dl.settings 2", server);
} else if (Config.enable_amethyst_trimmed == Config.bool.NO) {
sendCommand("scoreboard players set $amethyst_trimmed ts.dl.settings -1", server);
} else {
sendCommand("execute if score $amethyst_trimmed ts.dl.settings matches -1 run scoreboard players set $amethyst_trimmed ts.dl.settings 0", server);
sendCommand("execute if score $amethyst_trimmed ts.dl.settings matches 2 run scoreboard players set $amethyst_trimmed ts.dl.settings 1", server);
}

if (Config.enable_fire_aspect == Config.bool.YES) {
sendCommand("scoreboard players set $fire_aspect ts.dl.settings 2", server);
} else if (Config.enable_fire_aspect == Config.bool.NO) {
sendCommand("scoreboard players set $fire_aspect ts.dl.settings -1", server);
} else {
sendCommand("execute if score $fire_aspect ts.dl.settings matches -1 run scoreboard players set $fire_aspect ts.dl.settings 0", server);
sendCommand("execute if score $fire_aspect ts.dl.settings matches 2 run scoreboard players set $fire_aspect ts.dl.settings 1", server);
}

if (Config.enable_riptide == Config.bool.YES) {
sendCommand("scoreboard players set $riptide ts.dl.settings 2", server);
} else if (Config.enable_riptide == Config.bool.NO) {
sendCommand("scoreboard players set $riptide ts.dl.settings -1", server);
} else {
sendCommand("execute if score $riptide ts.dl.settings matches -1 run scoreboard players set $riptide ts.dl.settings 0", server);
sendCommand("execute if score $riptide ts.dl.settings matches 2 run scoreboard players set $riptide ts.dl.settings 1", server);
}

if (Config.enable_channeling == Config.bool.YES) {
sendCommand("scoreboard players set $channeling ts.dl.settings 2", server);
} else if (Config.enable_channeling == Config.bool.NO) {
sendCommand("scoreboard players set $channeling ts.dl.settings -1", server);
} else {
sendCommand("execute if score $channeling ts.dl.settings matches -1 run scoreboard players set $channeling ts.dl.settings 0", server);
sendCommand("execute if score $channeling ts.dl.settings matches 2 run scoreboard players set $channeling ts.dl.settings 1", server);
}

if (Config.enable_water_sensitive == Config.bool.YES) {
sendCommand("scoreboard players set $water_sensitive ts.dl.settings 2", server);
} else if (Config.enable_water_sensitive == Config.bool.NO) {
sendCommand("scoreboard players set $water_sensitive ts.dl.settings -1", server);
} else {
sendCommand("execute if score $water_sensitive ts.dl.settings matches -1 run scoreboard players set $water_sensitive ts.dl.settings 0", server);
sendCommand("execute if score $water_sensitive ts.dl.settings matches 2 run scoreboard players set $water_sensitive ts.dl.settings 1", server);
}

if (Config.enable_sound == Config.bool.YES) {
sendCommand("scoreboard players set $enable_sound ts.dl.settings 2", server);
} else if (Config.enable_sound == Config.bool.NO) {
sendCommand("scoreboard players set $enable_sound ts.dl.settings -1", server);
} else {
sendCommand("execute if score $enable_sound ts.dl.settings matches -1 run scoreboard players set $enable_sound ts.dl.settings 0", server);
sendCommand("execute if score $enable_sound ts.dl.settings matches 2 run scoreboard players set $enable_sound ts.dl.settings 1", server);
}

if (Config.enable_rain_sensitive == Config.bool.YES) {
sendCommand("scoreboard players set $rain_sensitive ts.dl.settings 2", server);
} else if (Config.enable_rain_sensitive == Config.bool.NO) {
sendCommand("scoreboard players set $rain_sensitive ts.dl.settings -1", server);
} else {
sendCommand("execute if score $rain_sensitive ts.dl.settings matches -1 run scoreboard players set $rain_sensitive ts.dl.settings 0", server);
sendCommand("execute if score $rain_sensitive ts.dl.settings matches 2 run scoreboard players set $rain_sensitive ts.dl.settings 1", server);
}
}

public static void sendCommand(String command, MinecraftServer server) {
ServerCommandSource commandSource = server.getCommandSource();
try {
server.getCommandManager().getDispatcher().execute(command, commandSource);
} catch (CommandSyntaxException ignored) {
}
}

}