initial 3d region test
This commit is contained in:
parent
a7fe2db49f
commit
8f0c0f7170
30 changed files with 491 additions and 1563 deletions
|
@ -157,7 +157,6 @@ import common.util.LazyLoadBase;
|
|||
import common.util.Util;
|
||||
import common.util.HitPosition.ObjectType;
|
||||
import common.world.Chunk;
|
||||
import common.world.LightType;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
|
@ -1730,30 +1729,22 @@ public class Client implements IThreadListener {
|
|||
break;
|
||||
}
|
||||
|
||||
Biome biome = null;
|
||||
String bline;
|
||||
String lline;
|
||||
String light;
|
||||
if(this.world.isBlockLoaded(blockpos)) {
|
||||
Chunk chunk = this.world.getChunk(blockpos);
|
||||
biome = chunk.getBiome(blockpos, null);
|
||||
bline = "Biom: " + biome.display + " (" + biome.id + ")" + /* (this.debugHideInfo ? "" : */ (", D: " +
|
||||
TextColor.stripCodes(this.world.dimension.getFormattedName(false)) +
|
||||
" (" + this.world.dimension.getDimensionId() + ")");
|
||||
lline = "Licht: " + chunk.getLightSub(blockpos, 0) + " (" + chunk.getLight(LightType.SKY, blockpos) + " Himmel, "
|
||||
+ chunk.getLight(LightType.BLOCK, blockpos) + " Blöcke, " + String.format(
|
||||
light = "Licht: " + chunk.getLightSub(blockpos, 0) + " ("
|
||||
+ chunk.getLight(blockpos) + " Blöcke, " + String.format(
|
||||
"%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt), A: "
|
||||
+ String.format("%.3f", this.world.getCelestialAngle(1.0f));
|
||||
}
|
||||
else {
|
||||
bline = "Biom: <?>, D: " +
|
||||
TextColor.stripCodes(this.world.dimension.getFormattedName(false)) +
|
||||
" (" + this.world.dimension.getDimensionId() + ")";
|
||||
lline = "Licht: " + String.format(
|
||||
light = "Licht: " + String.format(
|
||||
"%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt, A: "
|
||||
+ String.format("%.3f", this.world.getCelestialAngle(1.0f));
|
||||
}
|
||||
|
||||
float temp = this.world.getTempOffset() + (biome != null ? biome.getTemperature(blockpos) : 0.0f);
|
||||
float temp = this.world.getTemperatureK(blockpos);
|
||||
Biome biome = this.world.getBiomeGenForCoords(blockpos);
|
||||
long ticked = System.currentTimeMillis() - this.lastTicked;
|
||||
|
||||
return
|
||||
|
@ -1778,8 +1769,10 @@ public class Client implements IThreadListener {
|
|||
String.format(" (Zoom x%.1f)", this.zoomLevel) : "") + "\n" +
|
||||
String.format("Richtung: %s (%.1f / %.1f)", dirStr,
|
||||
ExtMath.wrapf(entity.rotYaw), ExtMath.wrapf(entity.rotPitch)) + "\n" +
|
||||
bline + "\n" +
|
||||
lline + "\n" +
|
||||
"Biom: " + biome.display + " (" + biome.id + ")" + (", D: " +
|
||||
TextColor.stripCodes(this.world.dimension.getFormattedName(false)) +
|
||||
" (" + this.world.dimension.getDimensionId() + ")") + "\n" +
|
||||
light + "\n" +
|
||||
String.format("Zeit: %d T, R %d / %d T, U %d / %d T",
|
||||
this.world.getDayTime(),
|
||||
this.world.getDayTime() % this.world.dimension.getRotationalPeriod(),
|
||||
|
|
|
@ -1143,7 +1143,7 @@ public class EntityRenderer {
|
|||
|
||||
for (int l = 0; l < k; ++l)
|
||||
{
|
||||
BlockPos blockpos1 = world.getPrecipitationHeight(blockpos.add(this.random.zrange(i) - this.random.zrange(i), 0, this.random.zrange(i) - this.random.zrange(i)));
|
||||
BlockPos blockpos1 = world.getHeight(blockpos.add(this.random.zrange(i) - this.random.zrange(i), 0, this.random.zrange(i) - this.random.zrange(i)));
|
||||
Biome biomegenbase = world.getBiomeGenForCoords(blockpos1);
|
||||
BlockPos blockpos2 = blockpos1.down();
|
||||
Block block = world.getState(blockpos2).getBlock();
|
||||
|
@ -1189,7 +1189,7 @@ public class EntityRenderer {
|
|||
{
|
||||
this.rainSoundCounter = 0;
|
||||
|
||||
if (d1 > (double)(blockpos.getY() + 1) && world.getPrecipitationHeight(blockpos).getY() > ExtMath.floorf((float)blockpos.getY()))
|
||||
if (d1 > (double)(blockpos.getY() + 1) && world.getHeight(blockpos).getY() > ExtMath.floorf((float)blockpos.getY()))
|
||||
{
|
||||
this.gm.world.playSound(d0, d1, d2, n >= j ? this.pickMoltenSound() : SoundEvent.RAIN, n >= j ? 0.2f : 0.1F);
|
||||
}
|
||||
|
@ -1257,7 +1257,7 @@ public class EntityRenderer {
|
|||
|
||||
// if (biomegenbase.canRain() || biomegenbase.isSnowyBiome())
|
||||
// {
|
||||
int j2 = world.getPrecipitationHeight(blockpos$mutableblockpos).getY();
|
||||
int j2 = world.getHeight(blockpos$mutableblockpos).getY();
|
||||
int k2 = j - i1;
|
||||
int l2 = j + i1;
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import common.util.Vec3i;
|
|||
import common.world.Chunk;
|
||||
import common.world.ChunkCache;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.LightType;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -32,14 +31,16 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess
|
|||
boolean empty = true;
|
||||
for (int i1 = posFromIn.getX() >> 4; i1 <= posToIn.getX() >> 4; ++i1)
|
||||
{
|
||||
for (int j1 = posFromIn.getZ() >> 4; j1 <= posToIn.getZ() >> 4; ++j1)
|
||||
{
|
||||
Chunk chunk = this.chunkArray[i1 - this.chunkX][j1 - this.chunkZ];
|
||||
|
||||
if (chunk != null && !chunk.isEmpty(posFromIn.getY(), posToIn.getY()))
|
||||
{
|
||||
empty = false;
|
||||
}
|
||||
for (int n1 = posFromIn.getY() >> 4; n1 <= posToIn.getY() >> 4; ++n1) {
|
||||
for (int j1 = posFromIn.getZ() >> 4; j1 <= posToIn.getZ() >> 4; ++j1)
|
||||
{
|
||||
Chunk chunk = this.chunkArray[i1 - this.chunkX][n1 - this.chunkY][j1 - this.chunkZ];
|
||||
|
||||
if (chunk != null && !chunk.isEmpty())
|
||||
{
|
||||
empty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.empty = empty;
|
||||
|
@ -53,8 +54,9 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess
|
|||
public TileEntity getTileEntity(BlockPos pos)
|
||||
{
|
||||
int i = (pos.getX() >> 4) - this.chunkX;
|
||||
int n = (pos.getY() >> 4) - this.chunkY;
|
||||
int j = (pos.getZ() >> 4) - this.chunkZ;
|
||||
return this.chunkArray[i][j].getTileEntity(pos, TileEntity.EnumCreateEntityType.QUEUED);
|
||||
return this.chunkArray[i][n][j].getTileEntity(pos, TileEntity.EnumCreateEntityType.QUEUED);
|
||||
}
|
||||
|
||||
public int getCombinedLight(BlockPos pos, int lightValue)
|
||||
|
@ -87,16 +89,10 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess
|
|||
|
||||
private State getBlockStateRaw(BlockPos pos)
|
||||
{
|
||||
if (pos.getY() >= 0 && pos.getY() < 512)
|
||||
{
|
||||
int i = (pos.getX() >> 4) - this.chunkX;
|
||||
int j = (pos.getZ() >> 4) - this.chunkZ;
|
||||
return this.chunkArray[i][j].getState(pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
return DEFAULT_STATE;
|
||||
}
|
||||
int i = (pos.getX() >> 4) - this.chunkX;
|
||||
int n = (pos.getY() >> 4) - this.chunkY;
|
||||
int j = (pos.getZ() >> 4) - this.chunkZ;
|
||||
return this.chunkArray[i][n][j].getState(pos);
|
||||
}
|
||||
|
||||
private int getPositionIndex(BlockPos p_175630_1_)
|
||||
|
@ -114,15 +110,14 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess
|
|||
|
||||
public int getLight(BlockPos pos, int lightValue)
|
||||
{
|
||||
int i = this.getLightForExt(LightType.SKY, pos);
|
||||
int j = this.getLightForExt(LightType.BLOCK, pos);
|
||||
int j = this.getLightForExt(pos);
|
||||
|
||||
if (j < lightValue)
|
||||
{
|
||||
j = lightValue;
|
||||
}
|
||||
|
||||
return i << 20 | j << 4;
|
||||
return 15 << 20 | j << 4;
|
||||
}
|
||||
|
||||
public Biome getBiomeGenForCoords(BlockPos pos)
|
||||
|
@ -130,74 +125,43 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess
|
|||
return this.worldObj.getBiomeGenForCoords(pos);
|
||||
}
|
||||
|
||||
private int getLightForExt(LightType p_175629_1_, BlockPos pos)
|
||||
private int getLightForExt(BlockPos pos)
|
||||
{
|
||||
if (p_175629_1_ == LightType.SKY && this.worldObj.dimension.hasNoLight())
|
||||
if (this.getState(pos).getBlock().getSumBrightness())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (pos.getY() >= 0 && pos.getY() < 512)
|
||||
{
|
||||
if (this.getState(pos).getBlock().getSumBrightness())
|
||||
int l = 0;
|
||||
|
||||
for (Facing enumfacing : Facing.values())
|
||||
{
|
||||
int l = 0;
|
||||
int k = this.getLightFor(pos.offset(enumfacing));
|
||||
|
||||
for (Facing enumfacing : Facing.values())
|
||||
if (k > l)
|
||||
{
|
||||
int k = this.getLightFor(p_175629_1_, pos.offset(enumfacing));
|
||||
|
||||
if (k > l)
|
||||
{
|
||||
l = k;
|
||||
}
|
||||
|
||||
if (l >= 15)
|
||||
{
|
||||
return l;
|
||||
}
|
||||
l = k;
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = (pos.getX() >> 4) - this.chunkX;
|
||||
int j = (pos.getZ() >> 4) - this.chunkZ;
|
||||
return this.chunkArray[i][j].getLight(p_175629_1_, pos);
|
||||
if (l >= 15)
|
||||
{
|
||||
return l;
|
||||
}
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
else
|
||||
{
|
||||
return p_175629_1_.defValue;
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Checks to see if an air block exists at the provided location. Note that this only checks to see if the blocks
|
||||
// * material is set to air, meaning it is possible for non-vanilla blocks to still pass this check.
|
||||
// */
|
||||
// public boolean isAirBlock(BlockPos pos)
|
||||
// {
|
||||
// return this.getBlockState(pos).getBlock().getMaterial() == Material.air;
|
||||
// }
|
||||
|
||||
public int getLightFor(LightType p_175628_1_, BlockPos pos)
|
||||
{
|
||||
if (pos.getY() >= 0 && pos.getY() < 512)
|
||||
{
|
||||
int i = (pos.getX() >> 4) - this.chunkX;
|
||||
int n = (pos.getX() >> 4) - this.chunkY;
|
||||
int j = (pos.getZ() >> 4) - this.chunkZ;
|
||||
return this.chunkArray[i][j].getLight(p_175628_1_, pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
return p_175628_1_.defValue;
|
||||
return this.chunkArray[i][n][j].getLight(pos);
|
||||
}
|
||||
}
|
||||
|
||||
// public int getStrongPower(BlockPos pos, EnumFacing direction)
|
||||
// {
|
||||
// IBlockState iblockstate = this.getBlockState(pos);
|
||||
// return iblockstate.getBlock().getStrongPower(this, pos, iblockstate, direction);
|
||||
// }
|
||||
|
||||
public int getLightFor(BlockPos pos)
|
||||
{
|
||||
int i = (pos.getX() >> 4) - this.chunkX;
|
||||
int n = (pos.getY() >> 4) - this.chunkY;
|
||||
int j = (pos.getZ() >> 4) - this.chunkZ;
|
||||
return this.chunkArray[i][n][j].getLight(pos);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,21 +10,10 @@ import common.tileentity.TileEntity;
|
|||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.world.Chunk;
|
||||
import common.world.LightType;
|
||||
|
||||
public class EmptyChunk extends Chunk {
|
||||
public EmptyChunk(WorldClient world) {
|
||||
super(world, 0, 0);
|
||||
}
|
||||
|
||||
public int getHeight(int x, int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void genHeights() {
|
||||
}
|
||||
|
||||
public void genSkyLight() {
|
||||
super(world, 0, 0, 0);
|
||||
}
|
||||
|
||||
public Block getBlock(BlockPos pos) {
|
||||
|
@ -39,11 +28,11 @@ public class EmptyChunk extends Chunk {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public int getLight(LightType type, BlockPos pos) {
|
||||
return type.defValue;
|
||||
public int getLight(BlockPos pos) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setLight(LightType type, BlockPos pos, int value) {
|
||||
public void setLight(BlockPos pos, int value) {
|
||||
}
|
||||
|
||||
public int getLightSub(BlockPos pos, int amount) {
|
||||
|
@ -56,10 +45,6 @@ public class EmptyChunk extends Chunk {
|
|||
public void removeEntity(Entity entity) {
|
||||
}
|
||||
|
||||
public boolean canSeeSky(BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity(BlockPos pos, TileEntity.EnumCreateEntityType type) {
|
||||
return null;
|
||||
}
|
||||
|
@ -88,15 +73,15 @@ public class EmptyChunk extends Chunk {
|
|||
public <T extends Entity> void getEntities(Class<? extends T> clazz, BoundingBox bb, List<T> list, Predicate<? super T> pred) {
|
||||
}
|
||||
|
||||
public boolean isDirty() {
|
||||
public boolean isDirty(long time) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isDummy() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isEmpty(int bottom, int top) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ public class WorldClient extends AWorldClient
|
|||
else
|
||||
{
|
||||
Chunk chunk = this.getChunk(x, z);
|
||||
if (!chunk.isEmpty())
|
||||
if (!chunk.isDummy())
|
||||
{
|
||||
chunk.onChunkUnload();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue