Did some more things...

This commit is contained in:
PeytonPlayz595 2024-03-18 17:17:59 -04:00
parent a4c4ca9652
commit 3bb6fb09c2
9 changed files with 11957 additions and 12690 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,68 +0,0 @@
package net.minecraft.src;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class ChunkProviderIso implements IChunkProvider {
private Map<Integer, Chunk> chunks = new HashMap<Integer, Chunk>();
private World worldObj;
private IChunkLoader chunkLoader;
byte[] field_899_a = new byte[-Short.MIN_VALUE];
public ChunkProviderIso(World var1, IChunkLoader var2) {
this.worldObj = var1;
this.chunkLoader = var2;
}
public boolean chunkExists(int var1, int var2) {
int var3 = var1 & 15 | (var2 & 15) * 16;
return this.chunks.containsKey(var3) && this.chunks.get(var3).isAtLocation(var1, var2);
}
public Chunk provideChunk(int var1, int var2) {
int var3 = var1 & 15 | (var2 & 15) * 16;
try {
if(!this.chunkExists(var1, var2)) {
Chunk var4 = this.func_543_c(var1, var2);
if(var4 == null) {
var4 = new Chunk(this.worldObj, this.field_899_a, var1, var2);
var4.field_1524_q = true;
var4.neverSave = true;
}
this.chunks.put(var3, var4);
}
return this.chunks.get(var3);
} catch (Exception var5) {
var5.printStackTrace();
return null;
}
}
private synchronized Chunk func_543_c(int var1, int var2) {
try {
return this.chunkLoader.loadChunk(this.worldObj, var1, var2);
} catch (IOException var4) {
var4.printStackTrace();
return null;
}
}
public void populate(IChunkProvider var1, int var2, int var3) {
}
public boolean saveChunks(boolean var1, IProgressUpdate var2) {
return true;
}
public boolean func_532_a() {
return false;
}
public boolean func_536_b() {
return false;
}
}

View File

