Rewrite Chunk Storage, fix water, reduce lag
This commit is contained in:
parent
eca31d4823
commit
5094081717
File diff suppressed because one or more lines are too long
|
@ -1,96 +0,0 @@
|
|||
package net.PeytonPlayz585.io;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||
|
||||
public class File {
|
||||
|
||||
private String path;
|
||||
|
||||
public File(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public File(String parent, String child) {
|
||||
this.path = parent + "/" + child;
|
||||
}
|
||||
|
||||
public File(File parent, String child) {
|
||||
this.path = parent.getPath() + "/" + child;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public boolean exists() {
|
||||
byte[] data = LWJGLMain.readFile(path);
|
||||
if(data == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean mkdirs() {
|
||||
String[] directories = path.split("/");
|
||||
String currentPath = "";
|
||||
|
||||
for (String directory : directories) {
|
||||
currentPath += directory + "/";
|
||||
if (!LWJGLMain.directoryExists(currentPath) && !LWJGLMain.pathExists(currentPath)) {
|
||||
LWJGLMain.writeFile(currentPath, new byte[0]);
|
||||
if(LWJGLMain.readFile(currentPath) == null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean mkdir() {
|
||||
if (!LWJGLMain.listFiles(path, false, false).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LWJGLMain.writeFile(path, new byte[0]);
|
||||
if(LWJGLMain.readFile(path) != null) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] getBytes() {
|
||||
return LWJGLMain.readFile(path);
|
||||
}
|
||||
|
||||
public void writeBytes(byte[] data) {
|
||||
LWJGLMain.writeFile(path, data);
|
||||
}
|
||||
|
||||
public long length() {
|
||||
return LWJGLMain.getFileSize(path);
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
if(exists()) {
|
||||
LWJGLMain.deleteFile(path);
|
||||
}
|
||||
}
|
||||
|
||||
public File[] listFiles() {
|
||||
Collection<LWJGLMain.FileEntry> fileEntries = LWJGLMain.listFiles(path, false, false);
|
||||
File[] files = new File[fileEntries.size()];
|
||||
int i = 0;
|
||||
for (LWJGLMain.FileEntry fileEntry : fileEntries) {
|
||||
files[i++] = new File(fileEntry.path);
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
public void renameTo(File var4) {
|
||||
LWJGLMain.renameFile(path, var4.getPath());
|
||||
}
|
||||
}
|
24
src/main/java/net/PeytonPlayz585/io/FileSystemUtils.java
Normal file
24
src/main/java/net/PeytonPlayz585/io/FileSystemUtils.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
package net.PeytonPlayz585.io;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||
|
||||
public class FileSystemUtils {
|
||||
|
||||
public static void recursiveDeleteDirectory(String dir) {
|
||||
Collection<LWJGLMain.FileEntry> lst = LWJGLMain.listFiles(dir, true, true);
|
||||
for(LWJGLMain.FileEntry t : lst) {
|
||||
if(!t.isDirectory) {
|
||||
LWJGLMain.deleteFile(t.path);
|
||||
}
|
||||
}
|
||||
for(LWJGLMain.FileEntry t : lst) {
|
||||
if(t.isDirectory) {
|
||||
LWJGLMain.deleteFile(t.path);
|
||||
}
|
||||
}
|
||||
LWJGLMain.deleteFile(dir);
|
||||
}
|
||||
|
||||
}
|
|
@ -182,7 +182,7 @@ public abstract class BlockFluid extends Block {
|
|||
}
|
||||
|
||||
public int getRenderBlockPass() {
|
||||
return this.blockMaterial == Material.water ? 1 : 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
|
|
|
@ -1,61 +1,69 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.PeytonPlayz585.io.File;
|
||||
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||
|
||||
public class ChunkLoader implements IChunkLoader {
|
||||
private File saveDir;
|
||||
private boolean createIfNecessary;
|
||||
|
||||
public ChunkLoader(File var1, boolean var2) {
|
||||
this.saveDir = var1;
|
||||
this.createIfNecessary = var2;
|
||||
private String saveDir;
|
||||
|
||||
public ChunkLoader(String dir) {
|
||||
saveDir = dir;
|
||||
}
|
||||
|
||||
private File chunkFileForXZ(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);
|
||||
File var6 = new File(this.saveDir, var4);
|
||||
if(!var6.exists()) {
|
||||
if(!this.createIfNecessary) {
|
||||
return null;
|
||||
}
|
||||
public static final String CHUNK_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
var6.mkdir();
|
||||
private String chunkFileForXZ(int x, int z) {
|
||||
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;
|
||||
}
|
||||
|
||||
var6 = new File(var6, var5);
|
||||
if(!var6.exists()) {
|
||||
if(!this.createIfNecessary) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var6.mkdir();
|
||||
}
|
||||
|
||||
var6 = new File(var6, var3);
|
||||
return !var6.exists() && !this.createIfNecessary ? null : var6;
|
||||
return new String(path);
|
||||
}
|
||||
|
||||
public Chunk loadChunk(World var1, int var2, int var3) {
|
||||
File var4 = this.chunkFileForXZ(var2, var3);
|
||||
if(var4 != null && var4.exists()) {
|
||||
public Chunk loadChunk(World var1, int x, int z) {
|
||||
String name = chunkFileForXZ(x, z);
|
||||
String path = saveDir + "/" + name;
|
||||
byte[] dat = LWJGLMain.readFile(path);
|
||||
if(dat != null) {
|
||||
try {
|
||||
NBTTagCompound var6 = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(var4.getBytes())));
|
||||
return loadChunkIntoWorldFromCompound(var1, var6.getCompoundTag("Level"));
|
||||
} catch (Exception var7) {
|
||||
var7.printStackTrace();
|
||||
}
|
||||
}
|
||||
NBTTagCompound nbt = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(dat)));
|
||||
int xx = nbt.getInteger("xPos");
|
||||
int zz = nbt.getInteger("zPos");
|
||||
if(x != xx || z != zz) {
|
||||
String name2 = chunkFileForXZ(xx, zz);
|
||||
System.err.println("The chunk file '" + name + "' was supposed to be at [" + x + ", " + z + "], but the file contained a chunk from [" + xx + ", " + zz +
|
||||
"]. It's data will be moved to file '" + name2 + "', and a new empty chunk will be created for file '" + name + "' for [" + x + ", " + z + "]");
|
||||
LWJGLMain.renameFile(path, saveDir + "/" + name2);
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
return loadChunkIntoWorldFromCompound(var1, nbt);
|
||||
} catch (IOException e) {
|
||||
System.err.println("Corrupt chunk '" + name + "' was found at: [" + x + ", " + z + "]");
|
||||
System.err.println("The file will be deleted");
|
||||
LWJGLMain.deleteFile(path);
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void saveChunk(World var1, Chunk var2) {
|
||||
File var3 = this.chunkFileForXZ(var2.xPosition, var2.zPosition);
|
||||
NBTTagCompound toSave = new NBTTagCompound();
|
||||
storeChunkInCompound(var2, var1, toSave);
|
||||
ByteArrayOutputStream bao = new ByteArrayOutputStream(131072);
|
||||
|
@ -66,7 +74,7 @@ public class ChunkLoader implements IChunkLoader {
|
|||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
var3.writeBytes(bao.toByteArray());
|
||||
LWJGLMain.writeFile(saveDir + "/" + chunkFileForXZ(var2.xPosition, var2.zPosition), bao.toByteArray());
|
||||
}
|
||||
|
||||
public void storeChunkInCompound(Chunk var1, World var2, NBTTagCompound var3) {
|
||||
|
@ -82,33 +90,33 @@ public class ChunkLoader implements IChunkLoader {
|
|||
var1.hasEntities = false;
|
||||
NBTTagList var4 = new NBTTagList();
|
||||
|
||||
Iterator var6;
|
||||
NBTTagCompound var8;
|
||||
for(int var5 = 0; var5 < var1.entities.length; ++var5) {
|
||||
var6 = var1.entities[var5].iterator();
|
||||
|
||||
while(var6.hasNext()) {
|
||||
Entity var7 = (Entity)var6.next();
|
||||
var1.hasEntities = true;
|
||||
var8 = new NBTTagCompound();
|
||||
if(var7.addEntityID(var8)) {
|
||||
var4.setTag(var8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var3.setTag("Entities", var4);
|
||||
NBTTagList var9 = new NBTTagList();
|
||||
var6 = var1.chunkTileEntityMap.values().iterator();
|
||||
|
||||
while(var6.hasNext()) {
|
||||
TileEntity var10 = (TileEntity)var6.next();
|
||||
var8 = new NBTTagCompound();
|
||||
var10.writeToNBT(var8);
|
||||
var9.setTag(var8);
|
||||
}
|
||||
|
||||
var3.setTag("TileEntities", var9);
|
||||
// Iterator var6;
|
||||
// NBTTagCompound var8;
|
||||
// for(int var5 = 0; var5 < var1.entities.length; ++var5) {
|
||||
// var6 = var1.entities[var5].iterator();
|
||||
//
|
||||
// while(var6.hasNext()) {
|
||||
// Entity var7 = (Entity)var6.next();
|
||||
// var1.hasEntities = true;
|
||||
// var8 = new NBTTagCompound();
|
||||
// if(var7.addEntityID(var8)) {
|
||||
// var4.setTag(var8);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// var3.setTag("Entities", var4);
|
||||
// NBTTagList var9 = new NBTTagList();
|
||||
// var6 = var1.chunkTileEntityMap.values().iterator();
|
||||
//
|
||||
// while(var6.hasNext()) {
|
||||
// TileEntity var10 = (TileEntity)var6.next();
|
||||
// var8 = new NBTTagCompound();
|
||||
// var10.writeToNBT(var8);
|
||||
// var9.setTag(var8);
|
||||
// }
|
||||
//
|
||||
// var3.setTag("TileEntities", var9);
|
||||
}
|
||||
|
||||
public static Chunk loadChunkIntoWorldFromCompound(World var0, NBTTagCompound var1) {
|
||||
|
@ -136,28 +144,28 @@ public class ChunkLoader implements IChunkLoader {
|
|||
var4.doNothing();
|
||||
}
|
||||
|
||||
NBTTagList var5 = var1.getTagList("Entities");
|
||||
if(var5 != null) {
|
||||
for(int var6 = 0; var6 < var5.tagCount(); ++var6) {
|
||||
NBTTagCompound var7 = (NBTTagCompound)var5.tagAt(var6);
|
||||
Entity var8 = EntityList.createEntityFromNBT(var7, var0);
|
||||
var4.hasEntities = true;
|
||||
if(var8 != null) {
|
||||
var4.addEntity(var8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagList var10 = var1.getTagList("TileEntities");
|
||||
if(var10 != null) {
|
||||
for(int var11 = 0; var11 < var10.tagCount(); ++var11) {
|
||||
NBTTagCompound var12 = (NBTTagCompound)var10.tagAt(var11);
|
||||
TileEntity var9 = TileEntity.createAndLoadEntity(var12);
|
||||
if(var9 != null) {
|
||||
var4.addTileEntity(var9);
|
||||
}
|
||||
}
|
||||
}
|
||||
// NBTTagList var5 = var1.getTagList("Entities");
|
||||
// if(var5 != null) {
|
||||
// for(int var6 = 0; var6 < var5.tagCount(); ++var6) {
|
||||
// NBTTagCompound var7 = (NBTTagCompound)var5.tagAt(var6);
|
||||
// Entity var8 = EntityList.createEntityFromNBT(var7, var0);
|
||||
// var4.hasEntities = true;
|
||||
// if(var8 != null) {
|
||||
// var4.addEntity(var8);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// NBTTagList var10 = var1.getTagList("TileEntities");
|
||||
// if(var10 != null) {
|
||||
// for(int var11 = 0; var11 < var10.tagCount(); ++var11) {
|
||||
// NBTTagCompound var12 = (NBTTagCompound)var10.tagAt(var11);
|
||||
// TileEntity var9 = TileEntity.createAndLoadEntity(var12);
|
||||
// if(var9 != null) {
|
||||
// var4.addTileEntity(var9);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return var4;
|
||||
}
|
||||
|
|
|
@ -727,20 +727,19 @@ public abstract class Entity {
|
|||
}
|
||||
|
||||
public void turn(float var1, float var2) {
|
||||
float var3 = this.rotationPitch;
|
||||
float var4 = this.rotationYaw;
|
||||
this.rotationYaw = (float)((double)this.rotationYaw + (double)var1 * 0.15D);
|
||||
this.rotationPitch = (float)((double)this.rotationPitch - (double)var2 * 0.15D);
|
||||
float var3 = this.rotationPitch;
|
||||
float var4 = this.rotationYaw;
|
||||
this.rotationYaw = (float)((double)this.rotationYaw + (double)var1 * 0.15D);
|
||||
this.rotationPitch = (float)((double)this.rotationPitch - (double)var2 * 0.15D);
|
||||
if(this.rotationPitch < -90.0F) {
|
||||
this.rotationPitch = -90.0F;
|
||||
}
|
||||
|
||||
if(this.rotationPitch < -90.0F) {
|
||||
this.rotationPitch = -90.0F;
|
||||
}
|
||||
if(this.rotationPitch > 90.0F) {
|
||||
this.rotationPitch = 90.0F;
|
||||
}
|
||||
|
||||
if(this.rotationPitch > 90.0F) {
|
||||
this.rotationPitch = 90.0F;
|
||||
}
|
||||
|
||||
this.prevRotationPitch += this.rotationPitch - var3;
|
||||
this.prevRotationYaw += this.rotationYaw - var4;
|
||||
}
|
||||
this.prevRotationPitch += this.rotationPitch - var3;
|
||||
this.prevRotationYaw += this.rotationYaw - var4;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -292,17 +292,18 @@ public class EntityRenderer {
|
|||
// }
|
||||
|
||||
int var5 = Mouse.getDX();
|
||||
int var6 = Mouse.getDY();
|
||||
int var6 = Mouse.getDY();;
|
||||
byte var91 = 1;
|
||||
|
||||
if(this.mc.gameSettings.invertMouse) {
|
||||
var91 = -1;
|
||||
}
|
||||
|
||||
if(this.mc.inGameHasFocus) {
|
||||
this.mc.thePlayer.turn((float)var5, (float)(var6 & var91));
|
||||
if(this.mc.inGameHasFocus && this.mc.theWorld != null) {
|
||||
this.mc.thePlayer.turn((float)var5, (float)(var6 * var91));
|
||||
}
|
||||
|
||||
|
||||
if(!this.mc.skipRenderWorld) {
|
||||
ScaledResolution var7 = new ScaledResolution(this.mc.displayWidth, this.mc.displayHeight);
|
||||
var3 = var7.getScaledWidth();
|
||||
|
@ -389,24 +390,24 @@ public class EntityRenderer {
|
|||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
|
||||
if(this.mc.gameSettings.fancyGraphics) {
|
||||
GL11.glColorMask(false, false, false, false);
|
||||
int var13 = var3.sortAndRender(var2, 1, (double)var1);
|
||||
GL11.glColorMask(true, true, true, true);
|
||||
if(this.mc.gameSettings.anaglyph) {
|
||||
if(var11 == 0) {
|
||||
GL11.glColorMask(false, true, true, false);
|
||||
} else {
|
||||
GL11.glColorMask(true, false, false, false);
|
||||
}
|
||||
}
|
||||
//if(this.mc.gameSettings.fancyGraphics) {
|
||||
//GL11.glColorMask(false, false, false, false);
|
||||
//int var13 = var3.sortAndRender(var2, 1, (double)var1);
|
||||
//GL11.glColorMask(true, true, true, true);
|
||||
//if(this.mc.gameSettings.anaglyph) {
|
||||
//if(var11 == 0) {
|
||||
//GL11.glColorMask(false, true, true, false);
|
||||
//} else {
|
||||
//GL11.glColorMask(true, false, false, false);
|
||||
//}
|
||||
//}
|
||||
|
||||
if(var13 > 0) {
|
||||
var3.renderAllRenderLists(1, (double)var1);
|
||||
}
|
||||
} else {
|
||||
var3.sortAndRender(var2, 1, (double)var1);
|
||||
}
|
||||
//if(var13 > 0) {
|
||||
var3.sortAndRender(var2, 1, (double)var1);
|
||||
//}
|
||||
//} else {
|
||||
//var3.sortAndRender(var2, 1, (double)var1);
|
||||
//}
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
enum EnumOS {
|
||||
linux,
|
||||
solaris,
|
||||
windows,
|
||||
macos,
|
||||
unknown;
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
enum EnumOSIsom {
|
||||
linux,
|
||||
solaris,
|
||||
windows,
|
||||
macos,
|
||||
unknown;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.PeytonPlayz585.io.File;
|
||||
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||
|
||||
public class GuiCreateWorld extends GuiScreen {
|
||||
protected GuiScreen parentGuiScreen;
|
||||
|
@ -12,16 +12,14 @@ public class GuiCreateWorld extends GuiScreen {
|
|||
}
|
||||
|
||||
public void initGui() {
|
||||
File var1 = Minecraft.getMinecraftDir();
|
||||
|
||||
for(int var2 = 0; var2 < 5; ++var2) {
|
||||
NBTTagCompound var3 = World.getLevelData(var1, "World" + (var2 + 1));
|
||||
NBTTagCompound var3 = World.getLevelData("World" + (var2 + 1));
|
||||
if(var3 == null) {
|
||||
this.controlList.add(new GuiButton(var2, this.width / 2 - 100, this.height / 6 + 24 * var2, "- empty -"));
|
||||
} else {
|
||||
String var4 = "World " + (var2 + 1);
|
||||
long var5 = var3.getLong("SizeOnDisk");
|
||||
var4 = var4 + " (" + (float)(var5 / 1024L * 100L / 1024L) / 100.0F + " MB)";
|
||||
double var5 = LWJGLMain.getFileSize("World" + (var2 + 1) + "/level.dat");
|
||||
var4 = var4 + " (" + (double) var5 / 100 + " MB)";
|
||||
this.controlList.add(new GuiButton(var2, this.width / 2 - 100, this.height / 6 + 24 * var2, var4));
|
||||
}
|
||||
}
|
||||
|
@ -30,8 +28,7 @@ public class GuiCreateWorld extends GuiScreen {
|
|||
}
|
||||
|
||||
protected String getSaveFileName(int var1) {
|
||||
File var2 = Minecraft.getMinecraftDir();
|
||||
return World.getLevelData(var2, "World" + var1) != null ? "World" + var1 : null;
|
||||
return World.getLevelData("World" + var1) != null ? "World" + var1 : null;
|
||||
}
|
||||
|
||||
public void initButtons() {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.PeytonPlayz585.io.File;
|
||||
|
||||
public class GuiDeleteWorld extends GuiCreateWorld {
|
||||
public GuiDeleteWorld(GuiScreen var1) {
|
||||
super(var1);
|
||||
|
@ -22,8 +20,7 @@ public class GuiDeleteWorld extends GuiCreateWorld {
|
|||
|
||||
public void deleteWorld(boolean var1, int var2) {
|
||||
if(var1) {
|
||||
File var3 = Minecraft.getMinecraftDir();
|
||||
World.deleteWorld(var3, this.getSaveFileName(var2));
|
||||
World.deleteWorld(this.getSaveFileName(var2));
|
||||
}
|
||||
|
||||
this.mc.displayGuiScreen(this.parentGuiScreen);
|
||||
|
|
|
@ -1,23 +1,30 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class MathHelper {
|
||||
private static final float[] SIN_TABLE = new float[65536];
|
||||
private static final float SIN_CONVERSION_FACTOR = 10430.378F;
|
||||
private static final float COS_CONVERSION_FACTOR = 16384.0F;
|
||||
private static final float INVERSE_SIN_TABLE_LENGTH = 1.0F / SIN_TABLE.length;
|
||||
private static final float[] SIN_TABLE = new float[4096];
|
||||
|
||||
static {
|
||||
for (int i = 0; i < SIN_TABLE.length; ++i) {
|
||||
SIN_TABLE[i] = (float) Math.sin(i * 2 * Math.PI * INVERSE_SIN_TABLE_LENGTH);
|
||||
static {
|
||||
for (int j = 0; j < 4096; ++j) {
|
||||
SIN_TABLE[j] = (float)Math.sin((double)(((float)j + 0.5F) / 4096.0F * ((float)Math.PI * 2F)));
|
||||
}
|
||||
|
||||
for (int l = 0; l < 360; l += 90) {
|
||||
SIN_TABLE[(int)((float)l * 11.377778F) & 4095] = (float)Math.sin((double)((float)l * 0.017453292F));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sin looked up in a table
|
||||
*/
|
||||
public static float sin(float p_76126_0_) {
|
||||
return SIN_TABLE[(int)(p_76126_0_ * 651.8986F) & 4095];
|
||||
}
|
||||
|
||||
public static final float sin(float var0) {
|
||||
return SIN_TABLE[(int) (var0 * SIN_CONVERSION_FACTOR) & 65535];
|
||||
}
|
||||
|
||||
public static final float cos(float var0) {
|
||||
return SIN_TABLE[(int) (var0 * SIN_CONVERSION_FACTOR + COS_CONVERSION_FACTOR) & 65535];
|
||||
/**
|
||||
* cos looked up in the sin table with the appropriate offset
|
||||
*/
|
||||
public static float cos(float value) {
|
||||
return SIN_TABLE[(int)((value + ((float)Math.PI / 2F)) * 651.8986F) & 4095];
|
||||
}
|
||||
|
||||
public static final float sqrt_float(float var0) {
|
||||
|
|
|
@ -5,13 +5,10 @@ import org.lwjgl.input.Keyboard;
|
|||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.Display;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.PeytonPlayz585.io.File;
|
||||
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||
|
||||
public class Minecraft implements Runnable {
|
||||
public PlayerController playerController = new PlayerControllerSP(this);
|
||||
private boolean fullscreen = false;
|
||||
public int displayWidth;
|
||||
public int displayHeight;
|
||||
private Timer timer = new Timer(20.0F);
|
||||
|
@ -29,8 +26,6 @@ public class Minecraft implements Runnable {
|
|||
public EntityRenderer entityRenderer = new EntityRenderer(this);
|
||||
private int ticksRan = 0;
|
||||
private int leftClickCounter = 0;
|
||||
private int tempDisplayWidth;
|
||||
private int tempDisplayHeight;
|
||||
public String objectMouseOverString = null;
|
||||
public int rightClickDelayTimer = 0;
|
||||
public GuiIngame ingameGUI;
|
||||
|
@ -38,14 +33,11 @@ public class Minecraft implements Runnable {
|
|||
public ModelBiped playerModelBiped = new ModelBiped(0.0F);
|
||||
public MovingObjectPosition objectMouseOver = null;
|
||||
public GameSettings gameSettings;
|
||||
//public SoundManager sndManager = new SoundManager();
|
||||
public MouseHelper mouseHelper;
|
||||
public File mcDataDir;
|
||||
public static long[] tickTimes = new long[512];
|
||||
public static int numRecordedFrameTimes = 0;
|
||||
private TextureWaterFX textureWaterFX = new TextureWaterFX();
|
||||
private TextureLavaFX textureLavaFX = new TextureLavaFX();
|
||||
private static File minecraftDir = null;
|
||||
volatile boolean running = true;
|
||||
public String debug = "";
|
||||
long prevFrameTime = -1L;
|
||||
|
@ -55,20 +47,15 @@ public class Minecraft implements Runnable {
|
|||
long systemTime = System.currentTimeMillis();
|
||||
|
||||
public Minecraft(int var4, int var5, boolean var6) {
|
||||
this.tempDisplayWidth = var4;
|
||||
this.tempDisplayHeight = var5;
|
||||
this.fullscreen = var6;
|
||||
new ThreadSleepForever(this, "Timer hack thread");
|
||||
this.displayWidth = var4;
|
||||
this.displayHeight = var5;
|
||||
this.fullscreen = var6;
|
||||
}
|
||||
|
||||
public void setServer(String var1, int var2) {
|
||||
}
|
||||
|
||||
public void startGame() throws LWJGLException {
|
||||
this.mcDataDir = getMinecraftDir();
|
||||
this.gameSettings = new GameSettings(this);
|
||||
this.renderEngine = new RenderEngine(this.gameSettings);
|
||||
this.fontRenderer = new FontRenderer(this.gameSettings, "/default.png", this.renderEngine);
|
||||
|
@ -136,44 +123,6 @@ public class Minecraft implements Runnable {
|
|||
this.fontRenderer.drawStringWithShadow("Loading...", 8, this.displayHeight / 2 - 16, -1);
|
||||
}
|
||||
|
||||
public static File getMinecraftDir() {
|
||||
if(minecraftDir == null) {
|
||||
minecraftDir = getAppDir("minecraft");
|
||||
}
|
||||
|
||||
return minecraftDir;
|
||||
}
|
||||
|
||||
public static File getAppDir(String var0) {
|
||||
String var1 = System.getProperty("user.home", ".");
|
||||
File var2;
|
||||
switch(OSMap.osValues[getOs().ordinal()]) {
|
||||
case 1:
|
||||
case 2:
|
||||
var2 = new File(var1, '.' + var0 + '/');
|
||||
break;
|
||||
case 3:
|
||||
var2 = new File(var1, '.' + var0 + '/');
|
||||
break;
|
||||
case 4:
|
||||
var2 = new File(var1, "Library/Application Support/" + var0);
|
||||
break;
|
||||
default:
|
||||
var2 = new File(var1, var0 + '/');
|
||||
}
|
||||
|
||||
if(!var2.exists() && !var2.mkdirs()) {
|
||||
throw new RuntimeException("The working directory could not be created: " + var2);
|
||||
} else {
|
||||
return var2;
|
||||
}
|
||||
}
|
||||
|
||||
private static EnumOS getOs() {
|
||||
String var0 = System.getProperty("os.name").toLowerCase();
|
||||
return var0.contains("win") ? EnumOS.windows : (var0.contains("mac") ? EnumOS.macos : (var0.contains("solaris") ? EnumOS.solaris : (var0.contains("sunos") ? EnumOS.solaris : (var0.contains("linux") ? EnumOS.linux : (var0.contains("unix") ? EnumOS.linux : EnumOS.unknown)))));
|
||||
}
|
||||
|
||||
public void displayGuiScreen(GuiScreen var1) {
|
||||
if(!(this.currentScreen instanceof GuiErrorScreen)) {
|
||||
if(this.currentScreen != null) {
|
||||
|
@ -357,7 +306,7 @@ public class Minecraft implements Runnable {
|
|||
var9 = var9 * var9 / 255;
|
||||
int var10 = var9 * var9 / 255;
|
||||
var10 = var10 * var10 / 255;
|
||||
var3.setColorOpaque_I(-16777216 + var10 + var9 * 256 + var8 * 65536);
|
||||
var3.setColorOpaque_I(-16777216 + var10 + var9 * 256 + var8 * 4096);
|
||||
long var11 = tickTimes[var7] / 200000L;
|
||||
var3.addVertex((double)((float)var7 + 0.5F), (double)((float)((long)this.displayHeight - var11) + 0.5F), 0.0D);
|
||||
var3.addVertex((double)((float)var7 + 0.5F), (double)((float)this.displayHeight + 0.5F), 0.0D);
|
||||
|
@ -699,7 +648,7 @@ public class Minecraft implements Runnable {
|
|||
public void startWorld(String var1) {
|
||||
this.changeWorld1((World)null);
|
||||
System.gc();
|
||||
World var2 = new World(new File(getMinecraftDir(), "saves"), var1);
|
||||
World var2 = new World(var1);
|
||||
if(var2.isNewWorld) {
|
||||
this.changeWorld2(var2, "Generating level");
|
||||
} else {
|
||||
|
@ -798,20 +747,6 @@ public class Minecraft implements Runnable {
|
|||
BlockSand.fallInstantly = false;
|
||||
}
|
||||
|
||||
public void installResource(String var1, File var2) {
|
||||
int var3 = var1.indexOf("/");
|
||||
String var4 = var1.substring(0, var3);
|
||||
var1 = var1.substring(var3 + 1);
|
||||
if(var4.equalsIgnoreCase("sound")) {
|
||||
//this.sndManager.addSound(var1, var2);
|
||||
} else if(var4.equalsIgnoreCase("newsound")) {
|
||||
//this.sndManager.addSound(var1, var2);
|
||||
} else if(var4.equalsIgnoreCase("music")) {
|
||||
//this.sndManager.addMusic(var1, var2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String debugInfoRenders() {
|
||||
return this.renderGlobal.getDebugInfoRenders();
|
||||
}
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
class OSMap {
|
||||
static final int[] osValues = new int[EnumOS.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
osValues[EnumOS.linux.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError var4) {
|
||||
}
|
||||
|
||||
try {
|
||||
osValues[EnumOS.solaris.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError var3) {
|
||||
}
|
||||
|
||||
try {
|
||||
osValues[EnumOS.windows.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError var2) {
|
||||
}
|
||||
|
||||
try {
|
||||
osValues[EnumOS.macos.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError var1) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
class OSMapIsom {
|
||||
static final int[] osValues = new int[EnumOSIsom.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
osValues[EnumOSIsom.linux.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError var4) {
|
||||
}
|
||||
|
||||
try {
|
||||
osValues[EnumOSIsom.solaris.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError var3) {
|
||||
}
|
||||
|
||||
try {
|
||||
osValues[EnumOSIsom.windows.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError var2) {
|
||||
}
|
||||
|
||||
try {
|
||||
osValues[EnumOSIsom.macos.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError var1) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -8,8 +8,8 @@ public class PlayerControllerSP extends PlayerController {
|
|||
private float prevBlockDamage = 0.0F;
|
||||
private float blockDestroySoundCounter = 0.0F;
|
||||
private int blockHitWait = 0;
|
||||
//private SpawnerAnimals monsterSpawner = new SpawnerMonsters(this, 100, EntityMonster.class, new Class[]{EntityZombie.class, EntitySkeleton.class, EntityCreeper.class, EntitySpider.class});
|
||||
//private SpawnerAnimals animalSpawner = new SpawnerAnimals(20, EntityAnimal.class, new Class[]{EntitySheep.class, EntityPig.class});
|
||||
private SpawnerAnimals monsterSpawner = new SpawnerMonsters(this, 100, EntityMonster.class, new Class[]{EntityZombie.class, EntitySkeleton.class, EntityCreeper.class, EntitySpider.class});
|
||||
private SpawnerAnimals animalSpawner = new SpawnerAnimals(20, EntityAnimal.class, new Class[]{EntitySheep.class, EntityPig.class});
|
||||
|
||||
public PlayerControllerSP(Minecraft var1) {
|
||||
super(var1);
|
||||
|
@ -118,7 +118,7 @@ public class PlayerControllerSP extends PlayerController {
|
|||
|
||||
public void onUpdate() {
|
||||
this.prevBlockDamage = this.curBlockDamage;
|
||||
//this.monsterSpawner.onUpdate(this.mc.theWorld);
|
||||
//this.animalSpawner.onUpdate(this.mc.theWorld);
|
||||
this.monsterSpawner.onUpdate(this.mc.theWorld);
|
||||
this.animalSpawner.onUpdate(this.mc.theWorld);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,45 +61,45 @@ public abstract class Render {
|
|||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
private void renderShadow(Entity var1, double var2, double var4, double var6, float var8, float var9) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
RenderEngine var10 = this.renderManager.renderEngine;
|
||||
var10.bindTexture(var10.getTexture("%%/shadow.png"));
|
||||
World var11 = this.getWorldFromRenderManager();
|
||||
GL11.glDepthMask(false);
|
||||
float var12 = this.shadowSize;
|
||||
double var13 = var1.lastTickPosX + (var1.posX - var1.lastTickPosX) * (double)var9;
|
||||
double var15 = var1.lastTickPosY + (var1.posY - var1.lastTickPosY) * (double)var9;
|
||||
double var17 = var1.lastTickPosZ + (var1.posZ - var1.lastTickPosZ) * (double)var9;
|
||||
int var19 = MathHelper.floor_double(var13 - (double)var12);
|
||||
int var20 = MathHelper.floor_double(var13 + (double)var12);
|
||||
int var21 = MathHelper.floor_double(var15 - (double)var12);
|
||||
int var22 = MathHelper.floor_double(var15);
|
||||
int var23 = MathHelper.floor_double(var17 - (double)var12);
|
||||
int var24 = MathHelper.floor_double(var17 + (double)var12);
|
||||
double var25 = var2 - var13;
|
||||
double var27 = var4 - var15;
|
||||
double var29 = var6 - var17;
|
||||
Tessellator var31 = Tessellator.instance;
|
||||
var31.startDrawingQuads();
|
||||
|
||||
for(int var32 = var19; var32 <= var20; ++var32) {
|
||||
for(int var33 = var21; var33 <= var22; ++var33) {
|
||||
for(int var34 = var23; var34 <= var24; ++var34) {
|
||||
int var35 = var11.getBlockId(var32, var33 - 1, var34);
|
||||
if(var35 > 0 && var11.getBlockLightValue(var32, var33, var34) > 3) {
|
||||
this.renderShadowOnBlock(Block.blocksList[var35], var2, var4, var6, var32, var33, var34, var8, var12, var25, var27, var29);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var31.draw();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(true);
|
||||
}
|
||||
// private void renderShadow(Entity var1, double var2, double var4, double var6, float var8, float var9) {
|
||||
// GL11.glEnable(GL11.GL_BLEND);
|
||||
// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
// RenderEngine var10 = this.renderManager.renderEngine;
|
||||
// var10.bindTexture(var10.getTexture("%%/shadow.png"));
|
||||
// World var11 = this.getWorldFromRenderManager();
|
||||
// GL11.glDepthMask(false);
|
||||
// float var12 = this.shadowSize;
|
||||
// double var13 = var1.lastTickPosX + (var1.posX - var1.lastTickPosX) * (double)var9;
|
||||
// double var15 = var1.lastTickPosY + (var1.posY - var1.lastTickPosY) * (double)var9;
|
||||
// double var17 = var1.lastTickPosZ + (var1.posZ - var1.lastTickPosZ) * (double)var9;
|
||||
// int var19 = MathHelper.floor_double(var13 - (double)var12);
|
||||
// int var20 = MathHelper.floor_double(var13 + (double)var12);
|
||||
// int var21 = MathHelper.floor_double(var15 - (double)var12);
|
||||
// int var22 = MathHelper.floor_double(var15);
|
||||
// int var23 = MathHelper.floor_double(var17 - (double)var12);
|
||||
// int var24 = MathHelper.floor_double(var17 + (double)var12);
|
||||
// double var25 = var2 - var13;
|
||||
// double var27 = var4 - var15;
|
||||
// double var29 = var6 - var17;
|
||||
// Tessellator var31 = Tessellator.instance;
|
||||
// var31.startDrawingQuads();
|
||||
//
|
||||
// for(int var32 = var19; var32 <= var20; ++var32) {
|
||||
// for(int var33 = var21; var33 <= var22; ++var33) {
|
||||
// for(int var34 = var23; var34 <= var24; ++var34) {
|
||||
// int var35 = var11.getBlockId(var32, var33 - 1, var34);
|
||||
// if(var35 > 0 && var11.getBlockLightValue(var32, var33, var34) > 3) {
|
||||
// this.renderShadowOnBlock(Block.blocksList[var35], var2, var4, var6, var32, var33, var34, var8, var12, var25, var27, var29);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// var31.draw();
|
||||
// GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// GL11.glDisable(GL11.GL_BLEND);
|
||||
// GL11.glDepthMask(true);
|
||||
// }
|
||||
|
||||
private World getWorldFromRenderManager() {
|
||||
return this.renderManager.worldObj;
|
||||
|
@ -212,7 +212,7 @@ public abstract class Render {
|
|||
double var10 = this.renderManager.getDistanceToCamera(var1.posX, var1.posY, var1.posZ);
|
||||
float var12 = (float)((1.0D - var10 / 256.0D) * (double)this.shadowOpaque);
|
||||
if(var12 > 0.0F) {
|
||||
this.renderShadow(var1, var2, var4, var6, var12, var9);
|
||||
//this.renderShadow(var1, var2, var4, var6, var12, var9);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,18 +34,14 @@ public class RenderEngine {
|
|||
singleIntBuffer.clear();
|
||||
GLAllocation.generateTextureNames(singleIntBuffer);
|
||||
int i = singleIntBuffer.get(0);
|
||||
if (s.startsWith("%clamp%")) {
|
||||
if (s.startsWith("%%")) {
|
||||
clampTexture = true;
|
||||
setupTexture(readTextureImage(LWJGLMain.loadResourceBytes(s.substring(7))), i);
|
||||
clampTexture = false;
|
||||
} else if (s.startsWith("%blur%")) {
|
||||
blurTexture = true;
|
||||
setupTexture(readTextureImage(LWJGLMain.loadResourceBytes(s.substring(6))), i);
|
||||
blurTexture = false;
|
||||
} else {
|
||||
if(s.equals("/terrain.png")) {
|
||||
useMipmaps = true;
|
||||
}
|
||||
//if(s.equals("/terrain.png")) {
|
||||
//useMipmaps = true;
|
||||
//}
|
||||
setupTexture(readTextureImage(LWJGLMain.loadResourceBytes(s)), i);
|
||||
useMipmaps = false;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class RenderGlobal implements IWorldAccess {
|
|||
private int renderersBeingRendered;
|
||||
private int renderersSkippingRenderPass;
|
||||
private List glRenderLists = new ArrayList();
|
||||
private RenderList[] allRenderLists = new RenderList[]{new RenderList(), new RenderList(), new RenderList(), new RenderList()};
|
||||
//private RenderList[] allRenderLists = new RenderList[]{new RenderList(), new RenderList(), new RenderList(), new RenderList()};
|
||||
int dummyRenderInt = 0;
|
||||
int unusedGLCallList = GLAllocation.generateDisplayLists(1);
|
||||
double prevSortX = -9999.0D;
|
||||
|
@ -59,16 +59,6 @@ public class RenderGlobal implements IWorldAccess {
|
|||
this.renderEngine = var2;
|
||||
byte var3 = 64;
|
||||
this.glRenderListBase = GLAllocation.generateDisplayLists(var3 * var3 * var3 * 3);
|
||||
// this.occlusionEnabled = var1.getOpenGlCapsChecker().checkARBOcclusion();
|
||||
// if(this.occlusionEnabled) {
|
||||
// this.occlusionResult.clear();
|
||||
// this.glOcclusionQueryBase = GLAllocation.createIntBuffer(var3 * var3 * var3);
|
||||
// this.glOcclusionQueryBase.clear();
|
||||
// this.glOcclusionQueryBase.position(0);
|
||||
// this.glOcclusionQueryBase.limit(var3 * var3 * var3);
|
||||
// ARBOcclusionQuery.glGenQueriesARB(this.glOcclusionQueryBase);
|
||||
// }
|
||||
|
||||
this.starGLCallList = GLAllocation.generateDisplayLists(3);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE);
|
||||
|
@ -223,10 +213,6 @@ public class RenderGlobal implements IWorldAccess {
|
|||
}
|
||||
|
||||
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4] = new WorldRenderer(this.theWorld, this.tileEntities, var4 * 16, var5 * 16, var6 * 16, 16, this.glRenderListBase + var2);
|
||||
// if(this.occlusionEnabled) {
|
||||
// this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].glOcclusionQuery = this.glOcclusionQueryBase.get(var3);
|
||||
// }
|
||||
|
||||
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].isWaitingOnOcclusionQuery = false;
|
||||
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].isVisible = true;
|
||||
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].isInFrustum = true;
|
||||
|
@ -383,103 +369,9 @@ public class RenderGlobal implements IWorldAccess {
|
|||
}
|
||||
|
||||
byte var17 = 0;
|
||||
int var33;
|
||||
// if(this.occlusionEnabled && !this.mc.gameSettings.anaglyph && var2 == 0) {
|
||||
// byte var18 = 0;
|
||||
// int var19 = 16;
|
||||
// this.checkOcclusionQueryResult(var18, var19);
|
||||
//
|
||||
// for(int var20 = var18; var20 < var19; ++var20) {
|
||||
// this.sortedWorldRenderers[var20].isVisible = true;
|
||||
// }
|
||||
//
|
||||
// var33 = var17 + this.renderSortedRenderers(var18, var19, var2, var3);
|
||||
//
|
||||
// do {
|
||||
// int var34 = var19;
|
||||
// var19 *= 2;
|
||||
// if(var19 > this.sortedWorldRenderers.length) {
|
||||
// var19 = this.sortedWorldRenderers.length;
|
||||
// }
|
||||
//
|
||||
// GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
// GL11.glDisable(GL11.GL_LIGHTING);
|
||||
// GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
// GL11.glDisable(GL11.GL_FOG);
|
||||
// GL11.glColorMask(false, false, false, false);
|
||||
// GL11.glDepthMask(false);
|
||||
// this.checkOcclusionQueryResult(var34, var19);
|
||||
// GL11.glPushMatrix();
|
||||
// float var35 = 0.0F;
|
||||
// float var21 = 0.0F;
|
||||
// float var22 = 0.0F;
|
||||
//
|
||||
// for(int var23 = var34; var23 < var19; ++var23) {
|
||||
// if(this.sortedWorldRenderers[var23].skipAllRenderPasses()) {
|
||||
// this.sortedWorldRenderers[var23].isInFrustum = false;
|
||||
// } else {
|
||||
// if(!this.sortedWorldRenderers[var23].isInFrustum) {
|
||||
// this.sortedWorldRenderers[var23].isVisible = true;
|
||||
// }
|
||||
//
|
||||
// if(this.sortedWorldRenderers[var23].isInFrustum && !this.sortedWorldRenderers[var23].isWaitingOnOcclusionQuery) {
|
||||
// float var24 = MathHelper.sqrt_float(this.sortedWorldRenderers[var23].distanceToEntitySquared(var1));
|
||||
// int var25 = (int)(1.0F + var24 / 128.0F);
|
||||
// if(this.cloudTickCounter % var25 == var23 % var25) {
|
||||
// WorldRenderer var26 = this.sortedWorldRenderers[var23];
|
||||
// float var27 = (float)((double)var26.posXMinus - var5);
|
||||
// float var28 = (float)((double)var26.posYMinus - var7);
|
||||
// float var29 = (float)((double)var26.posZMinus - var9);
|
||||
// float var30 = var27 - var35;
|
||||
// float var31 = var28 - var21;
|
||||
// float var32 = var29 - var22;
|
||||
// if(var30 != 0.0F || var31 != 0.0F || var32 != 0.0F) {
|
||||
// GL11.glTranslatef(var30, var31, var32);
|
||||
// var35 += var30;
|
||||
// var21 += var31;
|
||||
// var22 += var32;
|
||||
// }
|
||||
//
|
||||
// ARBOcclusionQuery.glBeginQueryARB(GL15.GL_SAMPLES_PASSED, this.sortedWorldRenderers[var23].glOcclusionQuery);
|
||||
// this.sortedWorldRenderers[var23].callOcclusionQueryList();
|
||||
// ARBOcclusionQuery.glEndQueryARB(GL15.GL_SAMPLES_PASSED);
|
||||
// this.sortedWorldRenderers[var23].isWaitingOnOcclusionQuery = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// GL11.glPopMatrix();
|
||||
// GL11.glColorMask(true, true, true, true);
|
||||
// GL11.glDepthMask(true);
|
||||
// GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
// GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
// GL11.glEnable(GL11.GL_FOG);
|
||||
// var33 += this.renderSortedRenderers(var34, var19, var2, var3);
|
||||
// } while(var19 < this.sortedWorldRenderers.length);
|
||||
// } else {
|
||||
var33 = var17 + this.renderSortedRenderers(0, this.sortedWorldRenderers.length, var2, var3);
|
||||
//}
|
||||
|
||||
return var33;
|
||||
return var17 + this.renderSortedRenderers(0, this.sortedWorldRenderers.length, var2, var3);
|
||||
}
|
||||
|
||||
// private void checkOcclusionQueryResult(int var1, int var2) {
|
||||
// for(int var3 = var1; var3 < var2; ++var3) {
|
||||
// if(this.sortedWorldRenderers[var3].isWaitingOnOcclusionQuery) {
|
||||
// this.occlusionResult.clear();
|
||||
// ARBOcclusionQuery.glGetQueryObjectuARB(this.sortedWorldRenderers[var3].glOcclusionQuery, GL15.GL_QUERY_RESULT_AVAILABLE, this.occlusionResult);
|
||||
// if(this.occlusionResult.get(0) != 0) {
|
||||
// this.sortedWorldRenderers[var3].isWaitingOnOcclusionQuery = false;
|
||||
// this.occlusionResult.clear();
|
||||
// ARBOcclusionQuery.glGetQueryObjectuARB(this.sortedWorldRenderers[var3].glOcclusionQuery, GL15.GL_QUERY_RESULT, this.occlusionResult);
|
||||
// this.sortedWorldRenderers[var3].isVisible = this.occlusionResult.get(0) != 0;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
private int renderSortedRenderers(int var1, int var2, int var3, double var4) {
|
||||
this.glRenderLists.clear();
|
||||
int var6 = 0;
|
||||
|
@ -510,42 +402,17 @@ public class RenderGlobal implements IWorldAccess {
|
|||
double var10 = var19.lastTickPosY + (var19.posY - var19.lastTickPosY) * var4;
|
||||
double var12 = var19.lastTickPosZ + (var19.posZ - var19.lastTickPosZ) * var4;
|
||||
|
||||
int var14 = 0;
|
||||
|
||||
int var15;
|
||||
for(var15 = 0; var15 < this.allRenderLists.length; ++var15) {
|
||||
this.allRenderLists[var15].reset();
|
||||
for (int i2 = 0; i2 < glRenderLists.size(); i2++) {
|
||||
WorldRenderer worldrenderer = (WorldRenderer) glRenderLists.get(i2);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)(worldrenderer.posXMinus - var20), (float)(worldrenderer.posYMinus - var10), (float)(worldrenderer.posZMinus - var12));
|
||||
GL11.glCallList(worldrenderer.getGLCallListForPass(var3));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
for(var15 = 0; var15 < this.glRenderLists.size(); ++var15) {
|
||||
WorldRenderer var16 = (WorldRenderer)this.glRenderLists.get(var15);
|
||||
int var17 = -1;
|
||||
|
||||
for(int var18 = 0; var18 < var14; ++var18) {
|
||||
if(this.allRenderLists[var18].isRenderedAt(var16.posXMinus, var16.posYMinus, var16.posZMinus)) {
|
||||
var17 = var18;
|
||||
}
|
||||
}
|
||||
|
||||
if(var17 < 0) {
|
||||
var17 = var14++;
|
||||
this.allRenderLists[var17].setLocation(var16.posXMinus, var16.posYMinus, var16.posZMinus, var20, var10, var12);
|
||||
}
|
||||
|
||||
this.allRenderLists[var17].render(var16.getGLCallListForPass(var3));
|
||||
}
|
||||
|
||||
this.renderAllRenderLists(var3, var4);
|
||||
return var6;
|
||||
}
|
||||
|
||||
public void renderAllRenderLists(int var1, double var2) {
|
||||
for(int var4 = 0; var4 < this.allRenderLists.length; ++var4) {
|
||||
this.allRenderLists[var4].render();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updateClouds() {
|
||||
++this.cloudTickCounter;
|
||||
}
|
||||
|
|
|
@ -1,61 +1,61 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderList {
|
||||
private int posX;
|
||||
private int posY;
|
||||
private int posZ;
|
||||
private float playerPosX;
|
||||
private float playerPosY;
|
||||
private float playerPosZ;
|
||||
private IntBuffer buffer = GLAllocation.createIntBuffer(65536);
|
||||
private boolean render = false;
|
||||
private boolean isCached = false;
|
||||
|
||||
public void setLocation(int var1, int var2, int var3, double var4, double var6, double var8) {
|
||||
this.render = true;
|
||||
this.buffer.clear();
|
||||
this.posX = var1;
|
||||
this.posY = var2;
|
||||
this.posZ = var3;
|
||||
this.playerPosX = (float)var4;
|
||||
this.playerPosY = (float)var6;
|
||||
this.playerPosZ = (float)var8;
|
||||
}
|
||||
|
||||
public boolean isRenderedAt(int var1, int var2, int var3) {
|
||||
return !this.render ? false : var1 == this.posX && var2 == this.posY && var3 == this.posZ;
|
||||
}
|
||||
|
||||
public void render(int var1) {
|
||||
this.buffer.put(var1);
|
||||
if(this.buffer.remaining() == 0) {
|
||||
this.render();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void render() {
|
||||
if(this.render) {
|
||||
if(!this.isCached) {
|
||||
this.buffer.flip();
|
||||
this.isCached = true;
|
||||
}
|
||||
|
||||
if(this.buffer.remaining() > 0) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)this.posX - this.playerPosX, (float)this.posY - this.playerPosY, (float)this.posZ - this.playerPosZ);
|
||||
GL11.glCallLists(this.buffer);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.render = false;
|
||||
this.isCached = false;
|
||||
}
|
||||
}
|
||||
//package net.minecraft.src;
|
||||
//
|
||||
//import java.nio.IntBuffer;
|
||||
//import org.lwjgl.opengl.GL11;
|
||||
//
|
||||
//public class RenderList {
|
||||
// private int posX;
|
||||
// private int posY;
|
||||
// private int posZ;
|
||||
// private float playerPosX;
|
||||
// private float playerPosY;
|
||||
// private float playerPosZ;
|
||||
// private IntBuffer buffer = GLAllocation.createIntBuffer(65536);
|
||||
// private boolean render = false;
|
||||
// private boolean isCached = false;
|
||||
//
|
||||
// public void setLocation(int var1, int var2, int var3, double var4, double var6, double var8) {
|
||||
// this.render = true;
|
||||
// this.buffer.clear();
|
||||
// this.posX = var1;
|
||||
// this.posY = var2;
|
||||
// this.posZ = var3;
|
||||
// this.playerPosX = (float)var4;
|
||||
// this.playerPosY = (float)var6;
|
||||
// this.playerPosZ = (float)var8;
|
||||
// }
|
||||
//
|
||||
// public boolean isRenderedAt(int var1, int var2, int var3) {
|
||||
// return !this.render ? false : var1 == this.posX && var2 == this.posY && var3 == this.posZ;
|
||||
// }
|
||||
//
|
||||
// public void render(int var1) {
|
||||
// this.buffer.put(var1);
|
||||
// if(this.buffer.remaining() == 0) {
|
||||
// this.render();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public void render() {
|
||||
// if(this.render) {
|
||||
// if(!this.isCached) {
|
||||
// this.buffer.flip();
|
||||
// this.isCached = true;
|
||||
// }
|
||||
//
|
||||
// if(this.buffer.remaining() > 0) {
|
||||
// GL11.glPushMatrix();
|
||||
// GL11.glTranslatef((float)this.posX - this.playerPosX, (float)this.posY - this.playerPosY, (float)this.posZ - this.playerPosZ);
|
||||
// GL11.glCallLists(this.buffer);
|
||||
// GL11.glPopMatrix();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void reset() {
|
||||
// this.render = false;
|
||||
// this.isCached = false;
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -1,96 +1,96 @@
|
|||
//package net.minecraft.src;
|
||||
//
|
||||
//public class SpawnerAnimals {
|
||||
// private int maxSpawns;
|
||||
// private Class entityType;
|
||||
// private Class[] entities;
|
||||
//
|
||||
// public SpawnerAnimals(int var1, Class var2, Class[] var3) {
|
||||
// this.maxSpawns = var1;
|
||||
// this.entityType = var2;
|
||||
// this.entities = var3;
|
||||
// }
|
||||
//
|
||||
// public void onUpdate(World var1) {
|
||||
// int var2 = var1.countEntities(this.entityType);
|
||||
// if(var2 < this.maxSpawns) {
|
||||
// for(int var3 = 0; var3 < 10; ++var3) {
|
||||
// this.performSpawning(var1, 1, var1.playerEntity, (IProgressUpdate)null);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// protected ChunkPosition getRandomSpawningPointInChunk(World var1, int var2, int var3) {
|
||||
// int var4 = var2 + var1.rand.nextInt(256) - 128;
|
||||
// int var5 = var1.rand.nextInt(128);
|
||||
// int var6 = var3 + var1.rand.nextInt(256) - 128;
|
||||
// return new ChunkPosition(var4, var5, var6);
|
||||
// }
|
||||
//
|
||||
// private int performSpawning(World var1, int var2, Entity var3, IProgressUpdate var4) {
|
||||
// int var5 = 0;
|
||||
// int var6 = MathHelper.floor_double(var3.posX);
|
||||
// int var7 = MathHelper.floor_double(var3.posZ);
|
||||
// int var8 = var1.rand.nextInt(this.entities.length);
|
||||
// ChunkPosition var9 = this.getRandomSpawningPointInChunk(var1, var6, var7);
|
||||
// int var10 = var9.x;
|
||||
// int var11 = var9.y;
|
||||
// int var12 = var9.z;
|
||||
// if(var1.isBlockNormalCube(var10, var11, var12)) {
|
||||
// return 0;
|
||||
// } else if(var1.getBlockMaterial(var10, var11, var12) != Material.air) {
|
||||
// return 0;
|
||||
// } else {
|
||||
// for(int var13 = 0; var13 < 3; ++var13) {
|
||||
// int var14 = var10;
|
||||
// int var15 = var11;
|
||||
// int var16 = var12;
|
||||
// byte var17 = 6;
|
||||
//
|
||||
// for(int var18 = 0; var18 < 3; ++var18) {
|
||||
// var14 += var1.rand.nextInt(var17) - var1.rand.nextInt(var17);
|
||||
// var15 += var1.rand.nextInt(1) - var1.rand.nextInt(1);
|
||||
// var16 += var1.rand.nextInt(var17) - var1.rand.nextInt(var17);
|
||||
// if(var1.isBlockNormalCube(var14, var15 - 1, var16) && !var1.isBlockNormalCube(var14, var15, var16) && !var1.getBlockMaterial(var14, var15, var16).getIsLiquid() && !var1.isBlockNormalCube(var14, var15 + 1, var16)) {
|
||||
// float var19 = (float)var14 + 0.5F;
|
||||
// float var20 = (float)var15 + 1.0F;
|
||||
// float var21 = (float)var16 + 0.5F;
|
||||
// if(var3 != null) {
|
||||
// double var22 = (double)var19 - var3.posX;
|
||||
// double var24 = (double)var20 - var3.posY;
|
||||
// double var26 = (double)var21 - var3.posZ;
|
||||
// double var28 = var22 * var22 + var24 * var24 + var26 * var26;
|
||||
// if(var28 < 1024.0D) {
|
||||
// continue;
|
||||
// }
|
||||
// } else {
|
||||
// float var31 = var19 - (float)var1.spawnX;
|
||||
// float var23 = var20 - (float)var1.spawnY;
|
||||
// float var33 = var21 - (float)var1.spawnZ;
|
||||
// float var25 = var31 * var31 + var23 * var23 + var33 * var33;
|
||||
// if(var25 < 1024.0F) {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// EntityLiving var32;
|
||||
// try {
|
||||
// var32 = (EntityLiving)this.entities[var8].getConstructor(new Class[]{World.class}).newInstance(new Object[]{var1});
|
||||
// } catch (Exception var30) {
|
||||
// return var5;
|
||||
// }
|
||||
//
|
||||
// var32.setPositionAndRotation((double)var19, (double)var20, (double)var21, var1.rand.nextFloat() * 360.0F, 0.0F);
|
||||
// if(var32.getCanSpawnHere((double)var19, (double)var20, (double)var21)) {
|
||||
// ++var5;
|
||||
// var1.spawnEntityInWorld(var32);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return var5;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
package net.minecraft.src;
|
||||
|
||||
public class SpawnerAnimals {
|
||||
private int maxSpawns;
|
||||
private Class entityType;
|
||||
private Class[] entities;
|
||||
|
||||
public SpawnerAnimals(int var1, Class var2, Class[] var3) {
|
||||
this.maxSpawns = var1;
|
||||
this.entityType = var2;
|
||||
this.entities = var3;
|
||||
}
|
||||
|
||||
public void onUpdate(World var1) {
|
||||
int var2 = var1.countEntities(this.entityType);
|
||||
if(var2 < this.maxSpawns) {
|
||||
for(int var3 = 0; var3 < 10; ++var3) {
|
||||
this.performSpawning(var1, 1, var1.playerEntity, (IProgressUpdate)null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected ChunkPosition getRandomSpawningPointInChunk(World var1, int var2, int var3) {
|
||||
int var4 = var2 + var1.rand.nextInt(256) - 128;
|
||||
int var5 = var1.rand.nextInt(128);
|
||||
int var6 = var3 + var1.rand.nextInt(256) - 128;
|
||||
return new ChunkPosition(var4, var5, var6);
|
||||
}
|
||||
|
||||
private int performSpawning(World var1, int var2, Entity var3, IProgressUpdate var4) {
|
||||
int var5 = 0;
|
||||
int var6 = MathHelper.floor_double(var3.posX);
|
||||
int var7 = MathHelper.floor_double(var3.posZ);
|
||||
int var8 = var1.rand.nextInt(this.entities.length);
|
||||
ChunkPosition var9 = this.getRandomSpawningPointInChunk(var1, var6, var7);
|
||||
int var10 = var9.x;
|
||||
int var11 = var9.y;
|
||||
int var12 = var9.z;
|
||||
if(var1.isBlockNormalCube(var10, var11, var12)) {
|
||||
return 0;
|
||||
} else if(var1.getBlockMaterial(var10, var11, var12) != Material.air) {
|
||||
return 0;
|
||||
} else {
|
||||
for(int var13 = 0; var13 < 3; ++var13) {
|
||||
int var14 = var10;
|
||||
int var15 = var11;
|
||||
int var16 = var12;
|
||||
byte var17 = 6;
|
||||
|
||||
for(int var18 = 0; var18 < 3; ++var18) {
|
||||
var14 += var1.rand.nextInt(var17) - var1.rand.nextInt(var17);
|
||||
var15 += var1.rand.nextInt(1) - var1.rand.nextInt(1);
|
||||
var16 += var1.rand.nextInt(var17) - var1.rand.nextInt(var17);
|
||||
if(var1.isBlockNormalCube(var14, var15 - 1, var16) && !var1.isBlockNormalCube(var14, var15, var16) && !var1.getBlockMaterial(var14, var15, var16).getIsLiquid() && !var1.isBlockNormalCube(var14, var15 + 1, var16)) {
|
||||
float var19 = (float)var14 + 0.5F;
|
||||
float var20 = (float)var15 + 1.0F;
|
||||
float var21 = (float)var16 + 0.5F;
|
||||
if(var3 != null) {
|
||||
double var22 = (double)var19 - var3.posX;
|
||||
double var24 = (double)var20 - var3.posY;
|
||||
double var26 = (double)var21 - var3.posZ;
|
||||
double var28 = var22 * var22 + var24 * var24 + var26 * var26;
|
||||
if(var28 < 1024.0D) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
float var31 = var19 - (float)var1.spawnX;
|
||||
float var23 = var20 - (float)var1.spawnY;
|
||||
float var33 = var21 - (float)var1.spawnZ;
|
||||
float var25 = var31 * var31 + var23 * var23 + var33 * var33;
|
||||
if(var25 < 1024.0F) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
EntityLiving var32;
|
||||
try {
|
||||
var32 = (EntityLiving)this.entities[var8].getConstructor(new Class[]{World.class}).newInstance(new Object[]{var1});
|
||||
} catch (Exception var30) {
|
||||
return var5;
|
||||
}
|
||||
|
||||
var32.setPositionAndRotation((double)var19, (double)var20, (double)var21, var1.rand.nextFloat() * 360.0F, 0.0F);
|
||||
if(var32.getCanSpawnHere((double)var19, (double)var20, (double)var21)) {
|
||||
++var5;
|
||||
var1.spawnEntityInWorld(var32);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return var5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
//package net.minecraft.src;
|
||||
//
|
||||
//class SpawnerMonsters extends SpawnerAnimals {
|
||||
// final PlayerControllerSP playerController;
|
||||
//
|
||||
// SpawnerMonsters(PlayerControllerSP var1, int var2, Class var3, Class[] var4) {
|
||||
// super(var2, var3, var4);
|
||||
// this.playerController = var1;
|
||||
// }
|
||||
//
|
||||
// protected ChunkPosition getRandomSpawningPointInChunk(World var1, int var2, int var3) {
|
||||
// int var4 = var2 + var1.rand.nextInt(256) - 128;
|
||||
// int var5 = var1.rand.nextInt(var1.rand.nextInt(var1.rand.nextInt(112) + 8) + 8);
|
||||
// int var6 = var3 + var1.rand.nextInt(256) - 128;
|
||||
// return new ChunkPosition(var4, var5, var6);
|
||||
// }
|
||||
//}
|
||||
package net.minecraft.src;
|
||||
|
||||
class SpawnerMonsters extends SpawnerAnimals {
|
||||
final PlayerControllerSP playerController;
|
||||
|
||||
SpawnerMonsters(PlayerControllerSP var1, int var2, Class var3, Class[] var4) {
|
||||
super(var2, var3, var4);
|
||||
this.playerController = var1;
|
||||
}
|
||||
|
||||
protected ChunkPosition getRandomSpawningPointInChunk(World var1, int var2, int var3) {
|
||||
int var4 = var2 + var1.rand.nextInt(256) - 128;
|
||||
int var5 = var1.rand.nextInt(var1.rand.nextInt(var1.rand.nextInt(112) + 8) + 8);
|
||||
int var6 = var3 + var1.rand.nextInt(256) - 128;
|
||||
return new ChunkPosition(var4, var5, var6);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,23 +43,22 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
|||
return "Chest";
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound var1) {
|
||||
super.readFromNBT(var1);
|
||||
NBTTagList var2 = var1.getTagList("Items");
|
||||
this.chestContents = new ItemStack[this.getSizeInventory()];
|
||||
public final void readFromNBT(NBTTagCompound var1) {
|
||||
NBTTagList var5 = var1.getTagList("Items");
|
||||
this.chestContents = new ItemStack[27];
|
||||
|
||||
for(int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
|
||||
int var5 = var4.getByte("Slot") & 255;
|
||||
if(var5 >= 0 && var5 < this.chestContents.length) {
|
||||
this.chestContents[var5] = new ItemStack(var4);
|
||||
for(int var2 = 0; var2 < var5.tagCount(); ++var2) {
|
||||
NBTTagCompound var3 = (NBTTagCompound)var5.tagAt(var2);
|
||||
int var4 = var3.getByte("Slot") & 255;
|
||||
if(var4 >= 0 && var4 < this.chestContents.length) {
|
||||
this.chestContents[var4] = new ItemStack(var3);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound var1) {
|
||||
super.writeToNBT(var1);
|
||||
public final void writeToNBT(NBTTagCompound var1) {
|
||||
var1.setString("id", "Chest");
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
|
||||
for(int var3 = 0; var3 < this.chestContents.length; ++var3) {
|
||||
|
|
|
@ -46,10 +46,10 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
|||
return "Chest";
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound var1) {
|
||||
public final void readFromNBT(NBTTagCompound var1) {
|
||||
super.readFromNBT(var1);
|
||||
NBTTagList var2 = var1.getTagList("Items");
|
||||
this.furnaceItemStacks = new ItemStack[this.getSizeInventory()];
|
||||
this.furnaceItemStacks = new ItemStack[this.furnaceItemStacks.length];
|
||||
|
||||
for(int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
|
||||
|
@ -61,13 +61,15 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
|||
|
||||
this.furnaceBurnTime = var1.getShort("BurnTime");
|
||||
this.furnaceCookTime = var1.getShort("CookTime");
|
||||
this.currentItemBurnTime = this.getItemBurnTime(this.furnaceItemStacks[1]);
|
||||
this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]);
|
||||
System.out.println("Lit: " + this.furnaceBurnTime + "/" + this.currentItemBurnTime);
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound var1) {
|
||||
public final void writeToNBT(NBTTagCompound var1) {
|
||||
super.writeToNBT(var1);
|
||||
var1.setShort("BurnTime", (short)this.furnaceBurnTime);
|
||||
var1.setShort("CookTime", (short)this.furnaceCookTime);
|
||||
var1.setString("id", "Furnace");
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
|
||||
for(int var3 = 0; var3 < this.furnaceItemStacks.length; ++var3) {
|
||||
|
|
|
@ -88,6 +88,7 @@ public class TileEntityMobSpawner extends TileEntity {
|
|||
|
||||
public void writeToNBT(NBTTagCompound var1) {
|
||||
super.writeToNBT(var1);
|
||||
var1.setString("id", "MobSpawner");
|
||||
var1.setString("EntityId", this.mobID);
|
||||
var1.setShort("Delay", (short)this.delay);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ public class TileEntitySign extends TileEntity {
|
|||
|
||||
public void writeToNBT(NBTTagCompound var1) {
|
||||
super.writeToNBT(var1);
|
||||
var1.setString("id", "Sign");
|
||||
var1.setString("Text1", this.signText[0]);
|
||||
var1.setString("Text2", this.signText[1]);
|
||||
var1.setString("Text3", this.signText[2]);
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.PeytonPlayz585.io.File;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
@ -13,6 +12,9 @@ import java.util.Random;
|
|||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.PeytonPlayz585.io.FileSystemUtils;
|
||||
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||
|
||||
public class World implements IBlockAccess {
|
||||
private List lightingToUpdate;
|
||||
private List loadedEntityList;
|
||||
|
@ -39,7 +41,7 @@ public class World implements IBlockAccess {
|
|||
public boolean isNewWorld;
|
||||
private List worldAccesses;
|
||||
private IChunkProvider chunkProvider;
|
||||
private File saveDirectory;
|
||||
private static String saveDirectory;
|
||||
public long randomSeed;
|
||||
private NBTTagCompound nbtCompoundPlayer;
|
||||
public long setSizeOnDisk;
|
||||
|
@ -47,52 +49,35 @@ public class World implements IBlockAccess {
|
|||
private ArrayList collidingBoundingBoxes;
|
||||
private List entitiesWithinAABBExcludingEntity;
|
||||
|
||||
public static NBTTagCompound getLevelData(File var0, String var1) {
|
||||
File var2 = new File(var0, "saves");
|
||||
File var3 = new File(var2, var1);
|
||||
if(!var3.exists()) {
|
||||
return null;
|
||||
public static NBTTagCompound getLevelData(String var1) {
|
||||
byte[] data = LWJGLMain.readFile(var1 + "/level.dat");
|
||||
System.out.println(var1 + "/level.dat");
|
||||
if(data != null) {
|
||||
try {
|
||||
NBTTagCompound var5 = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(data)));
|
||||
NBTTagCompound var6 = var5.getCompoundTag("Data");
|
||||
return var6;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
File var4 = new File(var3, "level.dat");
|
||||
if(var4.exists()) {
|
||||
try {
|
||||
NBTTagCompound var5 = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(var4.getBytes())));
|
||||
NBTTagCompound var6 = var5.getCompoundTag("Data");
|
||||
return var6;
|
||||
} catch (Exception var7) {
|
||||
var7.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void deleteWorld(File var0, String var1) {
|
||||
File var2 = new File(var0, "saves");
|
||||
File var3 = new File(var2, var1);
|
||||
if(var3.exists()) {
|
||||
deleteWorldFiles(var3.listFiles());
|
||||
var3.delete();
|
||||
public static void deleteWorld(String var1) {
|
||||
String dir = "saves/" + var1;
|
||||
if(LWJGLMain.directoryExists(dir)) {
|
||||
FileSystemUtils.recursiveDeleteDirectory(dir);
|
||||
}
|
||||
}
|
||||
|
||||
private static void deleteWorldFiles(File[] var0) {
|
||||
for(int var1 = 0; var1 < var0.length; ++var1) {
|
||||
if(var0[var1].exists()) {
|
||||
deleteWorldFiles(var0[var1].listFiles());
|
||||
}
|
||||
|
||||
var0[var1].delete();
|
||||
}
|
||||
|
||||
public World(String var2) {
|
||||
this(var2, (new Random()).nextLong());
|
||||
}
|
||||
|
||||
public World(File var1, String var2) {
|
||||
this(var1, var2, (new Random()).nextLong());
|
||||
}
|
||||
|
||||
public World(File var1, String var2, long var3) {
|
||||
public World(String var2, long var3) {
|
||||
this.lightingToUpdate = new ArrayList();
|
||||
this.loadedEntityList = new ArrayList();
|
||||
this.unloadedEntityList = new ArrayList();
|
||||
|
@ -115,14 +100,13 @@ public class World implements IBlockAccess {
|
|||
this.collidingBoundingBoxes = new ArrayList();
|
||||
this.entitiesWithinAABBExcludingEntity = new ArrayList();
|
||||
this.levelName = var2;
|
||||
var1.mkdirs();
|
||||
this.saveDirectory = new File(var1, var2);
|
||||
this.saveDirectory.mkdirs();
|
||||
File var5 = new File(this.saveDirectory, "level.dat");
|
||||
this.isNewWorld = !var5.exists();
|
||||
if(var5.exists()) {
|
||||
this.saveDirectory = var2;
|
||||
byte[] data = LWJGLMain.readFile(saveDirectory + "/level.dat");
|
||||
System.out.println(saveDirectory + "/level.dat");
|
||||
this.isNewWorld = data == null ? false : true;
|
||||
if(data != null) {
|
||||
try {
|
||||
NBTTagCompound var6 = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(var5.getBytes())));
|
||||
NBTTagCompound var6 = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(data)));
|
||||
NBTTagCompound var7 = var6.getCompoundTag("Data");
|
||||
this.randomSeed = var7.getLong("RandomSeed");
|
||||
this.spawnX = var7.getInteger("SpawnX");
|
||||
|
@ -142,7 +126,7 @@ public class World implements IBlockAccess {
|
|||
var9 = true;
|
||||
}
|
||||
|
||||
this.chunkProvider = this.getChunkProvider(this.saveDirectory);
|
||||
this.chunkProvider = this.getChunkProvider(saveDirectory);
|
||||
if(var9) {
|
||||
this.spawnX = 0;
|
||||
this.spawnY = 64;
|
||||
|
@ -155,8 +139,8 @@ public class World implements IBlockAccess {
|
|||
this.calculateInitialSkylight();
|
||||
}
|
||||
|
||||
protected IChunkProvider getChunkProvider(File var1) {
|
||||
return new ChunkProviderLoadOrGenerate(this, new ChunkLoader(var1, true), new ChunkProviderGenerate(this, this.randomSeed));
|
||||
protected IChunkProvider getChunkProvider(String var1) {
|
||||
return new ChunkProviderLoadOrGenerate(this, new ChunkLoader(var1), new ChunkProviderGenerate(this, this.randomSeed));
|
||||
}
|
||||
|
||||
public void setSpawnLocation() {
|
||||
|
@ -228,29 +212,29 @@ public class World implements IBlockAccess {
|
|||
var2.setTag("Data", var1);
|
||||
|
||||
try {
|
||||
File var3 = new File(this.saveDirectory, "level.dat_new");
|
||||
File var4 = new File(this.saveDirectory, "level.dat_old");
|
||||
File var5 = new File(this.saveDirectory, "level.dat");
|
||||
byte[] var3 = LWJGLMain.readFile(saveDirectory + "/level.dat_new");
|
||||
byte[] var4 = LWJGLMain.readFile(saveDirectory + "/level.dat_old");
|
||||
byte[] var5 = LWJGLMain.readFile(saveDirectory + "/level.dat");
|
||||
ByteArrayOutputStream bao = new ByteArrayOutputStream(131072);
|
||||
NBTBase.writeNamedTag(var2, new DataOutputStream(bao));
|
||||
var3.writeBytes(bao.toByteArray());
|
||||
if(var4.exists()) {
|
||||
var4.delete();
|
||||
LWJGLMain.writeFile(saveDirectory + "/level.dat_new", bao.toByteArray());
|
||||
if(LWJGLMain.readFile(saveDirectory + "/level.dat_old") != null) {
|
||||
LWJGLMain.deleteFile(saveDirectory + "/level.dat_old");
|
||||
}
|
||||
|
||||
var5.renameTo(var4);
|
||||
if(var5.exists()) {
|
||||
var5.delete();
|
||||
LWJGLMain.renameFile(saveDirectory + "/level.dat", saveDirectory + "/level.dat_old");
|
||||
if(LWJGLMain.readFile(saveDirectory + "/level.dat") != null) {
|
||||
LWJGLMain.deleteFile(saveDirectory + "/level.dat");
|
||||
}
|
||||
|
||||
var3.renameTo(var5);
|
||||
if(var3.exists()) {
|
||||
var3.delete();
|
||||
LWJGLMain.renameFile(saveDirectory + "/level.dat_new", saveDirectory + "/level.dat");
|
||||
|
||||
if(LWJGLMain.readFile(saveDirectory + "/level.dat_new") != null) {
|
||||
LWJGLMain.deleteFile(saveDirectory + "/level.dat_new");
|
||||
}
|
||||
} catch (Exception var6) {
|
||||
var6.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean saveWorld(int var1) {
|
||||
|
|
|
@ -74,14 +74,6 @@ public class WorldRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
// private void setupGLTranslation() {
|
||||
// float var19 = 1.000001F;
|
||||
// GL11.glTranslatef((float)posXClip * var19, (float)posYClip * var19, (float)posZClip * var19);
|
||||
// for(int var2000 = 0; var2000 < 4; var2000++) {
|
||||
// tessellator.addVertex(posX * var19, posY * var19, posZ * var19);
|
||||
// }
|
||||
// }
|
||||
|
||||
public void updateRenderer() {
|
||||
if(this.needsUpdate) {
|
||||
++chunksUpdated;
|
||||
|
|
Loading…
Reference in New Issue
Block a user