Various bug fixes
This commit is contained in:
parent
8118c4fca3
commit
083548facb
|
@ -14,6 +14,7 @@ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
|||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.EaglerDeferredConfig;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.resources.DefaultResourcePack;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
|
@ -34,6 +35,14 @@ public class Config {
|
|||
private static int antialiasingLevel = 0;
|
||||
public static boolean waterOpacityChanged = false;
|
||||
|
||||
/* Ancient chunk loading fix from Shadow 1.0 I copied and pasted
|
||||
* That NEEDS to be rewritten but I'm too lazy to do it...
|
||||
*/
|
||||
public static boolean chunkFix = true;
|
||||
public static boolean chunkFixNether = false;
|
||||
public static boolean chunkFixEnd = false;
|
||||
public static WorldClient worldClient = null;
|
||||
|
||||
public static void initGameSettings(GameSettings p_initGameSettings_0_) {
|
||||
if (gameSettings == null) {
|
||||
gameSettings = p_initGameSettings_0_;
|
||||
|
@ -336,15 +345,17 @@ public class Config {
|
|||
}
|
||||
|
||||
public static void updateThreadPriorities() {
|
||||
if (isSingleProcessor()) {
|
||||
if (isSmoothWorld()) {
|
||||
minecraftThread.setPriority(10);
|
||||
} else {
|
||||
minecraftThread.setPriority(5);
|
||||
}
|
||||
} else {
|
||||
minecraftThread.setPriority(10);
|
||||
}
|
||||
//womp womp
|
||||
|
||||
// if (isSingleProcessor()) {
|
||||
// if (isSmoothWorld()) {
|
||||
// minecraftThread.setPriority(10);
|
||||
// } else {
|
||||
// minecraftThread.setPriority(5);
|
||||
// }
|
||||
// } else {
|
||||
// minecraftThread.setPriority(10);
|
||||
// }
|
||||
}
|
||||
|
||||
public static boolean isMinecraftThread() {
|
||||
|
@ -649,4 +660,34 @@ public class Config {
|
|||
p_intHash_0_ = p_intHash_0_ ^ p_intHash_0_ >> 15;
|
||||
return p_intHash_0_;
|
||||
}
|
||||
|
||||
//So gay
|
||||
public static void fixChunkLoading() {
|
||||
if (chunkFix) {
|
||||
if (worldClient != null) {
|
||||
Minecraft.getMinecraft().renderGlobal.loadRenderers();
|
||||
Minecraft.getMinecraft().renderGlobal.setWorldAndLoadRenderers(worldClient);
|
||||
worldClient.updateBlocks();
|
||||
chunkFix = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (chunkFixNether) {
|
||||
if (worldClient != null) {
|
||||
Minecraft.getMinecraft().renderGlobal.loadRenderers();
|
||||
Minecraft.getMinecraft().renderGlobal.setWorldAndLoadRenderers(worldClient);
|
||||
worldClient.updateBlocks();
|
||||
chunkFixNether = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (chunkFixEnd) {
|
||||
if (worldClient != null) {
|
||||
Minecraft.getMinecraft().renderGlobal.loadRenderers();
|
||||
Minecraft.getMinecraft().renderGlobal.setWorldAndLoadRenderers(worldClient);
|
||||
worldClient.updateBlocks();
|
||||
chunkFixEnd = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ 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 >= 2) {
|
||||
if (Config.getGameSettings().renderDistanceChunks >= 2) {
|
||||
int i = p_renderSky_0_.provider.getDimensionId();
|
||||
|
||||
if (i >= 0 && i < worldSkyLayers.length) {
|
||||
|
@ -118,13 +118,15 @@ public class CustomSky {
|
|||
Blender.clearBlend(p_renderSky_3_);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasSkyLayers(World p_hasSkyLayers_0_) {
|
||||
if (worldSkyLayers == null) {
|
||||
return false;
|
||||
} else if(!(Config.getGameSettings().renderDistanceChunks >= 2)) {
|
||||
return false; //No sky layers at 1 chunk render distance...
|
||||
} else {
|
||||
int i = p_hasSkyLayers_0_.provider.getDimensionId();
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import net.minecraft.client.resources.data.IMetadataSection;
|
|||
|
||||
public class JSONUtils {
|
||||
|
||||
public static <T extends IMetadataSection> T fixJson(String string) {
|
||||
public static <T extends IMetadataSection> T parseCustomItemAnimation(String string) {
|
||||
JSONObject jsonObject = new JSONObject(string);
|
||||
JSONObject animationObject = jsonObject.getJSONObject("animation");
|
||||
int frametime = animationObject.getInt("frametime");
|
||||
|
|
|
@ -133,18 +133,9 @@ public class EaglerMinecraftServer extends MinecraftServer {
|
|||
this.tick();
|
||||
++counterTicksPerSecond;
|
||||
} else {
|
||||
boolean mustYield = false;
|
||||
if (j >= 50L) {
|
||||
if(mustYield) {
|
||||
try {
|
||||
Thread.sleep(1l); // allow some async
|
||||
}catch(InterruptedException e) {
|
||||
System.err.println("you eagler");
|
||||
}
|
||||
}
|
||||
if (j > 50L) {
|
||||
this.currentTime += 50l;
|
||||
this.tick();
|
||||
mustYield = true;
|
||||
++counterTicksPerSecond;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1825,6 +1825,7 @@ public class Minecraft implements IThreadListener {
|
|||
this.theWorld = worldClientIn;
|
||||
if (worldClientIn != null) {
|
||||
if (this.renderGlobal != null) {
|
||||
Config.worldClient = worldClientIn;
|
||||
this.renderGlobal.setWorldAndLoadRenderers(worldClientIn);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.PeytonPlayz585.shadow.Config;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
|
@ -89,6 +90,7 @@ public class ChunkProviderClient implements IChunkProvider {
|
|||
this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(parInt1, parInt2), chunk);
|
||||
this.chunkListing.add(chunk);
|
||||
chunk.setChunkLoaded(true);
|
||||
Config.fixChunkLoading();
|
||||
return chunk;
|
||||
}
|
||||
|
||||
|
|
|
@ -651,7 +651,11 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
|||
}
|
||||
|
||||
float farPlane = this.farPlaneDistance * 2.0f * MathHelper.SQRT_2;
|
||||
if(this.mc.gameSettings.renderDistanceChunks >= 2) {
|
||||
GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance);
|
||||
} else {
|
||||
GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, farPlane);
|
||||
}
|
||||
DeferredStateManager.setGBufferNearFarPlanes(0.05f, farPlane);
|
||||
GlStateManager.matrixMode(GL_MODELVIEW);
|
||||
GlStateManager.loadIdentity();
|
||||
|
@ -1216,17 +1220,25 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
|||
double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks;
|
||||
double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks;
|
||||
frustum.setPosition(d0, d1, d2);
|
||||
if ((Config.isSkyEnabled() || Config.isSunMoonEnabled() || Config.isStarsEnabled())){
|
||||
if ((Config.isSkyEnabled() || Config.isSunMoonEnabled() || Config.isStarsEnabled()) && this.mc.gameSettings.renderDistanceChunks >= 2){
|
||||
this.setupFog(-1, partialTicks);
|
||||
this.mc.mcProfiler.endStartSection("sky");
|
||||
GlStateManager.matrixMode(GL_PROJECTION);
|
||||
GlStateManager.loadIdentity();
|
||||
if(this.mc.gameSettings.renderDistanceChunks >= 2) {
|
||||
GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance);
|
||||
} else {
|
||||
GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, this.farPlaneDistance * 4.0F);
|
||||
}
|
||||
GlStateManager.matrixMode(GL_MODELVIEW);
|
||||
renderglobal.renderSky(partialTicks, pass);
|
||||
GlStateManager.matrixMode(GL_PROJECTION);
|
||||
GlStateManager.loadIdentity();
|
||||
if(this.mc.gameSettings.renderDistanceChunks >= 2) {
|
||||
GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance);
|
||||
} else {
|
||||
GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, this.farPlaneDistance * MathHelper.SQRT_2);
|
||||
}
|
||||
GlStateManager.matrixMode(GL_MODELVIEW);
|
||||
} else {
|
||||
GlStateManager.enableBlend();
|
||||
|
@ -1373,7 +1385,13 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
|||
this.mc.mcProfiler.endStartSection("clouds");
|
||||
GlStateManager.matrixMode(GL_PROJECTION);
|
||||
GlStateManager.loadIdentity();
|
||||
if(this.mc.gameSettings.renderDistanceChunks >= 2) {
|
||||
GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance * 4.0F);
|
||||
} else {
|
||||
//Clouds not rendered at 1 chunk render distance
|
||||
//But still, just to be safe...
|
||||
GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, this.farPlaneDistance * 4.0F);
|
||||
}
|
||||
GlStateManager.matrixMode(GL_MODELVIEW);
|
||||
GlStateManager.pushMatrix();
|
||||
this.setupFog(0, partialTicks);
|
||||
|
@ -1382,7 +1400,13 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
|||
GlStateManager.popMatrix();
|
||||
GlStateManager.matrixMode(GL_PROJECTION);
|
||||
GlStateManager.loadIdentity();
|
||||
if(this.mc.gameSettings.renderDistanceChunks >= 2) {
|
||||
GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance);
|
||||
} else {
|
||||
//Clouds not rendered at 1 chunk render distance
|
||||
//But still, just to be safe...
|
||||
GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, this.farPlaneDistance * MathHelper.SQRT_2);
|
||||
}
|
||||
GlStateManager.matrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
|
|
|
@ -1390,7 +1390,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
|||
GlStateManager.enableFog();
|
||||
GlStateManager.color(f, f1, f2);
|
||||
|
||||
if(Config.isSkyEnabled()) {
|
||||
if(Config.isSkyEnabled() && this.mc.gameSettings.renderDistanceChunks >= 2) {
|
||||
GlStateManager.callList(this.glSkyList);
|
||||
}
|
||||
|
||||
|
@ -1400,7 +1400,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
|||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
float[] afloat = this.theWorld.provider .calcSunriseSunsetColors(this.theWorld.getCelestialAngle(partialTicks), partialTicks);
|
||||
if (afloat != null && Config.isSunMoonEnabled()) {
|
||||
if (afloat != null && Config.isSunMoonEnabled() && this.mc.gameSettings.renderDistanceChunks >= 2) {
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.shadeModel(GL_SMOOTH);
|
||||
GlStateManager.pushMatrix();
|
||||
|
@ -1446,8 +1446,11 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
|||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, 1, 1, 0);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, f16);
|
||||
GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
if(this.mc.gameSettings.renderDistanceChunks >= 2) {
|
||||
CustomSky.renderSky(this.theWorld, this.renderEngine, this.theWorld.getCelestialAngle(partialTicks), f16);
|
||||
}
|
||||
GlStateManager.rotate(this.theWorld.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||
if(Config.isSunMoonEnabled() && this.mc.gameSettings.renderDistanceChunks >= 2) {
|
||||
this.renderEngine.bindTexture(locationSunPng);
|
||||
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||
worldrenderer.pos((double) (-f17), 100.0D, (double) (-f17)).tex(0.0D, 0.0D).endVertex();
|
||||
|
@ -1470,9 +1473,10 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
|||
worldrenderer.pos((double) f17, -100.0D, (double) (-f17)).tex((double) f22, (double) f23).endVertex();
|
||||
worldrenderer.pos((double) (-f17), -100.0D, (double) (-f17)).tex((double) f24, (double) f23).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
GlStateManager.disableTexture2D();
|
||||
float f15 = this.theWorld.getStarBrightness(partialTicks) * f16;
|
||||
if (f15 > 0.0F && Config.isStarsEnabled() && !CustomSky.hasSkyLayers(this.theWorld)) {
|
||||
if (f15 > 0.0F && Config.isStarsEnabled() && !CustomSky.hasSkyLayers(this.theWorld) && this.mc.gameSettings.renderDistanceChunks >= 2) {
|
||||
GlStateManager.color(f15, f15, f15, f15);
|
||||
GlStateManager.callList(this.starGLCallList);
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ public class SimpleResource implements IResource {
|
|||
return this.mcmetaInputStream != null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends IMetadataSection> T getMetadata(String s) {
|
||||
if (!this.hasMetadata()) {
|
||||
return (T) null;
|
||||
|
@ -92,13 +93,27 @@ public class SimpleResource implements IResource {
|
|||
} catch(Exception e) {
|
||||
if(this.srResourceLocation.toString().contains("mcpatcher") || this.srResourceLocation.toString().contains("optifine")) {
|
||||
try {
|
||||
imetadatasection = JSONUtils.fixJson(mcmetaJson.toString());
|
||||
if(s.contains("animation")) {
|
||||
imetadatasection = JSONUtils.parseCustomItemAnimation(mcmetaJson.toString());
|
||||
mapMetadataSections.put(s, imetadatasection);
|
||||
} else {
|
||||
/*
|
||||
* Only made json utils for custom item animations
|
||||
* So far I have had no issues with any other custom item feature
|
||||
* If this exception is printed it is most likely a user error...
|
||||
*/
|
||||
e.printStackTrace();
|
||||
|
||||
//Return it anyways lol
|
||||
return (T) imetadatasection;
|
||||
}
|
||||
} catch(Exception e1) {
|
||||
e1.printStackTrace();
|
||||
//Return it anyways lol
|
||||
return (T) imetadatasection;
|
||||
}
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
//Return it anyways lol
|
||||
return (T) imetadatasection;
|
||||
}
|
||||
|
|
|
@ -403,21 +403,13 @@ public abstract class MinecraftServer implements Runnable, ICommandSender, IThre
|
|||
this.tick();
|
||||
i = 0L;
|
||||
} else {
|
||||
boolean mustYield = false;
|
||||
while (i >= 50L) {
|
||||
if(mustYield) {
|
||||
//try {
|
||||
//Thread.sleep(1l); // allow some async
|
||||
//}catch(InterruptedException e) {
|
||||
//System.err.println("you eagler");
|
||||
//}
|
||||
}
|
||||
while (i > 50L) {
|
||||
i -= 50L;
|
||||
this.tick();
|
||||
mustYield = true;
|
||||
}
|
||||
}
|
||||
|
||||
Thread.sleep(Math.max(1L, 50L - i));
|
||||
this.serverIsRunning = true;
|
||||
}
|
||||
} else {
|
||||
|
@ -593,6 +585,12 @@ public abstract class MinecraftServer implements Runnable, ICommandSender, IThre
|
|||
public void startServerThread() {
|
||||
this.serverThread = new Thread(this, "Server thread");
|
||||
this.serverThread.start();
|
||||
|
||||
//Lmao ¯\_(ツ)_/¯
|
||||
Thread.currentThread().setPriority(10);
|
||||
|
||||
//Possible TPS fix!?!?
|
||||
this.serverThread.setPriority(10);
|
||||
}
|
||||
|
||||
/**+
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.minecraft.world;
|
||||
|
||||
import net.PeytonPlayz585.shadow.Config;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
@ -35,6 +36,7 @@ public class WorldProviderEnd extends WorldProvider {
|
|||
public void registerWorldChunkManager() {
|
||||
this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.sky, 0.0F);
|
||||
this.dimensionId = 1;
|
||||
Config.chunkFixEnd = true;
|
||||
this.hasNoSky = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.minecraft.world;
|
||||
|
||||
import net.PeytonPlayz585.shadow.Config;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.biome.WorldChunkManagerHell;
|
||||
|
@ -36,6 +37,7 @@ public class WorldProviderHell extends WorldProvider {
|
|||
this.isHellWorld = true;
|
||||
this.hasNoSky = true;
|
||||
this.dimensionId = -1;
|
||||
Config.chunkFixNether = true;
|
||||
}
|
||||
|
||||
/**+
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.minecraft.world;
|
||||
|
||||
import net.PeytonPlayz585.shadow.Config;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
|
@ -21,6 +23,13 @@ package net.minecraft.world;
|
|||
*
|
||||
*/
|
||||
public class WorldProviderSurface extends WorldProvider {
|
||||
|
||||
@Override
|
||||
public void registerWorldChunkManager() {
|
||||
super.registerWorldChunkManager();
|
||||
Config.chunkFix = true;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Returns the dimension's name, e.g. "The End", "Nether", or
|
||||
* "Overworld".
|
||||
|
|
Loading…
Reference in New Issue
Block a user