Fix mob spawning, water and saving settings
This commit is contained in:
parent
ce68e3168c
commit
412d394030
File diff suppressed because one or more lines are too long
|
@ -117,12 +117,7 @@ public class EaglerAdapterImpl2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onWindowUnload() {
|
@JSBody(params = { }, script = "window.addEventListener('beforeunload', (event) => {event.preventDefault(); return '';});")
|
||||||
LocalStorageManager.saveStorageG();
|
|
||||||
LocalStorageManager.saveStorageP();
|
|
||||||
}
|
|
||||||
|
|
||||||
@JSBody(params = { }, script = "window.onbeforeunload = function(){javaMethods.get('net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.onWindowUnload()V').invoke();return false;};")
|
|
||||||
private static native void onBeforeCloseRegister();
|
private static native void onBeforeCloseRegister();
|
||||||
|
|
||||||
public static final String[] fileContentsLines(String path) {
|
public static final String[] fileContentsLines(String path) {
|
||||||
|
|
|
@ -159,10 +159,6 @@ public class Minecraft implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadScreen() {
|
private void loadScreen() {
|
||||||
int xx = displayWidth;
|
|
||||||
if(xx > displayHeight) {
|
|
||||||
xx = displayHeight;
|
|
||||||
}
|
|
||||||
GL11.glClear(16640);
|
GL11.glClear(16640);
|
||||||
GL11.glMatrixMode(5889 /* GL_PROJECTION */);
|
GL11.glMatrixMode(5889 /* GL_PROJECTION */);
|
||||||
GL11.glLoadIdentity();
|
GL11.glLoadIdentity();
|
||||||
|
@ -187,12 +183,10 @@ public class Minecraft implements Runnable {
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
tessellator.startDrawingQuads();
|
tessellator.startDrawingQuads();
|
||||||
tessellator.setColorOpaque_I(0xffffff);
|
tessellator.setColorOpaque_I(0xffffff);
|
||||||
int marginX = (displayWidth - xx) / 2;
|
tessellator.addVertexWithUV(0.0D, displayHeight, 0.0D, 0.0D, 1.0D);
|
||||||
int marginY = (displayHeight - xx) / 2;
|
tessellator.addVertexWithUV(displayWidth, displayHeight, 0.0D, 1.0D, 1.0D);
|
||||||
tessellator.addVertexWithUV(marginX, displayHeight - marginY, 0.0D, 0.0D, 1.0D);
|
tessellator.addVertexWithUV(displayWidth, 0.0D, 0.0D, 1.0D, 0.0D);
|
||||||
tessellator.addVertexWithUV(displayWidth - marginX, displayHeight - marginY, 0.0D, 1.0D, 1.0D);
|
tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||||
tessellator.addVertexWithUV(displayWidth - marginX, marginY, 0.0D, 1.0D, 0.0D);
|
|
||||||
tessellator.addVertexWithUV(marginX, marginY, 0.0D, 0.0D, 0.0D);
|
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
GL11.glDisable(2896 /* GL_LIGHTING */);
|
GL11.glDisable(2896 /* GL_LIGHTING */);
|
||||||
GL11.glDisable(2912 /* GL_FOG */);
|
GL11.glDisable(2912 /* GL_FOG */);
|
||||||
|
|
|
@ -371,24 +371,7 @@ public class EntityRenderer {
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
|
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
|
||||||
if(this.mc.gameSettings.fancyGraphics) {
|
|
||||||
GL11.glColorMask(false, false, false, false);
|
|
||||||
int var13 = var3.func_943_a(var2, 1, (double)var1);
|
|
||||||
GL11.glColorMask(true, true, true, true);
|
|
||||||
if(this.mc.gameSettings.anaglyph) {
|
|
||||||
if(var11 == 0) {
|
|
||||||
GL11.glColorMask(false, true, true, false);
|
|
||||||
} else {
|
|
||||||
GL11.glColorMask(true, false, false, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(var13 > 0) {
|
|
||||||
var3.func_944_a(1, (double)var1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var3.func_943_a(var2, 1, (double)var1);
|
var3.func_943_a(var2, 1, (double)var1);
|
||||||
}
|
|
||||||
|
|
||||||
GL11.glDepthMask(true);
|
GL11.glDepthMask(true);
|
||||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||||
|
|
|
@ -5,6 +5,8 @@ import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
|
import net.PeytonPlayz585.storage.LocalStorageManager;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
@ -202,7 +204,6 @@ public class GameSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveOptions() {
|
public void saveOptions() {
|
||||||
try {
|
|
||||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||||
PrintWriter var1 = new PrintWriter(byteArrayOutputStream);
|
PrintWriter var1 = new PrintWriter(byteArrayOutputStream);
|
||||||
var1.println("music:" + this.musicVolume);
|
var1.println("music:" + this.musicVolume);
|
||||||
|
@ -216,7 +217,6 @@ public class GameSettings {
|
||||||
var1.println("difficulty:" + this.difficulty);
|
var1.println("difficulty:" + this.difficulty);
|
||||||
var1.println("fancyGraphics:" + this.fancyGraphics);
|
var1.println("fancyGraphics:" + this.fancyGraphics);
|
||||||
var1.println("skin:" + this.skin);
|
var1.println("skin:" + this.skin);
|
||||||
var1.println("lastServer:" + this.field_12259_z);
|
|
||||||
|
|
||||||
for(int var2 = 0; var2 < this.keyBindings.length; ++var2) {
|
for(int var2 = 0; var2 < this.keyBindings.length; ++var2) {
|
||||||
var1.println("key_" + this.keyBindings[var2].keyDescription + ":" + this.keyBindings[var2].keyCode);
|
var1.println("key_" + this.keyBindings[var2].keyDescription + ":" + this.keyBindings[var2].keyCode);
|
||||||
|
@ -227,10 +227,7 @@ public class GameSettings {
|
||||||
GL11.writeFile("options.txt", fileData);
|
GL11.writeFile("options.txt", fileData);
|
||||||
|
|
||||||
var1.close();
|
var1.close();
|
||||||
} catch (Exception var3) {
|
LocalStorageManager.saveStorageG();
|
||||||
System.out.println("Failed to save options");
|
LocalStorageManager.saveStorageP();
|
||||||
var3.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
public class MobSpawnerBase {
|
public class MobSpawnerBase {
|
||||||
public static final MobSpawnerBase rainforest = (new MobSpawnerBase()).func_4123_b(588342).setBiomeName("Rainforest").func_4124_a(2094168);
|
public static final MobSpawnerBase rainforest = (new MobSpawnerBase()).func_4123_b(588342).setBiomeName("Rainforest").func_4124_a(2094168);
|
||||||
public static final MobSpawnerBase swampland = (new MobSpawnerSwamp()).func_4123_b(522674).setBiomeName("Swampland").func_4124_a(9154376);
|
public static final MobSpawnerBase swampland = (new MobSpawnerSwamp()).func_4123_b(522674).setBiomeName("Swampland").func_4124_a(9154376);
|
||||||
|
@ -18,8 +24,8 @@ public class MobSpawnerBase {
|
||||||
public byte topBlock = (byte)Block.grass.blockID;
|
public byte topBlock = (byte)Block.grass.blockID;
|
||||||
public byte fillerBlock = (byte)Block.dirt.blockID;
|
public byte fillerBlock = (byte)Block.dirt.blockID;
|
||||||
public int field_6502_q = 5169201;
|
public int field_6502_q = 5169201;
|
||||||
protected Class[] biomeMonsters = new Class[]{EntitySpider.class, EntityZombie.class, EntitySkeleton.class, EntityCreeper.class};
|
protected List biomeMonsters = new ArrayList();
|
||||||
protected Class[] biomeCreatures = new Class[]{EntitySheep.class, EntityPig.class, EntityChicken.class, EntityCow.class};
|
protected List biomeCreatures = new ArrayList();
|
||||||
private static MobSpawnerBase[] biomeLookupTable = new MobSpawnerBase[4096];
|
private static MobSpawnerBase[] biomeLookupTable = new MobSpawnerBase[4096];
|
||||||
|
|
||||||
public static void generateBiomeLookup() {
|
public static void generateBiomeLookup() {
|
||||||
|
@ -131,8 +137,34 @@ public class MobSpawnerBase {
|
||||||
return (255 << 24) | (red << 16) | (green << 8) | blue;
|
return (255 << 24) | (red << 16) | (green << 8) | blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class[] getEntitiesForType(EnumCreatureType var1) {
|
public List getEntitiesForType(EnumCreatureType var1) {
|
||||||
return var1 == EnumCreatureType.monster ? this.biomeMonsters : (var1 == EnumCreatureType.creature ? this.biomeCreatures : null);
|
if(var1 == EnumCreatureType.monster) {
|
||||||
|
if(this.biomeMonsters.isEmpty()) {
|
||||||
|
initBiomeMonsters();
|
||||||
|
}
|
||||||
|
return this.biomeMonsters;
|
||||||
|
} else if(var1 == EnumCreatureType.creature) {
|
||||||
|
if(this.biomeCreatures.isEmpty()) {
|
||||||
|
initBiomeCreatures();
|
||||||
|
}
|
||||||
|
return this.biomeCreatures;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initBiomeMonsters() {
|
||||||
|
biomeMonsters.add(new EntitySpider(Minecraft.getMinecraft().theWorld));
|
||||||
|
biomeMonsters.add(new EntityZombie(Minecraft.getMinecraft().theWorld));
|
||||||
|
biomeMonsters.add(new EntitySkeleton(Minecraft.getMinecraft().theWorld));
|
||||||
|
biomeMonsters.add(new EntityCreeper(Minecraft.getMinecraft().theWorld));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initBiomeCreatures() {
|
||||||
|
biomeCreatures.add(new EntitySheep(Minecraft.getMinecraft().theWorld));
|
||||||
|
biomeCreatures.add(new EntityPig(Minecraft.getMinecraft().theWorld));
|
||||||
|
biomeCreatures.add(new EntityChicken(Minecraft.getMinecraft().theWorld));
|
||||||
|
biomeCreatures.add(new EntityCow(Minecraft.getMinecraft().theWorld));
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -1,8 +1,25 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
public class MobSpawnerHell extends MobSpawnerBase {
|
public class MobSpawnerHell extends MobSpawnerBase {
|
||||||
public MobSpawnerHell() {
|
public MobSpawnerHell() {
|
||||||
this.biomeMonsters = new Class[]{EntityGhast.class, EntityPigZombie.class};
|
biomeMonsters = new ArrayList();
|
||||||
this.biomeCreatures = new Class[0];
|
biomeCreatures = new ArrayList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initBiomeMonsters() {
|
||||||
|
biomeMonsters.add(new EntityGhast(Minecraft.getMinecraft().theWorld));
|
||||||
|
biomeMonsters.add(new EntityPigZombie(Minecraft.getMinecraft().theWorld));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initBiomeCreatures() {
|
||||||
|
if(biomeCreatures != null) {
|
||||||
|
biomeCreatures.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
public final class SpawnerAnimals {
|
public final class SpawnerAnimals {
|
||||||
private static Set eligibleChunksForSpawning = new HashSet();
|
private static Set eligibleChunksForSpawning = new HashSet();
|
||||||
|
private static List entityList = new ArrayList();
|
||||||
|
|
||||||
protected static ChunkPosition getRandomSpawningPointInChunk(World var0, int var1, int var2) {
|
protected static ChunkPosition getRandomSpawningPointInChunk(World var0, int var1, int var2) {
|
||||||
int var3 = var1 + var0.rand.nextInt(16);
|
int var3 = var1 + var0.rand.nextInt(16);
|
||||||
|
@ -45,7 +50,7 @@ public final class SpawnerAnimals {
|
||||||
int var10;
|
int var10;
|
||||||
int var11;
|
int var11;
|
||||||
int var12;
|
int var12;
|
||||||
Class[] var33;
|
List var33;
|
||||||
do {
|
do {
|
||||||
do {
|
do {
|
||||||
ChunkCoordIntPair var31;
|
ChunkCoordIntPair var31;
|
||||||
|
@ -62,9 +67,9 @@ public final class SpawnerAnimals {
|
||||||
MobSpawnerBase var32 = var0.func_4075_a().func_4074_a(var31);
|
MobSpawnerBase var32 = var0.func_4075_a().func_4074_a(var31);
|
||||||
var33 = var32.getEntitiesForType(var29);
|
var33 = var32.getEntitiesForType(var29);
|
||||||
} while(var33 == null);
|
} while(var33 == null);
|
||||||
} while(var33.length == 0);
|
} while(var33.size() == 0);
|
||||||
|
|
||||||
var8 = var0.rand.nextInt(var33.length);
|
var8 = var0.rand.nextInt(var33.size());
|
||||||
ChunkPosition var9 = getRandomSpawningPointInChunk(var0, var31.chunkXPos * 16, var31.chunkZPos * 16);
|
ChunkPosition var9 = getRandomSpawningPointInChunk(var0, var31.chunkXPos * 16, var31.chunkZPos * 16);
|
||||||
var10 = var9.x;
|
var10 = var9.x;
|
||||||
var11 = var9.y;
|
var11 = var9.y;
|
||||||
|
@ -96,12 +101,16 @@ public final class SpawnerAnimals {
|
||||||
if(var26 >= 576.0F) {
|
if(var26 >= 576.0F) {
|
||||||
EntityLiving var34;
|
EntityLiving var34;
|
||||||
try {
|
try {
|
||||||
var34 = (EntityLiving)var33[var8].getConstructor(new Class[]{World.class}).newInstance(new Object[]{var0});
|
var34 = setEntity(var33, var8);
|
||||||
} catch (Exception var27) {
|
} catch (Exception var27) {
|
||||||
var27.printStackTrace();
|
var27.printStackTrace();
|
||||||
return var1;
|
return var1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(var34 == null) {
|
||||||
|
return var1;
|
||||||
|
}
|
||||||
|
|
||||||
var34.setLocationAndAngles((double)var20, (double)var21, (double)var22, var0.rand.nextFloat() * 360.0F, 0.0F);
|
var34.setLocationAndAngles((double)var20, (double)var21, (double)var22, var0.rand.nextFloat() * 360.0F, 0.0F);
|
||||||
if(var34.getCanSpawnHere()) {
|
if(var34.getCanSpawnHere()) {
|
||||||
++var13;
|
++var13;
|
||||||
|
@ -130,4 +139,50 @@ public final class SpawnerAnimals {
|
||||||
|
|
||||||
return var1;
|
return var1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static EntityLiving setEntity(List l, int i) {
|
||||||
|
EntityLiving e = (EntityLiving)l.get(i);
|
||||||
|
|
||||||
|
if(e instanceof EntitySpider) {
|
||||||
|
return new EntitySpider(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(e instanceof EntityZombie) {
|
||||||
|
return new EntityZombie(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(e instanceof EntitySkeleton) {
|
||||||
|
return new EntitySkeleton(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(e instanceof EntityCreeper) {
|
||||||
|
return new EntityCreeper(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(e instanceof EntitySheep) {
|
||||||
|
return new EntitySheep(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(e instanceof EntityPig) {
|
||||||
|
return new EntityPig(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(e instanceof EntityChicken) {
|
||||||
|
return new EntityChicken(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(e instanceof EntityCow) {
|
||||||
|
return new EntityCow(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(e instanceof EntityGhast) {
|
||||||
|
return new EntityGhast(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(e instanceof EntityPigZombie) {
|
||||||
|
return new EntityPigZombie(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user