Compare commits
14 Commits
31d09f3c50
...
011edd8647
Author | SHA1 | Date | |
---|---|---|---|
|
011edd8647 | ||
|
f9fea9dfbf | ||
|
7d78af5b4c | ||
|
458e47b0d5 | ||
|
3f03c09656 | ||
|
0cb102fb0b | ||
|
2c83e4e899 | ||
|
5094081717 | ||
|
eca31d4823 | ||
|
5f2acc6c46 | ||
|
b19b0c99e4 | ||
|
d1284dbee1 | ||
|
319cac8223 | ||
|
e8059cbfc6 |
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
# 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,5 +1,34 @@
|
|||
# Infdev-20100630-1
|
||||
WebGL port of Minecraft Infdev-20100630-1
|
||||
# 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.
|
||||
|
||||
## 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.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight(), false);
|
||||
instance = new Minecraft(Display.getWidth(), Display.getHeight(), false);
|
||||
instance.session = new Session("Player", "fuckmojang123");
|
||||
instance.session.mpPassParameter = "randpasslol";
|
||||
mcThread = new Thread(instance, "Minecraft main thread");
|
||||
|
|
|
@ -1,99 +0,0 @@
|
|||
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());
|
||||
}
|
||||
}
|
50
src/main/java/net/PeytonPlayz585/io/FileSystemUtils.java
Normal file
50
src/main/java/net/PeytonPlayz585/io/FileSystemUtils.java
Normal file
|
@ -0,0 +1,50 @@
|
|||
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,7 +923,8 @@ 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);
|
||||
}
|
||||
ret.complete(new MinecraftImageData(pixels, pxlsDat.getWidth(), pxlsDat.getHeight(), true));
|
||||
IntBuffer buffer = IntBuffer.wrap(pixels);
|
||||
ret.complete(new MinecraftImageData(buffer, pxlsDat.getWidth(), pxlsDat.getHeight(), true));
|
||||
}
|
||||
});
|
||||
toLoad.addEventListener("error", new EventListener<Event>() {
|
||||
|
|
|
@ -1,40 +1,55 @@
|
|||
package net.PeytonPlayz585.opengl;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
public class MinecraftImageData {
|
||||
|
||||
public final int[] data;
|
||||
public final int w;
|
||||
public final int h;
|
||||
public final boolean alpha;
|
||||
public final IntBuffer 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 = new int[pw * ph];
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
this.w = pw;
|
||||
this.h = ph;
|
||||
this.alpha = palpha;
|
||||
if (!palpha) {
|
||||
for (int i = 0; i < pdata.length; ++i) {
|
||||
pdata[i] = pdata[i] | 0xFF000000;
|
||||
}
|
||||
}
|
||||
this.data = pdata;
|
||||
}
|
||||
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");
|
||||
}
|
||||
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);
|
||||
}
|
||||
pdata.rewind();
|
||||
}
|
||||
data = pdata;
|
||||
}
|
||||
|
||||
public MinecraftImageData getSubImage(int x, int y, int pw, int ph) {
|
||||
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 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);
|
||||
}
|
||||
|
||||
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 this.blockMaterial == Material.water ? 1 : 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
|
|
|
@ -1,72 +1,83 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.*;
|
||||
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.util.Iterator;
|
||||
|
||||
import net.PeytonPlayz585.io.File;
|
||||
import net.PeytonPlayz585.opengl.LWJGLMain;
|
||||
|
||||
public class ChunkLoader implements IChunkLoader {
|
||||
private File saveDir;
|
||||
private boolean createIfNecessary;
|
||||
|
||||
private String saveDir;
|
||||
|
||||
public ChunkLoader(String dir) {
|
||||
saveDir = dir;
|
||||
}
|
||||
|
||||
public static final String CHUNK_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
public ChunkLoader(File var1, boolean var2) {
|
||||
this.saveDir = var1;
|
||||
this.createIfNecessary = var2;
|
||||
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;
|
||||
}
|
||||
|
||||
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()) {
|
||||
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 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;
|
||||
}
|
||||
|
||||
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 {
|
||||
NBTBase.writeNamedTag(toSave, new DataOutputStream(bao));
|
||||
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);
|
||||
} 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) {
|
||||
|
@ -82,33 +93,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 +147,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,4 +725,21 @@ 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,42 +255,55 @@ 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;
|
||||
}
|
||||
// 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;
|
||||
|
||||
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.gameSettings.invertMouse) {
|
||||
var91 = -1;
|
||||
}
|
||||
|
||||
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();
|
||||
|
@ -377,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,9 @@
|
|||
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;
|
||||
|
||||
|
@ -15,7 +18,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;
|
||||
|
@ -169,4 +172,13 @@ 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,22 +1,28 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class Frustrum implements ICamera {
|
||||
private ClippingHelper clippingHelper = ClippingHelperImplementation.getInstance();
|
||||
private double xPosition;
|
||||
private double yPosition;
|
||||
private double zPosition;
|
||||
private final ClippingHelper clippingHelper = ClippingHelperImplementation.getInstance();
|
||||
private double xPosition;
|
||||
private double yPosition;
|
||||
private double zPosition;
|
||||
|
||||
public void setPosition(double var1, double var3, double var5) {
|
||||
this.xPosition = var1;
|
||||
this.yPosition = var3;
|
||||
this.zPosition = var5;
|
||||
}
|
||||
public void setPosition(double x, double y, double z) {
|
||||
xPosition = x;
|
||||
yPosition = y;
|
||||
zPosition = z;
|
||||
}
|
||||
|
||||
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 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 isBoundingBoxInFrustum(AxisAlignedBB var1) {
|
||||
return this.isBoxInFrustum(var1.minX, var1.minY, var1.minZ, var1.maxX, var1.maxY, var1.maxZ);
|
||||
}
|
||||
}
|
||||
public boolean isBoundingBoxInFrustum(AxisAlignedBB boundingBox) {
|
||||
return isBoxInFrustum(boundingBox.minX, boundingBox.minY, boundingBox.minZ, boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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"));
|
||||
|
|
45
src/main/java/net/minecraft/src/GuiMessage.java
Normal file
45
src/main/java/net/minecraft/src/GuiMessage.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
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 controlList = new ArrayList();
|
||||
protected List<GuiButton> controlList = new ArrayList<GuiButton>();
|
||||
public boolean allowUserInput = false;
|
||||
protected FontRenderer fontRenderer;
|
||||
|
||||
|
|
|
@ -5,5 +5,7 @@ public interface IProgressUpdate {
|
|||
|
||||
void displayLoadingString(String var1);
|
||||
|
||||
void displayLoadingString(String var1, String var2);
|
||||
|
||||
void setLoadingProgress(int var1);
|
||||
}
|
||||
|
|
|
@ -57,6 +57,23 @@ 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,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) {
|
||||
|
|
|
@ -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,8 +29,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 +36,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;
|
||||
|
@ -53,22 +48,18 @@ 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() throws LWJGLException {
|
||||
this.mcDataDir = getMinecraftDir();
|
||||
public void startGame() {
|
||||
this.gameSettings = new GameSettings(this);
|
||||
this.renderEngine = new RenderEngine(this.gameSettings);
|
||||
this.fontRenderer = new FontRenderer(this.gameSettings, "/default.png", this.renderEngine);
|
||||
|
@ -88,7 +79,6 @@ 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());
|
||||
|
@ -97,14 +87,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);
|
||||
this.displayGuiScreen(new GuiMainMenu());
|
||||
Minecraft.getMinecraft().displayGuiMessage(new GuiMainMenu(), "EARLY BETA TESTING!", "THIS PROJECT IS STILL IN TESTING!\nTHERE WILL BE BUGS!");
|
||||
this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
|
||||
this.checkGLError("Post startup");
|
||||
this.ingameGUI = new GuiIngame(this);
|
||||
this.playerController.init();
|
||||
}
|
||||
|
||||
private void loadScreen() throws LWJGLException {
|
||||
private void loadScreen() {
|
||||
ScaledResolution var1 = new ScaledResolution(this.displayWidth, this.displayHeight);
|
||||
int var2 = var1.getScaledWidth();
|
||||
int var3 = var1.getScaledHeight();
|
||||
|
@ -136,44 +126,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) {
|
||||
|
@ -201,6 +153,11 @@ 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) {
|
||||
|
@ -223,96 +180,83 @@ 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;
|
||||
}
|
||||
long var1 = System.currentTimeMillis();
|
||||
int var3 = 0;
|
||||
|
||||
try {
|
||||
long var1 = System.currentTimeMillis();
|
||||
int var3 = 0;
|
||||
|
||||
while(this.running) {
|
||||
AxisAlignedBB.clearBoundingBoxPool();
|
||||
Vec3D.initialize();
|
||||
while(this.running) {
|
||||
AxisAlignedBB.clearBoundingBoxPool();
|
||||
Vec3D.initialize();
|
||||
|
||||
if(this.isGamePaused) {
|
||||
float var4 = this.timer.renderPartialTicks;
|
||||
this.timer.updateTimer();
|
||||
this.timer.renderPartialTicks = var4;
|
||||
} else {
|
||||
this.timer.updateTimer();
|
||||
}
|
||||
if(this.isGamePaused) {
|
||||
float var4 = this.timer.renderPartialTicks;
|
||||
this.timer.updateTimer();
|
||||
this.timer.renderPartialTicks = var4;
|
||||
} else {
|
||||
this.timer.updateTimer();
|
||||
}
|
||||
|
||||
for(int var14 = 0; var14 < this.timer.elapsedTicks; ++var14) {
|
||||
++this.ticksRan;
|
||||
this.runTick();
|
||||
}
|
||||
for(int var14 = 0; var14 < this.timer.elapsedTicks; ++var14) {
|
||||
++this.ticksRan;
|
||||
this.runTick();
|
||||
}
|
||||
|
||||
this.checkGLError("Pre render");
|
||||
if(this.isGamePaused) {
|
||||
this.timer.renderPartialTicks = 1.0F;
|
||||
}
|
||||
this.checkGLError("Pre render");
|
||||
if(this.isGamePaused) {
|
||||
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()) {
|
||||
}
|
||||
}
|
||||
|
||||
if(!this.skipRenderWorld) {
|
||||
this.playerController.setPartialTime(this.timer.renderPartialTicks);
|
||||
this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks);
|
||||
}
|
||||
|
||||
if(Keyboard.isKeyDown(33) && Keyboard.isKeyDown(7)) {
|
||||
this.displayDebugInfo();
|
||||
} else {
|
||||
this.prevFrameTime = System.nanoTime();
|
||||
}
|
||||
|
||||
Thread.yield();
|
||||
Display.update();
|
||||
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) {
|
||||
this.displayWidth = 1;
|
||||
}
|
||||
|
||||
if(this.displayHeight <= 0) {
|
||||
this.displayHeight = 1;
|
||||
}
|
||||
|
||||
this.resize(this.displayWidth, this.displayHeight);
|
||||
}
|
||||
|
||||
if(this.gameSettings.limitFramerate) {
|
||||
Thread.sleep(5L);
|
||||
}
|
||||
|
||||
this.checkGLError("Post render");
|
||||
++var3;
|
||||
|
||||
for(this.isGamePaused = !this.isMultiplayerWorld() && this.currentScreen != null && this.currentScreen.doesGuiPauseGame(); System.currentTimeMillis() >= var1 + 1000L; var3 = 0) {
|
||||
this.debug = var3 + " fps, " + WorldRenderer.chunksUpdated + " chunk updates";
|
||||
WorldRenderer.chunksUpdated = 0;
|
||||
var1 += 1000L;
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
if(this.theWorld != null) {
|
||||
while(this.theWorld.updatingLighting()) {
|
||||
}
|
||||
}
|
||||
} catch (MinecraftError var11) {
|
||||
} catch (Exception var12) {
|
||||
var12.printStackTrace();
|
||||
new UnexpectedThrowable("Unexpected error", var12);
|
||||
} finally {
|
||||
this.shutdownMinecraftApplet();
|
||||
}
|
||||
|
||||
if(!this.skipRenderWorld) {
|
||||
this.playerController.setPartialTime(this.timer.renderPartialTicks);
|
||||
this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks);
|
||||
}
|
||||
|
||||
if(Keyboard.isKeyDown(33) && Keyboard.isKeyDown(7)) {
|
||||
this.displayDebugInfo();
|
||||
} else {
|
||||
this.prevFrameTime = System.nanoTime();
|
||||
}
|
||||
|
||||
Thread.yield();
|
||||
Display.update();
|
||||
if(Display.getWidth() != this.displayWidth || Display.getHeight() != this.displayHeight) {
|
||||
this.displayWidth = LWJGLMain.canvas.getWidth();
|
||||
this.displayHeight = LWJGLMain.canvas.getHeight();
|
||||
if(this.displayWidth <= 0) {
|
||||
this.displayWidth = 1;
|
||||
}
|
||||
|
||||
if(this.displayHeight <= 0) {
|
||||
this.displayHeight = 1;
|
||||
}
|
||||
|
||||
this.resize(this.displayWidth, this.displayHeight);
|
||||
}
|
||||
|
||||
if(this.gameSettings.limitFramerate) {
|
||||
try {
|
||||
Thread.sleep(5L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
this.checkGLError("Post render");
|
||||
++var3;
|
||||
|
||||
for(this.isGamePaused = !this.isMultiplayerWorld() && this.currentScreen != null && this.currentScreen.doesGuiPauseGame(); System.currentTimeMillis() >= var1 + 1000L; var3 = 0) {
|
||||
this.debug = var3 + " fps, " + WorldRenderer.chunksUpdated + " chunk updates";
|
||||
WorldRenderer.chunksUpdated = 0;
|
||||
var1 += 1000L;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void displayDebugInfo() {
|
||||
|
@ -363,7 +307,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);
|
||||
|
@ -705,7 +649,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 {
|
||||
|
@ -804,20 +748,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();
|
||||
}
|
||||
|
@ -848,4 +778,36 @@ 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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -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,12 @@ 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;
|
||||
}
|
||||
useMipmaps = true;
|
||||
setupTexture(readTextureImage(LWJGLMain.loadResourceBytes(s)), i);
|
||||
useMipmaps = false;
|
||||
}
|
||||
|
@ -103,7 +97,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;
|
||||
|
@ -161,7 +155,7 @@ public class RenderEngine {
|
|||
}
|
||||
|
||||
public int getTextureForDownloadableImage(String s, String s1) {
|
||||
return getTexture("/mob/char.png");
|
||||
return getTexture("/char.png");
|
||||
}
|
||||
|
||||
public void registerTextureFX(TextureFX texturefx) {
|
||||
|
@ -181,16 +175,19 @@ 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 HashMap<String, Integer> textureMap;
|
||||
private static 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,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;
|
||||
|
@ -509,42 +401,18 @@ 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;
|
||||
|
||||
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;
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -78,7 +78,6 @@ 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;
|
||||
|
|
|
@ -6,89 +6,26 @@ import org.teavm.jso.typedarrays.Float32Array;
|
|||
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;
|
||||
|
||||
/** 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. */
|
||||
public static final Tessellator instance = new Tessellator(524288);
|
||||
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);
|
||||
|
@ -113,10 +50,6 @@ public class Tessellator {
|
|||
if (this.hasColor) {
|
||||
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));
|
||||
|
||||
|
@ -127,10 +60,6 @@ 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;
|
||||
|
@ -167,7 +96,6 @@ public class Tessellator {
|
|||
this.isDrawing = true;
|
||||
this.reset();
|
||||
this.drawMode = par1;
|
||||
this.hasNormals = false;
|
||||
this.hasColor = false;
|
||||
this.hasTexture = false;
|
||||
this.isColorDisabled = false;
|
||||
|
@ -280,10 +208,6 @@ public class Tessellator {
|
|||
if (this.hasColor) {
|
||||
intBuffer0.set(bufferIndex + 5, this.color);
|
||||
}
|
||||
|
||||
if (this.hasNormals) {
|
||||
intBuffer0.set(bufferIndex + 6, this.normal);
|
||||
}
|
||||
|
||||
this.rawBufferIndex += 7;
|
||||
}
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -26,7 +26,7 @@ public class Vec3D {
|
|||
return ((Vec3D)vectorList.get(nextVector++)).setComponents(var0, var2, var4);
|
||||
}
|
||||
|
||||
private Vec3D(double var1, double var3, double var5) {
|
||||
public Vec3D(double var1, double var3, double var5) {
|
||||
if(var1 == -0.0D) {
|
||||
var1 = 0.0D;
|
||||
}
|
||||
|
|
|
@ -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,33 @@ 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 = var1 + "/";
|
||||
FileSystemUtils.recursiveDeleteDirectoryWithProgress(dir, "Deleting World!", "Please Wait...", Minecraft.getMinecraft().loadingScreen);
|
||||
}
|
||||
|
||||
private static void deleteWorldFiles(File[] var0) {
|
||||
for(int var1 = 0; var1 < var0.length; ++var1) {
|
||||
if(var0[var1].isDirectory()) {
|
||||
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 +98,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 +124,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 +137,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 +210,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,10 +74,6 @@ public class WorldRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
private void setupGLTranslation() {
|
||||
GL11.glTranslatef((float)this.posXClip, (float)this.posYClip, (float)this.posZClip);
|
||||
}
|
||||
|
||||
public void updateRenderer() {
|
||||
if(this.needsUpdate) {
|
||||
++chunksUpdated;
|
||||
|
@ -113,14 +109,8 @@ 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.posX), (double)(-this.posY), (double)(-this.posZ));
|
||||
tessellator.setTranslationD((double) (this.posXClip-this.posX), (double) (this.posYClip-this.posY), (double) (this.posZClip-this.posZ));
|
||||
}
|
||||
|
||||
if(var11 == 0 && Block.blocksList[var18] instanceof BlockContainer) {
|
||||
|
@ -144,7 +134,6 @@ public class WorldRenderer {
|
|||
|
||||
if(var14) {
|
||||
tessellator.draw();
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEndList();
|
||||
tessellator.setTranslationD(0.0D, 0.0D, 0.0D);
|
||||
} else {
|
||||
|
|
|
@ -13,7 +13,11 @@ public class Display {
|
|||
LWJGLMain.updateDisplay();
|
||||
}
|
||||
|
||||
public static HTMLCanvasElement getDisplayMode() {
|
||||
return LWJGLMain.canvas;
|
||||
public static int getWidth() {
|
||||
return LWJGLMain.getCanvasWidth();
|
||||
}
|
||||
|
||||
public static int getHeight() {
|
||||
return LWJGLMain.getCanvasHeight();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user