Chunk Loading Fix from 1.0

This commit is contained in:
peytonplayz595 2023-09-03 07:45:33 -05:00
parent b2e4099f77
commit ab7b820178
8 changed files with 55 additions and 2 deletions

View File

@ -12,6 +12,7 @@ import net.PeytonPlayz585.shadow.reflections.Reflector;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger; import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.DefaultResourcePack; import net.minecraft.client.resources.DefaultResourcePack;
import net.minecraft.client.resources.IResource; import net.minecraft.client.resources.IResource;
@ -27,6 +28,12 @@ public class Config {
private static DefaultResourcePack defaultResourcePackLazy = null; private static DefaultResourcePack defaultResourcePackLazy = null;
//Chunk Loading Fix
public static boolean chunkFix = true;
public static boolean chunkFixNether = false;
public static boolean chunkFixEnd = false;
public static WorldClient worldClient = null;
public static boolean isAnimatedWater() { public static boolean isAnimatedWater() {
return Minecraft.getMinecraft().gameSettings.ofAnimatedWater != 2; return Minecraft.getMinecraft().gameSettings.ofAnimatedWater != 2;
} }
@ -370,4 +377,33 @@ public class Config {
return Minecraft.getMinecraft().getTextureManager(); return Minecraft.getMinecraft().getTextureManager();
} }
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;
}
}
}
} }

View File

@ -22,7 +22,7 @@ public class VertexBuffer {
EaglercraftGPU.glNewList(parInt1, GL_COMPILE); EaglercraftGPU.glNewList(parInt1, GL_COMPILE);
VertexFormat fmt = p_181722_1_.getVertexFormat(); VertexFormat fmt = p_181722_1_.getVertexFormat();
ByteBuffer buf = p_181722_1_.getByteBuffer(); ByteBuffer buf = p_181722_1_.getByteBuffer();
EaglercraftGPU.renderBuffer(buf.position(0).compact().limit(p_181722_1_.getVertexCount() * fmt.attribStride), fmt.eaglercraftAttribBits, 7, p_181722_1_.getVertexCount()); EaglercraftGPU.renderBuffer(buf.position(0), fmt.eaglercraftAttribBits, 7, p_181722_1_.getVertexCount());
p_181722_1_.reset(); p_181722_1_.reset();
EaglercraftGPU.glEndList(); EaglercraftGPU.glEndList();
} }

View File

@ -19,6 +19,7 @@ import org.apache.commons.lang3.Validate;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.FatalCodes.shadow.Shadow; import net.FatalCodes.shadow.Shadow;
import net.PeytonPlayz585.shadow.Config;
import net.PeytonPlayz585.shadow.gui.GuiSecretMainMenu; import net.PeytonPlayz585.shadow.gui.GuiSecretMainMenu;
import net.lax1dude.eaglercraft.v1_8.Display; import net.lax1dude.eaglercraft.v1_8.Display;
import net.lax1dude.eaglercraft.v1_8.EagRuntime; import net.lax1dude.eaglercraft.v1_8.EagRuntime;
@ -1744,6 +1745,7 @@ public class Minecraft implements IThreadListener {
this.mcSoundHandler.stopSounds(); this.mcSoundHandler.stopSounds();
this.theWorld = worldClientIn; this.theWorld = worldClientIn;
if (worldClientIn != null) { if (worldClientIn != null) {
Config.worldClient = worldClientIn;
if (this.renderGlobal != null) { if (this.renderGlobal != null) {
this.renderGlobal.setWorldAndLoadRenderers(worldClientIn); this.renderGlobal.setWorldAndLoadRenderers(worldClientIn);
} }

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.google.common.collect.Lists; 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.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger; import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.EnumCreatureType;
@ -87,6 +88,7 @@ public class ChunkProviderClient implements IChunkProvider {
this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(parInt1, parInt2), chunk); this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(parInt1, parInt2), chunk);
this.chunkListing.add(chunk); this.chunkListing.add(chunk);
chunk.setChunkLoaded(true); chunk.setChunkLoaded(true);
Config.fixChunkLoading();
return chunk; return chunk;
} }

View File

@ -132,7 +132,7 @@ public class WorldClient extends World {
return this.clientChunkProvider; return this.clientChunkProvider;
} }
protected void updateBlocks() { public void updateBlocks() {
super.updateBlocks(); super.updateBlocks();
this.previousActiveChunkSet.retainAll(this.activeChunkSet); this.previousActiveChunkSet.retainAll(this.activeChunkSet);
if (this.previousActiveChunkSet.size() == this.activeChunkSet.size()) { if (this.previousActiveChunkSet.size() == this.activeChunkSet.size()) {

View File

@ -1,5 +1,6 @@
package net.minecraft.world; package net.minecraft.world;
import net.PeytonPlayz585.shadow.Config;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
@ -28,6 +29,7 @@ public class WorldProviderEnd extends WorldProvider {
*/ */
public void registerWorldChunkManager() { public void registerWorldChunkManager() {
this.dimensionId = 1; this.dimensionId = 1;
Config.chunkFixEnd = true;
this.hasNoSky = true; this.hasNoSky = true;
} }

View File

@ -1,5 +1,6 @@
package net.minecraft.world; package net.minecraft.world;
import net.PeytonPlayz585.shadow.Config;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.border.WorldBorder; import net.minecraft.world.border.WorldBorder;
@ -29,6 +30,7 @@ public class WorldProviderHell extends WorldProvider {
this.isHellWorld = true; this.isHellWorld = true;
this.hasNoSky = true; this.hasNoSky = true;
this.dimensionId = -1; this.dimensionId = -1;
Config.chunkFixNether = true;
} }
/**+ /**+

View File

@ -1,5 +1,7 @@
package net.minecraft.world; package net.minecraft.world;
import net.PeytonPlayz585.shadow.Config;
/**+ /**+
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code. * This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
* *
@ -19,6 +21,13 @@ package net.minecraft.world;
* *
*/ */
public class WorldProviderSurface extends WorldProvider { public class WorldProviderSurface extends WorldProvider {
@Override
public void registerWorldChunkManager() {
Config.chunkFix = true;
super.registerWorldChunkManager();
}
/**+ /**+
* Returns the dimension's name, e.g. "The End", "Nether", or * Returns the dimension's name, e.g. "The End", "Nether", or
* "Overworld". * "Overworld".