@ -8,7 +8,7 @@ public class ChunkProviderLoadOrGenerate implements IChunkProvider {
private Chunk blankChunk;
private IChunkProvider chunkProvider;
private IChunkLoader chunkLoader;
private Map<Integer, Chunk> chunks = new HashMap<Integer, Chunk>();
private Chunk[] chunks = new Chunk[1024];
private World worldObj;
int lastQueriedChunkXPos = -999999999;
int lastQueriedChunkZPos = -999999999;
@ -30,7 +30,7 @@ public class ChunkProviderLoadOrGenerate implements IChunkProvider {
int var3 = var1 & 31;
int var4 = var2 & 31;
int var5 = var3 + var4 * 32;
return this.chunks.containsKey(var5) && (this.chunks.get(var5) == this.blankChunk || this.chunks.get(var5).isAtLocation(var1, var2));
return this.chunks[var5] != null && (this.chunks[var5] == this.blankChunk || this.chunks[var5].isAtLocation(var1, var2));
}
}
@ -42,10 +42,10 @@ public class ChunkProviderLoadOrGenerate implements IChunkProvider {
int var4 = var2 & 31;
int var5 = var3 + var4 * 32;
if(!this.chunkExists(var1, var2)) {
if(this.chunks.containsKey(var5)) {
this.chunks.get(var5).onChunkUnload();
this.saveChunk(this.chunks.get(var5));
this.saveExtraChunkData(this.chunks.get(var5));
if(this.chunks[var5] != null) {
this.chunks[var5].onChunkUnload();
this.saveChunk(this.chunks[var5]);
this.saveExtraChunkData(this.chunks[var5]);
}
Chunk var6 = this.func_542_c(var1, var2);
@ -57,13 +57,13 @@ public class ChunkProviderLoadOrGenerate implements IChunkProvider {
}
}
this.chunks.put(var5, var6);
this.chunks[var5] = var6;
var6.func_4143_d();
if(this.chunks.containsKey(var5)) {
this.chunks.get(var5).onChunkLoad();
if(this.chunks[var5] != null) {
this.chunks[var5].onChunkLoad();
}
if(!this.chunks.get(var5).isTerrainPopulated && this.chunkExists(var1 + 1, var2 + 1) && this.chunkExists(var1, var2 + 1) && this.chunkExists(var1 + 1, var2)) {
if(!this.chunks[var5].isTerrainPopulated && this.chunkExists(var1 + 1, var2 + 1) && this.chunkExists(var1, var2 + 1) && this.chunkExists(var1 + 1, var2)) {
this.populate(this, var1, var2);
}
@ -82,8 +82,8 @@ public class ChunkProviderLoadOrGenerate implements IChunkProvider {
this.lastQueriedChunkXPos = var1;
this.lastQueriedChunkZPos = var2;
this.lastQueriedChunk = this.chunks.get(var5);
return this.chunks.get(var5);
this.lastQueriedChunk = this.chunks[var5];
return this.chunks[var5];
}
}
@ -145,8 +145,8 @@ public class ChunkProviderLoadOrGenerate implements IChunkProvider {
int var4 = 0;
int var5;
if(var2 != null) {
for(var5 = 0; var5 < this.chunks.size(); ++var5) {
if(this.chunks.get(var5) != null && this.chunks.get(var5).needsSaving(var1)) {
for(var5 = 0; var5 < this.chunks.length; ++var5) {
if(this.chunks[var5] != null && this.chunks[var5].needsSaving(var1)) {
++var4;
}
}
@ -154,15 +154,15 @@ public class ChunkProviderLoadOrGenerate implements IChunkProvider {
var5 = 0;
for(int var6 = 0; var6 < this.chunks.size(); ++var6) {
if(this.chunks.get(var6) != null) {
if(var1 && !this.chunks.get(var6).neverSave) {
this.saveExtraChunkData(this.chunks.get(var6));
for(int var6 = 0; var6 < this.chunks.length; ++var6) {
if(this.chunks[var6] != null) {
if(var1 && !this.chunks[var6].neverSave) {
this.saveExtraChunkData(this.chunks[var6]);
}
if(this.chunks.get(var6).needsSaving(var1)) {
this.saveChunk(this.chunks.get(var6));
this.chunks.get(var6).isModified = false;
if(this.chunks[var6].needsSaving(var1)) {
this.saveChunk(this.chunks[var6]);
this.chunks[var6].isModified = false;
++var3;
if(var3 == 2 && !var1) {
return false;

View File

@ -11,7 +11,7 @@ public class RenderList {
private float field_1239_d;
private float field_1238_e;
private float field_1237_f;
private IntBuffer field_1236_g = GLAllocation.createDirectIntBuffer(65536);
private IntBuffer field_1236_g = GLAllocation.createDirectIntBuffer(4096);
private boolean field_1235_h = false;
private boolean field_1234_i = false;

View File

@ -69,7 +69,7 @@ public class WorldRenderer {
float var4 = 2.0F;
this.field_1736_v = AxisAlignedBB.getBoundingBox((double)((float)var1 - var4), (double)((float)var2 - var4), (double)((float)var3 - var4), (double)((float)(var1 + this.field_1758_f) + var4), (double)((float)(var2 + this.field_1757_g) + var4), (double)((float)(var3 + this.field_1756_h) + var4));
GL11.glNewList(this.field_1744_C + 2, GL11.GL_COMPILE);
RenderItem.renderAABB(AxisAlignedBB.getBoundingBoxFromPool((double)((float)this.field_1752_l - var4), (double)((float)this.field_1751_m - var4), (double)((float)this.field_1750_n - var4), (double)((float)(this.field_1752_l + this.field_1758_f) + var4), (double)((float)(this.field_1751_m + this.field_1757_g) + var4), (double)((float)(this.field_1750_n + this.field_1756_h) + var4)));
//RenderItem.renderAABB(AxisAlignedBB.getBoundingBoxFromPool((double)((float)this.field_1752_l - var4), (double)((float)this.field_1751_m - var4), (double)((float)this.field_1750_n - var4), (double)((float)(this.field_1752_l + this.field_1758_f) + var4), (double)((float)(this.field_1751_m + this.field_1757_g) + var4), (double)((float)(this.field_1750_n + this.field_1756_h) + var4)));
GL11.glEndList();
this.MarkDirty();
}

View File

@ -14,53 +14,42 @@ public class ChunkLoader implements IChunkLoader {
this.createIfNecessary = var2;
}
private String chunkFileForXZ(int var1, int var2) {
private String chunkFileForXZ_OLD(int var1, int var2) {
String var3 = "c." + Integer.toString(var1, 36) + "." + Integer.toString(var2, 36) + ".dat";
String var4 = Integer.toString(var1 & 63, 36);
String var5 = Integer.toString(var2 & 63, 36);
String var6;
if(saveDir.endsWith("/")) {
var6 = saveDir + var4;
String var6 = saveDir + "/" + var4 + "/" + var5 + "/" + var3;
if(GL11.readFile(var6) != null) {
return var6;
} else {
var6 = saveDir + "/" + var4;
}
byte[] data = GL11.readFile(var6);
if(data == null) {
if(!this.createIfNecessary) {
return null;
}
GL11.writeFile(var6, new byte[0]);
}
if(var6.endsWith("/")) {
var6 = var6 + var5;
} else {
var6 = var6 + "/" + var5;
public static final String CHUNK_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
public String chunkFileForXZ(int x, int z) {
boolean oldChunk = false;
String oldChunkPath = chunkFileForXZ_OLD(x, z);
if(oldChunkPath != null) {
oldChunk = true;
}
data = null;
data = GL11.readFile(var6);
if(data == null) {
if(!this.createIfNecessary) {
return null;
int unsignedX = x + 30233088;
int unsignedZ = z + 30233088;
int radix = CHUNK_CHARS.length();
char[] path = new char[10];
for(int i = 0; i < 5; ++i) {
path[i * 2] = CHUNK_CHARS.charAt(unsignedX % radix);
unsignedX /= radix;
path[i * 2 + 1] = CHUNK_CHARS.charAt(unsignedZ % radix);
unsignedZ /= radix;
}
GL11.writeFile(var6, new byte[0]);
String s = this.saveDir + "/" + new String(path);
if(oldChunk) {
GL11.renameFile(oldChunkPath, s);
}
if(var6.endsWith("/")) {
var6 = var6 + var3;
} else {
var6 = var6 + "/" + var3;
}
data = null;
data = GL11.readFile(var6);
return data == null && !this.createIfNecessary ? null : var6;
return s;
}
public Chunk loadChunk(World var1, int var2, int var3) throws IOException {

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.