Fixed Models, terrain alpha channels, Mob Spawning

This commit is contained in:
PeytonPlayz595 2023-07-20 21:05:52 -04:00
parent 4427510421
commit 6711508638
10 changed files with 245 additions and 382 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -77,6 +77,7 @@ public final class Minecraft implements Runnable {
private static Tessellator tessellator = Tessellator.instance; private static Tessellator tessellator = Tessellator.instance;
public static Minecraft minecraft; public static Minecraft minecraft;
public Entity field_22009_h; public Entity field_22009_h;
public int timeSinceLastSaved = 0;
public Minecraft() { public Minecraft() {
@ -167,15 +168,7 @@ public final class Minecraft implements Runnable {
Item.initModels(); Item.initModels();
Mob.modelCache = new ModelManager(); Mob.modelCache = new ModelManager();
GL11.glViewport(0, 0, this.width, this.height); GL11.glViewport(0, 0, this.width, this.height);
if(this.server != null && this.session != null) { this.generateLevel(1);
Level var85;
(var85 = new Level()).setData(8, 8, 8, new byte[512]);
this.setLevel(var85);
} else {
boolean var10 = false;
this.generateLevel(1);
}
this.particleManager = new ParticleManager(this.level); this.particleManager = new ParticleManager(this.level);
checkGLError("Post startup"); checkGLError("Post startup");
this.hud = new HUDScreen(this, this.width, this.height); this.hud = new HUDScreen(this, this.width, this.height);
@ -187,7 +180,6 @@ public final class Minecraft implements Runnable {
try { try {
Thread.sleep(100L); Thread.sleep(100L);
} catch (InterruptedException e) { } catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} else { } else {
@ -816,12 +808,12 @@ public final class Minecraft implements Runnable {
GL11.glRotatef(-120.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(-120.0F, 0.0F, 0.0F, 1.0F);
GL11.glScalef(1.0F, 1.0F, 1.0F); GL11.glScalef(1.0F, 1.0F, 1.0F);
var34 = 0.0625F; var34 = 0.0625F;
ModelPart var127; ModelPart var127 = var112.minecraft.player.getModel().leftArm;
if(!(var127 = var112.minecraft.player.getModel().leftArm).hasList) { if(!(var127 = var112.minecraft.player.getModel().leftArm).compiled) {
var127.generateList(var34); var127.render(var34);
} }
GL11.glCallList(var127.list); GL11.glCallList(var127.displayList);
} }
GL11.glDisable(2977); GL11.glDisable(2977);
@ -859,17 +851,12 @@ public final class Minecraft implements Runnable {
try { try {
Thread.sleep(5L); Thread.sleep(5L);
} catch (InterruptedException e) { } catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
checkGLError("Post render"); checkGLError("Post render");
++var15; ++var15;
//} catch (Exception var58) {
//this.setCurrentScreen(new ErrorScreen("Client error", "The game broke! [" + var58 + "]"));
//var58.printStackTrace();
//}
while(System.currentTimeMillis() >= var13 + 1000L) { while(System.currentTimeMillis() >= var13 + 1000L) {
this.debug = var15 + " fps, " + Chunk.chunkUpdates + " chunk updates"; this.debug = var15 + " fps, " + Chunk.chunkUpdates + " chunk updates";
@ -1235,22 +1222,12 @@ public final class Minecraft implements Runnable {
} }
public final void generateLevel(int var1) { public final void generateLevel(int var1) {
String var2 = this.session != null?this.session.username:"anonymous"; String var2 = "PeytonPlayz585";
Level var4 = (new LevelGenerator(this.progressBar)).generate(var2, 128 << var1, 128 << var1, 64); Level var4 = (new LevelGenerator(this.progressBar)).generate(var2, 128 << var1, 128 << var1, 64);
this.gamemode.prepareLevel(var4); this.gamemode.prepareLevel(var4);
this.setLevel(var4); this.setLevel(var4);
} }
public final boolean loadOnlineLevel(String var1, int var2) {
Level var3;
if((var3 = this.levelIo.loadOnline(this.host, var1, var2)) == null) {
return false;
} else {
this.setLevel(var3);
return true;
}
}
public final void setLevel(Level var1) { public final void setLevel(Level var1) {
this.level = var1; this.level = var1;
if(var1 != null) { if(var1 != null) {

View File

@ -146,12 +146,12 @@ public final class SurvivalGameMode extends GameMode
@Override @Override
public void spawnMob() public void spawnMob()
{ {
// int area = spawner.level.width * spawner.level.height * spawner.level.depth / 64 / 64 / 64; int area = spawner.level.width * spawner.level.height * spawner.level.depth / 64 / 64 / 64;
//
// if(spawner.level.random.nextInt(100) < area && spawner.level.countInstanceOf(Mob.class) < area * 20) if(spawner.level.random.nextInt(100) < area && spawner.level.countInstanceOf(Mob.class) < area * 20)
// { {
// spawner.spawn(area, spawner.level.player, null); spawner.spawn(area, spawner.level.player, null);
// } }
} }
@ -164,6 +164,6 @@ public final class SurvivalGameMode extends GameMode
int area = level.width * level.height * level.depth / 800; int area = level.width * level.height * level.depth / 800;
spawner.spawn(area, null, minecraft.progressBar); //spawner.spawn(area, null, minecraft.progressBar);
} }
} }

View File

@ -1,7 +1,6 @@
package com.mojang.minecraft.gui; package com.mojang.minecraft.gui;
import com.mojang.minecraft.gui.Button; import org.lwjgl.opengl.GL11;
import com.mojang.minecraft.gui.GuiScreen;
public final class GenerateLevelScreen extends GuiScreen { public final class GenerateLevelScreen extends GuiScreen {
@ -24,9 +23,9 @@ public final class GenerateLevelScreen extends GuiScreen {
if(var1.id == 3) { if(var1.id == 3) {
this.minecraft.setCurrentScreen(this.parent); this.minecraft.setCurrentScreen(this.parent);
} else { } else {
this.minecraft.generateLevel(var1.id); this.minecraft.generateLevel(var1.id);
this.minecraft.setCurrentScreen((GuiScreen)null); this.minecraft.setCurrentScreen((GuiScreen)null);
this.minecraft.grabMouse(); this.minecraft.grabMouse();
} }
} }

View File

@ -1,5 +1,7 @@
package com.mojang.minecraft.gui; package com.mojang.minecraft.gui;
import java.io.IOException;
import com.mojang.minecraft.gui.Button; import com.mojang.minecraft.gui.Button;
import com.mojang.minecraft.gui.GenerateLevelScreen; import com.mojang.minecraft.gui.GenerateLevelScreen;
import com.mojang.minecraft.gui.GuiScreen; import com.mojang.minecraft.gui.GuiScreen;

View File

@ -22,85 +22,85 @@ public final class MobSpawner {
} }
public final int spawn(int var1, Entity var2, ProgressBarDisplay var3) { public final int spawn(int var1, Entity var2, ProgressBarDisplay var3) {
// int var4 = 0; int var4 = 0;
//
// for(int var5 = 0; var5 < var1; ++var5) {
// if(var3 != null) {
// var3.setProgress(var5 * 100 / (var1 - 1));
// }
//
// int var6 = this.level.random.nextInt(6);
// int var7 = this.level.random.nextInt(this.level.width);
// int var8 = (int)(Math.min(this.level.random.nextFloat(), this.level.random.nextFloat()) * (float)this.level.depth);
// int var9 = this.level.random.nextInt(this.level.height);
// if(!this.level.isSolidTile(var7, var8, var9) && this.level.getLiquid(var7, var8, var9) == LiquidType.NOT_LIQUID && (!this.level.isLit(var7, var8, var9) || this.level.random.nextInt(5) == 0)) {
// for(int var10 = 0; var10 < 3; ++var10) {
// int var11 = var7;
// int var12 = var8;
// int var13 = var9;
//
// for(int var14 = 0; var14 < 3; ++var14) {
// var11 += this.level.random.nextInt(6) - this.level.random.nextInt(6);
// var12 += this.level.random.nextInt(1) - this.level.random.nextInt(1);
// var13 += this.level.random.nextInt(6) - this.level.random.nextInt(6);
// if(var11 >= 0 && var13 >= 1 && var12 >= 0 && var12 < this.level.depth - 2 && var11 < this.level.width && var13 < this.level.height && this.level.isSolidTile(var11, var12 - 1, var13) && !this.level.isSolidTile(var11, var12, var13) && !this.level.isSolidTile(var11, var12 + 1, var13)) {
// float var15 = (float)var11 + 0.5F;
// float var16 = (float)var12 + 1.0F;
// float var17 = (float)var13 + 0.5F;
// float var19;
// float var18;
// float var20;
// if(var2 != null) {
// var18 = var15 - var2.x;
// var19 = var16 - var2.y;
// var20 = var17 - var2.z;
// if(var18 * var18 + var19 * var19 + var20 * var20 < 256.0F) {
// continue;
// }
// } else {
// var18 = var15 - (float)this.level.xSpawn;
// var19 = var16 - (float)this.level.ySpawn;
// var20 = var17 - (float)this.level.zSpawn;
// if(var18 * var18 + var19 * var19 + var20 * var20 < 256.0F) {
// continue;
// }
// }
//
// Object var21 = null;
// if(var6 == 0) {
// var21 = new Zombie(this.level, var15, var16, var17);
// }
//
// if(var6 == 1) {
// var21 = new Skeleton(this.level, var15, var16, var17);
// }
//
// if(var6 == 2) {
// var21 = new Pig(this.level, var15, var16, var17);
// }
//
// if(var6 == 3) {
// var21 = new Creeper(this.level, var15, var16, var17);
// }
//
// if(var6 == 4) {
// var21 = new Spider(this.level, var15, var16, var17);
// }
//
// if(var6 == 5) {
// var21 = new Sheep(this.level, var15, var16, var17);
// }
//
// if(this.level.isFree(((Mob)var21).bb)) {
// ++var4;
// this.level.addEntity((Entity)var21);
// }
// }
// }
// }
// }
// }
return 0; for(int var5 = 0; var5 < var1; ++var5) {
if(var3 != null) {
var3.setProgress(var5 * 100 / (var1 - 1));
}
int var6 = this.level.random.nextInt(6);
int var7 = this.level.random.nextInt(this.level.width);
int var8 = (int)(Math.min(this.level.random.nextFloat(), this.level.random.nextFloat()) * (float)this.level.depth);
int var9 = this.level.random.nextInt(this.level.height);
if(!this.level.isSolidTile(var7, var8, var9) && this.level.getLiquid(var7, var8, var9) == LiquidType.NOT_LIQUID && (!this.level.isLit(var7, var8, var9) || this.level.random.nextInt(5) == 0)) {
for(int var10 = 0; var10 < 3; ++var10) {
int var11 = var7;
int var12 = var8;
int var13 = var9;
for(int var14 = 0; var14 < 3; ++var14) {
var11 += this.level.random.nextInt(6) - this.level.random.nextInt(6);
var12 += this.level.random.nextInt(1) - this.level.random.nextInt(1);
var13 += this.level.random.nextInt(6) - this.level.random.nextInt(6);
if(var11 >= 0 && var13 >= 1 && var12 >= 0 && var12 < this.level.depth - 2 && var11 < this.level.width && var13 < this.level.height && this.level.isSolidTile(var11, var12 - 1, var13) && !this.level.isSolidTile(var11, var12, var13) && !this.level.isSolidTile(var11, var12 + 1, var13)) {
float var15 = (float)var11 + 0.5F;
float var16 = (float)var12 + 1.0F;
float var17 = (float)var13 + 0.5F;
float var19;
float var18;
float var20;
if(var2 != null) {
var18 = var15 - var2.x;
var19 = var16 - var2.y;
var20 = var17 - var2.z;
if(var18 * var18 + var19 * var19 + var20 * var20 < 256.0F) {
continue;
}
} else {
var18 = var15 - (float)this.level.xSpawn;
var19 = var16 - (float)this.level.ySpawn;
var20 = var17 - (float)this.level.zSpawn;
if(var18 * var18 + var19 * var19 + var20 * var20 < 256.0F) {
continue;
}
}
Object var21 = null;
if(var6 == 0) {
var21 = new Zombie(this.level, var15, var16, var17);
}
if(var6 == 1) {
var21 = new Skeleton(this.level, var15, var16, var17);
}
if(var6 == 2) {
var21 = new Pig(this.level, var15, var16, var17);
}
if(var6 == 3) {
var21 = new Creeper(this.level, var15, var16, var17);
}
if(var6 == 4) {
var21 = new Spider(this.level, var15, var16, var17);
}
if(var6 == 5) {
var21 = new Sheep(this.level, var15, var16, var17);
}
if(this.level.isFree(((Mob)var21).bb)) {
++var4;
this.level.addEntity((Entity)var21);
}
}
}
}
}
}
return var4;
} }
} }

View File

@ -1,155 +1,149 @@
package com.mojang.minecraft.model; package com.mojang.minecraft.model;
import com.mojang.minecraft.model.TexturedQuad;
import com.mojang.minecraft.model.Vec3D;
import com.mojang.minecraft.model.Vertex;
import net.PeytonPlayz585.glemu.ModeBuffer;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import net.lax1dude.eaglercraft.adapter.Tessellator;
public final class ModelPart { public final class ModelPart {
public Vertex[] vertices;
public TexturedQuad[] quads;
private int textureOffsetX;
private int textureOffsetY;
public float x;
public float y;
public float z;
public float pitch;
public float yaw;
public float roll;
public boolean compiled = false;
public int displayList = 0;
public boolean mirror = false;
public boolean render = true;
private boolean isHidden = false;
public Vertex[] vertices; public ModelPart(int var1, int var2) {
public TexturedQuad[] quads; this.textureOffsetX = var1;
private int u; this.textureOffsetY = var2;
private int v; }
public float x;
public float y;
public float z;
public float pitch;
public float yaw;
public float roll;
public boolean hasList = false;
public int list = 0;
public boolean mirror = false;
public boolean render = true;
private boolean unused = false;
public final void setBounds(float var1, float var2, float var3, int var4, int var5, int var6, float var7) {
this.vertices = new Vertex[8];
this.quads = new TexturedQuad[6];
float var8 = var1 + (float)var4;
float var9 = var2 + (float)var5;
float var10 = var3 + (float)var6;
var1 -= var7;
var2 -= var7;
var3 -= var7;
var8 += var7;
var9 += var7;
var10 += var7;
if(this.mirror) {
var7 = var8;
var8 = var1;
var1 = var7;
}
public ModelPart(int var1, int var2) { Vertex var20 = new Vertex(var1, var2, var3, 0.0F, 0.0F);
this.u = var1; Vertex var11 = new Vertex(var8, var2, var3, 0.0F, 8.0F);
this.v = var2; Vertex var12 = new Vertex(var8, var9, var3, 8.0F, 8.0F);
} Vertex var18 = new Vertex(var1, var9, var3, 8.0F, 0.0F);
Vertex var13 = new Vertex(var1, var2, var10, 0.0F, 0.0F);
Vertex var15 = new Vertex(var8, var2, var10, 0.0F, 8.0F);
Vertex var21 = new Vertex(var8, var9, var10, 8.0F, 8.0F);
Vertex var14 = new Vertex(var1, var9, var10, 8.0F, 0.0F);
this.vertices[0] = var20;
this.vertices[1] = var11;
this.vertices[2] = var12;
this.vertices[3] = var18;
this.vertices[4] = var13;
this.vertices[5] = var15;
this.vertices[6] = var21;
this.vertices[7] = var14;
this.quads[0] = new TexturedQuad(new Vertex[]{var15, var11, var12, var21}, this.textureOffsetX + var6 + var4, this.textureOffsetY + var6, this.textureOffsetX + var6 + var4 + var6, this.textureOffsetY + var6 + var5);
this.quads[1] = new TexturedQuad(new Vertex[]{var20, var13, var14, var18}, this.textureOffsetX, this.textureOffsetY + var6, this.textureOffsetX + var6, this.textureOffsetY + var6 + var5);
this.quads[2] = new TexturedQuad(new Vertex[]{var15, var13, var20, var11}, this.textureOffsetX + var6, this.textureOffsetY, this.textureOffsetX + var6 + var4, this.textureOffsetY + var6);
this.quads[3] = new TexturedQuad(new Vertex[]{var12, var18, var14, var21}, this.textureOffsetX + var6 + var4, this.textureOffsetY, this.textureOffsetX + var6 + var4 + var4, this.textureOffsetY + var6);
this.quads[4] = new TexturedQuad(new Vertex[]{var11, var20, var18, var12}, this.textureOffsetX + var6, this.textureOffsetY + var6, this.textureOffsetX + var6 + var4, this.textureOffsetY + var6 + var5);
this.quads[5] = new TexturedQuad(new Vertex[]{var13, var15, var21, var14}, this.textureOffsetX + var6 + var4 + var6, this.textureOffsetY + var6, this.textureOffsetX + var6 + var4 + var6 + var4, this.textureOffsetY + var6 + var5);
if(this.mirror) {
for(int var16 = 0; var16 < this.quads.length; ++var16) {
TexturedQuad var17 = this.quads[var16];
Vertex[] var19 = new Vertex[var17.vertices.length];
public final void setBounds(float var1, float var2, float var3, int var4, int var5, int var6, float var7) { for(var4 = 0; var4 < var17.vertices.length; ++var4) {
this.vertices = new Vertex[8]; var19[var4] = var17.vertices[var17.vertices.length - var4 - 1];
this.quads = new TexturedQuad[6]; }
float var8 = var1 + (float)var4;
float var9 = var2 + (float)var5;
float var10 = var3 + (float)var6;
var1 -= var7;
var2 -= var7;
var3 -= var7;
var8 += var7;
var9 += var7;
var10 += var7;
if(this.mirror) {
var7 = var8;
var8 = var1;
var1 = var7;
}
Vertex var20 = new Vertex(var1, var2, var3, 0.0F, 0.0F); var17.vertices = var19;
Vertex var11 = new Vertex(var8, var2, var3, 0.0F, 8.0F); }
Vertex var12 = new Vertex(var8, var9, var3, 8.0F, 8.0F); }
Vertex var18 = new Vertex(var1, var9, var3, 8.0F, 0.0F);
Vertex var13 = new Vertex(var1, var2, var10, 0.0F, 0.0F);
Vertex var15 = new Vertex(var8, var2, var10, 0.0F, 8.0F);
Vertex var21 = new Vertex(var8, var9, var10, 8.0F, 8.0F);
Vertex var14 = new Vertex(var1, var9, var10, 8.0F, 0.0F);
this.vertices[0] = var20;
this.vertices[1] = var11;
this.vertices[2] = var12;
this.vertices[3] = var18;
this.vertices[4] = var13;
this.vertices[5] = var15;
this.vertices[6] = var21;
this.vertices[7] = var14;
this.quads[0] = new TexturedQuad(new Vertex[]{var15, var11, var12, var21}, this.u + var6 + var4, this.v + var6, this.u + var6 + var4 + var6, this.v + var6 + var5);
this.quads[1] = new TexturedQuad(new Vertex[]{var20, var13, var14, var18}, this.u, this.v + var6, this.u + var6, this.v + var6 + var5);
this.quads[2] = new TexturedQuad(new Vertex[]{var15, var13, var20, var11}, this.u + var6, this.v, this.u + var6 + var4, this.v + var6);
this.quads[3] = new TexturedQuad(new Vertex[]{var12, var18, var14, var21}, this.u + var6 + var4, this.v, this.u + var6 + var4 + var4, this.v + var6);
this.quads[4] = new TexturedQuad(new Vertex[]{var11, var20, var18, var12}, this.u + var6, this.v + var6, this.u + var6 + var4, this.v + var6 + var5);
this.quads[5] = new TexturedQuad(new Vertex[]{var13, var15, var21, var14}, this.u + var6 + var4 + var6, this.v + var6, this.u + var6 + var4 + var6 + var4, this.v + var6 + var5);
if(this.mirror) {
for(int var16 = 0; var16 < this.quads.length; ++var16) {
TexturedQuad var17;
Vertex[] var19 = new Vertex[(var17 = this.quads[var16]).vertices.length];
for(var4 = 0; var4 < var17.vertices.length; ++var4) { }
var19[var4] = var17.vertices[var17.vertices.length - var4 - 1];
}
var17.vertices = var19; public final void setPosition(float var1, float var2, float var3) {
} this.x = var1;
} this.y = var2;
this.z = var3;
}
} public final void render(float var1) {
if(this.render) {
if(!this.compiled) {
float var3 = var1;
ModelPart var2 = this;
this.displayList = GL11.glGenLists(1);
GL11.glNewList(this.displayList, GL11.GL_COMPILE);
Tessellator var4 = Tessellator.instance;
public final void setPosition(float var1, float var2, float var3) { for(int var5 = 0; var5 < var2.quads.length; ++var5) {
this.x = var1; var4.startDrawingQuads();
this.y = var2; TexturedQuad var10000 = var2.quads[var5];
this.z = var3; float var8 = var3;
} TexturedQuad var6 = var10000;
Vec3D var9 = var6.vertices[1].vector.subtract(var6.vertices[0].vector).normalize();
Vec3D var10 = var6.vertices[1].vector.subtract(var6.vertices[2].vector).normalize();
var9 = (new Vec3D(var9.y * var10.z - var9.z * var10.y, var9.z * var10.x - var9.x * var10.z, var9.x * var10.y - var9.y * var10.x)).normalize();
var4.setNormal(-var9.x, -var9.y, -var9.z);
public final void render(float var1) { for(int var11 = 0; var11 < 4; ++var11) {
if(this.render) { Vertex var12 = var6.vertices[var11];
if(!this.hasList) { var4.addVertexWithUV(var12.vector.x * var8, var12.vector.y * var8, var12.vector.z * var8, var12.u, var12.v);
this.generateList(var1); }
}
if(this.pitch == 0.0F && this.yaw == 0.0F && this.roll == 0.0F) { var4.draw();
if(this.x == 0.0F && this.y == 0.0F && this.z == 0.0F) { }
GL11.glCallList(this.list);
} else {
GL11.glTranslatef(this.x * var1, this.y * var1, this.z * var1);
GL11.glCallList(this.list);
GL11.glTranslatef(-this.x * var1, -this.y * var1, -this.z * var1);
}
} else {
GL11.glPushMatrix();
GL11.glTranslatef(this.x * var1, this.y * var1, this.z * var1);
if(this.roll != 0.0F) {
GL11.glRotatef(this.roll * 57.295776F, 0.0F, 0.0F, 1.0F);
}
if(this.yaw != 0.0F) { GL11.glEndList();
GL11.glRotatef(this.yaw * 57.295776F, 0.0F, 1.0F, 0.0F); var2.compiled = true;
} }
if(this.pitch != 0.0F) { if(this.pitch == 0.0F && this.yaw == 0.0F && this.roll == 0.0F) {
GL11.glRotatef(this.pitch * 57.295776F, 1.0F, 0.0F, 0.0F); if(this.x == 0.0F && this.y == 0.0F && this.z == 0.0F) {
} GL11.glCallList(this.displayList);
} else {
GL11.glTranslatef(this.x * var1, this.y * var1, this.z * var1);
GL11.glCallList(this.displayList);
GL11.glTranslatef(-this.x * var1, -this.y * var1, -this.z * var1);
}
} else {
GL11.glPushMatrix();
GL11.glTranslatef(this.x * var1, this.y * var1, this.z * var1);
if(this.roll != 0.0F) {
GL11.glRotatef(this.roll * (180.0F / (float)Math.PI), 0.0F, 0.0F, 1.0F);
}
GL11.glCallList(this.list); if(this.yaw != 0.0F) {
GL11.glPopMatrix(); GL11.glRotatef(this.yaw * (180.0F / (float)Math.PI), 0.0F, 1.0F, 0.0F);
} }
}
}
public void generateList(float var1) { if(this.pitch != 0.0F) {
this.list = GL11.glGenLists(1); GL11.glRotatef(this.pitch * (180.0F / (float)Math.PI), 1.0F, 0.0F, 0.0F);
GL11.glNewList(this.list, 4864); }
//GL11.glBegin(7);
for(int var2 = 0; var2 < this.quads.length; ++var2) { GL11.glCallList(this.displayList);
TexturedQuad var10000 = this.quads[var2]; GL11.glPopMatrix();
float var3 = var1; }
TexturedQuad var4 = var10000; }
Vec3D var5 = var10000.vertices[1].vector.subtract(var4.vertices[0].vector).normalize(); }
Vec3D var6 = var4.vertices[1].vector.subtract(var4.vertices[2].vector).normalize();
GL11.glNormal3f((var5 = (new Vec3D(var5.y * var6.z - var5.z * var6.y, var5.z * var6.x - var5.x * var6.z, var5.x * var6.y - var5.y * var6.x)).normalize()).x, var5.y, var5.z);
// for(int var7 = 0; var7 < 4; ++var7) {
// Vertex var8;
// GL11.glTexCoord2f((var8 = var4.vertices[var7]).u, var8.v);
// GL11.glVertex3f(var8.vector.x * var3, var8.vector.y * var3, var8.vector.z * var3);
// }
}
//GL11.glEnd();
GL11.glEndList();
this.hasList = true;
}
} }

View File

@ -15,7 +15,7 @@ import net.lax1dude.eaglercraft.Base64;
public class LocalStorageManager { public class LocalStorageManager {
public static NBTTagCompound gameSettingsStorage = null; public static NBTTagCompound gameSettingsStorage = null;
public static NBTTagCompound profileSettingsStorage = null; public static NBTTagCompound levelSettingsStorage = null;
public static void loadStorage() { public static void loadStorage() {
byte[] g = GL11.loadLocalStorage("g"); byte[] g = GL11.loadLocalStorage("g");
@ -36,7 +36,7 @@ public class LocalStorageManager {
try { try {
NBTBase t = NBTBase.readTag(new DataInputStream(new ByteArrayInputStream(p))); NBTBase t = NBTBase.readTag(new DataInputStream(new ByteArrayInputStream(p)));
if(t != null && t instanceof NBTTagCompound) { if(t != null && t instanceof NBTTagCompound) {
profileSettingsStorage = (NBTTagCompound)t; levelSettingsStorage = (NBTTagCompound)t;
} }
}catch(IOException e) { }catch(IOException e) {
; ;
@ -44,7 +44,7 @@ public class LocalStorageManager {
} }
if(gameSettingsStorage == null) gameSettingsStorage = new NBTTagCompound(); if(gameSettingsStorage == null) gameSettingsStorage = new NBTTagCompound();
if(profileSettingsStorage == null) profileSettingsStorage = new NBTTagCompound(); if(levelSettingsStorage == null) levelSettingsStorage = new NBTTagCompound();
} }
@ -61,7 +61,7 @@ public class LocalStorageManager {
public static void saveStorageP() { public static void saveStorageP() {
try { try {
ByteArrayOutputStream s = new ByteArrayOutputStream(); ByteArrayOutputStream s = new ByteArrayOutputStream();
NBTBase.writeTag(profileSettingsStorage, new DataOutputStream(s)); NBTBase.writeTag(levelSettingsStorage, new DataOutputStream(s));
GL11.saveLocalStorage("p", s.toByteArray()); GL11.saveLocalStorage("p", s.toByteArray());
} catch (IOException e) { } catch (IOException e) {
; ;

View File

@ -66,6 +66,10 @@ public class NBTTagCompound extends NBTBase {
tagMap.put(s, (new NBTTagByteArray(abyte0)).setKey(s)); tagMap.put(s, (new NBTTagByteArray(abyte0)).setKey(s));
} }
public void setObject(String s, Object obj) {
tagMap.put(s, obj);
}
public void setCompoundTag(String s, NBTTagCompound nbttagcompound) { public void setCompoundTag(String s, NBTTagCompound nbttagcompound) {
tagMap.put(s, nbttagcompound.setKey(s)); tagMap.put(s, nbttagcompound.setKey(s));
} }
@ -162,6 +166,14 @@ public class NBTTagCompound extends NBTBase {
return getByte(s) != 0; return getByte(s) != 0;
} }
public Object getObject(String s) {
if(!tagMap.containsKey(s)) {
return null;
} else {
return tagMap.get(s);
}
}
public String toString() { public String toString() {
return (new StringBuilder()).append("").append(tagMap.size()).append(" entries").toString(); return (new StringBuilder()).append("").append(tagMap.size()).append(" entries").toString();
} }

View File

@ -1,121 +0,0 @@
package net.lax1dude.eaglercraft;
import java.util.Collection;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.FileEntry;
import net.lax1dude.eaglercraft.adapter.teavm.IndexedDBFilesystem;
import net.lax1dude.eaglercraft.adapter.teavm.IndexedDBFilesystem.OpenState;
public class TestFilesystem {
public static void main(String[] args) {
OpenState os = IndexedDBFilesystem.initialize();
if(os != OpenState.OPENED) {
System.out.println("Error: " + os);
System.out.println("Detail: " + IndexedDBFilesystem.errorDetail());
return;
}
IndexedDBFilesystem.writeFile("text.txt", "fuck fuck shit".getBytes());
IndexedDBFilesystem.writeFile("folder/text.txt", "fuck shit fuck".getBytes());
IndexedDBFilesystem.writeFile("folder/eee/text.txt", "shit shit fuck".getBytes());
System.out.println("exists text.txt:" + IndexedDBFilesystem.fileExists("text.txt"));
System.out.println("exists folder/text.txt:" + IndexedDBFilesystem.fileExists("folder/text.txt"));
System.out.println("exists folder/eee/text.txt:" + IndexedDBFilesystem.fileExists("folder/eee/text.txt"));
System.out.println("type file text.txt:" + IndexedDBFilesystem.fileExists("text.txt"));
System.out.println("type file folder:" + IndexedDBFilesystem.fileExists("folder"));
System.out.println("type file folder/text.txt:" + IndexedDBFilesystem.fileExists("folder/text.txt"));
System.out.println("type file folder/eee:" + IndexedDBFilesystem.fileExists("folder/eee"));
System.out.println("type file folder/eee/text.txt:" + IndexedDBFilesystem.fileExists("folder/eee/text.txt"));
System.out.println("type folder text.txt:" + IndexedDBFilesystem.directoryExists("text.txt"));
System.out.println("type folder folder:" + IndexedDBFilesystem.directoryExists("folder"));
System.out.println("type folder folder/text.txt:" + IndexedDBFilesystem.directoryExists("folder/text.txt"));
System.out.println("type folder folder/eee:" + IndexedDBFilesystem.directoryExists("folder/eee"));
System.out.println("type folder folder/eee/text.txt:" + IndexedDBFilesystem.directoryExists("folder/eee/text.txt"));
System.out.println("data file text.txt:" + new String(IndexedDBFilesystem.readFile("text.txt")));
System.out.println("data file folder/text.txt:" + new String(IndexedDBFilesystem.readFile("folder/text.txt")));
System.out.println("data file folder/eee/text.txt:" + new String(IndexedDBFilesystem.readFile("folder/eee/text.txt")));
System.out.println("copy file text.txt to text2.txt"); IndexedDBFilesystem.copyFile("text.txt", "text2.txt");
System.out.println("copy file text.txt to folder2/text2.txt"); IndexedDBFilesystem.copyFile("text.txt", "folder2/text2.txt");
System.out.println("copy file folder/text.txt to folder3/eee2/text2.txt:"); IndexedDBFilesystem.copyFile("folder/text.txt", "folder3/eee2/text2.txt");
System.out.println("copy file folder3/eee2/text2.txt to text2.txt:"); IndexedDBFilesystem.copyFile("folder3/eee2/text2.txt", "text2.txt");
System.out.println("type folder folder2:" + IndexedDBFilesystem.directoryExists("folder2"));
System.out.println("type folder folder3:" + IndexedDBFilesystem.directoryExists("folder3"));
System.out.println("type folder folder3/eee2:" + IndexedDBFilesystem.directoryExists("folder3/eee2"));
System.out.println("data file text.txt:" + new String(IndexedDBFilesystem.readFile("text.txt")));
System.out.println("data file folder/text.txt:" + new String(IndexedDBFilesystem.readFile("folder/text.txt")));
System.out.println("data file folder/eee/text.txt:" + new String(IndexedDBFilesystem.readFile("folder/eee/text.txt")));
System.out.println("data file text2.txt:" + new String(IndexedDBFilesystem.readFile("text2.txt")));
System.out.println("data file folder2/text2.txt:" + new String(IndexedDBFilesystem.readFile("folder2/text2.txt")));
System.out.println("data file folder3/eee2/text2.txt:" + new String(IndexedDBFilesystem.readFile("folder3/eee2/text2.txt")));
System.out.println("data file folder2/tefjfgj.txt:" + IndexedDBFilesystem.readFile("folder2/tefjfgj.txt"));
System.out.println("data file folder3/gjjg/text2.txt:" + IndexedDBFilesystem.readFile("folder3/eegjjge2/text2.txt"));
System.out.println("move file text.txt to text3.txt"); IndexedDBFilesystem.renameFile("text.txt", "text3.txt");
System.out.println("move file text.txt to folder4/text2.txt"); IndexedDBFilesystem.renameFile("text.txt", "folder4/text2.txt");
System.out.println("move file text3.txt to folder4/text2.txt"); IndexedDBFilesystem.renameFile("text.txt", "folder4/text3.txt");
System.out.println("move file folder22/text.txt to folder3/eee2/text3.txt:"); IndexedDBFilesystem.renameFile("folder22/text.txt", "folder3/eee2/text3.txt");
System.out.println("last modified text.txt:" + IndexedDBFilesystem.getLastModified("text.txt"));
System.out.println("last modified folder/text.txt:" + IndexedDBFilesystem.getLastModified("folder/text.txt"));
System.out.println("last modified folder/eee/text.txt:" + IndexedDBFilesystem.getLastModified("folder/eee/text.txt"));
System.out.println("last modified text2.txt:" + IndexedDBFilesystem.getLastModified("text2.txt"));
System.out.println("last modified folder2/text2.txt:" + IndexedDBFilesystem.getLastModified("folder2/text2.txt"));
System.out.println("last modified folder3/eee2/text2.txt:" + IndexedDBFilesystem.getLastModified("folder3/eee2/text2.txt"));
System.out.println("last modified folder2/tefjfgj.txt:" + IndexedDBFilesystem.getLastModified("folder2/tefjfgj.txt"));
System.out.println("last modified folder3/gjjg/text2.txt:" + IndexedDBFilesystem.getLastModified("folder3/eegjjge2/text2.txt"));
System.out.println("last modified text3.txt: " + IndexedDBFilesystem.getLastModified("text3.txt"));
System.out.println("last modified folder4/text2.txt: " + IndexedDBFilesystem.getLastModified("folder4/text2.txt"));
System.out.println("last modified folder4/text3.txt: " + IndexedDBFilesystem.getLastModified("folder4/text3.txt"));
System.out.println("last modified folder3/eee2/text3.txt:" + IndexedDBFilesystem.getLastModified("folder3/eee2/text3.txt"));
System.out.println("delete file text3.txt"); IndexedDBFilesystem.deleteFile("text3.txt");
System.out.println("delete file folder4/text2.txt"); IndexedDBFilesystem.deleteFile("folder4/text2.txt");
System.out.println("delete file folder4/text2.txt"); IndexedDBFilesystem.deleteFile("folder4/text3.txt");
System.out.println("delete file folder4"); IndexedDBFilesystem.deleteFile("folder4");
System.out.println("delete file folder3/eee2/text3.txt:"); IndexedDBFilesystem.deleteFile("folder3/eee2/text3.txt");
Collection<FileEntry> files = IndexedDBFilesystem.listFiles("", true, true);
System.out.println();
System.out.println("List all:");
listFileList(files);
files = IndexedDBFilesystem.listFiles("", false, true);
System.out.println();
System.out.println("List all files:");
listFileList(files);
files = IndexedDBFilesystem.listFiles("", false, false);
System.out.println();
System.out.println("List all files not recursive:");
listFileList(files);
files = IndexedDBFilesystem.listFiles("folder", true, true);
System.out.println();
System.out.println("List all files in 'folder':");
listFileList(files);
files = IndexedDBFilesystem.listFiles("folder", true, false);
System.out.println();
System.out.println("List all files in 'folder' no recursive:");
listFileList(files);
}
private static void listFileList(Collection<FileEntry> files) {
for(FileEntry f : files) {
System.out.println(" - " + f.path + " " + f.isDirectory + " " + f.lastModified + " " + f.getName());
}
}
}