fix mob spawning, saving entities and mipmaping
This commit is contained in:
parent
df5b7fd080
commit
2606c0ce9b
File diff suppressed because one or more lines are too long
|
@ -113,6 +113,7 @@ public class ChunkLoader implements IChunkLoader {
|
||||||
|
|
||||||
while(var6.hasNext()) {
|
while(var6.hasNext()) {
|
||||||
Entity var7 = (Entity)var6.next();
|
Entity var7 = (Entity)var6.next();
|
||||||
|
if(!(var7 instanceof EntityPlayer) && !(var7 instanceof EntityPlayerSP)) {
|
||||||
var1.hasEntities = true;
|
var1.hasEntities = true;
|
||||||
var8 = new NBTTagCompound();
|
var8 = new NBTTagCompound();
|
||||||
if(var7.func_358_c(var8)) {
|
if(var7.func_358_c(var8)) {
|
||||||
|
@ -120,6 +121,7 @@ public class ChunkLoader implements IChunkLoader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var3.setTag("Entities", var4);
|
var3.setTag("Entities", var4);
|
||||||
NBTTagList var9 = new NBTTagList();
|
NBTTagList var9 = new NBTTagList();
|
||||||
|
@ -167,10 +169,12 @@ public class ChunkLoader implements IChunkLoader {
|
||||||
Entity var8 = EntityList.createEntityFromNBT(var7, var0);
|
Entity var8 = EntityList.createEntityFromNBT(var7, var0);
|
||||||
var4.hasEntities = true;
|
var4.hasEntities = true;
|
||||||
if(var8 != null) {
|
if(var8 != null) {
|
||||||
|
if(!(var8 instanceof EntityPlayer) && !(var8 instanceof EntityPlayerSP)) {
|
||||||
var4.addEntity(var8);
|
var4.addEntity(var8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NBTTagList var10 = var1.getTagList("TileEntities");
|
NBTTagList var10 = var1.getTagList("TileEntities");
|
||||||
if(var10 != null) {
|
if(var10 != null) {
|
||||||
|
|
|
@ -681,7 +681,9 @@ public abstract class Entity {
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound var1) {
|
public void writeToNBT(NBTTagCompound var1) {
|
||||||
var1.setTag("Pos", this.func_375_a(new double[]{this.posX, this.posY, this.posZ}));
|
var1.setTag("Pos", this.func_375_a(new double[]{this.posX, this.posY, this.posZ}));
|
||||||
var1.setTag("Motion", this.func_375_a(new double[]{this.motionX, this.motionY, this.motionZ}));
|
var1.setDouble("MotionX", this.motionX);
|
||||||
|
var1.setDouble("MotionY", this.motionY);
|
||||||
|
var1.setDouble("MotionZ", this.motionZ);
|
||||||
var1.setTag("Rotation", this.func_377_a(new float[]{this.rotationYaw, this.rotationPitch}));
|
var1.setTag("Rotation", this.func_377_a(new float[]{this.rotationYaw, this.rotationPitch}));
|
||||||
var1.setFloat("FallDistance", this.fallDistance);
|
var1.setFloat("FallDistance", this.fallDistance);
|
||||||
var1.setShort("Fire", (short)this.fire);
|
var1.setShort("Fire", (short)this.fire);
|
||||||
|
@ -692,12 +694,11 @@ public abstract class Entity {
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound var1) {
|
public void readFromNBT(NBTTagCompound var1) {
|
||||||
NBTTagList var2 = var1.getTagList("Pos");
|
NBTTagList var2 = var1.getTagList("Pos");
|
||||||
NBTTagList var3 = var1.getTagList("Motion");
|
|
||||||
NBTTagList var4 = var1.getTagList("Rotation");
|
NBTTagList var4 = var1.getTagList("Rotation");
|
||||||
this.setPosition(0.0D, 0.0D, 0.0D);
|
this.setPosition(0.0D, 0.0D, 0.0D);
|
||||||
this.motionX = ((NBTTagDouble)var3.tagAt(0)).doubleValue;
|
this.motionX = var1.getDouble("MotionX");
|
||||||
this.motionY = ((NBTTagDouble)var3.tagAt(1)).doubleValue;
|
this.motionY = var1.getDouble("MotionY");
|
||||||
this.motionZ = ((NBTTagDouble)var3.tagAt(2)).doubleValue;
|
this.motionZ = var1.getDouble("MotionZ");
|
||||||
this.prevPosX = this.lastTickPosX = this.posX = ((NBTTagDouble)var2.tagAt(0)).doubleValue;
|
this.prevPosX = this.lastTickPosX = this.posX = ((NBTTagDouble)var2.tagAt(0)).doubleValue;
|
||||||
this.prevPosY = this.lastTickPosY = this.posY = ((NBTTagDouble)var2.tagAt(1)).doubleValue;
|
this.prevPosY = this.lastTickPosY = this.posY = ((NBTTagDouble)var2.tagAt(1)).doubleValue;
|
||||||
this.prevPosZ = this.lastTickPosZ = this.posZ = ((NBTTagDouble)var2.tagAt(2)).doubleValue;
|
this.prevPosZ = this.lastTickPosZ = this.posZ = ((NBTTagDouble)var2.tagAt(2)).doubleValue;
|
||||||
|
|
|
@ -3,13 +3,15 @@ package net.minecraft.src;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
public class EntityList {
|
public class EntityList {
|
||||||
private static Map stringToClassMapping = new HashMap();
|
private static Map stringToClassMapping = new HashMap();
|
||||||
private static Map classToStringMapping = new HashMap();
|
private static Map classToStringMapping = new HashMap();
|
||||||
private static Map IDtoClassMapping = new HashMap();
|
private static Map IDtoClassMapping = new HashMap();
|
||||||
private static Map classToIDMapping = new HashMap();
|
private static Map classToIDMapping = new HashMap();
|
||||||
|
|
||||||
private static void addMapping(Class var0, String var1, int var2) {
|
private static void addMapping(Object var0, String var1, int var2) {
|
||||||
stringToClassMapping.put(var1, var0);
|
stringToClassMapping.put(var1, var0);
|
||||||
classToStringMapping.put(var0, var1);
|
classToStringMapping.put(var0, var1);
|
||||||
IDtoClassMapping.put(Integer.valueOf(var2), var0);
|
IDtoClassMapping.put(Integer.valueOf(var2), var0);
|
||||||
|
@ -21,8 +23,9 @@ public class EntityList {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Class var3 = (Class)stringToClassMapping.get(var0);
|
Class var3 = (Class)stringToClassMapping.get(var0);
|
||||||
if(var3 != null) {
|
Entity entity = getEntity(var3);
|
||||||
var2 = (Entity)var3.getConstructor(new Class[]{World.class}).newInstance(new Object[]{var1});
|
if(var3 != null && entity != null & !(entity instanceof EntityPlayer || entity instanceof EntityPlayerSP)) {
|
||||||
|
var2 = entity;
|
||||||
}
|
}
|
||||||
} catch (Exception var4) {
|
} catch (Exception var4) {
|
||||||
var4.printStackTrace();
|
var4.printStackTrace();
|
||||||
|
@ -36,8 +39,9 @@ public class EntityList {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Class var3 = (Class)stringToClassMapping.get(var0.getString("id"));
|
Class var3 = (Class)stringToClassMapping.get(var0.getString("id"));
|
||||||
if(var3 != null) {
|
Entity entity = getEntity(var3);
|
||||||
var2 = (Entity)var3.getConstructor(new Class[]{World.class}).newInstance(new Object[]{var1});
|
if(var3 != null && entity != null && !(entity instanceof EntityPlayer || entity instanceof EntityPlayerSP)) {
|
||||||
|
var2 = entity;
|
||||||
}
|
}
|
||||||
} catch (Exception var4) {
|
} catch (Exception var4) {
|
||||||
var4.printStackTrace();
|
var4.printStackTrace();
|
||||||
|
@ -57,8 +61,9 @@ public class EntityList {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Class var3 = (Class)IDtoClassMapping.get(Integer.valueOf(var0));
|
Class var3 = (Class)IDtoClassMapping.get(Integer.valueOf(var0));
|
||||||
if(var3 != null) {
|
Entity entity = getEntity(var3);
|
||||||
var2 = (Entity)var3.getConstructor(new Class[]{World.class}).newInstance(new Object[]{var1});
|
if(var3 != null && entity != null && !(entity instanceof EntityPlayer || entity instanceof EntityPlayerSP)) {
|
||||||
|
var2 = entity;
|
||||||
}
|
}
|
||||||
} catch (Exception var4) {
|
} catch (Exception var4) {
|
||||||
var4.printStackTrace();
|
var4.printStackTrace();
|
||||||
|
@ -79,6 +84,103 @@ public class EntityList {
|
||||||
return (String)classToStringMapping.get(var0.getClass());
|
return (String)classToStringMapping.get(var0.getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Entity getEntity(Class c) {
|
||||||
|
|
||||||
|
if(c == EntityPlayer.class || c == EntityPlayerSP.class) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityArrow.class) {
|
||||||
|
return new EntityArrow(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntitySnowball.class) {
|
||||||
|
return new EntitySnowball(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityItem.class) {
|
||||||
|
return new EntityItem(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityPainting.class) {
|
||||||
|
return new EntityPainting(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityCreeper.class) {
|
||||||
|
return new EntityCreeper(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntitySkeleton.class) {
|
||||||
|
return new EntitySkeleton(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntitySpider.class) {
|
||||||
|
return new EntitySpider(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityZombieSimple.class) {
|
||||||
|
return new EntityZombieSimple(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityZombie.class) {
|
||||||
|
return new EntityZombie(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntitySlime.class) {
|
||||||
|
return new EntitySlime(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityGhast.class) {
|
||||||
|
return new EntityGhast(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityPigZombie.class) {
|
||||||
|
return new EntityPigZombie(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityPig.class) {
|
||||||
|
return new EntityPig(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntitySheep.class) {
|
||||||
|
return new EntitySheep(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityCow.class) {
|
||||||
|
return new EntityCow(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityChicken.class) {
|
||||||
|
return new EntityChicken(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityTNTPrimed.class) {
|
||||||
|
return new EntityTNTPrimed(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityFallingSand.class) {
|
||||||
|
return new EntityFallingSand(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityMinecart.class) {
|
||||||
|
return new EntityMinecart(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityBoat.class) {
|
||||||
|
return new EntityBoat(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityMobs.class) {
|
||||||
|
return new EntityMobs(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c == EntityLiving.class) {
|
||||||
|
return new EntityLiving(Minecraft.getMinecraft().theWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
addMapping(EntityArrow.class, "Arrow", 10);
|
addMapping(EntityArrow.class, "Arrow", 10);
|
||||||
addMapping(EntitySnowball.class, "Snowball", 11);
|
addMapping(EntitySnowball.class, "Snowball", 11);
|
||||||
|
|
|
@ -40,7 +40,9 @@ public class RenderEngine {
|
||||||
setupTexture(readTextureImage(GL11.loadResourceBytes(s1[1])), i);
|
setupTexture(readTextureImage(GL11.loadResourceBytes(s1[1])), i);
|
||||||
clampTexture = false;
|
clampTexture = false;
|
||||||
} else {
|
} else {
|
||||||
|
if(s.contains("terrain")) {
|
||||||
useMipmaps = true;
|
useMipmaps = true;
|
||||||
|
}
|
||||||
setupTexture(readTextureImage(GL11.loadResourceBytes(s)), i);
|
setupTexture(readTextureImage(GL11.loadResourceBytes(s)), i);
|
||||||
useMipmaps = false;
|
useMipmaps = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ public class TileEntity {
|
||||||
var1.setInteger("x", this.xCoord);
|
var1.setInteger("x", this.xCoord);
|
||||||
var1.setInteger("y", this.yCoord);
|
var1.setInteger("y", this.yCoord);
|
||||||
var1.setInteger("z", this.zCoord);
|
var1.setInteger("z", this.zCoord);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,20 +76,19 @@ public class World implements IBlockAccess {
|
||||||
|
|
||||||
public static void deleteWorld(String var1) {
|
public static void deleteWorld(String var1) {
|
||||||
String path = "saves/" + var1 + "/";
|
String path = "saves/" + var1 + "/";
|
||||||
Collection<GL11.FileEntry> files = GL11.listFiles(path, true, false);
|
Collection<GL11.FileEntry> lst = GL11.listFiles(path, true, true);
|
||||||
|
for(GL11.FileEntry t : lst) {
|
||||||
for(GL11.FileEntry entry : files) {
|
if(!t.isDirectory) {
|
||||||
byte[] data = GL11.readFile(entry.path);
|
GL11.deleteFile(t.path);
|
||||||
if(data != null) {
|
|
||||||
GL11.deleteFile(entry.path);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for(GL11.FileEntry t : lst) {
|
||||||
byte[] data = GL11.readFile("saves/" + var1 + "/");
|
if(t.isDirectory) {
|
||||||
if(data != null) {
|
GL11.deleteFile(t.path);
|
||||||
GL11.deleteFile("saves/" + var1 + "/");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
GL11.deleteFile(path);
|
||||||
|
}
|
||||||
|
|
||||||
public WorldChunkManager func_4075_a() {
|
public WorldChunkManager func_4075_a() {
|
||||||
return this.worldProvider.worldChunkMgr;
|
return this.worldProvider.worldChunkMgr;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user