Fix CustomSkys

This commit is contained in:
PeytonPlayz595 2023-10-16 21:47:33 -04:00
parent 202a6577f0
commit f1aa39a8a9
9 changed files with 108611 additions and 108498 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,7 @@ public class CustomSky {
String s1 = s + j + "/sky"; String s1 = s + j + "/sky";
List list = new ArrayList(); List list = new ArrayList();
for (int k = 1; k < 1000; ++k) { for (int k = 1; k < 26; ++k) {
String s2 = s1 + k + ".properties"; String s2 = s1 + k + ".properties";
try { try {
@ -49,6 +49,7 @@ public class CustomSky {
Properties properties = new Properties(); Properties properties = new Properties();
properties.load(inputstream); properties.load(inputstream);
inputstream.close(); inputstream.close();
Config.dbg("CustomSky properties: " + s2);
String s3 = s1 + k + ".png"; String s3 = s1 + k + ".png";
CustomSkyLayer customskylayer = new CustomSkyLayer(properties, s3); CustomSkyLayer customskylayer = new CustomSkyLayer(properties, s3);
@ -56,7 +57,9 @@ public class CustomSky {
ResourceLocation resourcelocation1 = new ResourceLocation(customskylayer.source); ResourceLocation resourcelocation1 = new ResourceLocation(customskylayer.source);
ITextureObject itextureobject = TextureUtils.getTexture(resourcelocation1); ITextureObject itextureobject = TextureUtils.getTexture(resourcelocation1);
if (!(itextureobject == null)) { if (itextureobject == null) {
Config.log("CustomSky: Texture not found: " + resourcelocation1);
} else {
customskylayer.textureId = itextureobject.getGlTextureId(); customskylayer.textureId = itextureobject.getGlTextureId();
list.add(customskylayer); list.add(customskylayer);
inputstream.close(); inputstream.close();
@ -92,37 +95,35 @@ public class CustomSky {
public static void renderSky(World p_renderSky_0_, TextureManager p_renderSky_1_, float p_renderSky_2_, float p_renderSky_3_) { public static void renderSky(World p_renderSky_0_, TextureManager p_renderSky_1_, float p_renderSky_2_, float p_renderSky_3_) {
if (worldSkyLayers != null) { if (worldSkyLayers != null) {
if (Config.getGameSettings().renderDistanceChunks >= 8) { //if (Config.getGameSettings().renderDistanceChunks >= 8) {
int i = p_renderSky_0_.provider.getDimensionId(); int i = p_renderSky_0_.provider.getDimensionId();
if (i >= 0 && i < worldSkyLayers.length) { if (i >= 0 && i < worldSkyLayers.length) {
CustomSkyLayer[] acustomskylayer = worldSkyLayers[i]; CustomSkyLayer[] acustomskylayer = worldSkyLayers[i];
if (acustomskylayer != null) { if (acustomskylayer != null) {
long j = p_renderSky_0_.getWorldTime(); long j = p_renderSky_0_.getWorldTime();
int k = (int)(j % 24000L); int k = (int)(j % 24000L);
for (int l = 0; l < acustomskylayer.length; ++l) { for (int l = 0; l < acustomskylayer.length; ++l) {
CustomSkyLayer customskylayer = acustomskylayer[l]; CustomSkyLayer customskylayer = acustomskylayer[l];
if (customskylayer.isActive(p_renderSky_0_, k)) { if (customskylayer.isActive(p_renderSky_0_, k)) {
customskylayer.render(k, p_renderSky_2_, p_renderSky_3_); customskylayer.render(k, p_renderSky_2_, p_renderSky_3_);
}
} }
Blender.clearBlend(p_renderSky_3_);
} }
Blender.clearBlend(p_renderSky_3_);
} }
} }
} //}
} }
}
public static boolean hasSkyLayers(World p_hasSkyLayers_0_) { public static boolean hasSkyLayers(World p_hasSkyLayers_0_) {
if (worldSkyLayers == null) { if (worldSkyLayers == null) {
return false; return false;
} else if (Config.getGameSettings().renderDistanceChunks < 8) { } else {
return false;
} else {
int i = p_hasSkyLayers_0_.provider.getDimensionId(); int i = p_hasSkyLayers_0_.provider.getDimensionId();
if (i >= 0 && i < worldSkyLayers.length) { if (i >= 0 && i < worldSkyLayers.length) {

View File

@ -3,11 +3,12 @@ package net.PeytonPlayz585.shadow;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.ITextureObject; import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.SimpleTexture; import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.client.resources.IReloadableResourceManager;
import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener; import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
public class TextureUtils implements IResourceManagerReloadListener { public class TextureUtils {
static TextureMap texturemap = new TextureMap(); static TextureMap texturemap = new TextureMap();
public static String s = "minecraft:blocks/"; public static String s = "minecraft:blocks/";
@ -112,7 +113,21 @@ public class TextureUtils implements IResourceManagerReloadListener {
} }
} }
public void onResourceManagerReload(IResourceManager p_resourcesReloaded_0_) { public static void registerResourceListener() {
IResourceManager iresourcemanager = Minecraft.getMinecraft().getResourceManager();
if (iresourcemanager instanceof IReloadableResourceManager) {
IReloadableResourceManager ireloadableresourcemanager = (IReloadableResourceManager)iresourcemanager;
IResourceManagerReloadListener iresourcemanagerreloadlistener = new IResourceManagerReloadListener() {
public void onResourceManagerReload(IResourceManager resourceManager) {
TextureUtils.resourcesReloaded();
}
};
ireloadableresourcemanager.registerReloadListener(iresourcemanagerreloadlistener);
}
}
public static void resourcesReloaded() {
if (getTextureMapBlocks() != null) { if (getTextureMapBlocks() != null) {
Config.dbg("*** Reloading custom textures ***"); Config.dbg("*** Reloading custom textures ***");
CustomSky.reset(); CustomSky.reset();

View File

@ -1,5 +1,6 @@
package net.lax1dude.eaglercraft.v1_8.profile; package net.lax1dude.eaglercraft.v1_8.profile;
import net.PeytonPlayz585.shadow.CustomSky;
import net.lax1dude.eaglercraft.v1_8.EagRuntime; import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.Keyboard; import net.lax1dude.eaglercraft.v1_8.Keyboard;
import net.lax1dude.eaglercraft.v1_8.Mouse; import net.lax1dude.eaglercraft.v1_8.Mouse;
@ -265,6 +266,7 @@ public class GuiScreenEditProfile extends GuiScreen {
if(!dropDownOpen) { if(!dropDownOpen) {
if(par1GuiButton.id == 0) { if(par1GuiButton.id == 0) {
safeProfile(); safeProfile();
CustomSky.update();
this.mc.displayGuiScreen((GuiScreen) parent); this.mc.displayGuiScreen((GuiScreen) parent);
}else if(par1GuiButton.id == 1) { }else if(par1GuiButton.id == 1) {
EagRuntime.displayFileChooser("image/png", "png"); EagRuntime.displayFileChooser("image/png", "png");

View File

@ -88,6 +88,7 @@ import net.minecraft.world.WorldSettings;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import net.PeytonPlayz585.shadow.Config; import net.PeytonPlayz585.shadow.Config;
import net.PeytonPlayz585.shadow.TextureUtils;
/**+ /**+
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code. * This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
@ -176,6 +177,8 @@ public class EntityRenderer implements IResourceManagerReloadListener {
public boolean fogStandard = false; public boolean fogStandard = false;
private float clipDistance = 128.0F; private float clipDistance = 128.0F;
private boolean initialized = false;
public EntityRenderer(Minecraft mcIn, IResourceManager resourceManagerIn) { public EntityRenderer(Minecraft mcIn, IResourceManager resourceManagerIn) {
this.useShader = false; this.useShader = false;
this.frameCount = 0; this.frameCount = 0;
@ -891,6 +894,7 @@ public class EntityRenderer implements IResourceManagerReloadListener {
} }
public void func_181560_a(float parFloat1, long parLong1) { public void func_181560_a(float parFloat1, long parLong1) {
this.frameInit();
boolean flag = Display.isActive(); boolean flag = Display.isActive();
if (!flag && this.mc.gameSettings.pauseOnLostFocus if (!flag && this.mc.gameSettings.pauseOnLostFocus
&& (!this.mc.gameSettings.touchscreen || !Mouse.isButtonDown(1))) { && (!this.mc.gameSettings.touchscreen || !Mouse.isButtonDown(1))) {
@ -2833,4 +2837,11 @@ public class EntityRenderer implements IResourceManagerReloadListener {
GlStateManager.rotate(-DeferredStateManager.sunAngle, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(-DeferredStateManager.sunAngle, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
} }
public void frameInit() {
if (!this.initialized) {
TextureUtils.registerResourceListener();
this.initialized = true;
}
}
} }