Skip to content

Commit

Permalink
Add new dark vault screen packs, new option for disabling chat button…
Browse files Browse the repository at this point in the history
…s, remove dark vault config
  • Loading branch information
triphora committed Feb 11, 2022
1 parent 2837551 commit 8d05e67
Show file tree
Hide file tree
Showing 18 changed files with 97 additions and 34 deletions.
19 changes: 2 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id "architectury-plugin" version "3.4.+"
id "dev.architectury.loom" version "0.11.0.+" apply false
id "com.modrinth.minotaur" version "1.2.+"
id "com.modrinth.minotaur" version "1.2.+" apply false
id "io.github.juuxel.loom-quiltflower" version "1.+" apply false
}

Expand All @@ -13,6 +13,7 @@ subprojects {
apply plugin: "dev.architectury.loom"
apply from: rootProject.file("setupAuth.gradle")
apply plugin: "io.github.juuxel.loom-quiltflower"
apply plugin: "com.modrinth.minotaur"

repositories {
maven {
Expand Down Expand Up @@ -55,22 +56,6 @@ allprojects {

jar { from "LICENSE" }

//noinspection UnnecessaryQualifiedReference
task modrinth(type: com.modrinth.minotaur.TaskModrinthUpload) {
final String loader = project.name
onlyIf { System.getenv().MODRINTH_TOKEN }
detectLoaders = false
token = System.getenv().MODRINTH_TOKEN
projectId = "QYTT62S0"
versionNumber = mod_version + "+" + loader
versionName = "${rootProject.release_title} (${loader.substring(0, 1).toUpperCase() + loader.substring(1)})"
changelog = rootProject.changeLog
uploadFile = project.file("build/libs/${rootProject.archivesBaseName}-${rootProject.version}.jar")
versionType = "beta"
addGameVersion(mc_version)
addLoader(loader)
}

publishing {
repositories {
maven {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class ChatChannels {
private static final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;

public static void handleChatScreenRender(Screen screen, MatrixStack matrices) {
if (Util.isOnEMC) {
if (Util.isOnEMC && Config.chatButtonsEnabled()) {
for (ChatChannel channel : ChatChannel.values()) {
if (channel == ChatChannel.SUPPORTER && Util.getPlayerGroupId() < 2) break;
if (channel == ChatChannel.MODERATOR && Util.getPlayerGroupId() < 5) break;
Expand All @@ -40,7 +40,7 @@ public static void handleChatScreenRender(Screen screen, MatrixStack matrices) {
}

public static void handleChatScreenMouseClicked(Screen screen, double mouseX, double mouseY) {
if (Util.isOnEMC) {
if (Util.isOnEMC && Config.chatButtonsEnabled()) {
for (ChatChannel channel : ChatChannel.values()) {
if (channel == ChatChannel.SUPPORTER && Util.getPlayerGroupId() < 2) break;
if (channel == ChatChannel.MODERATOR && Util.getPlayerGroupId() < 5) break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@
@SuppressWarnings("SpellCheckingInspection")
public class VaultScreen extends HandledScreen<VaultScreenHandler> implements ScreenHandlerProvider<VaultScreenHandler> {
public static final RegistrySupplier<ScreenHandlerType<VaultScreenHandler>> GENERIC_9X7;
private static final Identifier TEXTURE = new Identifier(MODID, Config.darkVaultScreen() ?
"textures/gui/container/generic_63_dark.png" :
"textures/gui/container/generic_63.png");
private static final Identifier TEXTURE = new Identifier(MODID, "textures/gui/container/generic_63.png");
private final int vaultPage;
private final int[] slotOffsets = {8, 26, 44, 62, 80, 98, 116, 134, 152};
private boolean shouldCallClose = true;
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/dev/frydae/emcutils/utils/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@SuppressWarnings("unused")
public class Config {
@ExpectPlatform
public static boolean darkVaultScreen() {
public static boolean chatButtonsEnabled() {
throw new AssertionError("ExpectPlatform didn't apply!");
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"pack": {
"pack_format": 8,
"description": "emcutils - Dark vault (Dark UI 32x style)"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"pack": {
"pack_format": 8,
"description": "emcutils - Dark vault (Vanilla Tweaks style)"
}
}
16 changes: 15 additions & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies {
exclude group: "net.fabricmc"
}

modRuntimeOnly "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_version}"

modApi("dev.architectury:architectury-fabric:${rootProject.architectury_version}") {
exclude group: "net.fabricmc.fabric-api"
Expand Down Expand Up @@ -89,6 +89,20 @@ components.java {
}
}

//noinspection UnnecessaryQualifiedReference
task modrinth(type: com.modrinth.minotaur.TaskModrinthUpload) {
onlyIf { System.getenv().MODRINTH_TOKEN }
token = System.getenv().MODRINTH_TOKEN
projectId = "QYTT62S0"
versionNumber = mod_version + "+fabric"
versionName = rootProject.release_title + " (Fabric)"
changelog = rootProject.changeLog
uploadFile = remapJar
versionType = "beta"
addGameVersion(mc_version)
addLoader("fabric")
}

publishing {
publications {
mavenJavaFabric(MavenPublication) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
import eu.midnightdust.lib.config.MidnightConfig;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.util.Identifier;

import static dev.frydae.emcutils.utils.Util.LOG;
import static dev.frydae.emcutils.utils.Util.MODID;
import static net.fabricmc.fabric.api.resource.ResourceManagerHelper.registerBuiltinResourcePack;
import static net.fabricmc.fabric.api.resource.ResourcePackActivationType.NORMAL;

public class EmpireMinecraftUtilitiesImpl implements ClientModInitializer {
public static final boolean hasVoxelMap = FabricLoader.getInstance().isModLoaded("voxelmap");
Expand All @@ -23,6 +26,12 @@ public class EmpireMinecraftUtilitiesImpl implements ClientModInitializer {
public void onInitializeClient() {
MidnightConfig.init(MODID, FabricConfig.class);

// These don't work in dev for whatever reason, but work in prod
FabricLoader.getInstance().getModContainer(MODID).ifPresent(container ->
registerBuiltinResourcePack(id("dark-ui-vault"), container, NORMAL));
FabricLoader.getInstance().getModContainer(MODID).ifPresent(container ->
registerBuiltinResourcePack(id("vt-dark-vault"), container, NORMAL));

Util.runResidenceCollector();

VaultScreen.initStatic();
Expand All @@ -43,4 +52,8 @@ public static void onPostJoinEmpireMinecraft() {
if (hasVoxelMap || hasXaeroMap) Tasks.runTasks(new GetLocationTask());
if (hasVoxelMap) Tasks.runTasks(new VoxelMapIntegration());
}

private static Identifier id(String id) {
return new Identifier(MODID, id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import dev.frydae.emcutils.utils.Config.TabListSortType;

public class ConfigImpl {
public static boolean darkVaultScreen() {
return FabricConfig.darkVaultScreen;
public static boolean chatButtonsEnabled() {
return FabricConfig.chatButtonsEnabled;
}

public static boolean tabListShowAllServers() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import eu.midnightdust.lib.config.MidnightConfig;

public class FabricConfig extends MidnightConfig {
@Entry public static boolean darkVaultScreen = false;
@Entry public static boolean chatButtonsEnabled = true;
@Entry public static boolean tabListShowAllServers = true;
@Entry public static TabListSortType tabListSortType = TabListSortType.SERVER_ASCENDING;
@Entry public static TabListCurrentServerPlacement tabListCurrentServerPlacement = TabListCurrentServerPlacement.TOP;
Expand Down
14 changes: 14 additions & 0 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@ components.java {
}
}

//noinspection UnnecessaryQualifiedReference
task modrinth(type: com.modrinth.minotaur.TaskModrinthUpload) {
onlyIf { System.getenv().MODRINTH_TOKEN }
token = System.getenv().MODRINTH_TOKEN
projectId = "QYTT62S0"
versionNumber = mod_version + "+forge"
versionName = rootProject.release_title + " (Forge)"
changelog = rootProject.changeLog
uploadFile = remapJar
versionType = "beta"
addGameVersion(mc_version)
addLoader("forge")
}

publishing {
publications {
mavenJavaForge(MavenPublication) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

import java.io.IOException;
import java.io.InputStream;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.nio.file.Paths;

import static dev.frydae.emcutils.utils.Util.LOG;
import static dev.frydae.emcutils.utils.Util.MODID;

Expand All @@ -27,6 +33,8 @@ public EmpireMinecraftUtilitiesImpl() {

ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, ForgeConfig.SPEC);

movePacks("vt-dark-vault");

DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> EmpireMinecraftUtilities::initClient);

ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () ->
Expand All @@ -39,6 +47,25 @@ public static void onPostJoinEmpireMinecraft() {
EmpireMinecraftUtilities.onPostJoinEmpireMinecraftCommon();
}

private static void movePacks(String... packs) {
try {
Files.createDirectories(Paths.get("resourcepacks"));
} catch (FileAlreadyExistsException ignored) {
} catch (IOException e) {
LOG.warn("Could not create resource packs folder");
return;
}

for (String pack : packs) {
try (InputStream packZip = EmpireMinecraftUtilitiesImpl.class.getResourceAsStream("/resourcepacks/" + pack + ".zip")) {
Files.copy(packZip, Paths.get("resourcepacks/" + pack + ".zip")); // This works in prod but not dev
} catch (FileAlreadyExistsException ignored) {
} catch (IOException | NullPointerException e) {
e.printStackTrace();
}
}
}

@SubscribeEvent
public static void event(FMLClientSetupEvent event) {
MenuRegistry.registerScreenFactory(VaultScreen.GENERIC_9X7.get(), VaultScreen::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

public class ForgeConfig {
public static final ForgeConfigSpec SPEC;
public static BooleanValue darkVaultScreen;
public static BooleanValue chatButtonsEnabled;
public static BooleanValue tabListShowAllServers;
public static EnumValue<TabListSortType> tabListSortType;
public static EnumValue<TabListCurrentServerPlacement> tabListCurrentServerPlacement;
Expand All @@ -36,8 +36,8 @@ public class ForgeConfig {
.defineEnum("chatAlertSound", ChatAlertSound.LEVEL_UP);
builder.pop();
builder.push("misc").comment("Miscellaneous Settings");
darkVaultScreen = builder.comment("Dark vault screen (requires restart)")
.define("darkVaultScreen", false);
chatButtonsEnabled = builder.comment("Whether chat buttons are enabled")
.define("chatButtonsEnabled", true);
dontRunResidenceCollector = builder.comment("Don't run residence collector")
.define("dontRunResidenceCollector", false);
builder.pop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import dev.frydae.emcutils.utils.Config.TabListSortType;

public class ConfigImpl {
public static boolean darkVaultScreen() {
return ForgeConfig.darkVaultScreen.get();
public static boolean chatButtonsEnabled() {
return ForgeConfig.chatButtonsEnabled.get();
}

public static boolean tabListShowAllServers() {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ mc_version=1.18.1
mod_version=3.0.0-beta.1

release_title=Change target to 1.18.1
changeLog=Re-add VoxelMap support on Fabric, new config system on Forge
changeLog=Re-add VoxelMap support on Fabric, new config system on Forge, new dark vault screen packs, new option for disabling chat buttons

# https://fabricmc.net/develop
yarn_mappings=22
loader_version=0.13.1
fabric_version=0.46.4+1.18

# https://files.minecraftforge.net/
forge_version=39.0.66
forge_version=39.0.75

# https://maven.shedaniel.me/dev/architectury/architectury/
architectury_version=3.6.17
Expand Down

0 comments on commit 8d05e67

Please sign in to comment.