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()) {
|
||||
Entity var7 = (Entity)var6.next();
|
||||
if(!(var7 instanceof EntityPlayer) && !(var7 instanceof EntityPlayerSP)) {
|
||||
var1.hasEntities = true;
|
||||
var8 = new NBTTagCompound();
|
||||
if(var7.func_358_c(var8)) {
|
||||
|
@ -120,6 +121,7 @@ public class ChunkLoader implements IChunkLoader {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var3.setTag("Entities", var4);
|
||||
NBTTagList var9 = new NBTTagList();
|
||||
|
@ -167,10 +169,12 @@ public class ChunkLoader implements IChunkLoader {
|
|||
Entity var8 = EntityList.createEntityFromNBT(var7, var0);
|
||||
var4.hasEntities = true;
|
||||
if(var8 != null) {
|
||||
if(!(var8 instanceof EntityPlayer) && !(var8 instanceof EntityPlayerSP)) {
|
||||
var4.addEntity(var8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagList var10 = var1.getTagList("TileEntities");
|
||||
if(var10 != null) {
|
||||
|
|
|
@ -681,7 +681,9 @@ public abstract class Entity {
|
|||
|
||||
public void writeToNBT(NBTTagCompound var1) {
|
||||
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.setFloat("FallDistance", this.fallDistance);
|
||||
var1.setShort("Fire", (short)this.fire);
|
||||
|
@ -692,12 +694,11 @@ public abstract class Entity {
|
|||
|
||||
public void readFromNBT(NBTTagCompound var1) {
|
||||
NBTTagList var2 = var1.getTagList("Pos");
|
||||
NBTTagList var3 = var1.getTagList("Motion");
|
||||
NBTTagList var4 = var1.getTagList("Rotation");
|
||||
this.setPosition(0.0D, 0.0D, 0.0D);
|
||||
this.motionX = ((NBTTagDouble)var3.tagAt(0)).doubleValue;
|
||||
this.motionY = ((NBTTagDouble)var3.tagAt(1)).doubleValue;
|
||||
this.motionZ = ((NBTTagDouble)var3.tagAt(2)).doubleValue;
|
||||
this.motionX = var1.getDouble("MotionX");
|
||||
this.motionY = var1.getDouble("MotionY");
|
||||
this.motionZ = var1.getDouble("MotionZ");
|
||||
this.prevPosX = this.lastTickPosX = this.posX = ((NBTTagDouble)var2.tagAt(0)).doubleValue;
|
||||
this.prevPosY = this.lastTickPosY = this.posY = ((NBTTagDouble)var2.tagAt(1)).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.Map;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class EntityList {
|
||||
private static Map stringToClassMapping = new HashMap();
|
||||
private static Map classToStringMapping = new HashMap();
|
||||
private static Map IDtoClassMapping = 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);
|
||||
classToStringMapping.put(var0, var1);
|
||||
IDtoClassMapping.put(Integer.valueOf(var2), var0);
|
||||
|
@ -21,8 +23,9 @@ 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});
|
||||
Entity entity = getEntity(var3);
|
||||
if(var3 != null && entity != null & !(entity instanceof EntityPlayer || entity instanceof EntityPlayerSP)) {
|
||||
var2 = entity;
|
||||
}
|
||||
} catch (Exception var4) {
|
||||
var4.printStackTrace();
|
||||
|
@ -36,8 +39,9 @@ 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});
|
||||
Entity entity = getEntity(var3);
|
||||
if(var3 != null && entity != null && !(entity instanceof EntityPlayer || entity instanceof EntityPlayerSP)) {
|
||||
var2 = entity;
|
||||
}
|
||||
} catch (Exception var4) {
|
||||
var4.printStackTrace();
|
||||
|
@ -57,8 +61,9 @@ 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});
|
||||
Entity entity = getEntity(var3);
|
||||
if(var3 != null && entity != null && !(entity instanceof EntityPlayer || entity instanceof EntityPlayerSP)) {
|
||||
var2 = entity;
|
||||
}
|
||||
} catch (Exception var4) {
|
||||
var4.printStackTrace();
|
||||
|
@ -79,6 +84,103 @@ public class EntityList {
|
|||
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 {
|
||||
addMapping(EntityArrow.class, "Arrow", 10);
|
||||
addMapping(EntitySnowball.class, "Snowball", 11);
|
||||
|
|
|
@ -40,7 +40,9 @@ public class RenderEngine {
|
|||
setupTexture(readTextureImage(GL11.loadResourceBytes(s1[1])), i);
|
||||
clampTexture = false;
|
||||
} else {
|
||||
if(s.contains("terrain")) {
|
||||
useMipmaps = true;
|
||||
}
|
||||
setupTexture(readTextureImage(GL11.loadResourceBytes(s)), i);
|
||||
useMipmaps = false;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ public class TileEntity {
|
|||
var1.setInteger("x", this.xCoord);
|
||||
var1.setInteger("y", this.yCoord);
|
||||
var1.setInteger("z", this.zCoord);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,20 +76,19 @@ public class World implements IBlockAccess {
|
|||
|
||||
public static void deleteWorld(String var1) {
|
||||
String path = "saves/" + var1 + "/";
|
||||
Collection<GL11.FileEntry> files = GL11.listFiles(path, true, false);
|
||||
|
||||
for(GL11.FileEntry entry : files) {
|
||||
byte[] data = GL11.readFile(entry.path);
|
||||
if(data != null) {
|
||||
GL11.deleteFile(entry.path);
|
||||
Collection<GL11.FileEntry> lst = GL11.listFiles(path, true, true);
|
||||
for(GL11.FileEntry t : lst) {
|
||||
if(!t.isDirectory) {
|
||||
GL11.deleteFile(t.path);
|
||||
}
|
||||
}
|
||||
|
||||
byte[] data = GL11.readFile("saves/" + var1 + "/");
|
||||
if(data != null) {
|
||||
GL11.deleteFile("saves/" + var1 + "/");
|
||||
for(GL11.FileEntry t : lst) {
|
||||
if(t.isDirectory) {
|
||||
GL11.deleteFile(t.path);
|
||||
}
|
||||
}
|
||||
GL11.deleteFile(path);
|
||||
}
|
||||
|
||||
public WorldChunkManager func_4075_a() {
|
||||
return this.worldProvider.worldChunkMgr;
|
||||
|
|
Loading…
Reference in New Issue
Block a user