Compare commits
No commits in common. "011edd86472602454b5001603343f610802550ca" and "31d09f3c50608717e71de5387d0e7cbe79524d69" have entirely different histories.
011edd8647
...
31d09f3c50
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,5 +0,0 @@
|
|||
# Ignore Gradle project-specific cache directory
|
||||
.gradle
|
||||
|
||||
# Ignore Gradle build output directory
|
||||
build
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
33
README.md
33
README.md
|
@ -1,34 +1,5 @@
|
|||
# Infdev-20100630-1-WebGL
|
||||
This project aims to be a 1:1 replica of Minecraft Infdev 20100630-1 ported to the browser using WebGL and TeaVM.
|
||||
# Infdev-20100630-1
|
||||
WebGL port of Minecraft Infdev-20100630-1
|
||||
|
||||
## STILL IN TESTING!
|
||||
THIS PROJECT IS STILL IN TESTING, IT WILL CONTAIN BUGS AND GLITCHES SO DON'T GET TOO ATTACHED TO YOUR WORLDS!
|
||||
|
||||
GAME IS EXTREMELY LAGGY...
|
||||
|
||||
## Contributing
|
||||
Feel free to contribute, just open a pull request and DM on Discord (peytonplayz585) because I probably won't check pull requests that often.
|
||||
|
||||
## Bugs
|
||||
- Saving of Entities/Tile Entities have been removed due to a crash
|
||||
- Water doesn't render correctly
|
||||
- Game is EXTREMELY laggy
|
||||
- Lighting is broken
|
||||
- Mob spawning removed due to a crash
|
||||
|
||||
## Pros & Cons
|
||||
|
||||
Pros:
|
||||
- Can be played in the browser (No Download)
|
||||
- ITS FREE!
|
||||
- More features
|
||||
|
||||
Cons:
|
||||
- EXTREMELY laggy
|
||||
- It's pirated
|
||||
- Has bugs & some features may have to be removed for performance issues
|
||||
|
||||
<br>
|
||||
|
||||
fuck microsoft :trollface:
|
||||
<br>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -62,7 +62,7 @@ public class Client {
|
|||
}
|
||||
|
||||
public static void run0() {
|
||||
instance = new Minecraft(Display.getWidth(), Display.getHeight(), false);
|
||||
instance = new Minecraft(Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight(), false);
|
||||
instance.session = new Session("Player", "fuckmojang123");
|
||||
instance.session.mpPassParameter = "randpasslol";
|
||||
mcThread = new Thread(instance, "Minecraft main thread");
|
||||
|
|
99
src/main/java/net/PeytonPlayz585/io/File.java
Normal file
99
src/main/java/net/PeytonPlayz585/io/File.java
Normal file
|
@ -0,0 +1,99 @@
|
|||
package net.PeytonPlayz585.io;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
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() {
|
||||
if(LWJGLMain.directoryExists(path) || LWJGLMain.fileExists(path)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
LWJGLMain.writeFile(path, null);
|
||||
}
|
||||
|
||||
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 boolean isDirectory() {
|
||||
return LWJGLMain.directoryExists(path);
|
||||
}
|
||||
|
||||
public void renameTo(File var4) {
|
||||
LWJGLMain.renameFile(path, var4.getPath());
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package net.PeytonPlayz585.io;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||
import net.minecraft.src.IProgressUpdate;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public static void recursiveDeleteDirectoryWithProgress(String dir, String title, String subText, IProgressUpdate progress) {
|
||||
progress.displayLoadingString(title, "(please wait)");
|
||||
Collection<LWJGLMain.FileEntry> lst = LWJGLMain.listFiles(dir, true, true);
|
||||
int totalDeleted = 0;
|
||||
int lastTotalDeleted = 0;
|
||||
for(LWJGLMain.FileEntry t : lst) {
|
||||
if(!t.isDirectory) {
|
||||
LWJGLMain.deleteFile(t.path);
|
||||
++totalDeleted;
|
||||
if(totalDeleted - lastTotalDeleted >= 10) {
|
||||
lastTotalDeleted = totalDeleted;
|
||||
int percentage = (int) Math.ceil(((double) totalDeleted / lst.size()) * 100);
|
||||
progress.displayLoadingString(title, subText.replace("%i", "" + totalDeleted));
|
||||
progress.setLoadingProgress(percentage);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(LWJGLMain.FileEntry t : lst) {
|
||||
if(t.isDirectory) {
|
||||
LWJGLMain.deleteFile(t.path);
|
||||
}
|
||||
}
|
||||
LWJGLMain.deleteFile(dir);
|
||||
}
|
||||
|
||||
}
|
|
@ -923,8 +923,7 @@ public class LWJGLMain {
|
|||
for(int i = 0; i < pixels.length; ++i) {
|
||||
pixels[i] = (pxls.get(i * 4) << 16) | (pxls.get(i * 4 + 1) << 8) | pxls.get(i * 4 + 2) | (pxls.get(i * 4 + 3) << 24);
|
||||
}
|
||||
IntBuffer buffer = IntBuffer.wrap(pixels);
|
||||
ret.complete(new MinecraftImageData(buffer, pxlsDat.getWidth(), pxlsDat.getHeight(), true));
|
||||
ret.complete(new MinecraftImageData(pixels, pxlsDat.getWidth(), pxlsDat.getHeight(), true));
|
||||
}
|
||||
});
|
||||
toLoad.addEventListener("error", new EventListener<Event>() {
|
||||
|
|
|
@ -1,55 +1,40 @@
|
|||
package net.PeytonPlayz585.opengl;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
public class MinecraftImageData {
|
||||
|
||||
public final IntBuffer data;
|
||||
public final int[] data;
|
||||
public final int w;
|
||||
public final int h;
|
||||
public final boolean alpha;
|
||||
private final int wh;
|
||||
|
||||
public MinecraftImageData(int pw, int ph, boolean palpha) {
|
||||
this.w = pw;
|
||||
this.h = ph;
|
||||
this.alpha = palpha;
|
||||
this.data = IntBuffer.allocate(pw * ph);
|
||||
this.wh = pw * ph;
|
||||
this.data = new int[pw * ph];
|
||||
}
|
||||
|
||||
public MinecraftImageData(IntBuffer pdata, int pw, int ph, boolean palpha) {
|
||||
if (pdata.capacity() != pw * ph) {
|
||||
throw new IllegalArgumentException("buffer capacity does not equal image size");
|
||||
public MinecraftImageData(int[] pdata, int pw, int ph, boolean palpha) {
|
||||
if (pdata.length != pw * ph) {
|
||||
throw new IllegalArgumentException("array size does not equal image size");
|
||||
}
|
||||
w = pw;
|
||||
h = ph;
|
||||
alpha = palpha;
|
||||
wh = pw * ph;
|
||||
if (!alpha) {
|
||||
for (int i = 0; i < wh; ++i) {
|
||||
pdata.put(i, pdata.get(i) | 0xFF000000);
|
||||
this.w = pw;
|
||||
this.h = ph;
|
||||
this.alpha = palpha;
|
||||
if (!palpha) {
|
||||
for (int i = 0; i < pdata.length; ++i) {
|
||||
pdata[i] = pdata[i] | 0xFF000000;
|
||||
}
|
||||
pdata.rewind();
|
||||
}
|
||||
data = pdata;
|
||||
this.data = pdata;
|
||||
}
|
||||
|
||||
public MinecraftImageData getSubImage(int x, int y, int pw, int ph) {
|
||||
int start = y * w + x;
|
||||
IntBuffer subBuffer = data.slice();
|
||||
subBuffer.position(start);
|
||||
subBuffer.limit(start + pw * ph);
|
||||
int[] temp = new int[pw * ph];
|
||||
subBuffer.get(temp);
|
||||
IntBuffer newBuffer = IntBuffer.wrap(temp);
|
||||
return new MinecraftImageData(newBuffer, pw, ph, alpha);
|
||||
int[] img = new int[pw * ph];
|
||||
for (int i = 0; i < ph; ++i) {
|
||||
System.arraycopy(data, (i + y) * this.w + x, img, i * pw, pw);
|
||||
}
|
||||
return new MinecraftImageData(img, pw, ph, alpha);
|
||||
}
|
||||
|
||||
public int[] data() {
|
||||
int[] array = new int[wh];
|
||||
data.rewind();
|
||||
data.get(array);
|
||||
return array;
|
||||
}
|
||||
}
|
|
@ -182,7 +182,7 @@ public abstract class BlockFluid extends Block {
|
|||
}
|
||||
|
||||
public int getRenderBlockPass() {
|
||||
return 0;
|
||||
return this.blockMaterial == Material.water ? 1 : 0;
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
|
|
|
@ -1,83 +1,72 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||
import net.PeytonPlayz585.io.File;
|
||||
|
||||
public class ChunkLoader implements IChunkLoader {
|
||||
private File saveDir;
|
||||
private boolean createIfNecessary;
|
||||
|
||||
private String saveDir;
|
||||
|
||||
public ChunkLoader(String dir) {
|
||||
saveDir = dir;
|
||||
public ChunkLoader(File var1, boolean var2) {
|
||||
this.saveDir = var1;
|
||||
this.createIfNecessary = var2;
|
||||
}
|
||||
|
||||
public static final String CHUNK_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
private String chunkFileForXZ(int x, int z) {
|
||||
int unsignedX = x + 30233088;
|
||||
int unsignedZ = z + 30233088;
|
||||
int radix = CHUNK_CHARS.length();
|
||||
StringBuilder path = new StringBuilder(10);
|
||||
for(int i = 0; i < 5; ++i) {
|
||||
path.append(CHUNK_CHARS.charAt(unsignedX % radix));
|
||||
unsignedX /= radix;
|
||||
path.append(CHUNK_CHARS.charAt(unsignedZ % radix));
|
||||
unsignedZ /= radix;
|
||||
}
|
||||
return path.toString();
|
||||
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 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) {
|
||||
var6.mkdir();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public Chunk loadChunk(World var1, int var2, int var3) {
|
||||
File var4 = this.chunkFileForXZ(var2, var3);
|
||||
if(var4 != null && var4.exists()) {
|
||||
try {
|
||||
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;
|
||||
NBTTagCompound var6 = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(var4.getBytes())));
|
||||
return loadChunkIntoWorldFromCompound(var1, var6.getCompoundTag("Level"));
|
||||
} catch (Exception var7) {
|
||||
var7.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
try (DataOutputStream dos = new DataOutputStream(new BufferedOutputStream(bao))) {
|
||||
NBTBase.writeNamedTag(toSave, dos);
|
||||
dos.flush();
|
||||
byte[] data = bao.toByteArray();
|
||||
LWJGLMain.writeFile(saveDir + "/" + chunkFileForXZ(var2.xPosition, var2.zPosition), data);
|
||||
try {
|
||||
NBTBase.writeNamedTag(toSave, new DataOutputStream(bao));
|
||||
} catch (IOException e) {
|
||||
System.err.println("Failed to serialize chunk at [" + var2.xPosition + ", " + var2.zPosition + "] to byte array");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
var3.writeBytes(bao.toByteArray());
|
||||
}
|
||||
|
||||
public void storeChunkInCompound(Chunk var1, World var2, NBTTagCompound var3) {
|
||||
|
@ -93,33 +82,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) {
|
||||
|
@ -147,28 +136,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;
|
||||
}
|
||||
|
|
|
@ -725,21 +725,4 @@ public abstract class Entity {
|
|||
var1.riddenByEntity = this;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -255,54 +255,41 @@ public class EntityRenderer {
|
|||
int var3;
|
||||
int var9;
|
||||
int var10;
|
||||
// if(this.mc.inGameHasFocus) {
|
||||
// int var2 = Mouse.getDX() * 0;
|
||||
// var3 = Mouse.getDY() * 0;
|
||||
// this.mc.mouseHelper.mouseXYChange();
|
||||
// byte var4 = 1;
|
||||
// if(this.mc.gameSettings.invertMouse) {
|
||||
// var4 = -1;
|
||||
// }
|
||||
//
|
||||
// boolean var5 = false;
|
||||
// boolean var6 = false;
|
||||
// var9 = var2 + this.mc.mouseHelper.deltaX;
|
||||
// var10 = var3 - this.mc.mouseHelper.deltaY;
|
||||
// if(var2 != 0 || this.mouseDX != 0) {
|
||||
// System.out.println("xxo: " + var2 + ", " + this.mouseDX + ": " + this.mouseDX + ", xo: " + var9);
|
||||
// }
|
||||
//
|
||||
// if(this.mouseDX != 0) {
|
||||
// this.mouseDX = 0;
|
||||
// }
|
||||
//
|
||||
// if(this.mouseDY != 0) {
|
||||
// this.mouseDY = 0;
|
||||
// }
|
||||
//
|
||||
// if(var2 != 0) {
|
||||
// this.mouseDX = var2;
|
||||
// }
|
||||
//
|
||||
// if(var3 != 0) {
|
||||
// this.mouseDY = var3;
|
||||
// }
|
||||
//
|
||||
// this.mc.thePlayer.setAngles((float)var9, (float)(var10 * var4));
|
||||
// }
|
||||
|
||||
int var5 = Mouse.getDX();
|
||||
int var6 = Mouse.getDY();;
|
||||
byte var91 = 1;
|
||||
|
||||
if(this.mc.inGameHasFocus) {
|
||||
int var2 = Mouse.getDX() * 0;
|
||||
var3 = Mouse.getDY() * 0;
|
||||
this.mc.mouseHelper.mouseXYChange();
|
||||
byte var4 = 1;
|
||||
if(this.mc.gameSettings.invertMouse) {
|
||||
var91 = -1;
|
||||
var4 = -1;
|
||||
}
|
||||
|
||||
if(this.mc.inGameHasFocus && this.mc.theWorld != null) {
|
||||
this.mc.thePlayer.turn((float)var5, (float)(var6 * var91));
|
||||
boolean var5 = false;
|
||||
boolean var6 = false;
|
||||
var9 = var2 + this.mc.mouseHelper.deltaX;
|
||||
var10 = var3 - this.mc.mouseHelper.deltaY;
|
||||
if(var2 != 0 || this.mouseDX != 0) {
|
||||
System.out.println("xxo: " + var2 + ", " + this.mouseDX + ": " + this.mouseDX + ", xo: " + var9);
|
||||
}
|
||||
|
||||
if(this.mouseDX != 0) {
|
||||
this.mouseDX = 0;
|
||||
}
|
||||
|
||||
if(this.mouseDY != 0) {
|
||||
this.mouseDY = 0;
|
||||
}
|
||||
|
||||
if(var2 != 0) {
|
||||
this.mouseDX = var2;
|
||||
}
|
||||
|
||||
if(var3 != 0) {
|
||||
this.mouseDY = var3;
|
||||
}
|
||||
|
||||
this.mc.thePlayer.setAngles((float)var9, (float)(var10 * var4));
|
||||
}
|
||||
|
||||
if(!this.mc.skipRenderWorld) {
|
||||
ScaledResolution var7 = new ScaledResolution(this.mc.displayWidth, this.mc.displayHeight);
|
||||
|
@ -390,24 +377,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) {
|
||||
if(var13 > 0) {
|
||||
var3.renderAllRenderLists(1, (double)var1);
|
||||
}
|
||||
} else {
|
||||
var3.sortAndRender(var2, 1, (double)var1);
|
||||
//}
|
||||
//} else {
|
||||
//var3.sortAndRender(var2, 1, (double)var1);
|
||||
//}
|
||||
}
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
|
9
src/main/java/net/minecraft/src/EnumOS.java
Normal file
9
src/main/java/net/minecraft/src/EnumOS.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
enum EnumOS {
|
||||
linux,
|
||||
solaris,
|
||||
windows,
|
||||
macos,
|
||||
unknown;
|
||||
}
|
9
src/main/java/net/minecraft/src/EnumOSIsom.java
Normal file
9
src/main/java/net/minecraft/src/EnumOSIsom.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
enum EnumOSIsom {
|
||||
linux,
|
||||
solaris,
|
||||
windows,
|
||||
macos,
|
||||
unknown;
|
||||
}
|
|
@ -1,9 +1,6 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -18,7 +15,7 @@ public class FontRenderer {
|
|||
MinecraftImageData bufferedimage = LWJGLMain.loadPNG(LWJGLMain.loadResourceBytes(s));
|
||||
int i = bufferedimage.w;
|
||||
int j = bufferedimage.h;
|
||||
int ai[] = bufferedimage.data();
|
||||
int ai[] = bufferedimage.data;
|
||||
for (int k = 0; k < 256; k++) {
|
||||
int l = k % 16;
|
||||
int k1 = k / 16;
|
||||
|
@ -172,13 +169,4 @@ public class FontRenderer {
|
|||
private IntBuffer buffer;
|
||||
|
||||
public static final char formatChar = '\247';
|
||||
|
||||
public List<String> listFormattedStringToWidth(String title2) {
|
||||
java.util.ArrayList arraylist = new java.util.ArrayList();
|
||||
String[] string = title2.split("\n");
|
||||
for (String list : string) {
|
||||
arraylist.add(list);
|
||||
}
|
||||
return arraylist;
|
||||
}
|
||||
}
|
|
@ -1,28 +1,22 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class Frustrum implements ICamera {
|
||||
private final ClippingHelper clippingHelper = ClippingHelperImplementation.getInstance();
|
||||
private ClippingHelper clippingHelper = ClippingHelperImplementation.getInstance();
|
||||
private double xPosition;
|
||||
private double yPosition;
|
||||
private double zPosition;
|
||||
|
||||
public void setPosition(double x, double y, double z) {
|
||||
xPosition = x;
|
||||
yPosition = y;
|
||||
zPosition = z;
|
||||
public void setPosition(double var1, double var3, double var5) {
|
||||
this.xPosition = var1;
|
||||
this.yPosition = var3;
|
||||
this.zPosition = var5;
|
||||
}
|
||||
|
||||
public boolean isBoxInFrustum(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
|
||||
minX -= xPosition;
|
||||
minY -= yPosition;
|
||||
minZ -= zPosition;
|
||||
maxX -= xPosition;
|
||||
maxY -= yPosition;
|
||||
maxZ -= zPosition;
|
||||
return clippingHelper.isBoxInFrustum(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
public boolean isBoxInFrustum(double var1, double var3, double var5, double var7, double var9, double var11) {
|
||||
return this.clippingHelper.isBoxInFrustum(var1 - this.xPosition, var3 - this.yPosition, var5 - this.zPosition, var7 - this.xPosition, var9 - this.yPosition, var11 - this.zPosition);
|
||||
}
|
||||
|
||||
public boolean isBoundingBoxInFrustum(AxisAlignedBB boundingBox) {
|
||||
return isBoxInFrustum(boundingBox.minX, boundingBox.minY, boundingBox.minZ, boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ);
|
||||
public boolean isBoundingBoxInFrustum(AxisAlignedBB var1) {
|
||||
return this.isBoxInFrustum(var1.minX, var1.minY, var1.minZ, var1.maxX, var1.maxY, var1.maxZ);
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||
import net.PeytonPlayz585.io.File;
|
||||
|
||||
public class GuiCreateWorld extends GuiScreen {
|
||||
protected GuiScreen parentGuiScreen;
|
||||
|
@ -12,14 +12,16 @@ public class GuiCreateWorld extends GuiScreen {
|
|||
}
|
||||
|
||||
public void initGui() {
|
||||
File var1 = Minecraft.getMinecraftDir();
|
||||
|
||||
for(int var2 = 0; var2 < 5; ++var2) {
|
||||
NBTTagCompound var3 = World.getLevelData("World" + (var2 + 1));
|
||||
NBTTagCompound var3 = World.getLevelData(var1, "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);
|
||||
double var5 = LWJGLMain.getFileSize("World" + (var2 + 1) + "/level.dat");
|
||||
var4 = var4 + " (" + (double) var5 / 100 + " MB)";
|
||||
long var5 = var3.getLong("SizeOnDisk");
|
||||
var4 = var4 + " (" + (float)(var5 / 1024L * 100L / 1024L) / 100.0F + " MB)";
|
||||
this.controlList.add(new GuiButton(var2, this.width / 2 - 100, this.height / 6 + 24 * var2, var4));
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +30,8 @@ public class GuiCreateWorld extends GuiScreen {
|
|||
}
|
||||
|
||||
protected String getSaveFileName(int var1) {
|
||||
return World.getLevelData("World" + var1) != null ? "World" + var1 : null;
|
||||
File var2 = Minecraft.getMinecraftDir();
|
||||
return World.getLevelData(var2, "World" + var1) != null ? "World" + var1 : null;
|
||||
}
|
||||
|
||||
public void initButtons() {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.PeytonPlayz585.io.File;
|
||||
|
||||
public class GuiDeleteWorld extends GuiCreateWorld {
|
||||
public GuiDeleteWorld(GuiScreen var1) {
|
||||
super(var1);
|
||||
|
@ -20,7 +22,8 @@ public class GuiDeleteWorld extends GuiCreateWorld {
|
|||
|
||||
public void deleteWorld(boolean var1, int var2) {
|
||||
if(var1) {
|
||||
World.deleteWorld(this.getSaveFileName(var2));
|
||||
File var3 = Minecraft.getMinecraftDir();
|
||||
World.deleteWorld(var3, this.getSaveFileName(var2));
|
||||
}
|
||||
|
||||
this.mc.displayGuiScreen(this.parentGuiScreen);
|
||||
|
|
|
@ -29,9 +29,9 @@ public class GuiIngame extends Gui {
|
|||
FontRenderer var8 = this.mc.fontRenderer;
|
||||
this.mc.entityRenderer.setupOverlayRendering();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
// if(this.mc.gameSettings.fancyGraphics) {
|
||||
// this.renderVignette(this.mc.thePlayer.getEntityBrightness(var1), var6, var7);
|
||||
// }
|
||||
if(this.mc.gameSettings.fancyGraphics) {
|
||||
this.renderVignette(this.mc.thePlayer.getEntityBrightness(var1), var6, var7);
|
||||
}
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/gui.png"));
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiMessage extends GuiScreen {
|
||||
|
||||
private String title1;
|
||||
private String title2;
|
||||
private final List listLines2 = new ArrayList();
|
||||
private GuiScreen parent;
|
||||
|
||||
public GuiMessage(GuiScreen var1, String var2, String var3) {
|
||||
parent = var1;
|
||||
title1 = var2;
|
||||
title2 = var3;
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
this.controlList.clear();
|
||||
this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 72, "I Understand!"));
|
||||
this.listLines2.clear();
|
||||
this.listLines2.addAll(this.fontRenderer.listFormattedStringToWidth(this.title2));
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton var1) {
|
||||
if(var1.id == 0) {
|
||||
this.mc.displayGuiScreen(parent);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawScreen(int var1, int var2, float var3) {
|
||||
this.drawDefaultBackground();
|
||||
this.drawCenteredString(fontRenderer, title1, this.width / 2 - 5, 70, 16777215);
|
||||
int i = 90;
|
||||
|
||||
for (Object s : this.listLines2) {
|
||||
this.drawCenteredString(this.fontRenderer, (String) s, this.width / 2 - 5, i, 16777215);
|
||||
i += 9;
|
||||
}
|
||||
|
||||
super.drawScreen(var1, var2, var3);
|
||||
}
|
||||
|
||||
}
|
|
@ -10,7 +10,7 @@ public class GuiScreen extends Gui {
|
|||
protected Minecraft mc;
|
||||
public int width;
|
||||
public int height;
|
||||
protected List<GuiButton> controlList = new ArrayList<GuiButton>();
|
||||
protected List controlList = new ArrayList();
|
||||
public boolean allowUserInput = false;
|
||||
protected FontRenderer fontRenderer;
|
||||
|
||||
|
|
|
@ -5,7 +5,5 @@ public interface IProgressUpdate {
|
|||
|
||||
void displayLoadingString(String var1);
|
||||
|
||||
void displayLoadingString(String var1, String var2);
|
||||
|
||||
void setLoadingProgress(int var1);
|
||||
}
|
||||
|
|
|
@ -57,23 +57,6 @@ public class LoadingScreenRenderer implements IProgressUpdate {
|
|||
}
|
||||
}
|
||||
|
||||
public void displayLoadingString(String s, String s1) {
|
||||
if (!mc.running) {
|
||||
if (printText) {
|
||||
return;
|
||||
} else {
|
||||
throw new MinecraftError();
|
||||
}
|
||||
} else {
|
||||
systemTime = 0L;
|
||||
currentlyDisplayedProgress = s1;
|
||||
currentlyDisplayedText = s;
|
||||
setLoadingProgress(-1);
|
||||
systemTime = 0L;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void setLoadingProgress(int var1) {
|
||||
if(!this.mc.running) {
|
||||
if(!this.printText) {
|
||||
|
|
|
@ -1,30 +1,23 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class MathHelper {
|
||||
private static final float[] SIN_TABLE = new float[4096];
|
||||
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;
|
||||
|
||||
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));
|
||||
for (int i = 0; i < SIN_TABLE.length; ++i) {
|
||||
SIN_TABLE[i] = (float) Math.sin(i * 2 * Math.PI * INVERSE_SIN_TABLE_LENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 cos(float var0) {
|
||||
return SIN_TABLE[(int) (var0 * SIN_CONVERSION_FACTOR + COS_CONVERSION_FACTOR) & 65535];
|
||||
}
|
||||
|
||||
public static final float sqrt_float(float var0) {
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import org.lwjgl.LWJGLException;
|
||||
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,6 +29,8 @@ 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;
|
||||
|
@ -36,11 +38,14 @@ 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;
|
||||
|
@ -48,18 +53,22 @@ public class Minecraft implements Runnable {
|
|||
private int mouseTicksRan = 0;
|
||||
public boolean isRaining = false;
|
||||
long systemTime = System.currentTimeMillis();
|
||||
private static Minecraft mc;
|
||||
|
||||
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() {
|
||||
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);
|
||||
|
@ -79,6 +88,7 @@ public class Minecraft implements Runnable {
|
|||
GL11.glLoadIdentity();
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
this.checkGLError("Startup");
|
||||
//this.sndManager.loadSoundSettings(this.gameSettings);
|
||||
this.renderEngine.registerTextureFX(this.textureLavaFX);
|
||||
this.renderEngine.registerTextureFX(this.textureWaterFX);
|
||||
this.renderEngine.registerTextureFX(new TextureWaterFlowFX());
|
||||
|
@ -87,14 +97,14 @@ public class Minecraft implements Runnable {
|
|||
this.renderEngine.registerTextureFX(new TextureFlamesFX(1));
|
||||
this.renderGlobal = new RenderGlobal(this, this.renderEngine);
|
||||
GL11.glViewport(0, 0, this.displayWidth, this.displayHeight);
|
||||
Minecraft.getMinecraft().displayGuiMessage(new GuiMainMenu(), "EARLY BETA TESTING!", "THIS PROJECT IS STILL IN TESTING!\nTHERE WILL BE BUGS!");
|
||||
this.displayGuiScreen(new GuiMainMenu());
|
||||
this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
|
||||
this.checkGLError("Post startup");
|
||||
this.ingameGUI = new GuiIngame(this);
|
||||
this.playerController.init();
|
||||
}
|
||||
|
||||
private void loadScreen() {
|
||||
private void loadScreen() throws LWJGLException {
|
||||
ScaledResolution var1 = new ScaledResolution(this.displayWidth, this.displayHeight);
|
||||
int var2 = var1.getScaledWidth();
|
||||
int var3 = var1.getScaledHeight();
|
||||
|
@ -126,6 +136,44 @@ 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) {
|
||||
|
@ -153,11 +201,6 @@ public class Minecraft implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
public void displayGuiMessage(GuiScreen var1, String var2, String var3) {
|
||||
GuiMessage guimessage = new GuiMessage(var1, var2, var3);
|
||||
this.displayGuiScreen(guimessage);
|
||||
}
|
||||
|
||||
private void checkGLError(String var1) {
|
||||
int var2 = GL11.glGetError();
|
||||
if(var2 != 0) {
|
||||
|
@ -180,8 +223,16 @@ public class Minecraft implements Runnable {
|
|||
|
||||
public void run() {
|
||||
this.running = true;
|
||||
this.startGame();
|
||||
|
||||
try {
|
||||
this.startGame();
|
||||
} catch (Exception var10) {
|
||||
var10.printStackTrace();
|
||||
new UnexpectedThrowable("Failed to start game", var10);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
long var1 = System.currentTimeMillis();
|
||||
int var3 = 0;
|
||||
|
||||
|
@ -207,6 +258,7 @@ public class Minecraft implements Runnable {
|
|||
this.timer.renderPartialTicks = 1.0F;
|
||||
}
|
||||
|
||||
//this.sndManager.setListener(this.thePlayer, this.timer.renderPartialTicks);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
if(this.theWorld != null) {
|
||||
while(this.theWorld.updatingLighting()) {
|
||||
|
@ -226,7 +278,7 @@ public class Minecraft implements Runnable {
|
|||
|
||||
Thread.yield();
|
||||
Display.update();
|
||||
if(Display.getWidth() != this.displayWidth || Display.getHeight() != this.displayHeight) {
|
||||
if(LWJGLMain.canvas.getWidth() != this.displayWidth || LWJGLMain.canvas.getHeight() != this.displayHeight) {
|
||||
this.displayWidth = LWJGLMain.canvas.getWidth();
|
||||
this.displayHeight = LWJGLMain.canvas.getHeight();
|
||||
if(this.displayWidth <= 0) {
|
||||
|
@ -241,11 +293,7 @@ public class Minecraft implements Runnable {
|
|||
}
|
||||
|
||||
if(this.gameSettings.limitFramerate) {
|
||||
try {
|
||||
Thread.sleep(5L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
this.checkGLError("Post render");
|
||||
|
@ -257,6 +305,14 @@ public class Minecraft implements Runnable {
|
|||
var1 += 1000L;
|
||||
}
|
||||
}
|
||||
} catch (MinecraftError var11) {
|
||||
} catch (Exception var12) {
|
||||
var12.printStackTrace();
|
||||
new UnexpectedThrowable("Unexpected error", var12);
|
||||
} finally {
|
||||
this.shutdownMinecraftApplet();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void displayDebugInfo() {
|
||||
|
@ -307,7 +363,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 * 4096);
|
||||
var3.setColorOpaque_I(-16777216 + var10 + var9 * 256 + var8 * 65536);
|
||||
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);
|
||||
|
@ -649,7 +705,7 @@ public class Minecraft implements Runnable {
|
|||
public void startWorld(String var1) {
|
||||
this.changeWorld1((World)null);
|
||||
System.gc();
|
||||
World var2 = new World(var1);
|
||||
World var2 = new World(new File(getMinecraftDir(), "saves"), var1);
|
||||
if(var2.isNewWorld) {
|
||||
this.changeWorld2(var2, "Generating level");
|
||||
} else {
|
||||
|
@ -748,6 +804,20 @@ 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();
|
||||
}
|
||||
|
@ -778,36 +848,4 @@ public class Minecraft implements Runnable {
|
|||
this.playerController.onRespawn(this.thePlayer);
|
||||
this.preloadWorld("Respawning");
|
||||
}
|
||||
|
||||
public static Minecraft getMinecraft() {
|
||||
return mc;
|
||||
}
|
||||
|
||||
public final void setLighting(boolean var1) {
|
||||
if(!var1) {
|
||||
GL11.glDisable(2896);
|
||||
GL11.glDisable(16384);
|
||||
} else {
|
||||
GL11.glEnable(2896);
|
||||
GL11.glEnable(16384);
|
||||
GL11.glEnable(2903);
|
||||
GL11.glColorMaterial(1032, 5634);
|
||||
float var4 = 0.7F;
|
||||
float var2 = 0.3F;
|
||||
Vec3D var3 = (new Vec3D(0.0F, -1.0F, 0.5F)).normalize();
|
||||
GL11.glLight(16384, 4611, this.createBuffer((float)var3.xCoord, (float)var3.yCoord, (float)var3.zCoord, 0.0F));
|
||||
GL11.glLight(16384, 4609, this.createBuffer(var2, var2, var2, 1.0F));
|
||||
GL11.glLight(16384, 4608, this.createBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GL11.glLightModel(2899, this.createBuffer(var4, var4, var4, 1.0F));
|
||||
}
|
||||
}
|
||||
|
||||
private FloatBuffer createBuffer(float var1, float var2, float var3, float var4) {
|
||||
buffer.clear();
|
||||
buffer.put(var1).put(var2).put(var3).put(var4);
|
||||
buffer.flip();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private FloatBuffer buffer = GLAllocation.createFloatBuffer(16);
|
||||
}
|
||||
|
|
28
src/main/java/net/minecraft/src/OSMap.java
Normal file
28
src/main/java/net/minecraft/src/OSMap.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
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) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
28
src/main/java/net/minecraft/src/OSMapIsom.java
Normal file
28
src/main/java/net/minecraft/src/OSMapIsom.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
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) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -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,12 +34,18 @@ public class RenderEngine {
|
|||
singleIntBuffer.clear();
|
||||
GLAllocation.generateTextureNames(singleIntBuffer);
|
||||
int i = singleIntBuffer.get(0);
|
||||
if (s.startsWith("%%")) {
|
||||
if (s.startsWith("%clamp%")) {
|
||||
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;
|
||||
}
|
||||
setupTexture(readTextureImage(LWJGLMain.loadResourceBytes(s)), i);
|
||||
useMipmaps = false;
|
||||
}
|
||||
|
@ -97,7 +103,7 @@ public class RenderEngine {
|
|||
}
|
||||
int j = bufferedimage.w;
|
||||
int k = bufferedimage.h;
|
||||
int ai[] = bufferedimage.data();
|
||||
int ai[] = bufferedimage.data;
|
||||
byte abyte0[] = new byte[j * k * 4];
|
||||
for (int l = 0; l < ai.length; l++) {
|
||||
int j1 = ai[l] >> 24 & 0xff;
|
||||
|
@ -155,7 +161,7 @@ public class RenderEngine {
|
|||
}
|
||||
|
||||
public int getTextureForDownloadableImage(String s, String s1) {
|
||||
return getTexture("/char.png");
|
||||
return getTexture("/mob/char.png");
|
||||
}
|
||||
|
||||
public void registerTextureFX(TextureFX texturefx) {
|
||||
|
@ -175,19 +181,16 @@ public class RenderEngine {
|
|||
}
|
||||
|
||||
public void bindTexture(int i) {
|
||||
Minecraft.getMinecraft().setLighting(true);
|
||||
if (i < 0) {
|
||||
Minecraft.getMinecraft().setLighting(false);
|
||||
return;
|
||||
} else {
|
||||
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, i);
|
||||
Minecraft.getMinecraft().setLighting(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean useMipmaps = false;
|
||||
private static HashMap<String, Integer> textureMap;
|
||||
private HashMap<String, Integer> textureMap;
|
||||
private HashMap<Integer, MinecraftImageData> textureNameToImageMap;
|
||||
private IntBuffer singleIntBuffer;
|
||||
private ByteBuffer imageDataB1;
|
||||
|
|
|
@ -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,6 +59,16 @@ 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);
|
||||
|
@ -213,6 +223,10 @@ 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;
|
||||
|
@ -369,9 +383,103 @@ public class RenderGlobal implements IWorldAccess {
|
|||
}
|
||||
|
||||
byte var17 = 0;
|
||||
return var17 + this.renderSortedRenderers(0, this.sortedWorldRenderers.length, var2, var3);
|
||||
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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
@ -401,18 +509,42 @@ public class RenderGlobal implements IWorldAccess {
|
|||
double var20 = var19.lastTickPosX + (var19.posX - var19.lastTickPosX) * var4;
|
||||
double var10 = var19.lastTickPosY + (var19.posY - var19.lastTickPosY) * var4;
|
||||
double var12 = var19.lastTickPosZ + (var19.posZ - var19.lastTickPosZ) * var4;
|
||||
int var14 = 0;
|
||||
|
||||
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();
|
||||
int var15;
|
||||
for(var15 = 0; var15 < this.allRenderLists.length; ++var15) {
|
||||
this.allRenderLists[var15].reset();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ public class SpawnerAnimals {
|
|||
try {
|
||||
var32 = (EntityLiving)this.entities[var8].getConstructor(new Class[]{World.class}).newInstance(new Object[]{var1});
|
||||
} catch (Exception var30) {
|
||||
var30.printStackTrace();
|
||||
return var5;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ public class TerrainTextureManager {
|
|||
field_1184_e = new int[5120];
|
||||
field_1183_f = new int[34];
|
||||
field_1182_g = new int[768];
|
||||
int ai[] = LWJGLMain.loadPNG(LWJGLMain.loadResourceBytes("/terrain.png")).data();
|
||||
int ai[] = LWJGLMain.loadPNG(LWJGLMain.loadResourceBytes("/terrain.png")).data;
|
||||
for (int j = 0; j < 256; j++) {
|
||||
int k = 0;
|
||||
int l = 0;
|
||||
|
|
|
@ -7,25 +7,88 @@ import org.teavm.jso.typedarrays.Int32Array;
|
|||
|
||||
public class Tessellator {
|
||||
|
||||
/** The byte buffer used for GL allocation. */
|
||||
private Int32Array intBuffer;
|
||||
private Float32Array floatBuffer;
|
||||
|
||||
/**
|
||||
* The number of vertices to be drawn in the next draw call. Reset to 0 between
|
||||
* draw calls.
|
||||
*/
|
||||
private int vertexCount = 0;
|
||||
|
||||
/** The first coordinate to be used for the texture. */
|
||||
private float textureU;
|
||||
|
||||
/** The second coordinate to be used for the texture. */
|
||||
private float textureV;
|
||||
|
||||
/** The color (RGBA) value to be used for the following draw call. */
|
||||
private int color;
|
||||
|
||||
/**
|
||||
* Whether the current draw object for this tessellator has color values.
|
||||
*/
|
||||
private boolean hasColor = false;
|
||||
|
||||
/**
|
||||
* Whether the current draw object for this tessellator has texture coordinates.
|
||||
*/
|
||||
private boolean hasTexture = false;
|
||||
|
||||
/**
|
||||
* Whether the current draw object for this tessellator has normal values.
|
||||
*/
|
||||
private boolean hasNormals = false;
|
||||
|
||||
/** The index into the raw buffer to be used for the next data. */
|
||||
private int rawBufferIndex = 0;
|
||||
|
||||
/**
|
||||
* The number of vertices manually added to the given draw call. This differs
|
||||
* from vertexCount because it adds extra vertices when converting quads to
|
||||
* triangles.
|
||||
*/
|
||||
private int addedVertices = 0;
|
||||
|
||||
/** Disables all color information for the following draw call. */
|
||||
private boolean isColorDisabled = false;
|
||||
|
||||
/** The draw mode currently being used by the tessellator. */
|
||||
private int drawMode;
|
||||
|
||||
/**
|
||||
* An offset to be applied along the x-axis for all vertices in this draw call.
|
||||
*/
|
||||
private double xOffset;
|
||||
|
||||
/**
|
||||
* An offset to be applied along the y-axis for all vertices in this draw call.
|
||||
*/
|
||||
private double yOffset;
|
||||
|
||||
/**
|
||||
* An offset to be applied along the z-axis for all vertices in this draw call.
|
||||
*/
|
||||
private double zOffset;
|
||||
public static final Tessellator instance = new Tessellator(524288);
|
||||
|
||||
/** The normal to be applied to the face being drawn. */
|
||||
private int normal;
|
||||
|
||||
/** The static instance of the Tessellator. */
|
||||
public static final Tessellator instance = new Tessellator(525000);
|
||||
|
||||
/** Whether this tessellator is currently in draw mode. */
|
||||
private boolean isDrawing = false;
|
||||
|
||||
/** Whether we are currently using VBO or not. */
|
||||
private boolean useVBO = false;
|
||||
|
||||
/** The size of the buffers used (in integers). */
|
||||
private int bufferSize;
|
||||
|
||||
private Tessellator(int par1) {
|
||||
this.bufferSize = par1;
|
||||
ArrayBuffer a = ArrayBuffer.create(par1 * 4);
|
||||
this.intBuffer = Int32Array.create(a);
|
||||
this.floatBuffer = Float32Array.create(a);
|
||||
|
@ -51,6 +114,10 @@ public class Tessellator {
|
|||
GL11.glEnableVertexAttrib(GL11.GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
if (this.hasNormals) {
|
||||
GL11.glEnableVertexAttrib(GL11.GL_NORMAL_ARRAY);
|
||||
}
|
||||
|
||||
GL11.glDrawArrays(this.drawMode, 0, this.vertexCount, Int32Array.create(intBuffer.getBuffer(), 0, this.vertexCount * 7));
|
||||
|
||||
if (this.hasTexture) {
|
||||
|
@ -60,6 +127,10 @@ public class Tessellator {
|
|||
if (this.hasColor) {
|
||||
GL11.glDisableVertexAttrib(GL11.GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
if (this.hasNormals) {
|
||||
GL11.glDisableVertexAttrib(GL11.GL_NORMAL_ARRAY);
|
||||
}
|
||||
}
|
||||
|
||||
int var1 = this.rawBufferIndex * 4;
|
||||
|
@ -96,6 +167,7 @@ public class Tessellator {
|
|||
this.isDrawing = true;
|
||||
this.reset();
|
||||
this.drawMode = par1;
|
||||
this.hasNormals = false;
|
||||
this.hasColor = false;
|
||||
this.hasTexture = false;
|
||||
this.isColorDisabled = false;
|
||||
|
@ -209,6 +281,10 @@ public class Tessellator {
|
|||
intBuffer0.set(bufferIndex + 5, this.color);
|
||||
}
|
||||
|
||||
if (this.hasNormals) {
|
||||
intBuffer0.set(bufferIndex + 6, this.normal);
|
||||
}
|
||||
|
||||
this.rawBufferIndex += 7;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,22 +43,23 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
|||
return "Chest";
|
||||
}
|
||||
|
||||
public final void readFromNBT(NBTTagCompound var1) {
|
||||
NBTTagList var5 = var1.getTagList("Items");
|
||||
this.chestContents = new ItemStack[27];
|
||||
public void readFromNBT(NBTTagCompound var1) {
|
||||
super.readFromNBT(var1);
|
||||
NBTTagList var2 = var1.getTagList("Items");
|
||||
this.chestContents = new ItemStack[this.getSizeInventory()];
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final void writeToNBT(NBTTagCompound var1) {
|
||||
var1.setString("id", "Chest");
|
||||
public void writeToNBT(NBTTagCompound var1) {
|
||||
super.writeToNBT(var1);
|
||||
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 final void readFromNBT(NBTTagCompound var1) {
|
||||
public void readFromNBT(NBTTagCompound var1) {
|
||||
super.readFromNBT(var1);
|
||||
NBTTagList var2 = var1.getTagList("Items");
|
||||
this.furnaceItemStacks = new ItemStack[this.furnaceItemStacks.length];
|
||||
this.furnaceItemStacks = new ItemStack[this.getSizeInventory()];
|
||||
|
||||
for(int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
|
||||
|
@ -61,15 +61,13 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
|||
|
||||
this.furnaceBurnTime = var1.getShort("BurnTime");
|
||||
this.furnaceCookTime = var1.getShort("CookTime");
|
||||
this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]);
|
||||
System.out.println("Lit: " + this.furnaceBurnTime + "/" + this.currentItemBurnTime);
|
||||
this.currentItemBurnTime = this.getItemBurnTime(this.furnaceItemStacks[1]);
|
||||
}
|
||||
|
||||
public final void writeToNBT(NBTTagCompound var1) {
|
||||
public 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,7 +88,6 @@ 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,7 +6,6 @@ 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]);
|
||||
|
|
|
@ -26,7 +26,7 @@ public class Vec3D {
|
|||
return ((Vec3D)vectorList.get(nextVector++)).setComponents(var0, var2, var4);
|
||||
}
|
||||
|
||||
public Vec3D(double var1, double var3, double var5) {
|
||||
private Vec3D(double var1, double var3, double var5) {
|
||||
if(var1 == -0.0D) {
|
||||
var1 = 0.0D;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
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;
|
||||
|
@ -12,9 +13,6 @@ 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;
|
||||
|
@ -41,7 +39,7 @@ public class World implements IBlockAccess {
|
|||
public boolean isNewWorld;
|
||||
private List worldAccesses;
|
||||
private IChunkProvider chunkProvider;
|
||||
private static String saveDirectory;
|
||||
private File saveDirectory;
|
||||
public long randomSeed;
|
||||
private NBTTagCompound nbtCompoundPlayer;
|
||||
public long setSizeOnDisk;
|
||||
|
@ -49,33 +47,52 @@ public class World implements IBlockAccess {
|
|||
private ArrayList collidingBoundingBoxes;
|
||||
private List entitiesWithinAABBExcludingEntity;
|
||||
|
||||
public static NBTTagCompound getLevelData(String var1) {
|
||||
byte[] data = LWJGLMain.readFile(var1 + "/level.dat");
|
||||
System.out.println(var1 + "/level.dat");
|
||||
if(data != null) {
|
||||
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;
|
||||
} else {
|
||||
File var4 = new File(var3, "level.dat");
|
||||
if(var4.exists()) {
|
||||
try {
|
||||
NBTTagCompound var5 = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(data)));
|
||||
NBTTagCompound var5 = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(var4.getBytes())));
|
||||
NBTTagCompound var6 = var5.getCompoundTag("Data");
|
||||
return var6;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} catch (Exception var7) {
|
||||
var7.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void deleteWorld(String var1) {
|
||||
String dir = var1 + "/";
|
||||
FileSystemUtils.recursiveDeleteDirectoryWithProgress(dir, "Deleting World!", "Please Wait...", Minecraft.getMinecraft().loadingScreen);
|
||||
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 World(String var2) {
|
||||
this(var2, (new Random()).nextLong());
|
||||
private static void deleteWorldFiles(File[] var0) {
|
||||
for(int var1 = 0; var1 < var0.length; ++var1) {
|
||||
if(var0[var1].isDirectory()) {
|
||||
deleteWorldFiles(var0[var1].listFiles());
|
||||
}
|
||||
|
||||
public World(String var2, long var3) {
|
||||
var0[var1].delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public World(File var1, String var2) {
|
||||
this(var1, var2, (new Random()).nextLong());
|
||||
}
|
||||
|
||||
public World(File var1, String var2, long var3) {
|
||||
this.lightingToUpdate = new ArrayList();
|
||||
this.loadedEntityList = new ArrayList();
|
||||
this.unloadedEntityList = new ArrayList();
|
||||
|
@ -98,13 +115,14 @@ public class World implements IBlockAccess {
|
|||
this.collidingBoundingBoxes = new ArrayList();
|
||||
this.entitiesWithinAABBExcludingEntity = new ArrayList();
|
||||
this.levelName = var2;
|
||||
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) {
|
||||
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()) {
|
||||
try {
|
||||
NBTTagCompound var6 = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(data)));
|
||||
NBTTagCompound var6 = (NBTTagCompound) NBTBase.readNamedTag(new DataInputStream(new ByteArrayInputStream(var5.getBytes())));
|
||||
NBTTagCompound var7 = var6.getCompoundTag("Data");
|
||||
this.randomSeed = var7.getLong("RandomSeed");
|
||||
this.spawnX = var7.getInteger("SpawnX");
|
||||
|
@ -124,7 +142,7 @@ public class World implements IBlockAccess {
|
|||
var9 = true;
|
||||
}
|
||||
|
||||
this.chunkProvider = this.getChunkProvider(saveDirectory);
|
||||
this.chunkProvider = this.getChunkProvider(this.saveDirectory);
|
||||
if(var9) {
|
||||
this.spawnX = 0;
|
||||
this.spawnY = 64;
|
||||
|
@ -137,8 +155,8 @@ public class World implements IBlockAccess {
|
|||
this.calculateInitialSkylight();
|
||||
}
|
||||
|
||||
protected IChunkProvider getChunkProvider(String var1) {
|
||||
return new ChunkProviderLoadOrGenerate(this, new ChunkLoader(var1), new ChunkProviderGenerate(this, this.randomSeed));
|
||||
protected IChunkProvider getChunkProvider(File var1) {
|
||||
return new ChunkProviderLoadOrGenerate(this, new ChunkLoader(var1, true), new ChunkProviderGenerate(this, this.randomSeed));
|
||||
}
|
||||
|
||||
public void setSpawnLocation() {
|
||||
|
@ -210,29 +228,29 @@ public class World implements IBlockAccess {
|
|||
var2.setTag("Data", var1);
|
||||
|
||||
try {
|
||||
byte[] var3 = LWJGLMain.readFile(saveDirectory + "/level.dat_new");
|
||||
byte[] var4 = LWJGLMain.readFile(saveDirectory + "/level.dat_old");
|
||||
byte[] var5 = LWJGLMain.readFile(saveDirectory + "/level.dat");
|
||||
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");
|
||||
ByteArrayOutputStream bao = new ByteArrayOutputStream(131072);
|
||||
NBTBase.writeNamedTag(var2, new DataOutputStream(bao));
|
||||
LWJGLMain.writeFile(saveDirectory + "/level.dat_new", bao.toByteArray());
|
||||
if(LWJGLMain.readFile(saveDirectory + "/level.dat_old") != null) {
|
||||
LWJGLMain.deleteFile(saveDirectory + "/level.dat_old");
|
||||
var3.writeBytes(bao.toByteArray());
|
||||
if(var4.exists()) {
|
||||
var4.delete();
|
||||
}
|
||||
|
||||
LWJGLMain.renameFile(saveDirectory + "/level.dat", saveDirectory + "/level.dat_old");
|
||||
if(LWJGLMain.readFile(saveDirectory + "/level.dat") != null) {
|
||||
LWJGLMain.deleteFile(saveDirectory + "/level.dat");
|
||||
var5.renameTo(var4);
|
||||
if(var5.exists()) {
|
||||
var5.delete();
|
||||
}
|
||||
|
||||
LWJGLMain.renameFile(saveDirectory + "/level.dat_new", saveDirectory + "/level.dat");
|
||||
|
||||
if(LWJGLMain.readFile(saveDirectory + "/level.dat_new") != null) {
|
||||
LWJGLMain.deleteFile(saveDirectory + "/level.dat_new");
|
||||
var3.renameTo(var5);
|
||||
if(var3.exists()) {
|
||||
var3.delete();
|
||||
}
|
||||
} catch (Exception var6) {
|
||||
var6.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean saveWorld(int var1) {
|
||||
|
|
|
@ -74,6 +74,10 @@ public class WorldRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
private void setupGLTranslation() {
|
||||
GL11.glTranslatef((float)this.posXClip, (float)this.posYClip, (float)this.posZClip);
|
||||
}
|
||||
|
||||
public void updateRenderer() {
|
||||
if(this.needsUpdate) {
|
||||
++chunksUpdated;
|
||||
|
@ -109,8 +113,14 @@ public class WorldRenderer {
|
|||
if(!var14) {
|
||||
var14 = true;
|
||||
GL11.glNewList(this.glRenderList + var11, GL11.GL_COMPILE);
|
||||
GL11.glPushMatrix();
|
||||
this.setupGLTranslation();
|
||||
float var19 = 1.000001F;
|
||||
GL11.glTranslatef((float)(-this.sizeDepth) / 2.0F, (float)(-this.sizeHeight) / 2.0F, (float)(-this.sizeDepth) / 2.0F);
|
||||
GL11.glScalef(var19, var19, var19);
|
||||
GL11.glTranslatef((float)this.sizeDepth / 2.0F, (float)this.sizeHeight / 2.0F, (float)this.sizeDepth / 2.0F);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setTranslationD((double) (this.posXClip-this.posX), (double) (this.posYClip-this.posY), (double) (this.posZClip-this.posZ));
|
||||
tessellator.setTranslationD((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ));
|
||||
}
|
||||
|
||||
if(var11 == 0 && Block.blocksList[var18] instanceof BlockContainer) {
|
||||
|
@ -134,6 +144,7 @@ public class WorldRenderer {
|
|||
|
||||
if(var14) {
|
||||
tessellator.draw();
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEndList();
|
||||
tessellator.setTranslationD(0.0D, 0.0D, 0.0D);
|
||||
} else {
|
||||
|
|
|
@ -13,11 +13,7 @@ public class Display {
|
|||
LWJGLMain.updateDisplay();
|
||||
}
|
||||
|
||||
public static int getWidth() {
|
||||
return LWJGLMain.getCanvasWidth();
|
||||
}
|
||||
|
||||
public static int getHeight() {
|
||||
return LWJGLMain.getCanvasHeight();
|
||||
public static HTMLCanvasElement getDisplayMode() {
|
||||
return LWJGLMain.canvas;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user