Fixed Texture Blending, Fixed Rendering BS, and removed Mob Spawning
This commit is contained in:
parent
3f5a869a2b
commit
a3af8490f0
File diff suppressed because one or more lines are too long
BIN
js/resources.epk
BIN
js/resources.epk
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 10 KiB |
Binary file not shown.
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 44 KiB |
|
@ -983,9 +983,9 @@ public final class Minecraft implements Runnable {
|
|||
}
|
||||
|
||||
private void tick() {
|
||||
//if(!settings.gamemode) {
|
||||
//this.gamemode.spawnMob();
|
||||
//}
|
||||
// if(!settings.gamemode) {
|
||||
// this.gamemode.spawnMob();
|
||||
// }
|
||||
HUDScreen var17 = this.hud;
|
||||
++this.hud.ticks;
|
||||
|
||||
|
|
|
@ -146,12 +146,12 @@ public final class SurvivalGameMode extends GameMode
|
|||
@Override
|
||||
public void spawnMob()
|
||||
{
|
||||
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)
|
||||
{
|
||||
spawner.spawn(area, spawner.level.player, null);
|
||||
}
|
||||
// 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)
|
||||
// {
|
||||
// spawner.spawn(area, spawner.level.player, null);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -22,85 +22,85 @@ public final class MobSpawner {
|
|||
}
|
||||
|
||||
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);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
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;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class RenderEngine {
|
|||
imageDataB1 = GLAllocation.createDirectByteBuffer(0x100000);
|
||||
imageDataB2 = GLAllocation.createDirectByteBuffer(0x100000);
|
||||
textureList = new ArrayList<TextureFX>();
|
||||
//useMipmaps = false;
|
||||
textureBlending = false;
|
||||
options = Minecraft.settings;
|
||||
}
|
||||
|
||||
|
@ -43,11 +43,11 @@ public class RenderEngine {
|
|||
singleIntBuffer.clear();
|
||||
GLAllocation.generateTextureNames(singleIntBuffer);
|
||||
int i = singleIntBuffer.get(0);
|
||||
//if(s.equals("/terrain.png")) {
|
||||
//useMipmaps = true;
|
||||
//}
|
||||
if(s.equals("/terrain.png") || s.contains("arrow") || s.contains("default")) {
|
||||
textureBlending = true;
|
||||
}
|
||||
setupTexture(readTextureImage(texturepackbase.func_6481_a(s)), i);
|
||||
//useMipmaps = false;
|
||||
textureBlending = false;
|
||||
textureMap.put(s, Integer.valueOf(i));
|
||||
return i;
|
||||
} catch (IOException ioexception) {
|
||||
|
@ -63,43 +63,19 @@ public class RenderEngine {
|
|||
textureNameToImageMap.put(Integer.valueOf(i), bufferedimage);
|
||||
return i;
|
||||
}
|
||||
|
||||
public int allocateAndSetupTexture(byte[] data, int w, int h) {
|
||||
int i = GL11.glGenTextures();
|
||||
|
||||
public void setupTexture(EaglerImage bufferedimage, int i) {
|
||||
if(textureBlending) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
//GL11.glDepthMask(false);
|
||||
GL11.glAlphaFunc(GL11._wGL_LESS, 1.0F);
|
||||
}
|
||||
bindTexture(i);
|
||||
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, 9729 /* GL_LINEAR */);
|
||||
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, 9728 /* GL_NEAREST */);
|
||||
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, 9728 /* GL_NEAREST */);
|
||||
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10242 /* GL_TEXTURE_WRAP_S */, 10497 /* GL_REPEAT */);
|
||||
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10243 /* GL_TEXTURE_WRAP_T */, 10497 /* GL_REPEAT */);
|
||||
imageDataB1.clear();
|
||||
imageDataB1.put(data);
|
||||
imageDataB1.position(0).limit(data.length);
|
||||
GL11.glTexImage2D(3553 /* GL_TEXTURE_2D */, 0, 6408 /* GL_RGBA */, w, h, 0, 6408 /* GL_RGBA */,
|
||||
5121 /* GL_UNSIGNED_BYTE */, imageDataB1);
|
||||
return i;
|
||||
}
|
||||
|
||||
public void setupTexture(EaglerImage bufferedimage, int i) {
|
||||
bindTexture(i);
|
||||
// if (useMipmaps) {
|
||||
// GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, EaglerAdapter.GL_NEAREST_MIPMAP_LINEAR);
|
||||
// GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, EaglerAdapter.GL_NEAREST /* GL_LINEAR */);
|
||||
// GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, EaglerAdapter.GL_TEXTURE_MAX_LEVEL, 4);
|
||||
// } else {
|
||||
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, 9728 /* GL_NEAREST */);
|
||||
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, 9728 /* GL_NEAREST */);
|
||||
// }
|
||||
// if (blurTexture) {
|
||||
// EaglerAdapter.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, 9729 /* GL_LINEAR */);
|
||||
// EaglerAdapter.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, 9729 /* GL_LINEAR */);
|
||||
// }
|
||||
// if (clampTexture) {
|
||||
// EaglerAdapter.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10242 /* GL_TEXTURE_WRAP_S */, 10496 /* GL_CLAMP */);
|
||||
// EaglerAdapter.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10243 /* GL_TEXTURE_WRAP_T */, 10496 /* GL_CLAMP */);
|
||||
// } else {
|
||||
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10242 /* GL_TEXTURE_WRAP_S */, 10497 /* GL_REPEAT */);
|
||||
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10243 /* GL_TEXTURE_WRAP_T */, 10497 /* GL_REPEAT */);
|
||||
// }
|
||||
int j = bufferedimage.w;
|
||||
int k = bufferedimage.h;
|
||||
int ai[] = bufferedimage.data;
|
||||
|
@ -125,34 +101,9 @@ public class RenderEngine {
|
|||
imageDataB1.clear();
|
||||
imageDataB1.put(abyte0);
|
||||
imageDataB1.position(0).limit(abyte0.length);
|
||||
GL11.glTexImage2D(3553 /* GL_TEXTURE_2D */, 0, 6408 /* GL_RGBA */, j, k, 0, 6408 /* GL_RGBA */,
|
||||
GL11.glTexImage2D(3553 /* GL_TEXTURE_2D */, 0, GL11._wGL_RGBA8 /* GL_RGBA */, j, k, 0, GL11._wGL_RGBA8 /* GL_RGBA */,
|
||||
5121 /* GL_UNSIGNED_BYTE */, imageDataB1);
|
||||
// if (useMipmaps) {
|
||||
// for (int i1 = 1; i1 <= 4; i1++) {
|
||||
// int k1 = j >> i1 - 1;
|
||||
// int i2 = j >> i1;
|
||||
// int k2 = k >> i1;
|
||||
// imageDataB2.clear();
|
||||
// for (int i3 = 0; i3 < i2; i3++) {
|
||||
// for (int k3 = 0; k3 < k2; k3++) {
|
||||
// int i4 = imageDataB1.getInt((i3 * 2 + 0 + (k3 * 2 + 0) * k1) * 4);
|
||||
// int k4 = imageDataB1.getInt((i3 * 2 + 1 + (k3 * 2 + 0) * k1) * 4);
|
||||
// int l4 = imageDataB1.getInt((i3 * 2 + 1 + (k3 * 2 + 1) * k1) * 4);
|
||||
// int i5 = imageDataB1.getInt((i3 * 2 + 0 + (k3 * 2 + 1) * k1) * 4);
|
||||
// int j5 = averageColor(averageColor(i4, k4), averageColor(l4, i5));
|
||||
// imageDataB2.putInt((i3 + k3 * i2) * 4, j5);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// GL11.glTexImage2D(3553 /* GL_TEXTURE_2D */, i1, 6408 /* GL_RGBA */, i2, k2, 0, 6408 /* GL_RGBA */,
|
||||
// 5121 /* GL_UNSIGNED_BYTE */, imageDataB2);
|
||||
// ByteBuffer tmp = imageDataB1;
|
||||
// imageDataB1 = imageDataB2;
|
||||
// imageDataB2 = tmp;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
public void deleteTexture(int i) {
|
||||
|
@ -195,4 +146,5 @@ public class RenderEngine {
|
|||
private ByteBuffer imageDataB2;
|
||||
private java.util.List<TextureFX> textureList;
|
||||
private GameSettings options;
|
||||
private boolean textureBlending;
|
||||
}
|
|
@ -2,4 +2,8 @@ package org.lwjgl.opengl;
|
|||
|
||||
public class GL11 extends EaglerAdapterGL30 {
|
||||
|
||||
public static void glPixelStorei(int glUnpackAlignment, int i) {
|
||||
webgl.pixelStorei(glUnpackAlignment, i);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user