add dummy display chunks
This commit is contained in:
parent
e145675525
commit
31dd9d6303
9 changed files with 147 additions and 68 deletions
|
@ -42,7 +42,7 @@ public class BlockTorch extends Block
|
|||
else {
|
||||
Chunk chunk = world.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
|
||||
|
||||
if(chunk.isEmpty()) {
|
||||
if(chunk.isDummy()) {
|
||||
return def;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -911,14 +911,14 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
}
|
||||
|
||||
public static Dimension getByNbt(NBTTagCompound tag) {
|
||||
return getByNbt(tag, true, false, false);
|
||||
return getByNbt(tag, true, false, false, false);
|
||||
}
|
||||
|
||||
public static Dimension getByNbt(NBTTagCompound tag, boolean generator) {
|
||||
return getByNbt(tag, false, generator, false);
|
||||
return getByNbt(tag, false, generator, !generator, false);
|
||||
}
|
||||
|
||||
private static Dimension getByNbt(NBTTagCompound tag, boolean mapOnly, boolean generator, boolean all) {
|
||||
private static Dimension getByNbt(NBTTagCompound tag, boolean mapOnly, boolean generator, boolean partialGen, boolean all) {
|
||||
Dimension dim;
|
||||
DimType type = DimType.getByName(tag.getString("Type"));
|
||||
int id = tag.getInteger("ID");
|
||||
|
@ -944,35 +944,41 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
dim = Space.INSTANCE;
|
||||
}
|
||||
if(!mapOnly)
|
||||
dim.fromNbt(tag, generator, all);
|
||||
dim.fromNbt(tag, generator, partialGen, all);
|
||||
return dim;
|
||||
}
|
||||
|
||||
public final Dimension copy() {
|
||||
Dimension dim = getByNbt(this.toNbt(true, true), false, true, true);
|
||||
Dimension dim = getByNbt(this.toNbt(true, false, true), false, true, false, true);
|
||||
dim.setCustomName(this.getCustomName());
|
||||
return dim;
|
||||
}
|
||||
|
||||
public final Dimension copy(int id, String name) {
|
||||
NBTTagCompound tag = this.toNbt(true, true);
|
||||
NBTTagCompound tag = this.toNbt(true, false, true);
|
||||
tag.setInteger("ID", id);
|
||||
tag.setString("Name", name);
|
||||
return getByNbt(tag, false, true, true);
|
||||
return getByNbt(tag, false, true, false, true);
|
||||
}
|
||||
|
||||
public final void fromNbt(NBTTagCompound tag) {
|
||||
this.fromNbt(tag, true, false);
|
||||
this.fromNbt(tag, true, false, false);
|
||||
}
|
||||
|
||||
private final void fromNbt(NBTTagCompound tag, boolean generator, boolean all) {
|
||||
private final void fromNbt(NBTTagCompound tag, boolean generator, boolean partialGen, boolean all) {
|
||||
if(this == Space.INSTANCE) {
|
||||
if(generator)
|
||||
if(generator || partialGen)
|
||||
this.seed = tag.getLong("Seed");
|
||||
return;
|
||||
}
|
||||
if(generator) {
|
||||
if(generator || partialGen) {
|
||||
this.seed = tag.getLong("Seed");
|
||||
if(partialGen || all || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
||||
this.seaLevel = tag.getInteger("SeaLevel");
|
||||
this.liquid = BlockRegistry.getFromIdName(tag.getString("LiquidBlock"), Blocks.water.getState());
|
||||
}
|
||||
}
|
||||
if(generator) {
|
||||
if(all || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
||||
this.noiseGen.coordinateScale = tag.getFloat("CoordScale");
|
||||
this.noiseGen.heightScale = tag.getFloat("HeightScale");
|
||||
|
@ -1009,7 +1015,6 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.seaRarity = tag.getInteger("SeaRarity");
|
||||
this.addRarity = tag.getInteger("AddRarity");
|
||||
// this.biomeRarity = tag.getInteger("BiomeRarity");
|
||||
this.seaLevel = tag.getInteger("SeaLevel");
|
||||
this.defaultBiome = Biome.findByName(tag.getString("DefaultBiome"));
|
||||
this.semiFixed = tag.getBoolean("SemiFixed");
|
||||
this.defaultWeather = Weather.getByName(tag.getString("DefaultWeather"));
|
||||
|
@ -1021,7 +1026,6 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.surface = BlockRegistry.getFromIdName(tag.getString("SurfaceBlock"), Blocks.grass.getState());
|
||||
this.alt1 = BlockRegistry.getFromIdName(tag.getString("AltBlock1"), Blocks.gravel.getState());
|
||||
this.alt2 = BlockRegistry.getFromIdName(tag.getString("AltBlock2"), Blocks.sand.getState());
|
||||
this.liquid = BlockRegistry.getFromIdName(tag.getString("LiquidBlock"), Blocks.water.getState());
|
||||
this.floor = tag.hasKey("FloorBlock", 8) ?
|
||||
BlockRegistry.getFromIdName(tag.getString("FloorBlock"), Blocks.bedrock.getState()) : null;
|
||||
this.ceiling = tag.hasKey("CeilingBlock", 8) ?
|
||||
|
@ -1197,18 +1201,24 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
}
|
||||
|
||||
public final NBTTagCompound toNbt(boolean generator) {
|
||||
return this.toNbt(generator, false);
|
||||
return this.toNbt(generator, !generator, false);
|
||||
}
|
||||
|
||||
private final NBTTagCompound toNbt(boolean generator, boolean all) {
|
||||
private final NBTTagCompound toNbt(boolean generator, boolean partialGen, boolean all) {
|
||||
NBTTagCompound tag = (all || !generator || this.id >= UniverseRegistry.MORE_DIM_ID) ? this.toNbt() : new NBTTagCompound();
|
||||
if(this == Space.INSTANCE) {
|
||||
if(generator)
|
||||
if(generator || partialGen)
|
||||
tag.setLong("Seed", this.seed);
|
||||
return tag;
|
||||
}
|
||||
if(generator) {
|
||||
if(generator || partialGen) {
|
||||
tag.setLong("Seed", this.seed);
|
||||
if(partialGen || all || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
||||
tag.setInteger("SeaLevel", this.seaLevel);
|
||||
tag.setString("LiquidBlock", BlockRegistry.toIdName(this.liquid));
|
||||
}
|
||||
}
|
||||
if(generator) {
|
||||
if(all || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
||||
tag.setFloat("CoordScale", this.noiseGen.coordinateScale);
|
||||
tag.setFloat("HeightScale", this.noiseGen.heightScale);
|
||||
|
@ -1245,7 +1255,6 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
tag.setInteger("SeaRarity", this.seaRarity);
|
||||
tag.setInteger("AddRarity", this.addRarity);
|
||||
// tag.setInteger("BiomeRarity", this.biomeRarity);
|
||||
tag.setInteger("SeaLevel", this.seaLevel);
|
||||
// if(this.defaultBiome != null)
|
||||
tag.setString("DefaultBiome", this.defaultBiome.name.toLowerCase());
|
||||
// if(this.mainBiome != null)
|
||||
|
@ -1257,7 +1266,6 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
tag.setString("SurfaceBlock", BlockRegistry.toIdName(this.surface));
|
||||
tag.setString("AltBlock1", BlockRegistry.toIdName(this.alt1));
|
||||
tag.setString("AltBlock2", BlockRegistry.toIdName(this.alt2));
|
||||
tag.setString("LiquidBlock", BlockRegistry.toIdName(this.liquid));
|
||||
if(this.floor != null)
|
||||
tag.setString("FloorBlock", BlockRegistry.toIdName(this.floor));
|
||||
if(this.ceiling != null)
|
||||
|
|
|
@ -1746,7 +1746,7 @@ public abstract class EntityLiving extends Entity
|
|||
this.motionY = 0.2D;
|
||||
}
|
||||
|
||||
if (this.worldObj.client && (!this.worldObj.isBlockLoaded(new BlockPos((int)this.posX, 0, (int)this.posZ)) || !this.worldObj.getChunk(new BlockPos((int)this.posX, 0, (int)this.posZ)).isLoaded()))
|
||||
if (this.worldObj.client && (!this.worldObj.isBlockLoaded(new BlockPos((int)this.posX, 0, (int)this.posZ)) || !this.worldObj.getChunk(new BlockPos((int)this.posX, 0, (int)this.posZ)).isLoaded()) && !this.isPlayer())
|
||||
{
|
||||
if (this.posY > 0.0D)
|
||||
{
|
||||
|
|
|
@ -395,10 +395,6 @@ public class Chunk {
|
|||
return block;
|
||||
}
|
||||
|
||||
public Block getBlock(int x, int y, int z) {
|
||||
return this.getBlock0(x & 15, y, z & 15);
|
||||
}
|
||||
|
||||
public Block getBlock(BlockPos pos) {
|
||||
return this.getBlock0(pos.getX() & 15, pos.getY(), pos.getZ() & 15);
|
||||
}
|
||||
|
@ -799,7 +795,7 @@ public class Chunk {
|
|||
return this.modified;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
public boolean isDummy() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
|
||||
protected boolean isLoaded(int x, int z, boolean allowEmpty) {
|
||||
return allowEmpty || !this.getChunk(x, z).isEmpty();
|
||||
return allowEmpty || !this.getChunk(x, z).isDummy();
|
||||
}
|
||||
|
||||
public Chunk getChunk(BlockPos pos) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue