Level saving, fix many bugs
This commit is contained in:
parent
1153220af2
commit
2d43435d31
|
@ -437,14 +437,12 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
|
|||
lightPos1vec.normalise();
|
||||
Matrix4f.transform(matModelV[matModelPointer], lightPos0vec, lightPos0vec).normalise();
|
||||
Matrix4f.transform(matModelV[matModelPointer], lightPos1vec, lightPos1vec).normalise();
|
||||
|
||||
//Maybe NOT flip light matrix???
|
||||
lightPos0vec.x = lightPos0vec.x;
|
||||
lightPos1vec.x = lightPos1vec.x;
|
||||
lightPos0vec.y = lightPos0vec.y;
|
||||
lightPos1vec.y = lightPos1vec.y;
|
||||
lightPos0vec.z = lightPos0vec.z;
|
||||
lightPos1vec.z = lightPos1vec.z;
|
||||
lightPos0vec.x = -lightPos0vec.x;
|
||||
lightPos1vec.x = -lightPos1vec.x;
|
||||
lightPos0vec.y = -lightPos0vec.y;
|
||||
lightPos1vec.y = -lightPos1vec.y;
|
||||
lightPos0vec.z = -lightPos0vec.z;
|
||||
lightPos1vec.z = -lightPos1vec.z;
|
||||
}
|
||||
|
||||
public static final void revertLightMatrix() {
|
||||
|
|
|
@ -2233,7 +2233,7 @@ public class JSONObject {
|
|||
try {
|
||||
BigDecimal bd = new BigDecimal(val);
|
||||
if(initial == '-' && BigDecimal.ZERO.compareTo(bd)==0) {
|
||||
return Double.valueOf(-0.0);
|
||||
return Double.valueOf(0D);
|
||||
}
|
||||
return bd;
|
||||
} catch (NumberFormatException retryAsDouble) {
|
||||
|
|
|
@ -67,6 +67,7 @@ import org.teavm.jso.websocket.WebSocket;
|
|||
import net.lax1dude.eaglercraft.adapter.teavm.WebGLQuery;
|
||||
import net.lax1dude.eaglercraft.adapter.teavm.WebGLVertexArray;
|
||||
import net.minecraft.src.MathHelper;
|
||||
import net.PeytonPlayz585.opengl.GL11;
|
||||
import net.PeytonPlayz585.storage.LocalStorageManager;
|
||||
import net.lax1dude.eaglercraft.AssetRepository;
|
||||
import net.lax1dude.eaglercraft.Base64;
|
||||
|
@ -1965,6 +1966,31 @@ public class EaglerAdapterImpl2 {
|
|||
return IndexedDBFilesystem.pathExists(path);
|
||||
}
|
||||
|
||||
public static final boolean exists(String path) {
|
||||
return readFile(path) != null;
|
||||
}
|
||||
|
||||
public static final void mkdir(String path) {
|
||||
String[] parts = path.split("/");
|
||||
String dir = parts[parts.length - 1];
|
||||
|
||||
if(path.endsWith("/")) {
|
||||
String file = "placeholder.txt";
|
||||
path = path.replace(dir + "/", "");
|
||||
if(!path.endsWith("/")) {
|
||||
path = path + "/";
|
||||
}
|
||||
GL11.writeFile(path + dir + "/" + file, "UwU".getBytes());
|
||||
} else {
|
||||
String file = "placeholder.txt";
|
||||
path = path.replace(dir, "");
|
||||
if(!path.endsWith("/")) {
|
||||
path = path + "/";
|
||||
}
|
||||
GL11.writeFile(path + dir + "/" + file, "UwU".getBytes());
|
||||
}
|
||||
}
|
||||
|
||||
public static final void writeFile(String path, byte[] data) {
|
||||
IndexedDBFilesystem.writeFile(path, data);
|
||||
}
|
||||
|
@ -2005,6 +2031,18 @@ public class EaglerAdapterImpl2 {
|
|||
return listFiles(path, false, true);
|
||||
}
|
||||
|
||||
public static final FileEntry[] listFiles(String path) {
|
||||
Collection<FileEntry> entries = IndexedDBFilesystem.listFiles(path, true, false);
|
||||
FileEntry[] entryArray = new FileEntry[entries.size()];
|
||||
|
||||
int i = 0;
|
||||
for(FileEntry entry : entries) {
|
||||
entryArray[i] = entry;
|
||||
i = i + 1;
|
||||
}
|
||||
return entryArray;
|
||||
}
|
||||
|
||||
public static class FileEntry {
|
||||
|
||||
public final String path;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package net.minecraft.client;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.PeytonPlayz585.input.Keyboard;
|
||||
import net.PeytonPlayz585.input.Mouse;
|
||||
import net.PeytonPlayz585.opengl.GL11;
|
||||
|
@ -13,6 +11,7 @@ import net.minecraft.src.ChunkProviderLoadOrGenerate;
|
|||
import net.minecraft.src.ColorizerFoliage;
|
||||
import net.minecraft.src.ColorizerGrass;
|
||||
import net.minecraft.src.ColorizerWater;
|
||||
import net.minecraft.src.EaglerSaveFormat;
|
||||
import net.minecraft.src.EffectRenderer;
|
||||
import net.minecraft.src.EntityClientPlayerMP;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
|
@ -20,8 +19,6 @@ import net.minecraft.src.EntityPlayer;
|
|||
import net.minecraft.src.EntityPlayerSP;
|
||||
import net.minecraft.src.EntityRenderer;
|
||||
import net.minecraft.src.EnumMovingObjectType;
|
||||
import net.minecraft.src.EnumOS2;
|
||||
import net.minecraft.src.EnumOSMappingHelper;
|
||||
import net.minecraft.src.EnumOptions;
|
||||
import net.minecraft.src.FontRenderer;
|
||||
import net.minecraft.src.GLAllocation;
|
||||
|
@ -59,7 +56,6 @@ import net.minecraft.src.RenderBlocks;
|
|||
import net.minecraft.src.RenderEngine;
|
||||
import net.minecraft.src.RenderGlobal;
|
||||
import net.minecraft.src.RenderManager;
|
||||
import net.minecraft.src.SaveConverterMcRegion;
|
||||
import net.minecraft.src.ScaledResolution;
|
||||
import net.minecraft.src.Session;
|
||||
import net.minecraft.src.SoundManager;
|
||||
|
@ -117,18 +113,16 @@ public class Minecraft implements Runnable {
|
|||
public GameSettings gameSettings;
|
||||
public SoundManager sndManager = new SoundManager();
|
||||
public MouseHelper mouseHelper;
|
||||
private File mcDataDir;
|
||||
private ISaveFormat saveLoader;
|
||||
public static long[] frameTimes = new long[512];
|
||||
public static long[] tickTimes = new long[512];
|
||||
public static int numRecordedFrameTimes = 0;
|
||||
public static long hasPaidCheckTime = 0L;
|
||||
public StatFileWriter statFileWriter;
|
||||
private String serverName;
|
||||
private int serverPort;
|
||||
private TextureWaterFX textureWaterFX = new TextureWaterFX();
|
||||
private TextureLavaFX textureLavaFX = new TextureLavaFX();
|
||||
private static File minecraftDir = null;
|
||||
private static String minecraftDir = "minecraft";
|
||||
public volatile boolean running = true;
|
||||
public String debug = "";
|
||||
boolean isTakingScreenshot = false;
|
||||
|
@ -139,6 +133,8 @@ public class Minecraft implements Runnable {
|
|||
long systemTime = System.currentTimeMillis();
|
||||
private int joinPlayerCounter = 0;
|
||||
|
||||
public static int debugFPS;
|
||||
|
||||
public Minecraft() {
|
||||
StatList.func_27360_a();
|
||||
this.tempDisplayHeight = GL11.getCanvasHeight();
|
||||
|
@ -160,9 +156,8 @@ public class Minecraft implements Runnable {
|
|||
}
|
||||
|
||||
public void startGame() {
|
||||
this.mcDataDir = getMinecraftDir();
|
||||
this.saveLoader = new SaveConverterMcRegion(new File(this.mcDataDir, "saves"));
|
||||
this.gameSettings = new GameSettings(this, this.mcDataDir);
|
||||
this.saveLoader = new EaglerSaveFormat(minecraftDir + "/" + "saves");
|
||||
this.gameSettings = new GameSettings(this, minecraftDir);
|
||||
this.renderEngine = new RenderEngine(this.gameSettings);
|
||||
this.fontRenderer = new FontRenderer(this.gameSettings, "/font/default.png", this.renderEngine);
|
||||
ColorizerWater.func_28182_a(this.renderEngine.func_28149_a("/misc/watercolor.png"));
|
||||
|
@ -170,7 +165,7 @@ public class Minecraft implements Runnable {
|
|||
ColorizerFoliage.func_28152_a(this.renderEngine.func_28149_a("/misc/foliagecolor.png"));
|
||||
this.entityRenderer = new EntityRenderer(this);
|
||||
RenderManager.instance.itemRenderer = new ItemRenderer(this);
|
||||
this.statFileWriter = new StatFileWriter(this.session, this.mcDataDir);
|
||||
this.statFileWriter = new StatFileWriter(this.session, minecraftDir + "/statsNew");
|
||||
AchievementList.openInventory.setStatStringFormatter(new StatStringFormatKeyInv(this));
|
||||
this.loadScreen();
|
||||
this.mouseHelper = new MouseHelper();
|
||||
|
@ -262,49 +257,6 @@ public class Minecraft implements Runnable {
|
|||
var9.draw();
|
||||
}
|
||||
|
||||
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(EnumOSMappingHelper.enumOSMappingArray[getOs().ordinal()]) {
|
||||
case 1:
|
||||
case 2:
|
||||
var2 = new File(var1, '.' + var0 + '/');
|
||||
break;
|
||||
case 3:
|
||||
String var3 = System.getenv("APPDATA");
|
||||
if(var3 != null) {
|
||||
var2 = new File(var3, "." + var0 + '/');
|
||||
} else {
|
||||
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 EnumOS2 getOs() {
|
||||
String var0 = System.getProperty("os.name").toLowerCase();
|
||||
return var0.contains("win") ? EnumOS2.windows : (var0.contains("mac") ? EnumOS2.macos : (var0.contains("solaris") ? EnumOS2.solaris : (var0.contains("sunos") ? EnumOS2.solaris : (var0.contains("linux") ? EnumOS2.linux : (var0.contains("unix") ? EnumOS2.linux : EnumOS2.unknown)))));
|
||||
}
|
||||
|
||||
public ISaveFormat getSaveLoader() {
|
||||
return this.saveLoader;
|
||||
}
|
||||
|
@ -384,13 +336,7 @@ public class Minecraft implements Runnable {
|
|||
public void run() {
|
||||
this.running = true;
|
||||
|
||||
try {
|
||||
this.startGame();
|
||||
} catch (Exception var17) {
|
||||
var17.printStackTrace();
|
||||
this.onMinecraftCrash(new UnexpectedThrowable("Failed to start game", var17));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
long var1 = System.currentTimeMillis();
|
||||
|
@ -480,6 +426,8 @@ public class Minecraft implements Runnable {
|
|||
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;
|
||||
debugFPS = var3;
|
||||
var3 = 0;
|
||||
var1 += 1000L;
|
||||
}
|
||||
} catch (MinecraftException var18) {
|
||||
|
@ -1181,24 +1129,6 @@ public class Minecraft implements Runnable {
|
|||
this.theWorld.func_656_j();
|
||||
}
|
||||
|
||||
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("streaming")) {
|
||||
this.sndManager.addStreaming(var1, var2);
|
||||
} else if(var4.equalsIgnoreCase("music")) {
|
||||
this.sndManager.addMusic(var1, var2);
|
||||
} else if(var4.equalsIgnoreCase("newmusic")) {
|
||||
this.sndManager.addMusic(var1, var2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String func_6241_m() {
|
||||
return this.renderGlobal.getDebugInfoRenders();
|
||||
}
|
||||
|
@ -1301,4 +1231,8 @@ public class Minecraft implements Runnable {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Minecraft getMinecraft() {
|
||||
return theMinecraft;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public class BlockSign extends BlockContainer {
|
|||
|
||||
protected TileEntity getBlockEntity() {
|
||||
try {
|
||||
return (TileEntity)this.signEntityClass.newInstance();
|
||||
return new TileEntitySign();
|
||||
} catch (Exception var2) {
|
||||
throw new RuntimeException(var2);
|
||||
}
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
class ChunkFile implements Comparable {
|
||||
private final File field_22326_a;
|
||||
private final int field_22325_b;
|
||||
private final int field_22327_c;
|
||||
|
||||
public ChunkFile(File var1) {
|
||||
this.field_22326_a = var1;
|
||||
Matcher var2 = ChunkFilePattern.field_22189_a.matcher(var1.getName());
|
||||
if(var2.matches()) {
|
||||
this.field_22325_b = Integer.parseInt(var2.group(1), 36);
|
||||
this.field_22327_c = Integer.parseInt(var2.group(2), 36);
|
||||
} else {
|
||||
this.field_22325_b = 0;
|
||||
this.field_22327_c = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int func_22322_a(ChunkFile var1) {
|
||||
int var2 = this.field_22325_b >> 5;
|
||||
int var3 = var1.field_22325_b >> 5;
|
||||
if(var2 == var3) {
|
||||
int var4 = this.field_22327_c >> 5;
|
||||
int var5 = var1.field_22327_c >> 5;
|
||||
return var4 - var5;
|
||||
} else {
|
||||
return var2 - var3;
|
||||
}
|
||||
}
|
||||
|
||||
public File func_22324_a() {
|
||||
return this.field_22326_a;
|
||||
}
|
||||
|
||||
public int func_22323_b() {
|
||||
return this.field_22325_b;
|
||||
}
|
||||
|
||||
public int func_22321_c() {
|
||||
return this.field_22327_c;
|
||||
}
|
||||
|
||||
public int compareTo(Object var1) {
|
||||
return this.func_22322_a((ChunkFile)var1);
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
class ChunkFilePattern implements FilenameFilter {
|
||||
public static final Pattern field_22189_a = Pattern.compile("c\\.(-?[0-9a-z]+)\\.(-?[0-9a-z]+)\\.dat");
|
||||
|
||||
private ChunkFilePattern() {
|
||||
}
|
||||
|
||||
public boolean accept(File var1, String var2) {
|
||||
Matcher var3 = field_22189_a.matcher(var2);
|
||||
return var3.matches();
|
||||
}
|
||||
|
||||
ChunkFilePattern(Empty2 var1) {
|
||||
this();
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
class ChunkFolderPattern implements FileFilter {
|
||||
public static final Pattern field_22392_a = Pattern.compile("[0-9a-z]|([0-9a-z][0-9a-z])");
|
||||
|
||||
private ChunkFolderPattern() {
|
||||
}
|
||||
|
||||
public boolean accept(File var1) {
|
||||
if(var1.isDirectory()) {
|
||||
Matcher var2 = field_22392_a.matcher(var1.getName());
|
||||
return var2.matches();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ChunkFolderPattern(Empty2 var1) {
|
||||
this();
|
||||
}
|
||||
}
|
|
@ -1,108 +1,110 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.PeytonPlayz585.opengl.GL11;
|
||||
|
||||
public class ChunkLoader implements IChunkLoader {
|
||||
private File saveDir;
|
||||
private boolean createIfNecessary;
|
||||
private String saveDir;
|
||||
|
||||
public ChunkLoader(File var1, boolean var2) {
|
||||
public ChunkLoader(String var1) {
|
||||
this.saveDir = var1;
|
||||
this.createIfNecessary = var2;
|
||||
}
|
||||
|
||||
private File chunkFileForXZ(int var1, int var2) {
|
||||
String var3 = "c." + Integer.toString(var1, 36) + "." + Integer.toString(var2, 36) + ".dat";
|
||||
String var4 = Integer.toString(var1 & 63, 36);
|
||||
String var5 = Integer.toString(var2 & 63, 36);
|
||||
File var6 = new File(this.saveDir, var4);
|
||||
if(!var6.exists()) {
|
||||
if(!this.createIfNecessary) {
|
||||
return null;
|
||||
}
|
||||
public static final String CHUNK_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
var6.mkdir();
|
||||
private String chunkFileForXZ(int var1, int var2) {
|
||||
int unsignedX = var1 + 30233088;
|
||||
int unsignedZ = var2 + 30233088;
|
||||
int radix = CHUNK_CHARS.length();
|
||||
char[] path = new char[10];
|
||||
for(int i = 0; i < 5; ++i) {
|
||||
path[i * 2] = CHUNK_CHARS.charAt(unsignedX % radix);
|
||||
unsignedX /= radix;
|
||||
path[i * 2 + 1] = CHUNK_CHARS.charAt(unsignedZ % radix);
|
||||
unsignedZ /= radix;
|
||||
}
|
||||
|
||||
var6 = new File(var6, var5);
|
||||
if(!var6.exists()) {
|
||||
if(!this.createIfNecessary) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var6.mkdir();
|
||||
}
|
||||
|
||||
var6 = new File(var6, var3);
|
||||
return !var6.exists() && !this.createIfNecessary ? null : var6;
|
||||
String s = new String(path);
|
||||
String s1 = saveDir + "/" + s;
|
||||
return s1;
|
||||
}
|
||||
|
||||
public Chunk loadChunk(World var1, int var2, int var3) throws IOException {
|
||||
File var4 = this.chunkFileForXZ(var2, var3);
|
||||
if(var4 != null && var4.exists()) {
|
||||
String var4 = this.chunkFileForXZ(var2, var3);
|
||||
byte[] chunkData = GL11.readFile(var4);
|
||||
|
||||
if(chunkData != null) {
|
||||
try {
|
||||
FileInputStream var5 = new FileInputStream(var4);
|
||||
NBTTagCompound var6 = CompressedStreamTools.func_1138_a(var5);
|
||||
if(!var6.hasKey("Level")) {
|
||||
System.out.println("Chunk file at " + var2 + "," + var3 + " is missing level data, skipping");
|
||||
ByteArrayInputStream var5 = new ByteArrayInputStream(chunkData);
|
||||
NBTTagCompound var6 = CompressedStreamTools.func_1138_a(var5).getCompoundTag("Level");
|
||||
|
||||
int x = var6.getInteger("xPos");
|
||||
int z = var6.getInteger("zPos");
|
||||
if(var2 != x || var3 != z) {
|
||||
String var7 = this.chunkFileForXZ(x, z);
|
||||
GL11.renameFile(var4, var7);
|
||||
return null;
|
||||
}
|
||||
|
||||
if(!var6.getCompoundTag("Level").hasKey("Blocks")) {
|
||||
System.out.println("Chunk file at " + var2 + "," + var3 + " is missing block data, skipping");
|
||||
return loadChunkIntoWorldFromCompound(var1, var6);
|
||||
} catch(IOException e) {
|
||||
GL11.deleteFile(var4);
|
||||
return null;
|
||||
}
|
||||
|
||||
Chunk var7 = loadChunkIntoWorldFromCompound(var1, var6.getCompoundTag("Level"));
|
||||
if(!var7.isAtLocation(var2, var3)) {
|
||||
System.out.println("Chunk file at " + var2 + "," + var3 + " is in the wrong location; relocating. (Expected " + var2 + ", " + var3 + ", got " + var7.xPosition + ", " + var7.zPosition + ")");
|
||||
var6.setInteger("xPos", var2);
|
||||
var6.setInteger("zPos", var3);
|
||||
var7 = loadChunkIntoWorldFromCompound(var1, var6.getCompoundTag("Level"));
|
||||
}
|
||||
|
||||
var7.func_25124_i();
|
||||
return var7;
|
||||
} catch (Exception var8) {
|
||||
var8.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
// if(var4 != null && GL11.exists(var4)) {
|
||||
// try {
|
||||
// ByteArrayInputStream var5 = new ByteArrayInputStream(GL11.readFile(var4));
|
||||
// NBTTagCompound var6 = CompressedStreamTools.func_1138_a(var5);
|
||||
// Chunk var7 = loadChunkIntoWorldFromCompound(var1, var6.getCompoundTag("Level"));
|
||||
// if(!var7.isAtLocation(var2, var3)) {
|
||||
// System.out.println("Chunk file at " + var2 + "," + var3 + " is in the wrong location; relocating. (Expected " + var2 + ", " + var3 + ", got " + var7.xPosition + ", " + var7.zPosition + ")");
|
||||
// var6.setInteger("xPos", var2);
|
||||
// var6.setInteger("zPos", var3);
|
||||
// var7 = loadChunkIntoWorldFromCompound(var1, var6.getCompoundTag("Level"));
|
||||
// }
|
||||
//
|
||||
// var7.func_25124_i();
|
||||
// return var7;
|
||||
// } catch (Exception var8) {
|
||||
// var8.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return null;
|
||||
}
|
||||
|
||||
public void saveChunk(World var1, Chunk var2) throws IOException {
|
||||
var1.checkSessionLock();
|
||||
File var3 = this.chunkFileForXZ(var2.xPosition, var2.zPosition);
|
||||
if(var3.exists()) {
|
||||
String var3 = this.chunkFileForXZ(var2.xPosition, var2.zPosition);
|
||||
ByteArrayOutputStream var5 = new ByteArrayOutputStream();
|
||||
|
||||
if(GL11.exists(var3)) {
|
||||
WorldInfo var4 = var1.getWorldInfo();
|
||||
var4.setSizeOnDisk(var4.getSizeOnDisk() - var3.length());
|
||||
var4.setSizeOnDisk(var4.getSizeOnDisk() - GL11.getFileSize(var3));
|
||||
}
|
||||
|
||||
try {
|
||||
File var10 = new File(this.saveDir, "tmp_chunk.dat");
|
||||
FileOutputStream var5 = new FileOutputStream(var10);
|
||||
NBTTagCompound var6 = new NBTTagCompound();
|
||||
NBTTagCompound var7 = new NBTTagCompound();
|
||||
var6.setTag("Level", var7);
|
||||
storeChunkInCompound(var2, var1, var7);
|
||||
|
||||
try {
|
||||
CompressedStreamTools.writeGzippedCompoundToOutputStream(var6, var5);
|
||||
var5.close();
|
||||
if(var3.exists()) {
|
||||
var3.delete();
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
var10.renameTo(var3);
|
||||
var5.flush();
|
||||
GL11.writeFile(var3, var5.toByteArray());
|
||||
WorldInfo var8 = var1.getWorldInfo();
|
||||
var8.setSizeOnDisk(var8.getSizeOnDisk() + var3.length());
|
||||
} catch (Exception var9) {
|
||||
var9.printStackTrace();
|
||||
}
|
||||
|
||||
var8.setSizeOnDisk(var8.getSizeOnDisk() + GL11.getFileSize(var3));
|
||||
}
|
||||
|
||||
public static void storeChunkInCompound(Chunk var0, World var1, NBTTagCompound var2) {
|
||||
|
|
144
src/net/minecraft/src/EaglerSaveFormat.java
Normal file
144
src/net/minecraft/src/EaglerSaveFormat.java
Normal file
|
@ -0,0 +1,144 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
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.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.PeytonPlayz585.opengl.GL11;
|
||||
|
||||
import static net.PeytonPlayz585.opengl.GL11.FileEntry;
|
||||
|
||||
public class EaglerSaveFormat implements ISaveFormat {
|
||||
|
||||
private String saveDir;
|
||||
|
||||
public EaglerSaveFormat(String s) {
|
||||
this.saveDir = s;
|
||||
}
|
||||
|
||||
public String func_22178_a() {
|
||||
return "Modified SaveFormat";
|
||||
}
|
||||
|
||||
public ISaveHandler getSaveLoader(String var1, boolean var2) {
|
||||
if(var1.contains("saves")) {
|
||||
var1 = var1.replace("saves/", "");
|
||||
}
|
||||
return new EaglerSaveHandler(saveDir + "/" + var1);
|
||||
}
|
||||
|
||||
//Returns a list a worlds
|
||||
public List func_22176_b() {
|
||||
ArrayList<SaveFormatComparator> lst = new ArrayList<>();
|
||||
GL11.listFilesAndDirectories(saveDir).forEach(new Consumer<FileEntry>() {
|
||||
@Override
|
||||
public void accept(FileEntry t) {
|
||||
if(!t.isDirectory) {
|
||||
return;
|
||||
}
|
||||
String folderName = t.getName();
|
||||
String dir = t.path;
|
||||
byte[] lvl = GL11.readFile(dir + "/level.dat");
|
||||
if(lvl != null) {
|
||||
try {
|
||||
NBTBase nbt = NBTBase.readTag(new DataInputStream(new ByteArrayInputStream(lvl)));
|
||||
if(nbt instanceof NBTTagCompound) {
|
||||
WorldInfo w = new WorldInfo((NBTTagCompound)nbt);
|
||||
String s1 = w.getWorldName();
|
||||
if (s1 == null || MathHelper.stringNullOrLengthZero(s1)) {
|
||||
s1 = folderName;
|
||||
}
|
||||
lst.add(new SaveFormatComparator(folderName, s1, w.getLastTimePlayed(), w.getSizeOnDisk(), false));
|
||||
}else {
|
||||
throw new IOException("file '" + dir + "/level.dat' does not contain an NBTTagCompound");
|
||||
}
|
||||
}catch(IOException e) {
|
||||
System.err.println("Failed to load world data for '" + saveDir + "/level.dat'");
|
||||
System.err.println("It will be kept for future recovery");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return lst;
|
||||
}
|
||||
|
||||
public void flushCache() {
|
||||
//no...
|
||||
}
|
||||
|
||||
//Returns world info for the world
|
||||
public WorldInfo func_22173_b(String var1) {
|
||||
byte[] lvl = GL11.readFile(saveDir + "/" + var1 + "/level.dat");
|
||||
if(lvl != null) {
|
||||
try {
|
||||
NBTBase nbt = NBTBase.readTag(new DataInputStream(new ByteArrayInputStream(lvl)));
|
||||
if(nbt instanceof NBTTagCompound) {
|
||||
return new WorldInfo((NBTTagCompound)nbt);
|
||||
}else {
|
||||
throw new IOException("file '" + saveDir + "/" + var1 + "/level.dat' does not contain an NBTTagCompound");
|
||||
}
|
||||
}catch(IOException e) {
|
||||
System.err.println("Failed to load world data for '" + saveDir + "/level.dat'");
|
||||
System.err.println("It will be kept for future recovery");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//Deletes world by name
|
||||
public void func_22172_c(String var1) {
|
||||
String path = saveDir + "/" + var1;
|
||||
if(path.contains("/saves/saves/")) {
|
||||
path = path.replace("/saves/saves/", "/saves/");
|
||||
}
|
||||
FilesystemUtils.recursiveDeleteDirectory(path);
|
||||
}
|
||||
|
||||
//Renames world
|
||||
public void func_22170_a(String var1, String var2) {
|
||||
if(var1.contains("/saves/saves/")) {
|
||||
var1 = var1.replace("/saves/saves/", "/saves/");
|
||||
}
|
||||
if(var2.contains("/saves/saves/")) {
|
||||
var2 = var2.replace("/saves/saves/", "/saves/");
|
||||
}
|
||||
byte[] lvl = GL11.readFile(saveDir + "/" + var1 + "/level.dat");
|
||||
if(lvl != null) {
|
||||
try {
|
||||
NBTBase nbt = NBTBase.readTag(new DataInputStream(new ByteArrayInputStream(lvl)));
|
||||
if(nbt instanceof NBTTagCompound) {
|
||||
NBTTagCompound w = (NBTTagCompound)nbt;
|
||||
w.setString("LevelName", var2);
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream(lvl.length + 16 + var2.length() * 2);
|
||||
NBTBase.writeTag(w, new DataOutputStream(out));
|
||||
GL11.writeFile(saveDir + "/" + var1 + "/level.dat", out.toByteArray());
|
||||
}else {
|
||||
throw new IOException("file '" + saveDir + "/" + var1 + "/level.dat' does not contain an NBTTagCompound");
|
||||
}
|
||||
}catch(IOException e) {
|
||||
System.err.println("Failed to load world data for '" + saveDir + "/level.dat'");
|
||||
System.err.println("It will be kept for future recovery");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//no
|
||||
public boolean isOldMapFormat(String var1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//Also no
|
||||
public boolean convertMapFormat(String var1, IProgressUpdate var2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
78
src/net/minecraft/src/EaglerSaveHandler.java
Normal file
78
src/net/minecraft/src/EaglerSaveHandler.java
Normal file
|
@ -0,0 +1,78 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import net.PeytonPlayz585.opengl.GL11;
|
||||
|
||||
public class EaglerSaveHandler implements ISaveHandler {
|
||||
|
||||
private String saveDir;
|
||||
|
||||
public EaglerSaveHandler(String s) {
|
||||
this.saveDir = s;
|
||||
}
|
||||
|
||||
public WorldInfo loadWorldInfo() {
|
||||
byte[] file = GL11.readFile(saveDir + "/level.dat");
|
||||
if(file != null) {
|
||||
try {
|
||||
NBTBase nbt = NBTBase.readTag(new DataInputStream(new ByteArrayInputStream(file)));
|
||||
if(nbt instanceof NBTTagCompound) {
|
||||
return new WorldInfo((NBTTagCompound)nbt);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.err.println("Failed to load world data for '" + saveDir + "/level.dat'");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void func_22150_b() {
|
||||
//lol
|
||||
}
|
||||
|
||||
public IChunkLoader getChunkLoader(WorldProvider var1) {
|
||||
if(var1 instanceof WorldProviderHell) {
|
||||
return new ChunkLoader(saveDir + "/c1");
|
||||
}else {
|
||||
return new ChunkLoader(saveDir + "/c0");
|
||||
}
|
||||
}
|
||||
|
||||
public void saveWorldInfoAndPlayer(WorldInfo var1, List var2) {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream(8192);
|
||||
DataOutputStream ds = new DataOutputStream(out);
|
||||
try {
|
||||
NBTBase.writeTag(var1.getNBTTagCompoundWithPlayer(var2), ds);
|
||||
} catch (IOException e) {
|
||||
System.err.println("Failed to serialize world data for '" + saveDir + "/level.dat'");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
GL11.writeFile(saveDir + "/level.dat", out.toByteArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveWorldInfo(WorldInfo var1) {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream(8192);
|
||||
DataOutputStream ds = new DataOutputStream(out);
|
||||
try {
|
||||
NBTBase.writeTag(var1.getNBTTagCompound(), ds);
|
||||
} catch (IOException e) {
|
||||
System.err.println("Failed to serialize world data for '" + saveDir + "/level.dat'");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
GL11.writeFile(saveDir + "/level.dat", out.toByteArray());
|
||||
}
|
||||
|
||||
public String func_28113_a(String var1) {
|
||||
return this.saveDir + "/" + var1 + ".dat";
|
||||
}
|
||||
}
|
|
@ -22,7 +22,7 @@ public class EntityList {
|
|||
try {
|
||||
Class var3 = (Class)stringToClassMapping.get(var0);
|
||||
if(var3 != null) {
|
||||
var2 = (Entity)var3.getConstructor(new Class[]{World.class}).newInstance(new Object[]{var1});
|
||||
var2 = SpawnerAnimals.newInstance(var3);
|
||||
}
|
||||
} catch (Exception var4) {
|
||||
var4.printStackTrace();
|
||||
|
@ -37,7 +37,7 @@ public class EntityList {
|
|||
try {
|
||||
Class var3 = (Class)stringToClassMapping.get(var0.getString("id"));
|
||||
if(var3 != null) {
|
||||
var2 = (Entity)var3.getConstructor(new Class[]{World.class}).newInstance(new Object[]{var1});
|
||||
var2 = SpawnerAnimals.newInstance(var3);
|
||||
}
|
||||
} catch (Exception var4) {
|
||||
var4.printStackTrace();
|
||||
|
@ -58,7 +58,7 @@ public class EntityList {
|
|||
try {
|
||||
Class var3 = (Class)IDtoClassMapping.get(Integer.valueOf(var0));
|
||||
if(var3 != null) {
|
||||
var2 = (Entity)var3.getConstructor(new Class[]{World.class}).newInstance(new Object[]{var1});
|
||||
var2 = SpawnerAnimals.newInstance(var3);
|
||||
}
|
||||
} catch (Exception var4) {
|
||||
var4.printStackTrace();
|
||||
|
|
|
@ -75,7 +75,7 @@ public abstract class EntityLiving extends Entity {
|
|||
}
|
||||
|
||||
public String getEntityTexture() {
|
||||
return "mob/char.png";
|
||||
return this.texture;
|
||||
}
|
||||
|
||||
public boolean canBeCollidedWith() {
|
||||
|
|
|
@ -3,6 +3,8 @@ package net.minecraft.src;
|
|||
import java.nio.FloatBuffer;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.PeytonPlayz585.glemu.GameOverlayFramebuffer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -49,8 +51,11 @@ public class EntityRenderer {
|
|||
private float fogColor2;
|
||||
private float fogColor1;
|
||||
|
||||
private GameOverlayFramebuffer overlayFramebuffer;
|
||||
|
||||
public EntityRenderer(Minecraft var1) {
|
||||
this.mc = var1;
|
||||
this.overlayFramebuffer = new GameOverlayFramebuffer();
|
||||
this.itemRenderer = new ItemRenderer(var1);
|
||||
}
|
||||
|
||||
|
@ -324,7 +329,7 @@ public class EntityRenderer {
|
|||
}
|
||||
|
||||
public void updateCameraAndRender(float var1) {
|
||||
if(!GL11.isPointerLocked2()) {
|
||||
if(!GL11.isFocused()) {
|
||||
if(System.currentTimeMillis() - this.prevFrameTime > 500L) {
|
||||
this.mc.displayInGameMenu();
|
||||
}
|
||||
|
@ -388,7 +393,43 @@ public class EntityRenderer {
|
|||
|
||||
this.field_28133_I = System.nanoTime();
|
||||
if(!this.mc.gameSettings.hideGUI || this.mc.currentScreen != null) {
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
long framebufferAge = this.overlayFramebuffer.getAge();
|
||||
if(framebufferAge == -1l || framebufferAge > (Minecraft.debugFPS < 25 ? 125l : 75l)) {
|
||||
this.overlayFramebuffer.beginRender(mc.displayWidth, mc.displayHeight);
|
||||
GL11.glColorMask(true, true, true, true);
|
||||
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
|
||||
GL11.enableOverlayFramebufferBlending(true);
|
||||
this.mc.ingameGUI.renderGameOverlay(var1, this.mc.currentScreen != null, var16, var17);
|
||||
GL11.enableOverlayFramebufferBlending(false);
|
||||
this.overlayFramebuffer.endRender();
|
||||
GL11.glClearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F);
|
||||
}
|
||||
this.func_905_b();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
if (this.mc.gameSettings.fancyGraphics) {
|
||||
this.mc.ingameGUI.renderVignette(this.mc.thePlayer.getEntityBrightness(var1), var14, var15);
|
||||
}
|
||||
this.mc.ingameGUI.renderCrossHairs(var14, var15);
|
||||
this.overlayFramebuffer.bindTexture();
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDepthMask(false);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(0.0D, (double) var15, -90.0D, 0.0D, 0.0D);
|
||||
tessellator.addVertexWithUV((double) var14, (double) var15, -90.0D, 1.0D, 0.0D);
|
||||
tessellator.addVertexWithUV((double) var14, 0.0D, -90.0D, 1.0D, 1.0D);
|
||||
tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 1.0D);
|
||||
tessellator.draw();
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
} else {
|
||||
GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
enum EnumOS1 {
|
||||
linux,
|
||||
solaris,
|
||||
windows,
|
||||
macos,
|
||||
unknown;
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public enum EnumOS2 {
|
||||
linux,
|
||||
solaris,
|
||||
windows,
|
||||
macos,
|
||||
unknown;
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class EnumOSMappingHelper {
|
||||
public static final int[] enumOSMappingArray = new int[EnumOS2.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
enumOSMappingArray[EnumOS2.linux.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError var4) {
|
||||
}
|
||||
|
||||
try {
|
||||
enumOSMappingArray[EnumOS2.solaris.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError var3) {
|
||||
}
|
||||
|
||||
try {
|
||||
enumOSMappingArray[EnumOS2.windows.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError var2) {
|
||||
}
|
||||
|
||||
try {
|
||||
enumOSMappingArray[EnumOS2.macos.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError var1) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
24
src/net/minecraft/src/FilesystemUtils.java
Normal file
24
src/net/minecraft/src/FilesystemUtils.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.PeytonPlayz585.opengl.GL11;
|
||||
|
||||
public class FilesystemUtils {
|
||||
|
||||
public static void recursiveDeleteDirectory(String dir) {
|
||||
Collection<GL11.FileEntry> lst = GL11.listFiles(dir, true, true);
|
||||
for(GL11.FileEntry t : lst) {
|
||||
if(!t.isDirectory) {
|
||||
GL11.deleteFile(t.path);
|
||||
}
|
||||
}
|
||||
for(GL11.FileEntry t : lst) {
|
||||
if(t.isDirectory) {
|
||||
GL11.deleteFile(t.path);
|
||||
}
|
||||
}
|
||||
GL11.deleteFile(dir);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,12 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import net.PeytonPlayz585.opengl.GL11;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
|
@ -37,7 +39,7 @@ public class GameSettings {
|
|||
public KeyBinding keyBindSneak = new KeyBinding("key.sneak", 42);
|
||||
public KeyBinding[] keyBindings = new KeyBinding[]{this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindToggleFog};
|
||||
protected Minecraft mc;
|
||||
private File optionsFile;
|
||||
private String optionsFile;
|
||||
public int difficulty = 2;
|
||||
public boolean hideGUI = false;
|
||||
public boolean thirdPersonView = false;
|
||||
|
@ -50,9 +52,9 @@ public class GameSettings {
|
|||
public float field_22271_G = 1.0F;
|
||||
public int guiScale = 0;
|
||||
|
||||
public GameSettings(Minecraft var1, File var2) {
|
||||
public GameSettings(Minecraft var1, String var2) {
|
||||
this.mc = var1;
|
||||
this.optionsFile = new File(var2, "options.txt");
|
||||
this.optionsFile = var2 + "/" + "options.txt";
|
||||
this.loadOptions();
|
||||
}
|
||||
|
||||
|
@ -175,11 +177,13 @@ public class GameSettings {
|
|||
|
||||
public void loadOptions() {
|
||||
try {
|
||||
if(!this.optionsFile.exists()) {
|
||||
if(!GL11.exists(this.optionsFile)) {
|
||||
return;
|
||||
}
|
||||
|
||||
BufferedReader var1 = new BufferedReader(new FileReader(this.optionsFile));
|
||||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(GL11.readFile(this.optionsFile));
|
||||
InputStreamReader inputStreamReader = new InputStreamReader(byteArrayInputStream, "UTF-8");
|
||||
BufferedReader var1 = new BufferedReader(inputStreamReader);
|
||||
String var2 = "";
|
||||
|
||||
while(true) {
|
||||
|
@ -273,7 +277,8 @@ public class GameSettings {
|
|||
|
||||
public void saveOptions() {
|
||||
try {
|
||||
PrintWriter var1 = new PrintWriter(new FileWriter(this.optionsFile));
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
PrintWriter var1 = new PrintWriter(byteArrayOutputStream);
|
||||
var1.println("music:" + this.musicVolume);
|
||||
var1.println("sound:" + this.soundVolume);
|
||||
var1.println("invertYMouse:" + this.invertMouse);
|
||||
|
@ -294,6 +299,10 @@ public class GameSettings {
|
|||
var1.println("key_" + this.keyBindings[var2].keyDescription + ":" + this.keyBindings[var2].keyCode);
|
||||
}
|
||||
|
||||
var1.flush();
|
||||
byte[] data = byteArrayOutputStream.toByteArray();
|
||||
GL11.writeFile(this.optionsFile, data);
|
||||
|
||||
var1.close();
|
||||
} catch (Exception var3) {
|
||||
System.out.println("Failed to save options");
|
||||
|
|
|
@ -57,21 +57,6 @@ public class GuiAchievement extends Gui {
|
|||
}
|
||||
|
||||
public void updateAchievementWindow() {
|
||||
if(Minecraft.hasPaidCheckTime > 0L) {
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDepthMask(false);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
this.updateAchievementWindowScale();
|
||||
String var1 = "Minecraft Beta 1.7.3 Unlicensed Copy :(";
|
||||
String var2 = "(Or logged in from another location)";
|
||||
String var3 = "Purchase at minecraft.net";
|
||||
this.theGame.fontRenderer.drawStringWithShadow(var1, 2, 2, 16777215);
|
||||
this.theGame.fontRenderer.drawStringWithShadow(var2, 2, 11, 16777215);
|
||||
this.theGame.fontRenderer.drawStringWithShadow(var3, 2, 20, 16777215);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
if(this.theAchievement != null && this.field_25083_f != 0L) {
|
||||
double var8 = (double)(System.currentTimeMillis() - this.field_25083_f) / 3000.0D;
|
||||
if(this.field_27103_i || this.field_27103_i || var8 >= 0.0D && var8 <= 1.0D) {
|
||||
|
|
|
@ -31,9 +31,6 @@ public class GuiIngame extends Gui {
|
|||
FontRenderer var8 = this.mc.fontRenderer;
|
||||
this.mc.entityRenderer.func_905_b();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
if(Minecraft.isFancyGraphicsEnabled()) {
|
||||
this.renderVignette(this.mc.thePlayer.getEntityBrightness(var1), var6, var7);
|
||||
}
|
||||
|
||||
ItemStack var9 = this.mc.thePlayer.inventory.armorItemInSlot(3);
|
||||
if(!this.mc.gameSettings.thirdPersonView && var9 != null && var9.itemID == Block.pumpkin.blockID) {
|
||||
|
@ -53,9 +50,6 @@ public class GuiIngame extends Gui {
|
|||
this.drawTexturedModalRect(var6 / 2 - 91 - 1 + var11.currentItem * 20, var7 - 22 - 1, 0, 22, 24, 22);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/icons.png"));
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR);
|
||||
this.drawTexturedModalRect(var6 / 2 - 7, var7 / 2 - 7, 0, 0, 16, 16);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
boolean var12 = this.mc.thePlayer.heartsLife / 3 % 2 == 1;
|
||||
if(this.mc.thePlayer.heartsLife < 10) {
|
||||
var12 = false;
|
||||
|
@ -165,10 +159,6 @@ public class GuiIngame extends Gui {
|
|||
String var23;
|
||||
if(this.mc.gameSettings.showDebugInfo) {
|
||||
GL11.glPushMatrix();
|
||||
if(Minecraft.hasPaidCheckTime > 0L) {
|
||||
GL11.glTranslatef(0.0F, 32.0F, 0.0F);
|
||||
}
|
||||
|
||||
var8.drawStringWithShadow("Minecraft Beta 1.7.3 (" + this.mc.debug + ")", 2, 2, 16777215);
|
||||
var8.drawStringWithShadow(this.mc.func_6241_m(), 2, 12, 16777215);
|
||||
var8.drawStringWithShadow(this.mc.func_6262_n(), 2, 22, 16777215);
|
||||
|
@ -260,7 +250,7 @@ public class GuiIngame extends Gui {
|
|||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
private void renderPumpkinBlur(int var1, int var2) {
|
||||
public void renderPumpkinBlur(int var1, int var2) {
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
@ -280,8 +270,9 @@ public class GuiIngame extends Gui {
|
|||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
private void renderVignette(float var1, int var2, int var3) {
|
||||
var1 = 1.0F - var1;
|
||||
public void renderVignette(float var1, int var2, int var3) {
|
||||
var1 = 1.0F - var1 * 0.5f;
|
||||
|
||||
if(var1 < 0.0F) {
|
||||
var1 = 0.0F;
|
||||
}
|
||||
|
@ -448,4 +439,13 @@ public class GuiIngame extends Gui {
|
|||
|
||||
return (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
public void renderCrossHairs(int w, int h) {
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/icons.png"));
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR);
|
||||
this.drawTexturedModalRect(w / 2 - 7, h / 2 - 7, 0, 0, 16, 16);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public interface ISaveHandler {
|
||||
|
@ -14,5 +13,5 @@ public interface ISaveHandler {
|
|||
|
||||
void saveWorldInfo(WorldInfo var1);
|
||||
|
||||
File func_28113_a(String var1);
|
||||
String func_28113_a(String var1);
|
||||
}
|
|
@ -178,7 +178,7 @@ public class ItemRenderer {
|
|||
for(int var17 = 0; var17 < 2; ++var17) {
|
||||
int var21 = var17 * 2 - 1;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.0F, -0.6F, 1.1F * (float)var21);
|
||||
GL11.glTranslatef(0F, -0.6F, 1.1F * (float)var21);
|
||||
GL11.glRotatef((float)(-45 * var21), 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(59.0F, 0.0F, 0.0F, 1.0F);
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.PeytonPlayz585.opengl.GL11;
|
||||
|
||||
public class MapStorage {
|
||||
private ISaveHandler field_28191_a;
|
||||
private Map loadedDataMap = new HashMap();
|
||||
|
@ -29,15 +30,15 @@ public class MapStorage {
|
|||
} else {
|
||||
if(this.field_28191_a != null) {
|
||||
try {
|
||||
File var4 = this.field_28191_a.func_28113_a(var2);
|
||||
if(var4 != null && var4.exists()) {
|
||||
String var4 = this.field_28191_a.func_28113_a(var2);
|
||||
if(var4 != null && GL11.exists(var4)) {
|
||||
try {
|
||||
var3 = (MapDataBase)var1.getConstructor(new Class[]{String.class}).newInstance(new Object[]{var2});
|
||||
} catch (Exception var7) {
|
||||
throw new RuntimeException("Failed to instantiate " + var1.toString(), var7);
|
||||
}
|
||||
|
||||
FileInputStream var5 = new FileInputStream(var4);
|
||||
ByteArrayInputStream var5 = new ByteArrayInputStream(GL11.readFile(var4));
|
||||
NBTTagCompound var6 = CompressedStreamTools.func_1138_a(var5);
|
||||
var5.close();
|
||||
var3.readFromNBT(var6.getCompoundTag("data"));
|
||||
|
@ -83,14 +84,15 @@ public class MapStorage {
|
|||
private void saveData(MapDataBase var1) {
|
||||
if(this.field_28191_a != null) {
|
||||
try {
|
||||
File var2 = this.field_28191_a.func_28113_a(var1.field_28168_a);
|
||||
String var2 = this.field_28191_a.func_28113_a(var1.field_28168_a);
|
||||
if(var2 != null) {
|
||||
NBTTagCompound var3 = new NBTTagCompound();
|
||||
var1.writeToNBT(var3);
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setCompoundTag("data", var3);
|
||||
FileOutputStream var5 = new FileOutputStream(var2);
|
||||
ByteArrayOutputStream var5 = new ByteArrayOutputStream();
|
||||
CompressedStreamTools.writeGzippedCompoundToOutputStream(var4, var5);
|
||||
GL11.writeFile(var2, var5.toByteArray());
|
||||
var5.close();
|
||||
}
|
||||
} catch (Exception var6) {
|
||||
|
@ -107,9 +109,9 @@ public class MapStorage {
|
|||
return;
|
||||
}
|
||||
|
||||
File var1 = this.field_28191_a.func_28113_a("idcounts");
|
||||
if(var1 != null && var1.exists()) {
|
||||
DataInputStream var2 = new DataInputStream(new FileInputStream(var1));
|
||||
String var1 = this.field_28191_a.func_28113_a("idcounts");
|
||||
if(var1 != null && GL11.exists(var1)) {
|
||||
DataInputStream var2 = new DataInputStream(new ByteArrayInputStream(GL11.readFile(var1)));
|
||||
NBTTagCompound var3 = CompressedStreamTools.func_1141_a(var2);
|
||||
var2.close();
|
||||
Iterator var4 = var3.func_28110_c().iterator();
|
||||
|
@ -143,7 +145,7 @@ public class MapStorage {
|
|||
return var2.shortValue();
|
||||
} else {
|
||||
try {
|
||||
File var3 = this.field_28191_a.func_28113_a("idcounts");
|
||||
String var3 = this.field_28191_a.func_28113_a("idcounts");
|
||||
if(var3 != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
Iterator var5 = this.idCounts.keySet().iterator();
|
||||
|
@ -154,8 +156,10 @@ public class MapStorage {
|
|||
var4.setShort(var6, var7);
|
||||
}
|
||||
|
||||
DataOutputStream var9 = new DataOutputStream(new FileOutputStream(var3));
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
DataOutputStream var9 = new DataOutputStream(baos);
|
||||
CompressedStreamTools.func_1139_a(var4, var9);
|
||||
GL11.writeFile(var3, baos.toByteArray());
|
||||
var9.close();
|
||||
}
|
||||
} catch (Exception var8) {
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class MathHelper {
|
||||
private static float[] SIN_TABLE = new float[65536];
|
||||
private static float[] SIN_TABLE = new float[4096];
|
||||
|
||||
public static final float sin(float var0) {
|
||||
return SIN_TABLE[(int)(var0 * 10430.378F) & '\uffff'];
|
||||
return SIN_TABLE[(int)(var0 * 651.8986F) & 4095];
|
||||
}
|
||||
|
||||
public static final float cos(float var0) {
|
||||
return SIN_TABLE[(int)(var0 * 10430.378F + 16384.0F) & '\uffff'];
|
||||
return SIN_TABLE[(int)((var0 + ((float)Math.PI / 2F)) * 651.8986F) & 4095];
|
||||
}
|
||||
|
||||
public static final float sqrt_float(float var0) {
|
||||
|
@ -54,9 +54,12 @@ public class MathHelper {
|
|||
}
|
||||
|
||||
static {
|
||||
for(int var0 = 0; var0 < 65536; ++var0) {
|
||||
SIN_TABLE[var0] = (float)Math.sin((double)var0 * Math.PI * 2.0D / 65536.0D);
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class McRegionChunkLoader implements IChunkLoader {
|
||||
private final File worldDir;
|
||||
|
||||
public McRegionChunkLoader(File var1) {
|
||||
this.worldDir = var1;
|
||||
}
|
||||
|
||||
public Chunk loadChunk(World var1, int var2, int var3) throws IOException {
|
||||
DataInputStream var4 = RegionFileCache.getChunkInputStream(this.worldDir, var2, var3);
|
||||
if(var4 != null) {
|
||||
NBTTagCompound var5 = CompressedStreamTools.func_1141_a(var4);
|
||||
if(!var5.hasKey("Level")) {
|
||||
System.out.println("Chunk file at " + var2 + "," + var3 + " is missing level data, skipping");
|
||||
return null;
|
||||
} else if(!var5.getCompoundTag("Level").hasKey("Blocks")) {
|
||||
System.out.println("Chunk file at " + var2 + "," + var3 + " is missing block data, skipping");
|
||||
return null;
|
||||
} else {
|
||||
Chunk var6 = ChunkLoader.loadChunkIntoWorldFromCompound(var1, var5.getCompoundTag("Level"));
|
||||
if(!var6.isAtLocation(var2, var3)) {
|
||||
System.out.println("Chunk file at " + var2 + "," + var3 + " is in the wrong location; relocating. (Expected " + var2 + ", " + var3 + ", got " + var6.xPosition + ", " + var6.zPosition + ")");
|
||||
var5.setInteger("xPos", var2);
|
||||
var5.setInteger("zPos", var3);
|
||||
var6 = ChunkLoader.loadChunkIntoWorldFromCompound(var1, var5.getCompoundTag("Level"));
|
||||
}
|
||||
|
||||
var6.func_25124_i();
|
||||
return var6;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void saveChunk(World var1, Chunk var2) throws IOException {
|
||||
var1.checkSessionLock();
|
||||
|
||||
try {
|
||||
DataOutputStream var3 = RegionFileCache.getChunkOutputStream(this.worldDir, var2.xPosition, var2.zPosition);
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
NBTTagCompound var5 = new NBTTagCompound();
|
||||
var4.setTag("Level", var5);
|
||||
ChunkLoader.storeChunkInCompound(var2, var1, var5);
|
||||
CompressedStreamTools.func_1139_a(var4, var3);
|
||||
var3.close();
|
||||
WorldInfo var6 = var1.getWorldInfo();
|
||||
var6.setSizeOnDisk(var6.getSizeOnDisk() + (long)RegionFileCache.getSizeDelta(this.worldDir, var2.xPosition, var2.zPosition));
|
||||
} catch (Exception var7) {
|
||||
var7.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void saveExtraChunkData(World var1, Chunk var2) throws IOException {
|
||||
}
|
||||
|
||||
public void func_814_a() {
|
||||
}
|
||||
|
||||
public void saveExtraData() {
|
||||
}
|
||||
}
|
|
@ -78,16 +78,15 @@ public class ModelSpider extends ModelBase {
|
|||
this.spiderLeg6.rotateAngleZ = var7 * 0.74F;
|
||||
this.spiderLeg7.rotateAngleZ = -var7;
|
||||
this.spiderLeg8.rotateAngleZ = var7;
|
||||
float var8 = -0.0F;
|
||||
float var9 = (float)Math.PI * 0.125F;
|
||||
this.spiderLeg1.rotateAngleY = var9 * 2.0F + var8;
|
||||
this.spiderLeg2.rotateAngleY = -var9 * 2.0F - var8;
|
||||
this.spiderLeg3.rotateAngleY = var9 * 1.0F + var8;
|
||||
this.spiderLeg4.rotateAngleY = -var9 * 1.0F - var8;
|
||||
this.spiderLeg5.rotateAngleY = -var9 * 1.0F + var8;
|
||||
this.spiderLeg6.rotateAngleY = var9 * 1.0F - var8;
|
||||
this.spiderLeg7.rotateAngleY = -var9 * 2.0F + var8;
|
||||
this.spiderLeg8.rotateAngleY = var9 * 2.0F - var8;
|
||||
this.spiderLeg1.rotateAngleY = var9 * 2.0F;
|
||||
this.spiderLeg2.rotateAngleY = -var9 * 2.0F;
|
||||
this.spiderLeg3.rotateAngleY = var9 * 1.0F;
|
||||
this.spiderLeg4.rotateAngleY = -var9 * 1.0F;
|
||||
this.spiderLeg5.rotateAngleY = -var9 * 1.0F;
|
||||
this.spiderLeg6.rotateAngleY = var9 * 1.0F;
|
||||
this.spiderLeg7.rotateAngleY = -var9 * 2.0F;
|
||||
this.spiderLeg8.rotateAngleY = var9 * 2.0F;
|
||||
float var10 = -(MathHelper.cos(var1 * 0.6662F * 2.0F + 0.0F) * 0.4F) * var2;
|
||||
float var11 = -(MathHelper.cos(var1 * 0.6662F * 2.0F + (float)Math.PI) * 0.4F) * var2;
|
||||
float var12 = -(MathHelper.cos(var1 * 0.6662F * 2.0F + (float)Math.PI * 0.5F) * 0.4F) * var2;
|
||||
|
|
|
@ -1,274 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.ArrayList;
|
||||
import java.util.zip.DeflaterOutputStream;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
|
||||
public class RegionFile {
|
||||
private static final byte[] emptySector = new byte[4096];
|
||||
private final File fileName;
|
||||
private RandomAccessFile dataFile;
|
||||
private final int[] offsets = new int[1024];
|
||||
private final int[] field_22217_e = new int[1024];
|
||||
private ArrayList sectorFree;
|
||||
private int sizeDelta;
|
||||
private long field_22214_h = 0L;
|
||||
|
||||
public RegionFile(File var1) {
|
||||
this.fileName = var1;
|
||||
this.debugln("REGION LOAD " + this.fileName);
|
||||
this.sizeDelta = 0;
|
||||
|
||||
try {
|
||||
if(var1.exists()) {
|
||||
this.field_22214_h = var1.lastModified();
|
||||
}
|
||||
|
||||
this.dataFile = new RandomAccessFile(var1, "rw");
|
||||
int var2;
|
||||
if(this.dataFile.length() < 4096L) {
|
||||
for(var2 = 0; var2 < 1024; ++var2) {
|
||||
this.dataFile.writeInt(0);
|
||||
}
|
||||
|
||||
for(var2 = 0; var2 < 1024; ++var2) {
|
||||
this.dataFile.writeInt(0);
|
||||
}
|
||||
|
||||
this.sizeDelta += 8192;
|
||||
}
|
||||
|
||||
if((this.dataFile.length() & 4095L) != 0L) {
|
||||
for(var2 = 0; (long)var2 < (this.dataFile.length() & 4095L); ++var2) {
|
||||
this.dataFile.write(0);
|
||||
}
|
||||
}
|
||||
|
||||
var2 = (int)this.dataFile.length() / 4096;
|
||||
this.sectorFree = new ArrayList(var2);
|
||||
|
||||
int var3;
|
||||
for(var3 = 0; var3 < var2; ++var3) {
|
||||
this.sectorFree.add(Boolean.valueOf(true));
|
||||
}
|
||||
|
||||
this.sectorFree.set(0, Boolean.valueOf(false));
|
||||
this.sectorFree.set(1, Boolean.valueOf(false));
|
||||
this.dataFile.seek(0L);
|
||||
|
||||
int var4;
|
||||
for(var3 = 0; var3 < 1024; ++var3) {
|
||||
var4 = this.dataFile.readInt();
|
||||
this.offsets[var3] = var4;
|
||||
if(var4 != 0 && (var4 >> 8) + (var4 & 255) <= this.sectorFree.size()) {
|
||||
for(int var5 = 0; var5 < (var4 & 255); ++var5) {
|
||||
this.sectorFree.set((var4 >> 8) + var5, Boolean.valueOf(false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(var3 = 0; var3 < 1024; ++var3) {
|
||||
var4 = this.dataFile.readInt();
|
||||
this.field_22217_e[var3] = var4;
|
||||
}
|
||||
} catch (IOException var6) {
|
||||
var6.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public synchronized int func_22209_a() {
|
||||
int var1 = this.sizeDelta;
|
||||
this.sizeDelta = 0;
|
||||
return var1;
|
||||
}
|
||||
|
||||
private void func_22211_a(String var1) {
|
||||
}
|
||||
|
||||
private void debugln(String var1) {
|
||||
this.func_22211_a(var1 + "\n");
|
||||
}
|
||||
|
||||
private void func_22199_a(String var1, int var2, int var3, String var4) {
|
||||
this.func_22211_a("REGION " + var1 + " " + this.fileName.getName() + "[" + var2 + "," + var3 + "] = " + var4);
|
||||
}
|
||||
|
||||
private void func_22197_a(String var1, int var2, int var3, int var4, String var5) {
|
||||
this.func_22211_a("REGION " + var1 + " " + this.fileName.getName() + "[" + var2 + "," + var3 + "] " + var4 + "B = " + var5);
|
||||
}
|
||||
|
||||
private void debugln(String var1, int var2, int var3, String var4) {
|
||||
this.func_22199_a(var1, var2, var3, var4 + "\n");
|
||||
}
|
||||
|
||||
public synchronized DataInputStream getChunkDataInputStream(int var1, int var2) {
|
||||
if(this.outOfBounds(var1, var2)) {
|
||||
this.debugln("READ", var1, var2, "out of bounds");
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
int var3 = this.getOffset(var1, var2);
|
||||
if(var3 == 0) {
|
||||
return null;
|
||||
} else {
|
||||
int var4 = var3 >> 8;
|
||||
int var5 = var3 & 255;
|
||||
if(var4 + var5 > this.sectorFree.size()) {
|
||||
this.debugln("READ", var1, var2, "invalid sector");
|
||||
return null;
|
||||
} else {
|
||||
this.dataFile.seek((long)(var4 * 4096));
|
||||
int var6 = this.dataFile.readInt();
|
||||
if(var6 > 4096 * var5) {
|
||||
this.debugln("READ", var1, var2, "invalid length: " + var6 + " > 4096 * " + var5);
|
||||
return null;
|
||||
} else {
|
||||
byte var7 = this.dataFile.readByte();
|
||||
byte[] var8;
|
||||
DataInputStream var9;
|
||||
if(var7 == 1) {
|
||||
var8 = new byte[var6 - 1];
|
||||
this.dataFile.read(var8);
|
||||
var9 = new DataInputStream(new GZIPInputStream(new ByteArrayInputStream(var8)));
|
||||
return var9;
|
||||
} else if(var7 == 2) {
|
||||
var8 = new byte[var6 - 1];
|
||||
this.dataFile.read(var8);
|
||||
var9 = new DataInputStream(new InflaterInputStream(new ByteArrayInputStream(var8)));
|
||||
return var9;
|
||||
} else {
|
||||
this.debugln("READ", var1, var2, "unknown version " + var7);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException var10) {
|
||||
this.debugln("READ", var1, var2, "exception");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DataOutputStream getChunkDataOutputStream(int var1, int var2) {
|
||||
return this.outOfBounds(var1, var2) ? null : new DataOutputStream(new DeflaterOutputStream(new RegionFileChunkBuffer(this, var1, var2)));
|
||||
}
|
||||
|
||||
protected synchronized void write(int var1, int var2, byte[] var3, int var4) {
|
||||
try {
|
||||
int var5 = this.getOffset(var1, var2);
|
||||
int var6 = var5 >> 8;
|
||||
int var7 = var5 & 255;
|
||||
int var8 = (var4 + 5) / 4096 + 1;
|
||||
if(var8 >= 256) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(var6 != 0 && var7 == var8) {
|
||||
this.func_22197_a("SAVE", var1, var2, var4, "rewrite");
|
||||
this.write(var6, var3, var4);
|
||||
} else {
|
||||
int var9;
|
||||
for(var9 = 0; var9 < var7; ++var9) {
|
||||
this.sectorFree.set(var6 + var9, Boolean.valueOf(true));
|
||||
}
|
||||
|
||||
var9 = this.sectorFree.indexOf(Boolean.valueOf(true));
|
||||
int var10 = 0;
|
||||
int var11;
|
||||
if(var9 != -1) {
|
||||
for(var11 = var9; var11 < this.sectorFree.size(); ++var11) {
|
||||
if(var10 != 0) {
|
||||
if(((Boolean)this.sectorFree.get(var11)).booleanValue()) {
|
||||
++var10;
|
||||
} else {
|
||||
var10 = 0;
|
||||
}
|
||||
} else if(((Boolean)this.sectorFree.get(var11)).booleanValue()) {
|
||||
var9 = var11;
|
||||
var10 = 1;
|
||||
}
|
||||
|
||||
if(var10 >= var8) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(var10 >= var8) {
|
||||
this.func_22197_a("SAVE", var1, var2, var4, "reuse");
|
||||
var6 = var9;
|
||||
this.setOffset(var1, var2, var9 << 8 | var8);
|
||||
|
||||
for(var11 = 0; var11 < var8; ++var11) {
|
||||
this.sectorFree.set(var6 + var11, Boolean.valueOf(false));
|
||||
}
|
||||
|
||||
this.write(var6, var3, var4);
|
||||
} else {
|
||||
this.func_22197_a("SAVE", var1, var2, var4, "grow");
|
||||
this.dataFile.seek(this.dataFile.length());
|
||||
var6 = this.sectorFree.size();
|
||||
|
||||
for(var11 = 0; var11 < var8; ++var11) {
|
||||
this.dataFile.write(emptySector);
|
||||
this.sectorFree.add(Boolean.valueOf(false));
|
||||
}
|
||||
|
||||
this.sizeDelta += 4096 * var8;
|
||||
this.write(var6, var3, var4);
|
||||
this.setOffset(var1, var2, var6 << 8 | var8);
|
||||
}
|
||||
}
|
||||
|
||||
this.func_22208_b(var1, var2, (int)(System.currentTimeMillis() / 1000L));
|
||||
} catch (IOException var12) {
|
||||
var12.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void write(int var1, byte[] var2, int var3) throws IOException {
|
||||
this.debugln(" " + var1);
|
||||
this.dataFile.seek((long)(var1 * 4096));
|
||||
this.dataFile.writeInt(var3 + 1);
|
||||
this.dataFile.writeByte(2);
|
||||
this.dataFile.write(var2, 0, var3);
|
||||
}
|
||||
|
||||
private boolean outOfBounds(int var1, int var2) {
|
||||
return var1 < 0 || var1 >= 32 || var2 < 0 || var2 >= 32;
|
||||
}
|
||||
|
||||
private int getOffset(int var1, int var2) {
|
||||
return this.offsets[var1 + var2 * 32];
|
||||
}
|
||||
|
||||
public boolean func_22202_c(int var1, int var2) {
|
||||
return this.getOffset(var1, var2) != 0;
|
||||
}
|
||||
|
||||
private void setOffset(int var1, int var2, int var3) throws IOException {
|
||||
this.offsets[var1 + var2 * 32] = var3;
|
||||
this.dataFile.seek((long)((var1 + var2 * 32) * 4));
|
||||
this.dataFile.writeInt(var3);
|
||||
}
|
||||
|
||||
private void func_22208_b(int var1, int var2, int var3) throws IOException {
|
||||
this.field_22217_e[var1 + var2 * 32] = var3;
|
||||
this.dataFile.seek((long)(4096 + (var1 + var2 * 32) * 4));
|
||||
this.dataFile.writeInt(var3);
|
||||
}
|
||||
|
||||
public void func_22196_b() throws IOException {
|
||||
this.dataFile.close();
|
||||
}
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public class RegionFileCache {
|
||||
private static final Map cache = new HashMap();
|
||||
|
||||
public static synchronized RegionFile func_22193_a(File var0, int var1, int var2) {
|
||||
File var3 = new File(var0, "region");
|
||||
File var4 = new File(var3, "r." + (var1 >> 5) + "." + (var2 >> 5) + ".mcr");
|
||||
Reference var5 = (Reference)cache.get(var4);
|
||||
RegionFile var6;
|
||||
if(var5 != null) {
|
||||
var6 = (RegionFile)var5.get();
|
||||
if(var6 != null) {
|
||||
return var6;
|
||||
}
|
||||
}
|
||||
|
||||
if(!var3.exists()) {
|
||||
var3.mkdirs();
|
||||
}
|
||||
|
||||
if(cache.size() >= 256) {
|
||||
func_22192_a();
|
||||
}
|
||||
|
||||
var6 = new RegionFile(var4);
|
||||
cache.put(var4, new SoftReference(var6));
|
||||
return var6;
|
||||
}
|
||||
|
||||
public static synchronized void func_22192_a() {
|
||||
Iterator var0 = cache.values().iterator();
|
||||
|
||||
while(var0.hasNext()) {
|
||||
Reference var1 = (Reference)var0.next();
|
||||
|
||||
try {
|
||||
RegionFile var2 = (RegionFile)var1.get();
|
||||
if(var2 != null) {
|
||||
var2.func_22196_b();
|
||||
}
|
||||
} catch (IOException var3) {
|
||||
var3.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
public static int getSizeDelta(File var0, int var1, int var2) {
|
||||
RegionFile var3 = func_22193_a(var0, var1, var2);
|
||||
return var3.func_22209_a();
|
||||
}
|
||||
|
||||
public static DataInputStream getChunkInputStream(File var0, int var1, int var2) {
|
||||
RegionFile var3 = func_22193_a(var0, var1, var2);
|
||||
return var3.getChunkDataInputStream(var1 & 31, var2 & 31);
|
||||
}
|
||||
|
||||
public static DataOutputStream getChunkOutputStream(File var0, int var1, int var2) {
|
||||
RegionFile var3 = func_22193_a(var0, var1, var2);
|
||||
return var3.getChunkDataOutputStream(var1 & 31, var2 & 31);
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
class RegionFileChunkBuffer extends ByteArrayOutputStream {
|
||||
private int field_22283_b;
|
||||
private int field_22285_c;
|
||||
final RegionFile field_22284_a;
|
||||
|
||||
public RegionFileChunkBuffer(RegionFile var1, int var2, int var3) {
|
||||
super(8096);
|
||||
this.field_22284_a = var1;
|
||||
this.field_22283_b = var2;
|
||||
this.field_22285_c = var3;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
this.field_22284_a.write(this.field_22283_b, this.field_22285_c, this.buf, this.count);
|
||||
}
|
||||
}
|
|
@ -286,85 +286,19 @@ public class RenderEngine {
|
|||
}
|
||||
|
||||
public void updateDynamicTextures() {
|
||||
int var1;
|
||||
TextureFX var2;
|
||||
int var3;
|
||||
int var4;
|
||||
int var5;
|
||||
int var6;
|
||||
int var7;
|
||||
int var8;
|
||||
int var9;
|
||||
int var10;
|
||||
int var11;
|
||||
int var12;
|
||||
for(var1 = 0; var1 < this.textureList.size(); ++var1) {
|
||||
var2 = (TextureFX)this.textureList.get(var1);
|
||||
var2.anaglyphEnabled = this.options.anaglyph;
|
||||
var2.onTick();
|
||||
this.imageData.clear();
|
||||
this.imageData.put(var2.imageData);
|
||||
this.imageData.position(0).limit(var2.imageData.length);
|
||||
var2.bindImage(this);
|
||||
|
||||
for(var3 = 0; var3 < var2.tileSize; ++var3) {
|
||||
for(var4 = 0; var4 < var2.tileSize; ++var4) {
|
||||
GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, var2.iconIndex % 16 * 16 + var3 * 16, var2.iconIndex / 16 * 16 + var4 * 16, 16, 16, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)this.imageData);
|
||||
if(useMipmaps) {
|
||||
for(var5 = 1; var5 <= 4; ++var5) {
|
||||
var6 = 16 >> var5 - 1;
|
||||
var7 = 16 >> var5;
|
||||
|
||||
for(var8 = 0; var8 < var7; ++var8) {
|
||||
for(var9 = 0; var9 < var7; ++var9) {
|
||||
var10 = this.imageData.getInt((var8 * 2 + 0 + (var9 * 2 + 0) * var6) * 4);
|
||||
var11 = this.imageData.getInt((var8 * 2 + 1 + (var9 * 2 + 0) * var6) * 4);
|
||||
var12 = this.imageData.getInt((var8 * 2 + 1 + (var9 * 2 + 1) * var6) * 4);
|
||||
int var13 = this.imageData.getInt((var8 * 2 + 0 + (var9 * 2 + 1) * var6) * 4);
|
||||
int var14 = this.averageColor(this.averageColor(var10, var11), this.averageColor(var12, var13));
|
||||
this.imageData.putInt((var8 + var9 * var7) * 4, var14);
|
||||
for (int i = 0; i < textureList.size(); i++) {
|
||||
TextureFX texturefx = (TextureFX) textureList.get(i);
|
||||
texturefx.anaglyphEnabled = this.options.anaglyph;
|
||||
texturefx.onTick();
|
||||
texturefx.bindImage(this);
|
||||
int tileSize = 16 * 16 * 4;
|
||||
imageData.clear();
|
||||
imageData.put(texturefx.imageData);
|
||||
imageData.position(0).limit(tileSize);
|
||||
GL11.glTexSubImage2D(3553, 0, (texturefx.iconIndex % 16) * 16, (texturefx.iconIndex / 16) * 16, 16, 16, 6408, 5121, imageData);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, var5, var2.iconIndex % 16 * var7, var2.iconIndex / 16 * var7, var7, var7, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, this.imageData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(var1 = 0; var1 < this.textureList.size(); ++var1) {
|
||||
var2 = (TextureFX)this.textureList.get(var1);
|
||||
if(var2.textureId > 0) {
|
||||
this.imageData.clear();
|
||||
this.imageData.put(var2.imageData);
|
||||
this.imageData.position(0).limit(var2.imageData.length);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, var2.textureId);
|
||||
GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 16, 16, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)this.imageData);
|
||||
if(useMipmaps) {
|
||||
for(var3 = 1; var3 <= 4; ++var3) {
|
||||
var4 = 16 >> var3 - 1;
|
||||
var5 = 16 >> var3;
|
||||
|
||||
for(var6 = 0; var6 < var5; ++var6) {
|
||||
for(var7 = 0; var7 < var5; ++var7) {
|
||||
var8 = this.imageData.getInt((var6 * 2 + 0 + (var7 * 2 + 0) * var4) * 4);
|
||||
var9 = this.imageData.getInt((var6 * 2 + 1 + (var7 * 2 + 0) * var4) * 4);
|
||||
var10 = this.imageData.getInt((var6 * 2 + 1 + (var7 * 2 + 1) * var4) * 4);
|
||||
var11 = this.imageData.getInt((var6 * 2 + 0 + (var7 * 2 + 1) * var4) * 4);
|
||||
var12 = this.averageColor(this.averageColor(var8, var9), this.averageColor(var10, var11));
|
||||
this.imageData.putInt((var6 + var7 * var5) * 4, var12);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, var3, 0, 0, var5, var5, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)this.imageData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int averageColor(int var1, int var2) {
|
||||
int var3 = (var1 & -16777216) >> 24 & 255;
|
||||
int var4 = (var2 & -16777216) >> 24 & 255;
|
||||
|
|
|
@ -536,7 +536,7 @@ public class RenderGlobal implements IWorldAccess {
|
|||
var14 = (float)var20 * (float)Math.PI * 2.0F / (float)var19;
|
||||
float var15 = MathHelper.sin(var14);
|
||||
float var16 = MathHelper.cos(var14);
|
||||
var17.addVertex((double)(var15 * 120.0F), (double)(var16 * 120.0F), (double)(-var16 * 40.0F * var18[3]));
|
||||
var17.addVertex((double)(var15 * 120.0F), (double)(var16 * 120.0F), (double)(var16 * 40.0F * var18[3]));
|
||||
}
|
||||
|
||||
var17.draw();
|
||||
|
@ -956,7 +956,7 @@ public class RenderGlobal implements IWorldAccess {
|
|||
var8 = this.worldObj.getBlockId(var2.blockX, var2.blockY, var2.blockZ);
|
||||
Block var9 = var8 > 0 ? Block.blocksList[var8] : null;
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glPolygonOffset(-3.0F, -3.0F);
|
||||
GL11.glPolygonOffset(3.0F, 3.0F);
|
||||
GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
double var10 = var1.lastTickPosX + (var1.posX - var1.lastTickPosX) * (double)var5;
|
||||
double var12 = var1.lastTickPosY + (var1.posY - var1.lastTickPosY) * (double)var5;
|
||||
|
|
|
@ -135,43 +135,44 @@ public class RenderPlayer extends RenderLiving {
|
|||
}
|
||||
}
|
||||
|
||||
if(this.loadDownloadableImageTexture(var1.playerCloakUrl, (String)null)) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0F, 0.0F, 2.0F / 16.0F);
|
||||
double var20 = var1.field_20066_r + (var1.field_20063_u - var1.field_20066_r) * (double)var2 - (var1.prevPosX + (var1.posX - var1.prevPosX) * (double)var2);
|
||||
double var22 = var1.field_20065_s + (var1.field_20062_v - var1.field_20065_s) * (double)var2 - (var1.prevPosY + (var1.posY - var1.prevPosY) * (double)var2);
|
||||
double var8 = var1.field_20064_t + (var1.field_20061_w - var1.field_20064_t) * (double)var2 - (var1.prevPosZ + (var1.posZ - var1.prevPosZ) * (double)var2);
|
||||
float var10 = var1.prevRenderYawOffset + (var1.renderYawOffset - var1.prevRenderYawOffset) * var2;
|
||||
double var11 = (double)MathHelper.sin(var10 * (float)Math.PI / 180.0F);
|
||||
double var13 = (double)(-MathHelper.cos(var10 * (float)Math.PI / 180.0F));
|
||||
float var15 = (float)var22 * 10.0F;
|
||||
if(var15 < -6.0F) {
|
||||
var15 = -6.0F;
|
||||
}
|
||||
|
||||
if(var15 > 32.0F) {
|
||||
var15 = 32.0F;
|
||||
}
|
||||
|
||||
float var16 = (float)(var20 * var11 + var8 * var13) * 100.0F;
|
||||
float var17 = (float)(var20 * var13 - var8 * var11) * 100.0F;
|
||||
if(var16 < 0.0F) {
|
||||
var16 = 0.0F;
|
||||
}
|
||||
|
||||
float var18 = var1.field_775_e + (var1.field_774_f - var1.field_775_e) * var2;
|
||||
var15 += MathHelper.sin((var1.prevDistanceWalkedModified + (var1.distanceWalkedModified - var1.prevDistanceWalkedModified) * var2) * 6.0F) * 32.0F * var18;
|
||||
if(var1.isSneaking()) {
|
||||
var15 += 25.0F;
|
||||
}
|
||||
|
||||
GL11.glRotatef(6.0F + var16 / 2.0F + var15, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(var17 / 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(-var17 / 2.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
this.modelBipedMain.renderCloak(1.0F / 16.0F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
//Uhm... I don't think so
|
||||
// if(this.loadDownloadableImageTexture(var1.playerCloakUrl, (String)null)) {
|
||||
// GL11.glPushMatrix();
|
||||
// GL11.glTranslatef(0.0F, 0.0F, 2.0F / 16.0F);
|
||||
// double var20 = var1.field_20066_r + (var1.field_20063_u - var1.field_20066_r) * (double)var2 - (var1.prevPosX + (var1.posX - var1.prevPosX) * (double)var2);
|
||||
// double var22 = var1.field_20065_s + (var1.field_20062_v - var1.field_20065_s) * (double)var2 - (var1.prevPosY + (var1.posY - var1.prevPosY) * (double)var2);
|
||||
// double var8 = var1.field_20064_t + (var1.field_20061_w - var1.field_20064_t) * (double)var2 - (var1.prevPosZ + (var1.posZ - var1.prevPosZ) * (double)var2);
|
||||
// float var10 = var1.prevRenderYawOffset + (var1.renderYawOffset - var1.prevRenderYawOffset) * var2;
|
||||
// double var11 = (double)MathHelper.sin(var10 * (float)Math.PI / 180.0F);
|
||||
// double var13 = (double)(-MathHelper.cos(var10 * (float)Math.PI / 180.0F));
|
||||
// float var15 = (float)var22 * 10.0F;
|
||||
// if(var15 < -6.0F) {
|
||||
// var15 = -6.0F;
|
||||
// }
|
||||
//
|
||||
// if(var15 > 32.0F) {
|
||||
// var15 = 32.0F;
|
||||
// }
|
||||
//
|
||||
// float var16 = (float)(var20 * var11 + var8 * var13) * 100.0F;
|
||||
// float var17 = (float)(var20 * var13 - var8 * var11) * 100.0F;
|
||||
// if(var16 < 0.0F) {
|
||||
// var16 = 0.0F;
|
||||
// }
|
||||
//
|
||||
// float var18 = var1.field_775_e + (var1.field_774_f - var1.field_775_e) * var2;
|
||||
// var15 += MathHelper.sin((var1.prevDistanceWalkedModified + (var1.distanceWalkedModified - var1.prevDistanceWalkedModified) * var2) * 6.0F) * 32.0F * var18;
|
||||
// if(var1.isSneaking()) {
|
||||
// var15 += 25.0F;
|
||||
// }
|
||||
//
|
||||
// GL11.glRotatef(6.0F + var16 / 2.0F + var15, 1.0F, 0.0F, 0.0F);
|
||||
// GL11.glRotatef(var17 / 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
// GL11.glRotatef(-var17 / 2.0F, 0.0F, 1.0F, 0.0F);
|
||||
// GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
// this.modelBipedMain.renderCloak(1.0F / 16.0F);
|
||||
// GL11.glPopMatrix();
|
||||
// }
|
||||
|
||||
ItemStack var21 = var1.inventory.getCurrentItem();
|
||||
if(var21 != null) {
|
||||
|
|
|
@ -1,174 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
public class SaveConverterMcRegion extends SaveFormatOld {
|
||||
public SaveConverterMcRegion(File var1) {
|
||||
super(var1);
|
||||
}
|
||||
|
||||
public String func_22178_a() {
|
||||
return "Scaevolus\' McRegion";
|
||||
}
|
||||
|
||||
public List func_22176_b() {
|
||||
ArrayList var1 = new ArrayList();
|
||||
File[] var2 = this.field_22180_a.listFiles();
|
||||
File[] var3 = var2;
|
||||
int var4 = var2.length;
|
||||
|
||||
for(int var5 = 0; var5 < var4; ++var5) {
|
||||
File var6 = var3[var5];
|
||||
if(var6.isDirectory()) {
|
||||
String var7 = var6.getName();
|
||||
WorldInfo var8 = this.func_22173_b(var7);
|
||||
if(var8 != null) {
|
||||
boolean var9 = var8.getSaveVersion() != 19132;
|
||||
String var10 = var8.getWorldName();
|
||||
if(var10 == null || MathHelper.stringNullOrLengthZero(var10)) {
|
||||
var10 = var7;
|
||||
}
|
||||
|
||||
var1.add(new SaveFormatComparator(var7, var10, var8.getLastTimePlayed(), var8.getSizeOnDisk(), var9));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return var1;
|
||||
}
|
||||
|
||||
public void flushCache() {
|
||||
RegionFileCache.func_22192_a();
|
||||
}
|
||||
|
||||
public ISaveHandler getSaveLoader(String var1, boolean var2) {
|
||||
return new SaveOldDir(this.field_22180_a, var1, var2);
|
||||
}
|
||||
|
||||
public boolean isOldMapFormat(String var1) {
|
||||
WorldInfo var2 = this.func_22173_b(var1);
|
||||
return var2 != null && var2.getSaveVersion() == 0;
|
||||
}
|
||||
|
||||
public boolean convertMapFormat(String var1, IProgressUpdate var2) {
|
||||
var2.setLoadingProgress(0);
|
||||
ArrayList var3 = new ArrayList();
|
||||
ArrayList var4 = new ArrayList();
|
||||
ArrayList var5 = new ArrayList();
|
||||
ArrayList var6 = new ArrayList();
|
||||
File var7 = new File(this.field_22180_a, var1);
|
||||
File var8 = new File(var7, "DIM-1");
|
||||
System.out.println("Scanning folders...");
|
||||
this.func_22183_a(var7, var3, var4);
|
||||
if(var8.exists()) {
|
||||
this.func_22183_a(var8, var5, var6);
|
||||
}
|
||||
|
||||
int var9 = var3.size() + var5.size() + var4.size() + var6.size();
|
||||
System.out.println("Total conversion count is " + var9);
|
||||
this.func_22181_a(var7, var3, 0, var9, var2);
|
||||
this.func_22181_a(var8, var5, var3.size(), var9, var2);
|
||||
WorldInfo var10 = this.func_22173_b(var1);
|
||||
var10.setSaveVersion(19132);
|
||||
ISaveHandler var11 = this.getSaveLoader(var1, false);
|
||||
var11.saveWorldInfo(var10);
|
||||
this.func_22182_a(var4, var3.size() + var5.size(), var9, var2);
|
||||
if(var8.exists()) {
|
||||
this.func_22182_a(var6, var3.size() + var5.size() + var4.size(), var9, var2);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void func_22183_a(File var1, ArrayList var2, ArrayList var3) {
|
||||
ChunkFolderPattern var4 = new ChunkFolderPattern((Empty2)null);
|
||||
ChunkFilePattern var5 = new ChunkFilePattern((Empty2)null);
|
||||
File[] var6 = var1.listFiles(var4);
|
||||
File[] var7 = var6;
|
||||
int var8 = var6.length;
|
||||
|
||||
for(int var9 = 0; var9 < var8; ++var9) {
|
||||
File var10 = var7[var9];
|
||||
var3.add(var10);
|
||||
File[] var11 = var10.listFiles(var4);
|
||||
File[] var12 = var11;
|
||||
int var13 = var11.length;
|
||||
|
||||
for(int var14 = 0; var14 < var13; ++var14) {
|
||||
File var15 = var12[var14];
|
||||
File[] var16 = var15.listFiles(var5);
|
||||
File[] var17 = var16;
|
||||
int var18 = var16.length;
|
||||
|
||||
for(int var19 = 0; var19 < var18; ++var19) {
|
||||
File var20 = var17[var19];
|
||||
var2.add(new ChunkFile(var20));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void func_22181_a(File var1, ArrayList var2, int var3, int var4, IProgressUpdate var5) {
|
||||
Collections.sort(var2);
|
||||
byte[] var6 = new byte[4096];
|
||||
Iterator var7 = var2.iterator();
|
||||
|
||||
while(var7.hasNext()) {
|
||||
ChunkFile var8 = (ChunkFile)var7.next();
|
||||
int var9 = var8.func_22323_b();
|
||||
int var10 = var8.func_22321_c();
|
||||
RegionFile var11 = RegionFileCache.func_22193_a(var1, var9, var10);
|
||||
if(!var11.func_22202_c(var9 & 31, var10 & 31)) {
|
||||
try {
|
||||
DataInputStream var12 = new DataInputStream(new GZIPInputStream(new FileInputStream(var8.func_22324_a())));
|
||||
DataOutputStream var13 = var11.getChunkDataOutputStream(var9 & 31, var10 & 31);
|
||||
boolean var14 = false;
|
||||
|
||||
while(true) {
|
||||
int var17 = var12.read(var6);
|
||||
if(var17 == -1) {
|
||||
var13.close();
|
||||
var12.close();
|
||||
break;
|
||||
}
|
||||
|
||||
var13.write(var6, 0, var17);
|
||||
}
|
||||
} catch (IOException var15) {
|
||||
var15.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
++var3;
|
||||
int var16 = (int)Math.round(100.0D * (double)var3 / (double)var4);
|
||||
var5.setLoadingProgress(var16);
|
||||
}
|
||||
|
||||
RegionFileCache.func_22192_a();
|
||||
}
|
||||
|
||||
private void func_22182_a(ArrayList var1, int var2, int var3, IProgressUpdate var4) {
|
||||
Iterator var5 = var1.iterator();
|
||||
|
||||
while(var5.hasNext()) {
|
||||
File var6 = (File)var5.next();
|
||||
File[] var7 = var6.listFiles();
|
||||
func_22179_a(var7);
|
||||
var6.delete();
|
||||
++var2;
|
||||
int var8 = (int)Math.round(100.0D * (double)var2 / (double)var3);
|
||||
var4.setLoadingProgress(var8);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SaveFormatOld implements ISaveFormat {
|
||||
protected final File field_22180_a;
|
||||
|
||||
public SaveFormatOld(File var1) {
|
||||
if(!var1.exists()) {
|
||||
var1.mkdirs();
|
||||
}
|
||||
|
||||
this.field_22180_a = var1;
|
||||
}
|
||||
|
||||
public String func_22178_a() {
|
||||
return "Old Format";
|
||||
}
|
||||
|
||||
public List func_22176_b() {
|
||||
ArrayList var1 = new ArrayList();
|
||||
|
||||
for(int var2 = 0; var2 < 5; ++var2) {
|
||||
String var3 = "World" + (var2 + 1);
|
||||
WorldInfo var4 = this.func_22173_b(var3);
|
||||
if(var4 != null) {
|
||||
var1.add(new SaveFormatComparator(var3, "", var4.getLastTimePlayed(), var4.getSizeOnDisk(), false));
|
||||
}
|
||||
}
|
||||
|
||||
return var1;
|
||||
}
|
||||
|
||||
public void flushCache() {
|
||||
}
|
||||
|
||||
public WorldInfo func_22173_b(String var1) {
|
||||
File var2 = new File(this.field_22180_a, var1);
|
||||
if(!var2.exists()) {
|
||||
return null;
|
||||
} else {
|
||||
File var3 = new File(var2, "level.dat");
|
||||
NBTTagCompound var4;
|
||||
NBTTagCompound var5;
|
||||
if(var3.exists()) {
|
||||
try {
|
||||
var4 = CompressedStreamTools.func_1138_a(new FileInputStream(var3));
|
||||
var5 = var4.getCompoundTag("Data");
|
||||
return new WorldInfo(var5);
|
||||
} catch (Exception var7) {
|
||||
var7.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
var3 = new File(var2, "level.dat_old");
|
||||
if(var3.exists()) {
|
||||
try {
|
||||
var4 = CompressedStreamTools.func_1138_a(new FileInputStream(var3));
|
||||
var5 = var4.getCompoundTag("Data");
|
||||
return new WorldInfo(var5);
|
||||
} catch (Exception var6) {
|
||||
var6.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void func_22170_a(String var1, String var2) {
|
||||
File var3 = new File(this.field_22180_a, var1);
|
||||
if(var3.exists()) {
|
||||
File var4 = new File(var3, "level.dat");
|
||||
if(var4.exists()) {
|
||||
try {
|
||||
NBTTagCompound var5 = CompressedStreamTools.func_1138_a(new FileInputStream(var4));
|
||||
NBTTagCompound var6 = var5.getCompoundTag("Data");
|
||||
var6.setString("LevelName", var2);
|
||||
CompressedStreamTools.writeGzippedCompoundToOutputStream(var5, new FileOutputStream(var4));
|
||||
} catch (Exception var7) {
|
||||
var7.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void func_22172_c(String var1) {
|
||||
File var2 = new File(this.field_22180_a, var1);
|
||||
if(var2.exists()) {
|
||||
func_22179_a(var2.listFiles());
|
||||
var2.delete();
|
||||
}
|
||||
}
|
||||
|
||||
protected static void func_22179_a(File[] var0) {
|
||||
for(int var1 = 0; var1 < var0.length; ++var1) {
|
||||
if(var0[var1].isDirectory()) {
|
||||
func_22179_a(var0[var1].listFiles());
|
||||
}
|
||||
|
||||
var0[var1].delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ISaveHandler getSaveLoader(String var1, boolean var2) {
|
||||
return new SaveHandler(this.field_22180_a, var1, var2);
|
||||
}
|
||||
|
||||
public boolean isOldMapFormat(String var1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean convertMapFormat(String var1, IProgressUpdate var2) {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,170 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class SaveHandler implements ISaveHandler {
|
||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||
private final File saveDirectory;
|
||||
private final File playersDirectory;
|
||||
private final File field_28114_d;
|
||||
private final long now = System.currentTimeMillis();
|
||||
|
||||
public SaveHandler(File var1, String var2, boolean var3) {
|
||||
this.saveDirectory = new File(var1, var2);
|
||||
this.saveDirectory.mkdirs();
|
||||
this.playersDirectory = new File(this.saveDirectory, "players");
|
||||
this.field_28114_d = new File(this.saveDirectory, "data");
|
||||
this.field_28114_d.mkdirs();
|
||||
if(var3) {
|
||||
this.playersDirectory.mkdirs();
|
||||
}
|
||||
|
||||
this.func_22154_d();
|
||||
}
|
||||
|
||||
private void func_22154_d() {
|
||||
try {
|
||||
File var1 = new File(this.saveDirectory, "session.lock");
|
||||
DataOutputStream var2 = new DataOutputStream(new FileOutputStream(var1));
|
||||
|
||||
try {
|
||||
var2.writeLong(this.now);
|
||||
} finally {
|
||||
var2.close();
|
||||
}
|
||||
|
||||
} catch (IOException var7) {
|
||||
var7.printStackTrace();
|
||||
throw new RuntimeException("Failed to check session lock, aborting");
|
||||
}
|
||||
}
|
||||
|
||||
protected File getSaveDirectory() {
|
||||
return this.saveDirectory;
|
||||
}
|
||||
|
||||
public void func_22150_b() {
|
||||
try {
|
||||
File var1 = new File(this.saveDirectory, "session.lock");
|
||||
DataInputStream var2 = new DataInputStream(new FileInputStream(var1));
|
||||
|
||||
try {
|
||||
if(var2.readLong() != this.now) {
|
||||
throw new MinecraftException("The save is being accessed from another location, aborting");
|
||||
}
|
||||
} finally {
|
||||
var2.close();
|
||||
}
|
||||
|
||||
} catch (IOException var7) {
|
||||
throw new MinecraftException("Failed to check session lock, aborting");
|
||||
}
|
||||
}
|
||||
|
||||
public IChunkLoader getChunkLoader(WorldProvider var1) {
|
||||
if(var1 instanceof WorldProviderHell) {
|
||||
File var2 = new File(this.saveDirectory, "DIM-1");
|
||||
var2.mkdirs();
|
||||
return new ChunkLoader(var2, true);
|
||||
} else {
|
||||
return new ChunkLoader(this.saveDirectory, true);
|
||||
}
|
||||
}
|
||||
|
||||
public WorldInfo loadWorldInfo() {
|
||||
File var1 = new File(this.saveDirectory, "level.dat");
|
||||
NBTTagCompound var2;
|
||||
NBTTagCompound var3;
|
||||
if(var1.exists()) {
|
||||
try {
|
||||
var2 = CompressedStreamTools.func_1138_a(new FileInputStream(var1));
|
||||
var3 = var2.getCompoundTag("Data");
|
||||
return new WorldInfo(var3);
|
||||
} catch (Exception var5) {
|
||||
var5.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
var1 = new File(this.saveDirectory, "level.dat_old");
|
||||
if(var1.exists()) {
|
||||
try {
|
||||
var2 = CompressedStreamTools.func_1138_a(new FileInputStream(var1));
|
||||
var3 = var2.getCompoundTag("Data");
|
||||
return new WorldInfo(var3);
|
||||
} catch (Exception var4) {
|
||||
var4.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void saveWorldInfoAndPlayer(WorldInfo var1, List var2) {
|
||||
NBTTagCompound var3 = var1.getNBTTagCompoundWithPlayer(var2);
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setTag("Data", var3);
|
||||
|
||||
try {
|
||||
File var5 = new File(this.saveDirectory, "level.dat_new");
|
||||
File var6 = new File(this.saveDirectory, "level.dat_old");
|
||||
File var7 = new File(this.saveDirectory, "level.dat");
|
||||
CompressedStreamTools.writeGzippedCompoundToOutputStream(var4, new FileOutputStream(var5));
|
||||
if(var6.exists()) {
|
||||
var6.delete();
|
||||
}
|
||||
|
||||
var7.renameTo(var6);
|
||||
if(var7.exists()) {
|
||||
var7.delete();
|
||||
}
|
||||
|
||||
var5.renameTo(var7);
|
||||
if(var5.exists()) {
|
||||
var5.delete();
|
||||
}
|
||||
} catch (Exception var8) {
|
||||
var8.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void saveWorldInfo(WorldInfo var1) {
|
||||
NBTTagCompound var2 = var1.getNBTTagCompound();
|
||||
NBTTagCompound var3 = new NBTTagCompound();
|
||||
var3.setTag("Data", var2);
|
||||
|
||||
try {
|
||||
File var4 = new File(this.saveDirectory, "level.dat_new");
|
||||
File var5 = new File(this.saveDirectory, "level.dat_old");
|
||||
File var6 = new File(this.saveDirectory, "level.dat");
|
||||
CompressedStreamTools.writeGzippedCompoundToOutputStream(var3, new FileOutputStream(var4));
|
||||
if(var5.exists()) {
|
||||
var5.delete();
|
||||
}
|
||||
|
||||
var6.renameTo(var5);
|
||||
if(var6.exists()) {
|
||||
var6.delete();
|
||||
}
|
||||
|
||||
var4.renameTo(var6);
|
||||
if(var4.exists()) {
|
||||
var4.delete();
|
||||
}
|
||||
} catch (Exception var7) {
|
||||
var7.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public File func_28113_a(String var1) {
|
||||
return new File(this.field_28114_d, var1 + ".dat");
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class SaveHandlerMP implements ISaveHandler {
|
||||
|
@ -21,7 +20,7 @@ public class SaveHandlerMP implements ISaveHandler {
|
|||
public void saveWorldInfo(WorldInfo var1) {
|
||||
}
|
||||
|
||||
public File func_28113_a(String var1) {
|
||||
public String func_28113_a(String var1) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class SaveOldDir extends SaveHandler {
|
||||
public SaveOldDir(File var1, String var2, boolean var3) {
|
||||
super(var1, var2, var3);
|
||||
}
|
||||
|
||||
public IChunkLoader getChunkLoader(WorldProvider var1) {
|
||||
File var2 = this.getSaveDirectory();
|
||||
if(var1 instanceof WorldProviderHell) {
|
||||
File var3 = new File(var2, "DIM-1");
|
||||
var3.mkdirs();
|
||||
return new McRegionChunkLoader(var3);
|
||||
} else {
|
||||
return new McRegionChunkLoader(var2);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveWorldInfoAndPlayer(WorldInfo var1, List var2) {
|
||||
var1.setSaveVersion(19132);
|
||||
super.saveWorldInfoAndPlayer(var1, var2);
|
||||
}
|
||||
}
|
|
@ -5,6 +5,8 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public final class SpawnerAnimals {
|
||||
private static Set eligibleChunksForSpawning = new HashSet();
|
||||
protected static final Class[] nightSpawnEntities = new Class[]{EntitySpider.class, EntityZombie.class, EntitySkeleton.class};
|
||||
|
@ -120,7 +122,11 @@ public final class SpawnerAnimals {
|
|||
if(var33 >= 576.0F) {
|
||||
EntityLiving var43;
|
||||
try {
|
||||
var43 = (EntityLiving)var15.entityClass.getConstructor(new Class[]{World.class}).newInstance(new Object[]{var0});
|
||||
var43 = (EntityLiving) newInstance(var15.entityClass);
|
||||
|
||||
if(var43 == null) {
|
||||
return var3;
|
||||
}
|
||||
} catch (Exception var34) {
|
||||
var34.printStackTrace();
|
||||
return var3;
|
||||
|
@ -214,7 +220,11 @@ public final class SpawnerAnimals {
|
|||
|
||||
EntityLiving var17;
|
||||
try {
|
||||
var17 = (EntityLiving)var6[var12].getConstructor(new Class[]{World.class}).newInstance(new Object[]{var0});
|
||||
var17 = (EntityLiving)newInstance(var6[var12]);
|
||||
|
||||
if(var17 == null) {
|
||||
return var2;
|
||||
}
|
||||
} catch (Exception var21) {
|
||||
var21.printStackTrace();
|
||||
return var2;
|
||||
|
@ -245,4 +255,124 @@ public final class SpawnerAnimals {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Entity newInstance(Class class0) {
|
||||
if(class0 == EntityArrow.class) {
|
||||
return new EntityArrow(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityBoat.class) {
|
||||
return new EntityBoat(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityChicken.class) {
|
||||
return new EntityChicken(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityCow.class) {
|
||||
return new EntityCow(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityCreature.class) {
|
||||
return new EntityCreature(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityCreeper.class) {
|
||||
return new EntityCreeper(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityEgg.class) {
|
||||
return new EntityEgg(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityFallingSand.class) {
|
||||
return new EntityFallingSand(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityFireball.class) {
|
||||
return new EntityFireball(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityFish.class) {
|
||||
return new EntityFish(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityFlying.class) {
|
||||
return new EntityFlying(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityGhast.class) {
|
||||
return new EntityGhast(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityGiantZombie.class) {
|
||||
return new EntityGiantZombie(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityItem.class) {
|
||||
return new EntityItem(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityMinecart.class) {
|
||||
return new EntityMinecart(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityMob.class) {
|
||||
return new EntityMob(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityPainting.class) {
|
||||
return new EntityPainting(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityPig.class) {
|
||||
return new EntityPig(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityPigZombie.class) {
|
||||
return new EntityPigZombie(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntitySheep.class) {
|
||||
return new EntitySheep(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntitySkeleton.class) {
|
||||
return new EntitySkeleton(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntitySlime.class) {
|
||||
return new EntitySlime(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntitySnowball.class) {
|
||||
return new EntitySnowball(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntitySpider.class) {
|
||||
return new EntitySpider(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntitySquid.class) {
|
||||
return new EntitySquid(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityTNTPrimed.class) {
|
||||
return new EntityTNTPrimed(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityWaterMob.class) {
|
||||
return new EntityWaterMob(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityWolf.class) {
|
||||
return new EntityWolf(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
if(class0 == EntityZombie.class) {
|
||||
return new EntityZombie(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,34 +1,32 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.PeytonPlayz585.opengl.GL11;
|
||||
|
||||
public class StatFileWriter {
|
||||
private Map field_25102_a = new HashMap();
|
||||
private Map field_25101_b = new HashMap();
|
||||
private boolean field_27189_c = false;
|
||||
private StatsSyncher statsSyncher;
|
||||
|
||||
public StatFileWriter(Session var1, File var2) {
|
||||
File var3 = new File(var2, "stats");
|
||||
if(!var3.exists()) {
|
||||
var3.mkdir();
|
||||
}
|
||||
public StatFileWriter(Session var1, String var2) {
|
||||
String var3 = var2 + "/" + "stats";
|
||||
|
||||
File[] var4 = var2.listFiles();
|
||||
GL11.FileEntry[] var4 = GL11.listFiles(var2);
|
||||
int var5 = var4.length;
|
||||
|
||||
for(int var6 = 0; var6 < var5; ++var6) {
|
||||
File var7 = var4[var6];
|
||||
GL11.FileEntry var7 = var4[var6];
|
||||
if(var7.getName().startsWith("stats_") && var7.getName().endsWith(".dat")) {
|
||||
File var8 = new File(var3, var7.getName());
|
||||
if(!var8.exists()) {
|
||||
String var8 = var3 + "/" + var7.getName();
|
||||
if(!GL11.exists(var8)) {
|
||||
System.out.println("Relocating " + var7.getName());
|
||||
var7.renameTo(var8);
|
||||
GL11.renameFile(var7.path, var8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +1,37 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Map;
|
||||
|
||||
import net.PeytonPlayz585.opengl.GL11;
|
||||
|
||||
public class StatsSyncher {
|
||||
private volatile boolean field_27438_a = false;
|
||||
private volatile Map field_27437_b = null;
|
||||
private volatile Map field_27436_c = null;
|
||||
private StatFileWriter field_27435_d;
|
||||
private File field_27434_e;
|
||||
private File field_27433_f;
|
||||
private File field_27432_g;
|
||||
private File field_27431_h;
|
||||
private File field_27430_i;
|
||||
private File field_27429_j;
|
||||
private String field_27434_e;
|
||||
private String field_27433_f;
|
||||
private String field_27432_g;
|
||||
private String field_27431_h;
|
||||
private String field_27430_i;
|
||||
private String field_27429_j;
|
||||
private Session field_27428_k;
|
||||
private int field_27427_l = 0;
|
||||
private int field_27426_m = 0;
|
||||
|
||||
public StatsSyncher(Session var1, StatFileWriter var2, File var3) {
|
||||
this.field_27434_e = new File(var3, "stats_" + var1.username.toLowerCase() + "_unsent.dat");
|
||||
this.field_27433_f = new File(var3, "stats_" + var1.username.toLowerCase() + ".dat");
|
||||
this.field_27430_i = new File(var3, "stats_" + var1.username.toLowerCase() + "_unsent.old");
|
||||
this.field_27429_j = new File(var3, "stats_" + var1.username.toLowerCase() + ".old");
|
||||
this.field_27432_g = new File(var3, "stats_" + var1.username.toLowerCase() + "_unsent.tmp");
|
||||
this.field_27431_h = new File(var3, "stats_" + var1.username.toLowerCase() + ".tmp");
|
||||
public StatsSyncher(Session var1, StatFileWriter var2, String var3) {
|
||||
this.field_27434_e = makeFilePath(var3, "stats_" + var1.username.toLowerCase() + "_unsent.dat");
|
||||
this.field_27433_f = makeFilePath(var3, "stats_" + var1.username.toLowerCase() + ".dat");
|
||||
this.field_27430_i = makeFilePath(var3, "stats_" + var1.username.toLowerCase() + "_unsent.old");
|
||||
this.field_27429_j = makeFilePath(var3, "stats_" + var1.username.toLowerCase() + ".old");
|
||||
this.field_27432_g = makeFilePath(var3, "stats_" + var1.username.toLowerCase() + "_unsent.tmp");
|
||||
this.field_27431_h = makeFilePath(var3, "stats_" + var1.username.toLowerCase() + ".tmp");
|
||||
if(!var1.username.toLowerCase().equals(var1.username)) {
|
||||
this.func_28214_a(var3, "stats_" + var1.username + "_unsent.dat", this.field_27434_e);
|
||||
this.func_28214_a(var3, "stats_" + var1.username + ".dat", this.field_27433_f);
|
||||
|
@ -41,30 +43,30 @@ public class StatsSyncher {
|
|||
|
||||
this.field_27435_d = var2;
|
||||
this.field_27428_k = var1;
|
||||
if(this.field_27434_e.exists()) {
|
||||
if(GL11.exists(this.field_27434_e)) {
|
||||
var2.func_27179_a(this.func_27415_a(this.field_27434_e, this.field_27432_g, this.field_27430_i));
|
||||
}
|
||||
|
||||
this.func_27418_a();
|
||||
}
|
||||
|
||||
private void func_28214_a(File var1, String var2, File var3) {
|
||||
File var4 = new File(var1, var2);
|
||||
if(var4.exists() && !var4.isDirectory() && !var3.exists()) {
|
||||
var4.renameTo(var3);
|
||||
private void func_28214_a(String var1, String var2, String var3) {
|
||||
String var4 = makeFilePath(var1, var2);
|
||||
if(GL11.exists(var4) && !GL11.directoryExists(var4) && !GL11.exists(var3)) {
|
||||
GL11.renameFile(var4, var3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Map func_27415_a(File var1, File var2, File var3) {
|
||||
return var1.exists() ? this.func_27408_a(var1) : (var3.exists() ? this.func_27408_a(var3) : (var2.exists() ? this.func_27408_a(var2) : null));
|
||||
private Map func_27415_a(String var1, String var2, String var3) {
|
||||
return GL11.exists(var1) ? this.func_27408_a(var1) : (GL11.exists(var3) ? this.func_27408_a(var3) : (GL11.exists(var2) ? this.func_27408_a(var2) : null));
|
||||
}
|
||||
|
||||
private Map func_27408_a(File var1) {
|
||||
private Map func_27408_a(String var1) {
|
||||
BufferedReader var2 = null;
|
||||
|
||||
try {
|
||||
var2 = new BufferedReader(new FileReader(var1));
|
||||
var2 = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(GL11.readFile(var1))));
|
||||
String var3 = "";
|
||||
StringBuilder var4 = new StringBuilder();
|
||||
|
||||
|
@ -93,24 +95,26 @@ public class StatsSyncher {
|
|||
return null;
|
||||
}
|
||||
|
||||
private void func_27410_a(Map var1, File var2, File var3, File var4) throws IOException {
|
||||
PrintWriter var5 = new PrintWriter(new FileWriter(var3, false));
|
||||
private void func_27410_a(Map var1, String var2, String var3, String var4) throws IOException {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
PrintWriter var5 = new PrintWriter(baos);
|
||||
|
||||
try {
|
||||
var5.print(StatFileWriter.func_27185_a(this.field_27428_k.username, "local", var1));
|
||||
GL11.writeFile(var3, baos.toByteArray());
|
||||
} finally {
|
||||
var5.close();
|
||||
}
|
||||
|
||||
if(var4.exists()) {
|
||||
var4.delete();
|
||||
if(GL11.exists(var4)) {
|
||||
GL11.deleteFile(var4);
|
||||
}
|
||||
|
||||
if(var2.exists()) {
|
||||
var2.renameTo(var4);
|
||||
if(GL11.exists(var2)) {
|
||||
GL11.renameFile(var2, var4);
|
||||
}
|
||||
|
||||
var3.renameTo(var2);
|
||||
GL11.renameFile(var3, var2);
|
||||
}
|
||||
|
||||
public void func_27418_a() {
|
||||
|
@ -190,19 +194,19 @@ public class StatsSyncher {
|
|||
return var0.field_27437_b;
|
||||
}
|
||||
|
||||
static File func_27423_b(StatsSyncher var0) {
|
||||
static String func_27423_b(StatsSyncher var0) {
|
||||
return var0.field_27433_f;
|
||||
}
|
||||
|
||||
static File func_27411_c(StatsSyncher var0) {
|
||||
static String func_27411_c(StatsSyncher var0) {
|
||||
return var0.field_27431_h;
|
||||
}
|
||||
|
||||
static File func_27413_d(StatsSyncher var0) {
|
||||
static String func_27413_d(StatsSyncher var0) {
|
||||
return var0.field_27429_j;
|
||||
}
|
||||
|
||||
static void func_27412_a(StatsSyncher var0, Map var1, File var2, File var3, File var4) throws IOException {
|
||||
static void func_27412_a(StatsSyncher var0, Map var1, String var2, String var3, String var4) throws IOException {
|
||||
var0.func_27410_a(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
|
@ -210,7 +214,7 @@ public class StatsSyncher {
|
|||
return var0.field_27437_b = var1;
|
||||
}
|
||||
|
||||
static Map func_27409_a(StatsSyncher var0, File var1, File var2, File var3) {
|
||||
static Map func_27409_a(StatsSyncher var0, String var1, String var2, String var3) {
|
||||
return var0.func_27415_a(var1, var2, var3);
|
||||
}
|
||||
|
||||
|
@ -218,15 +222,19 @@ public class StatsSyncher {
|
|||
return var0.field_27438_a = var1;
|
||||
}
|
||||
|
||||
static File func_27414_e(StatsSyncher var0) {
|
||||
static String func_27414_e(StatsSyncher var0) {
|
||||
return var0.field_27434_e;
|
||||
}
|
||||
|
||||
static File func_27417_f(StatsSyncher var0) {
|
||||
static String func_27417_f(StatsSyncher var0) {
|
||||
return var0.field_27432_g;
|
||||
}
|
||||
|
||||
static File func_27419_g(StatsSyncher var0) {
|
||||
static String func_27419_g(StatsSyncher var0) {
|
||||
return var0.field_27430_i;
|
||||
}
|
||||
|
||||
private static String makeFilePath(String s, String s1) {
|
||||
return s + "/" + s1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,15 +199,15 @@ public class Tessellator {
|
|||
}
|
||||
|
||||
public void setColorOpaque_I(int var1) {
|
||||
int var2 = var1 >> 16 & 255;
|
||||
int var3 = var1 >> 8 & 255;
|
||||
int var2 = var1 >>> 16 & 255;
|
||||
int var3 = var1 >>> 8 & 255;
|
||||
int var4 = var1 & 255;
|
||||
this.setColorOpaque(var2, var3, var4);
|
||||
}
|
||||
|
||||
public void setColorRGBA_I(int var1, int var2) {
|
||||
int var3 = var1 >> 16 & 255;
|
||||
int var4 = var1 >> 8 & 255;
|
||||
int var3 = var1 >>> 16 & 255;
|
||||
int var4 = var1 >>> 8 & 255;
|
||||
int var5 = var1 & 255;
|
||||
this.setColorRGBA(var3, var4, var5, var2);
|
||||
}
|
||||
|
@ -222,10 +222,10 @@ public class Tessellator {
|
|||
}
|
||||
|
||||
this.hasNormals = true;
|
||||
byte var4 = (byte)((int)(var1 * 128.0F));
|
||||
byte var5 = (byte)((int)(var2 * 127.0F));
|
||||
byte var6 = (byte)((int)(var3 * 127.0F));
|
||||
this.normal = var4 | var5 << 8 | var6 << 16;
|
||||
int var4 = (int)((var1) * 127.0F) + 127;
|
||||
int var5 = (int)((var2) * 127.0F) + 127;
|
||||
int var6 = (int)((var3) * 127.0F) + 127;
|
||||
this.normal = var4 & 255 | (var5 & 255) << 8 | (var6 & 255) << 16;
|
||||
}
|
||||
|
||||
public void setTranslationD(double var1, double var3, double var5) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.PeytonPlayz585.opengl.GL11;
|
||||
|
||||
class ThreadStatSyncherReceive extends Thread {
|
||||
final StatsSyncher field_27231_a;
|
||||
|
||||
|
@ -11,7 +13,7 @@ class ThreadStatSyncherReceive extends Thread {
|
|||
try {
|
||||
if(StatsSyncher.func_27422_a(this.field_27231_a) != null) {
|
||||
StatsSyncher.func_27412_a(this.field_27231_a, StatsSyncher.func_27422_a(this.field_27231_a), StatsSyncher.func_27423_b(this.field_27231_a), StatsSyncher.func_27411_c(this.field_27231_a), StatsSyncher.func_27413_d(this.field_27231_a));
|
||||
} else if(StatsSyncher.func_27423_b(this.field_27231_a).exists()) {
|
||||
} else if(GL11.exists(StatsSyncher.func_27423_b(this.field_27231_a))) {
|
||||
StatsSyncher.func_27421_a(this.field_27231_a, StatsSyncher.func_27409_a(this.field_27231_a, StatsSyncher.func_27423_b(this.field_27231_a), StatsSyncher.func_27411_c(this.field_27231_a), StatsSyncher.func_27413_d(this.field_27231_a)));
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
|
|
|
@ -32,15 +32,15 @@ public class Vec3D {
|
|||
}
|
||||
|
||||
private Vec3D(double var1, double var3, double var5) {
|
||||
if(var1 == -0.0D) {
|
||||
if(var1 == -0D) {
|
||||
var1 = 0.0D;
|
||||
}
|
||||
|
||||
if(var3 == -0.0D) {
|
||||
if(var3 == -0D) {
|
||||
var3 = 0.0D;
|
||||
}
|
||||
|
||||
if(var5 == -0.0D) {
|
||||
if(var5 == -0D) {
|
||||
var5 = 0.0D;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public abstract class WorldProvider {
|
|||
public float[] calcSunriseSunsetColors(float var1, float var2) {
|
||||
float var3 = 0.4F;
|
||||
float var4 = MathHelper.cos(var1 * (float)Math.PI * 2.0F) - 0.0F;
|
||||
float var5 = -0.0F;
|
||||
float var5 = 0F;
|
||||
if(var4 >= var5 - var3 && var4 <= var5 + var3) {
|
||||
float var6 = (var4 - var5) / var3 * 0.5F + 0.5F;
|
||||
float var7 = 1.0F - (1.0F - MathHelper.sin(var6 * (float)Math.PI)) * 0.99F;
|
||||
|
|
|
@ -157,6 +157,13 @@ public class WorldRenderer {
|
|||
this.tileEntities.removeAll(var21);
|
||||
this.isChunkLit = Chunk.isLit;
|
||||
this.isInitialized = true;
|
||||
|
||||
if(skipRenderPass[0]) {
|
||||
GL11.flushDisplayList(glRenderList);
|
||||
}
|
||||
if(skipRenderPass[1]) {
|
||||
GL11.flushDisplayList(glRenderList + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,6 +177,8 @@ public class WorldRenderer {
|
|||
public void setDontDraw() {
|
||||
for(int var1 = 0; var1 < 2; ++var1) {
|
||||
this.skipRenderPass[var1] = true;
|
||||
GL11.flushDisplayList(glRenderList);
|
||||
GL11.flushDisplayList(glRenderList + 1);
|
||||
}
|
||||
|
||||
this.isInFrustum = false;
|
||||
|
|
Loading…
Reference in New Issue
Block a user