aboutsummaryrefslogtreecommitdiff
path: root/mod/src/main/java
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2022-11-16 00:02:58 +0900
committersyeyoung <cyoung06@naver.com>2022-11-16 00:02:58 +0900
commita69263eec946558a71bee38e53f74f032c1799c2 (patch)
treead3497a68b91738da31438835ca2337e53ddb9c9 /mod/src/main/java
parent2893b632b4239dfb116dce853d07369a9fea222d (diff)
downloadSkyblock-Dungeons-Guide-a69263eec946558a71bee38e53f74f032c1799c2.tar.gz
Skyblock-Dungeons-Guide-a69263eec946558a71bee38e53f74f032c1799c2.tar.bz2
Skyblock-Dungeons-Guide-a69263eec946558a71bee38e53f74f032c1799c2.zip
- Move resources
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod/src/main/java')
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DGTexturePack.java66
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java1
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/resources/DGTexturePack.java31
3 files changed, 12 insertions, 86 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DGTexturePack.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DGTexturePack.java
deleted file mode 100644
index 78949d5f..00000000
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DGTexturePack.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.mod;
-
-import kr.syeyoung.dungeonsguide.launcher.authentication.Authenticator;
-import lombok.AllArgsConstructor;
-import net.minecraft.client.resources.IResourcePack;
-import net.minecraft.client.resources.data.IMetadataSection;
-import net.minecraft.client.resources.data.IMetadataSerializer;
-import net.minecraft.util.ResourceLocation;
-
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.Set;
-
-@AllArgsConstructor
-public class DGTexturePack implements IResourcePack {
-
- @Override
- public InputStream getInputStream(ResourceLocation location) {
- return this.getClass().getResourceAsStream("/assets/dg/"+location.getResourcePath());
- }
-
- @Override
- public boolean resourceExists(ResourceLocation location) {
- return this.getClass().getResource("/assets/dg/"+location.getResourcePath()) != null;
- }
-
- @Override
- public Set<String> getResourceDomains() {
- return Collections.singleton("dungeonsguide");
- }
-
- @Override
- public <T extends IMetadataSection> T getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException {
- return null;
- }
-
- @Override
- public BufferedImage getPackImage() throws IOException {
- return new BufferedImage(512,512, BufferedImage.TYPE_INT_RGB);
- }
-
- @Override
- public String getPackName() {
- return "Dungeons Guide Default Pack";
- }
-}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
index 408ae9d7..aee07553 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
@@ -34,6 +34,7 @@ import kr.syeyoung.dungeonsguide.mod.events.listener.FeatureListener;
import kr.syeyoung.dungeonsguide.mod.events.listener.PacketListener;
import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.mod.party.PartyManager;
+import kr.syeyoung.dungeonsguide.mod.resources.DGTexturePack;
import kr.syeyoung.dungeonsguide.mod.utils.AhUtils;
import kr.syeyoung.dungeonsguide.mod.utils.BlockCache;
import kr.syeyoung.dungeonsguide.mod.utils.TimeScoreUtil;
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/resources/DGTexturePack.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/resources/DGTexturePack.java
index 873ce17b..d23f2444 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/resources/DGTexturePack.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/resources/DGTexturePack.java
@@ -19,33 +19,34 @@
package kr.syeyoung.dungeonsguide.mod.resources;
import lombok.AllArgsConstructor;
+import net.minecraft.client.resources.AbstractResourcePack;
import net.minecraft.client.resources.IResourcePack;
import net.minecraft.client.resources.data.IMetadataSection;
import net.minecraft.client.resources.data.IMetadataSerializer;
import net.minecraft.util.ResourceLocation;
+import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.Set;
-@AllArgsConstructor
-public class DGTexturePack implements IResourcePack {
-
+public class DGTexturePack extends AbstractResourcePack {
+ public DGTexturePack() {
+ super(null);
+ }
@Override
- public InputStream getInputStream(ResourceLocation location) throws IOException {
- InputStream inputStream = this.getClass().getResourceAsStream("/assets/dg/"+location.getResourcePath());
- if (inputStream != null) return inputStream;
- return new ByteArrayInputStream(ResourceManager.getInstance().getResources().get("assets/dg/"+location.getResourcePath()));
+ protected InputStream getInputStreamByName(String name) {
+ return this.getClass().getResourceAsStream("/"+name);
}
@Override
- public boolean resourceExists(ResourceLocation location) {
- return ResourceManager.getInstance().getResources().containsKey("assets/dg/"+location.getResourcePath())
- || this.getClass().getResourceAsStream("/assets/dg/"+location.getResourcePath()) != null;
+ protected boolean hasResourceName(String name) {
+ return getInputStreamByName(name) != null;
}
@Override
@@ -54,16 +55,6 @@ public class DGTexturePack implements IResourcePack {
}
@Override
- public <T extends IMetadataSection> T getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException {
- return null;
- }
-
- @Override
- public BufferedImage getPackImage() throws IOException {
- return new BufferedImage(512,512, BufferedImage.TYPE_INT_RGB);
- }
-
- @Override
public String getPackName() {
return "Dungeons Guide Default Pack";
}