Skip to content

Commit

Permalink
Add programmer art config
Browse files Browse the repository at this point in the history
  • Loading branch information
Vazkii committed Apr 5, 2024
1 parent 4b48606 commit 13b8296
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 35 deletions.
2 changes: 1 addition & 1 deletion dependencies.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
forge=47.1.3
zeta=1.0-14.70
zeta=1.0-15.72
jei=4712868
terrablender=1.20.1-3.0.0.169
flan=4819286
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package org.violetmoon.quark.base.client.handler;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

import org.violetmoon.quark.base.Quark;
import org.violetmoon.quark.base.config.QuarkGeneralConfig;
import org.violetmoon.zeta.client.event.load.ZClientSetup;
import org.violetmoon.zeta.event.bus.LoadEvent;

public class QuarkProgrammerArtHandler {

@LoadEvent
public static void onClientSetup(ZClientSetup event) {
if(QuarkGeneralConfig.generateProgrammerArt)
copyProgrammerArtIfMissing();
}

private static void copyProgrammerArtIfMissing() {
File dir = new File(".", "resourcepacks");
File target = new File(dir, "Quark Programmer Art.zip");

if(!target.exists())
try {
dir.mkdirs();
InputStream in = Quark.class.getResourceAsStream("/assets/quark/programmer_art.zip");
FileOutputStream out = new FileOutputStream(target);

byte[] buf = new byte[16384];
int len;
while((len = in.read(buf)) > 0)
out.write(buf, 0, len);

in.close();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ public class QuarkGeneralConfig {
@Config(description = "The amount of slots the chest button system should seek when trying to figure out if a container should be eligible for them.")
public static int chestButtonSlotTarget = 27;

@Config(description = "Set this to false to not generate the Quark Programmer Art resource pack")
public static boolean generateProgrammerArt = true;

private QuarkGeneralConfig() {
// NO-OP
}
Expand Down
36 changes: 2 additions & 34 deletions src/main/java/org/violetmoon/quark/base/proxy/ClientProxy.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package org.violetmoon.quark.base.proxy;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.time.LocalDateTime;
import java.time.Month;

Expand All @@ -15,20 +11,15 @@
import org.violetmoon.quark.base.client.handler.ClientUtil;
import org.violetmoon.quark.base.client.handler.InventoryButtonHandler;
import org.violetmoon.quark.base.client.handler.ModelHandler;
import org.violetmoon.quark.base.client.handler.QuarkProgrammerArtHandler;
import org.violetmoon.quark.base.handler.ContributorRewardHandler;
import org.violetmoon.quark.base.handler.WoodSetHandler;
import org.violetmoon.quark.mixin.mixins.client.accessor.AccessorMultiPlayerGameMode;
import org.violetmoon.zeta.client.TopLayerTooltipHandler;
import org.violetmoon.zeta.event.load.ZConfigChanged;
import org.violetmoon.zeta.network.message.C2SUpdateFlag;
import org.violetmoon.zeta.util.handler.RequiredModTooltipHandler;

import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.RegistryAccess;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
Expand All @@ -54,6 +45,7 @@ public void start() {
.subscribe(ModelHandler.class) //TODO: Make this especially not a singleton, move it into respective modules
.subscribe(ContributorRewardHandler.Client.class)
.subscribe(WoodSetHandler.Client.class)
.subscribe(QuarkProgrammerArtHandler.class)
.subscribe(ClientUtil.class);

Quark.ZETA.playBus
Expand All @@ -65,8 +57,6 @@ public void start() {
super.start(); //<- loads and initializes modules

ModLoadingContext.get().registerExtensionPoint(ConfigScreenFactory.class, () -> new ConfigScreenFactory((minecraft, screen) -> new QuarkConfigHomeScreen(screen)));

copyProgrammerArtIfMissing();
}

@Override
Expand Down Expand Up @@ -99,26 +89,4 @@ public float getVisualTime() {
return QuarkClient.ZETA_CLIENT.hackilyGetCurrentClientLevelRegistryAccess();
}

private static void copyProgrammerArtIfMissing() {
File dir = new File(".", "resourcepacks");
File target = new File(dir, "Quark Programmer Art.zip");

if(!target.exists())
try {
dir.mkdirs();
InputStream in = Quark.class.getResourceAsStream("/assets/quark/programmer_art.zip");
FileOutputStream out = new FileOutputStream(target);

byte[] buf = new byte[16384];
int len;
while((len = in.read(buf)) > 0)
out.write(buf, 0, len);

in.close();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}

}

0 comments on commit 13b8296

Please sign in to comment.