Fix resource packs
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 8.0 KiB |
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 8.0 KiB |
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
|
@ -1 +0,0 @@
|
|||
.
|
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 8.0 KiB |
|
@ -1 +0,0 @@
|
|||
This is a test file, it does nothing, I'm just trying to get CustomSky's to work with Resource Packs...
|
48805
javascript/classes.js
|
@ -6,6 +6,7 @@ import java.lang.reflect.Array;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import net.PeytonPlayz585.shadow.reflections.Reflector;
|
||||
|
@ -24,6 +25,8 @@ import net.minecraft.client.settings.GameSettings;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.resources.ResourcePackRepository.Entry;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.vfs.SYS;
|
||||
|
||||
public class Config {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
@ -432,17 +435,13 @@ public class Config {
|
|||
}
|
||||
|
||||
public static boolean hasResource(ResourceLocation p_hasResource_0_) {
|
||||
IResourcePack iresourcepack = getDefiningResourcePack(p_hasResource_0_);
|
||||
return iresourcepack != null;
|
||||
}
|
||||
|
||||
public static boolean hasResource(IResourceManager p_hasResource_0_, ResourceLocation p_hasResource_1_) {
|
||||
try {
|
||||
IResource iresource = p_hasResource_0_.getResource(p_hasResource_1_);
|
||||
return iresource != null;
|
||||
} catch (IOException var3) {
|
||||
return false;
|
||||
for (IResourcePack resourcePack : getResourcePacks()) {
|
||||
if (resourcePack.resourceExists(p_hasResource_0_)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static IResourcePack getDefiningResourcePack(ResourceLocation p_getDefiningResourcePack_0_) {
|
||||
|
@ -503,13 +502,23 @@ public class Config {
|
|||
return airesourcepack;
|
||||
}
|
||||
|
||||
public static InputStream getResourceStream(ResourceLocation p_getResourceStream_0_) throws IOException {
|
||||
return getResourceStream(Minecraft.getMinecraft().getResourceManager(), p_getResourceStream_0_);
|
||||
}
|
||||
|
||||
public static InputStream getResourceStream(IResourceManager p_getResourceStream_0_, ResourceLocation p_getResourceStream_1_) throws IOException {
|
||||
IResource iresource = p_getResourceStream_0_.getResource(p_getResourceStream_1_);
|
||||
return iresource == null ? null : iresource.getInputStream();
|
||||
public static InputStream getResourceStream(ResourceLocation p_getResourceStream_1_) throws IOException {
|
||||
IResourceManager p_getResourceStream_0_ = Minecraft.getMinecraft().getResourceManager();
|
||||
|
||||
IResource defaultResource = p_getResourceStream_0_.getResource(p_getResourceStream_1_);
|
||||
if (defaultResource != null) {
|
||||
return defaultResource.getInputStream();
|
||||
}
|
||||
|
||||
Set<String> resourceDomains = p_getResourceStream_0_.getResourceDomains();
|
||||
for (String resourceDomain : resourceDomains) {
|
||||
IResource resource = p_getResourceStream_0_.getResource(new ResourceLocation(resourceDomain, p_getResourceStream_1_.getResourcePath()));
|
||||
if (resource != null) {
|
||||
return resource.getInputStream();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int intHash(int p_intHash_0_) {
|
||||
|
|
|
@ -49,7 +49,6 @@ public class CustomSky {
|
|||
Properties properties = new Properties();
|
||||
properties.load(inputstream);
|
||||
inputstream.close();
|
||||
//Config.dbg("CustomSky properties: " + s2);
|
||||
String s3 = s1 + k + ".png";
|
||||
CustomSkyLayer customskylayer = new CustomSkyLayer(properties, s3);
|
||||
|
||||
|
@ -57,9 +56,7 @@ public class CustomSky {
|
|||
ResourceLocation resourcelocation1 = new ResourceLocation(customskylayer.source);
|
||||
ITextureObject itextureobject = TextureUtils.getTexture(resourcelocation1);
|
||||
|
||||
if (itextureobject == null) {
|
||||
//Config.log("CustomSky: Texture not found: " + resourcelocation1);
|
||||
} else {
|
||||
if (itextureobject != null) {
|
||||
customskylayer.textureId = itextureobject.getGlTextureId();
|
||||
list.add(customskylayer);
|
||||
inputstream.close();
|
||||
|
@ -95,7 +92,6 @@ public class CustomSky {
|
|||
|
||||
public static void renderSky(World p_renderSky_0_, TextureManager p_renderSky_1_, float p_renderSky_2_, float p_renderSky_3_) {
|
||||
if (worldSkyLayers != null) {
|
||||
//if (Config.getGameSettings().renderDistanceChunks >= 8) {
|
||||
int i = p_renderSky_0_.provider.getDimensionId();
|
||||
|
||||
if (i >= 0 && i < worldSkyLayers.length) {
|
||||
|
@ -116,9 +112,8 @@ public class CustomSky {
|
|||
Blender.clearBlend(p_renderSky_3_);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasSkyLayers(World p_hasSkyLayers_0_) {
|
||||
if (worldSkyLayers == null) {
|
||||
|
|
|
@ -20,7 +20,7 @@ public class FontUtils {
|
|||
|
||||
try {
|
||||
ResourceLocation resourcelocation = new ResourceLocation(p_readFontProperties_0_.getResourceDomain(), s2);
|
||||
InputStream inputstream = Config.getResourceStream(Minecraft.getMinecraft().getResourceManager(), resourcelocation);
|
||||
InputStream inputstream = Config.getResourceStream(resourcelocation);
|
||||
|
||||
if (inputstream == null) {
|
||||
return properties;
|
||||
|
@ -92,7 +92,7 @@ public class FontUtils {
|
|||
s = s.substring(s1.length());
|
||||
s = s2 + s;
|
||||
ResourceLocation resourcelocation = new ResourceLocation(p_getHdFontLocation_0_.getResourceDomain(), s);
|
||||
return Config.hasResource(Minecraft.getMinecraft().getResourceManager(), resourcelocation) ? resourcelocation : p_getHdFontLocation_0_;
|
||||
return Config.hasResource(resourcelocation) ? resourcelocation : p_getHdFontLocation_0_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,19 @@
|
|||
package net.PeytonPlayz585.shadow;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.ITextureObject;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.client.resources.IResourcePack;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.SimpleTexture;
|
||||
import net.minecraft.client.resources.IReloadableResourceManager;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.resources.ResourcePackRepository;
|
||||
|
||||
public class TextureUtils {
|
||||
|
||||
|
@ -100,16 +107,29 @@ public class TextureUtils {
|
|||
}
|
||||
|
||||
public static ITextureObject getTexture(ResourceLocation p_getTexture_0_) {
|
||||
ITextureObject itextureobject = Config.getTextureManager().getTexture(p_getTexture_0_);
|
||||
|
||||
TextureManager textureManager = Config.getTextureManager();
|
||||
ITextureObject itextureobject = textureManager.getTexture(p_getTexture_0_);
|
||||
|
||||
if (itextureobject != null) {
|
||||
return itextureobject;
|
||||
} else if (!Config.hasResource(p_getTexture_0_)) {
|
||||
return null;
|
||||
} else {
|
||||
SimpleTexture simpletexture = new SimpleTexture(p_getTexture_0_);
|
||||
Config.getTextureManager().loadTexture(p_getTexture_0_, simpletexture);
|
||||
return simpletexture;
|
||||
for (ResourcePackRepository.Entry resourcePackEntry : Minecraft.getMinecraft().getResourcePackRepository().getRepositoryEntries()) {
|
||||
IResourcePack resourcePack = resourcePackEntry.getResourcePack();
|
||||
try {
|
||||
InputStream resourceStream = resourcePack.getInputStream(p_getTexture_0_);
|
||||
if (resourceStream != null) {
|
||||
itextureobject = new SimpleTexture(p_getTexture_0_);
|
||||
textureManager.loadTexture(p_getTexture_0_, itextureobject);
|
||||
return itextureobject;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.minecraft.client.resources;
|
|||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
@ -161,6 +162,21 @@ public class ResourcePackRepository {
|
|||
}
|
||||
}
|
||||
|
||||
public IResource getResource(ResourceLocation location) {
|
||||
for (ResourcePackRepository.Entry entry : this.repositoryEntries) {
|
||||
try {
|
||||
IResourcePack resourcePack = entry.getResourcePack();
|
||||
InputStream inputStream = resourcePack.getInputStream(location);
|
||||
if (inputStream != null) {
|
||||
return new SimpleResource(entry.getResourcePackName(), location, inputStream, null, null);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.warn("Failed to access resource pack {}", entry.getResourcePackName(), e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public class Entry {
|
||||
private final String resourcePackFile;
|
||||
private IResourcePack reResourcePack;
|
||||
|
|