fix mob spawning, saving entities and mipmaping

This commit is contained in:
PeytonPlayz595 2024-02-10 01:22:35 -05:00
parent df5b7fd080
commit 2606c0ce9b
8 changed files with 2456 additions and 4595 deletions

6878
js/app.js

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -113,10 +113,12 @@ public class ChunkLoader implements IChunkLoader {
while(var6.hasNext()) {
Entity var7 = (Entity)var6.next();
var1.hasEntities = true;
var8 = new NBTTagCompound();
if(var7.func_358_c(var8)) {
var4.setTag(var8);
if(!(var7 instanceof EntityPlayer) && !(var7 instanceof EntityPlayerSP)) {
var1.hasEntities = true;
var8 = new NBTTagCompound();
if(var7.func_358_c(var8)) {
var4.setTag(var8);
}
}
}
}
@ -167,7 +169,9 @@ public class ChunkLoader implements IChunkLoader {
Entity var8 = EntityList.createEntityFromNBT(var7, var0);
var4.hasEntities = true;
if(var8 != null) {
var4.addEntity(var8);
if(!(var8 instanceof EntityPlayer) && !(var8 instanceof EntityPlayerSP)) {
var4.addEntity(var8);
}
}
}
}

View File

@ -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;

View File

@ -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();
@ -78,6 +83,103 @@ public class EntityList {
public static String getEntityString(Entity var0) {
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);

View File

@ -40,7 +40,9 @@ public class RenderEngine {
setupTexture(readTextureImage(GL11.loadResourceBytes(s1[1])), i);
clampTexture = false;
} else {
useMipmaps = true;
if(s.contains("terrain")) {
useMipmaps = true;
}
setupTexture(readTextureImage(GL11.loadResourceBytes(s)), i);
useMipmaps = false;
}

View File

@ -35,6 +35,7 @@ public class TileEntity {
var1.setInteger("x", this.xCoord);
var1.setInteger("y", this.yCoord);
var1.setInteger("z", this.zCoord);
}
}

View File

@ -76,19 +76,18 @@ 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);
}
}
byte[] data = GL11.readFile("saves/" + var1 + "/");
if(data != null) {
GL11.deleteFile("saves/" + var1 + "/");
}
Collection<GL11.FileEntry> lst = GL11.listFiles(path, true, true);
for(GL11.FileEntry t : lst) {
if(!t.isDirectory) {
GL11.deleteFile(t.path);
}
}
for(GL11.FileEntry t : lst) {
if(t.isDirectory) {
GL11.deleteFile(t.path);
}
}
GL11.deleteFile(path);
}
public WorldChunkManager func_4075_a() {