diff --git a/client/src/client/Client.java b/client/src/client/Client.java index ba5d0d2..3ac6dda 100755 --- a/client/src/client/Client.java +++ b/client/src/client/Client.java @@ -95,7 +95,6 @@ import client.window.Wheel; import client.window.Window; import client.window.WindowEvent; import client.world.WorldClient; -import common.biome.Biome; import common.block.Block; import common.collect.Lists; import common.collect.Maps; @@ -158,7 +157,6 @@ import common.util.Util; import common.util.HitPosition.ObjectType; import common.world.Chunk; import common.world.State; -import common.world.World; import io.netty.bootstrap.Bootstrap; import io.netty.channel.Channel; import io.netty.channel.ChannelException; @@ -426,8 +424,9 @@ public class Client implements IThreadListener { public int soundBufferSize = 2048; @Variable(name = "snd_frame_size", category = CVarCategory.SOUND, min = 2, max = 8192, display = "PCM-Intervall") public int soundFrameSize = 32; - + private String serverInfo; + private String tickInfo; private int lastTickTime = -1; private AudioInterface audio; private boolean cfgDirty; @@ -1652,10 +1651,11 @@ public class Client implements IThreadListener { this.serverInfo = info; } - public void setLastTick(int time) { + public void setLastTick(int time, String info) { if(this.lastTickTime >= 0) { this.lastTicked = System.currentTimeMillis(); this.lastTickTime = time; + this.tickInfo = info; } } @@ -1729,30 +1729,20 @@ 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) + " (" + 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); + long ticked = System.currentTimeMillis() - this.lastTicked; return @@ -1777,8 +1767,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" + + "Dimension: " + (this.world.isExterminated() ? "[zerstört] " : "") + + 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(), @@ -1786,10 +1778,7 @@ public class Client implements IThreadListener { this.world.getDayTime() % this.world.dimension.getOrbitalPeriod(), this.world.dimension.getOrbitalPeriod() ) + "\n" + - String.format("Laub: %s%s, T: %.2f K / %.2f °C, %s (R %.1f, %.1f)", - !this.world.dimension.getType().days ? "*" : "", - this.world.getLeavesGen(blockpos).getDisplayName(), - temp, World.ABSOLUTE_ZERO + temp, + String.format("Wetter: %s (R %.1f, %.1f)", this.world.getWeather().getDisplay(), this.world.getRainStrength(), this.world.getDarkness() ) + "\n" + @@ -1799,7 +1788,8 @@ public class Client implements IThreadListener { String.format("Letzte Zeitsynch.: + %d.%d s", ticked / 1000L, (ticked / 100L) % 10L ) + - (this.serverInfo != null ? "\n" + this.serverInfo : "") + (this.serverInfo != null ? "\n" + this.serverInfo : "") + + (this.tickInfo != null ? "\n" + this.tickInfo : "") // IWorldServer world = this.server.getWorld(this.theWorld.dimension.getDimensionId()); // if(world != null) // list.add("Seed: " + world.getSeed()); @@ -1866,7 +1856,7 @@ public class Client implements IThreadListener { "Eigens.: " + (entity.dead ? "D" : " ") + (entity.noClip ? "N" : " ") + (entity.onGround ? "G" : " ") + (entity.canBeCollidedWith() ? "C" : " ") + (entity.canBePushed() ? "P" : " ") + (entity.isBurning() ? "B" : " ") // + (entity.isInvisible() ? "I" : " ") // + (entity.isSilent() ? "S" : " ") - + (entity.isWet() ? "W" : " ") + (entity.canAttackWithItem() ? "A" : " ") + + (entity.canAttackWithItem() ? "A" : " ") + (entity.passenger != null ? "H" : " ") + (entity.vehicle != null ? "R" : " ") + (entity instanceof EntityLiving ? ("+" /* + (((EntityLivingBase)entity).isEntityUndead() ? "U" : " ") */ // + (((EntityLivingBase)entity).isChild() ? "C" : " ") + (((EntityLiving)entity).doesEntityNotTriggerPressurePlate() ? "P" : " ")) : "") + "\n" + @@ -2608,6 +2598,7 @@ public class Client implements IThreadListener { if(Client.this.lastTickTime >= 0) { Client.this.performAction(Action.STOP_PROFILING); Client.this.lastTickTime = -1; + Client.this.tickInfo = null; } else { Client.this.performAction(Action.START_PROFILING); diff --git a/client/src/client/network/ClientPlayer.java b/client/src/client/network/ClientPlayer.java index eb3c533..fd0f656 100755 --- a/client/src/client/network/ClientPlayer.java +++ b/client/src/client/network/ClientPlayer.java @@ -94,7 +94,6 @@ import common.packet.S39PacketPlayerAbilities; import common.packet.S3APacketTabComplete; import common.packet.S43PacketUpdateEntityNBT; import common.packet.SPacketAnimation; -import common.packet.SPacketBiomes; import common.packet.SPacketBlockAction; import common.packet.SPacketBlockBreakAnim; import common.packet.SPacketBlockChange; @@ -753,7 +752,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer { NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController); - if (packetIn.hasBiomes()) + if (packetIn.isResend()) { if (packetIn.getExtractedSize() == 0) { @@ -766,23 +765,15 @@ public class ClientPlayer extends NetHandler implements IClientPlayer // this.clientWorldController.invalidateBlockReceiveRegion(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15); Chunk chunk = this.clientWorldController.getChunk(packetIn.getChunkX(), packetIn.getChunkZ()); - chunk.setData(packetIn.getExtractedDataBytes(), packetIn.getExtractedSize(), packetIn.hasBiomes()); + chunk.setData(packetIn.getExtractedDataBytes(), packetIn.getExtractedSize(), packetIn.isResend()); this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15); - if (!packetIn.hasBiomes() || this.clientWorldController.dimension.hasNoLight()) // TODO: check + if (!packetIn.isResend() || this.clientWorldController.dimension.hasNoLight()) // TODO: check { chunk.resetRelight(); } } - public void handleBiomes(SPacketBiomes packetIn) - { - NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController); - Chunk chunk = this.clientWorldController.getChunk(packetIn.getChunkX(), packetIn.getChunkZ()); - chunk.setBiomes(packetIn.getBiomes()); - this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15); - } - /** * Updates the block and metadata and generates a blockupdate (and notify the clients) */ @@ -998,7 +989,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer public void handleServerTick(SPacketServerTick packet) { NetHandler.checkThread(packet, this, this.gameController); - this.gameController.setLastTick(packet.getTime()); + this.gameController.setLastTick(packet.getTime(), packet.getServerinfo()); } // public void handleCompass(SPacketCompass packetIn) @@ -1441,9 +1432,6 @@ public class ClientPlayer extends NetHandler implements IClientPlayer case FOG_STRENGTH: this.clientWorldController.setFogStrength(packetIn.getFloat(true)); break; - case TEMPERATURE: - this.clientWorldController.setTemperature(packetIn.getFloat(false)); - break; } } diff --git a/client/src/client/renderer/EntityRenderer.java b/client/src/client/renderer/EntityRenderer.java index 3904914..36a3002 100755 --- a/client/src/client/renderer/EntityRenderer.java +++ b/client/src/client/renderer/EntityRenderer.java @@ -14,7 +14,6 @@ import client.renderer.particle.EffectRenderer; import client.renderer.texture.DynamicTexture; import client.renderer.texture.TextureMap; import client.world.WorldClient; -import common.biome.Biome; import common.block.Block; import common.entity.Entity; import common.entity.npc.EntityNPC; @@ -1144,10 +1143,9 @@ 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.getY() + 48, 64); - Biome biomegenbase = world.getBiomeGenForCoords(blockpos1); BlockPos blockpos2 = blockpos1.down(); Block block = world.getState(blockpos2).getBlock(); - float temp = World.ABSOLUTE_ZERO + world.getTempOffset() + biomegenbase.getTemperature(blockpos1); + float temp = 10.0f; // world.getTemperatureC(blockpos1); TODO: fix particles if (blockpos1.getY() <= blockpos.getY() + i && blockpos1.getY() >= blockpos.getY() - i && /* biomegenbase.canRain() && */ temp > 0.0F) { @@ -1253,7 +1251,6 @@ public class EntityRenderer { double d3 = (double)this.rainXCoords[i2] * 0.5D; double d4 = (double)this.rainYCoords[i2] * 0.5D; blockpos$mutableblockpos.set(l1, 0, k1); - Biome biomegenbase = world.getBiomeGenForCoords(blockpos$mutableblockpos); // if (biomegenbase.canRain() || biomegenbase.isSnowyBiome()) // { @@ -1282,7 +1279,7 @@ public class EntityRenderer { { this.random.setSeed((long)(l1 * l1 * 3121 + l1 * 45238971 ^ k1 * k1 * 418711 + k1 * 13761)); blockpos$mutableblockpos.set(l1, k2, k1); - float f2 = World.ABSOLUTE_ZERO + world.getTempOffset() + biomegenbase.getTemperature(blockpos$mutableblockpos); + float f2 = 10.0f; // world.getTemperatureC(blockpos$mutableblockpos); TODO: fix particles if(f2 >= 194.0f) { diff --git a/client/src/client/renderer/RegionRenderCache.java b/client/src/client/renderer/RegionRenderCache.java index 12fab08..4ea9417 100755 --- a/client/src/client/renderer/RegionRenderCache.java +++ b/client/src/client/renderer/RegionRenderCache.java @@ -2,7 +2,6 @@ package client.renderer; import java.util.Arrays; -import common.biome.Biome; import common.init.Blocks; import common.tileentity.TileEntity; import common.util.BlockPos; @@ -122,12 +121,7 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess return 15 << 20 | j << 4; } - - public Biome getBiomeGenForCoords(BlockPos pos) - { - return this.worldObj.getBiomeGenForCoords(pos); - } - + private int getLightForExt(BlockPos pos) { if (pos.getY() >= 0 && pos.getY() < 512) diff --git a/client/src/client/renderer/entity/RenderWolf.java b/client/src/client/renderer/entity/RenderWolf.java index 3fb1bf1..66ae7d7 100755 --- a/client/src/client/renderer/entity/RenderWolf.java +++ b/client/src/client/renderer/entity/RenderWolf.java @@ -1,6 +1,5 @@ package client.renderer.entity; -import client.renderer.GlState; import client.renderer.layers.LayerWolfCollar; import client.renderer.model.ModelBase; import common.entity.animal.EntityWolf; @@ -25,21 +24,7 @@ public class RenderWolf extends RenderLiving { return livingBase.getTailRotation(); } - - /** - * Renders the desired {@code T} type Entity. - */ - public void doRender(EntityWolf entity, double x, double y, double z, float partialTicks) - { - if (entity.isWolfWet()) - { - float f = entity.getBrightness(partialTicks) * entity.getShadingWhileWet(partialTicks); - GlState.color(f, f, f, 1.0F); - } - - super.doRender(entity, x, y, z, partialTicks); - } - + /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ diff --git a/client/src/client/renderer/model/ModelWolf.java b/client/src/client/renderer/model/ModelWolf.java index 7bb6909..acc9ff4 100755 --- a/client/src/client/renderer/model/ModelWolf.java +++ b/client/src/client/renderer/model/ModelWolf.java @@ -157,10 +157,7 @@ public class ModelWolf extends ModelBase this.wolfLeg4.rotateAngleX = ExtMath.cos(p_78086_2_ * 0.6662F) * 1.4F * p_78086_3_; } - this.wolfHeadMain.rotateAngleZ = entitywolf.getInterestedAngle(partialTickTime) + entitywolf.getShakeAngle(partialTickTime, 0.0F); - this.wolfMane.rotateAngleZ = entitywolf.getShakeAngle(partialTickTime, -0.08F); - this.wolfBody.rotateAngleZ = entitywolf.getShakeAngle(partialTickTime, -0.16F); - this.wolfTail.rotateAngleZ = entitywolf.getShakeAngle(partialTickTime, -0.2F); + this.wolfHeadMain.rotateAngleZ = entitywolf.getInterestedAngle(partialTickTime); } /** diff --git a/client/src/client/world/WorldClient.java b/client/src/client/world/WorldClient.java index ab87696..096ad5c 100755 --- a/client/src/client/world/WorldClient.java +++ b/client/src/client/world/WorldClient.java @@ -7,7 +7,6 @@ import java.util.Set; import client.Client; import client.renderer.particle.EntityFX; import client.renderer.particle.EntityFirework; -import common.biome.Biome; import common.block.Block; import common.collect.Lists; import common.collect.Maps; @@ -52,6 +51,7 @@ public class WorldClient extends AWorldClient // public final Profiler profiler; protected int lastLightning; protected Vec3 lightColor = new Vec3(0xffffff); + protected boolean exterminated; public WorldClient(Client gm, boolean debug, Dimension dim) { @@ -759,19 +759,16 @@ public class WorldClient extends AWorldClient } public Vec3 getSkyColor(Entity entity, float partial) { - BlockPos pos = new BlockPos(ExtMath.floord(entity.posX), ExtMath.floord(entity.posY), - ExtMath.floord(entity.posZ)); - Biome biome = this.getBiomeGenForCoords(pos); Vec3 vec; - if(biome.skyColor != 0xffffffff) - vec = new Vec3(biome.skyColor); + if(this.exterminated) + vec = new Vec3(0x101010); else vec = new Vec3(this.dimension.getSkyColor()); if(this.dimension.getType().days) { float mult = ExtMath.clampf(ExtMath.cos(this.getCelestialAngle(partial) * (float)Math.PI * 2.0F) * 2.0F + 0.5F, 0.0F, 1.0F); if(this.dimension.getSkyColor() == 0xffffffff) { - float temp = ExtMath.clampf(((biome.getTemperature(pos) + 14.0f) / 40.0f + 0.15f) / 3.0F, + float temp = ExtMath.clampf(((0.0f /* temp */ + 14.0f) / 40.0f + 0.15f) / 3.0F, -1.0F, 1.0F); Vec3 sky = new Vec3(hsvToRGB(0.62222224F - temp * 0.05F, 0.5F + temp * 0.1F, 1.0F)); vec = new Vec3(vec.xCoord * sky.xCoord * mult, vec.yCoord * sky.yCoord * mult, vec.zCoord * sky.zCoord * mult); @@ -817,10 +814,8 @@ public class WorldClient extends AWorldClient public Vec3 getCloudColour(Entity entity, float partialTicks) { Vec3 color = new Vec3(this.dimension.getCloudColor()); - Biome biome = this.getBiomeGenForCoords(new BlockPos(ExtMath.floord(entity.posX), ExtMath.floord(entity.posY), - ExtMath.floord(entity.posZ))); - if(biome.cloudColor != 0xffffffff) - color = new Vec3(biome.cloudColor); + if(this.exterminated) + color = new Vec3(0x000000); float r = (float)color.xCoord; float g = (float)color.yCoord; float b = (float)color.zCoord; @@ -856,10 +851,8 @@ public class WorldClient extends AWorldClient public Vec3 getFogColor(Entity entity, float partialTicks) { Vec3 color = new Vec3(this.dimension.getFogColor()); - Biome biome = this.getBiomeGenForCoords(new BlockPos(ExtMath.floord(entity.posX), ExtMath.floord(entity.posY), - ExtMath.floord(entity.posZ))); - if(biome.fogColor != 0xffffffff) - color = new Vec3(biome.fogColor); + if(this.exterminated) + color = new Vec3(0x303030); if(!this.dimension.getType().days) return color; float sun = ExtMath.clampf(ExtMath.cos(this.getCelestialAngle(partialTicks) * (float)Math.PI * 2.0F) * 2.0F + 0.5F, @@ -932,4 +925,12 @@ public class WorldClient extends AWorldClient public boolean hasNoChunks() { return this.chunkListing.isEmpty(); } + + public void setExterminated(boolean exterminated) { + this.exterminated = exterminated; + } + + public boolean isExterminated() { + return this.exterminated; + } } diff --git a/common/src/common/biome/Biome.java b/common/src/common/biome/Biome.java index b02260c..935453e 100644 --- a/common/src/common/biome/Biome.java +++ b/common/src/common/biome/Biome.java @@ -5,12 +5,10 @@ import java.util.Map; import common.collect.Lists; import common.collect.Maps; -import common.color.Colorizer; import common.log.Log; import common.rng.PerlinGen; import common.rng.Random; import common.util.BlockPos; -import common.util.ExtMath; public enum Biome { NONE(0, "none", "", 0x000000), @@ -19,16 +17,16 @@ public enum Biome { EXTREMEHILLS(3, "extremeHills", "Extremes Bergland", 0x606060, -12.0f, 30.0f), FOREST(4, "forest", "Wald", 0x056621, 8.0f, 80.0f), TAIGA(5, "taiga", "Taiga", 0x0b6659, -10.0f, 80.0f), - SWAMPLAND(6, "swampland", "Sumpf", 0x07f9b2, 12.0f, 90.0f, 0xe0ffae, 0xffffffff, 6975545), + SWAMPLAND(6, "swampland", "Sumpf", 0x07f9b2, 12.0f, 90.0f), RIVER(7, "river", "Fluss", 0x0000ff), - EXTERMINATED(8, "exterminated", "Ausgelöscht", 0x000000, 150.0f, 0.0f, 0x202020, 0x303030, 0x303030, 0x101010, 0x303030, 0x000000), + EXTERMINATED(8, "exterminated", "Ausgelöscht", 0x000000, 150.0f, 0.0f), SPACE(9, "space", "Leere des Weltraums", 0x000000, 0.0f, 0.0f), FROZENSEA(10, "frozenSea", "Vereister See", 0x9090a0, -20.0f), FROZENRIVER(11, "frozenRiver", "Vereister Fluss", 0xa0a0ff, -20.0f), ICEPLAINS(12, "icePlains", "Eisebene", 0xffffff, -20.0f), ICEMOUNTAINS(13, "iceMountains", "Vereistes Bergland", 0xa0a0a0, -20.0f), MUSHROOMPLAINS(14, "mushroomPlains", "Pilzland", 0xff00ff, 16.0f, 100.0f), - BLACKENED(15, "blackened", "Schwarz", 0x000000, 0.0f, 0.0f, 0x000000, 0x303030, 0x303030), + BLACKENED(15, "blackened", "Schwarz", 0x000000, 0.0f, 0.0f), BEACH(16, "beach", "Strand", 0xfade55, 12.0f, 40.0f), DESERTHILLS(17, "desertHills", "Wüsten-Bergland", 0xd25f12, 60.0f, 0.0f), FORESTHILLS(18, "forestHills", "Wald-Bergland", 0x22551c, 8.0f, 80.0f), @@ -50,17 +48,17 @@ public enum Biome { EXTREMEHILLSPLUS(34, "extremeHillsPlus", "Extremes Bergland +", 0x507050, -12.0f, 30.0f), SAVANNA(35, "savanna", "Savanne", 0xbdb25f, 28.0f, 0.0f), SAVANNAPLATEAU(36, "savannaPlateau", "Savannen-Plateau", 0xa79d64, 20.0f, 0.0f), - MESA(37, "mesa", "Mesa", 0xd94515, 0.0f, 0.0f, 0xffffff, 9470285, 10387789), - MESAPLATEAUF(38, "mesaPlateauF", "Mesa-Waldplateau", 0xb09765, 0.0f, 0.0f, 0xffffff, 9470285, 10387789), - MESAPLATEAU(39, "mesaPlateau", "Mesa-Plateau", 0xca8c65, 0.0f, 0.0f, 0xffffff, 9470285, 10387789), + MESA(37, "mesa", "Mesa", 0xd94515, 0.0f, 0.0f), + MESAPLATEAUF(38, "mesaPlateauF", "Mesa-Waldplateau", 0xb09765, 0.0f, 0.0f), + MESAPLATEAU(39, "mesaPlateau", "Mesa-Plateau", 0xca8c65, 0.0f, 0.0f), SNOWLAND(40, "snowLand", "Eisland", 0xffffff, 0.0f, 100.0f), TIAN(41, "tian", "Tian", 0x808080, 0.0f, 80.0f), ELVENFOREST(42, "elvenForest", "Elbenwald", 0x059821, 8.0f, 90.0f), - UPPERHELL(43, "upperHell", "Übergang in die Hölle", 0xff0000, 0.0f, 0.0f, 0x000000, 0x000000, 0x000000), - LOWERHELL(44, "lowerHell", "Abgrund der Hölle", 0xff0000, 0.0f, 0.0f, 0x000000, 0x000000, 0x000000), - HELLHILLS(45, "hellHills", "Bergland der Hölle", 0xff0000, 0.0f, 0.0f, 0x000000, 0x000000, 0x000000), - SOULPLAINS(46, "soulPlains", "Seelenland", 0xff0000, 0.0f, 0.0f, 0x000000, 0x000000, 0x000000), - ASHLAND(47, "ashLand", "Verbrannt", 0xff0000, 0.0f, 0.0f, 0x000000, 0x000000, 0x000000), + UPPERHELL(43, "upperHell", "Übergang in die Hölle", 0xff0000, 0.0f, 0.0f), + LOWERHELL(44, "lowerHell", "Abgrund der Hölle", 0xff0000, 0.0f, 0.0f), + HELLHILLS(45, "hellHills", "Bergland der Hölle", 0xff0000, 0.0f, 0.0f), + SOULPLAINS(46, "soulPlains", "Seelenland", 0xff0000, 0.0f, 0.0f), + ASHLAND(47, "ashLand", "Verbrannt", 0xff0000, 0.0f, 0.0f), MOON(48, "moon", "Mondoberfläche", 0xa0a0a0, 0.0f, 0.0f), CHAOS(49, "chaos", "Chaos", 0xff00ff), @@ -68,7 +66,7 @@ public enum Biome { EXTREMEHILLSM(131, "extremeHillsM", "Extremes Bergland M", 0x606060, -12.0f, 30.0f), FLOWERFOREST(132, "flowerForest", "Blumenwald", 0x6a7425, 8.0f, 80.0f), TAIGAM(133, "taigaM", "Taiga M", 0x0b6659, -10.0f, 80.0f), - SWAMPLANDM(134, "swamplandM", "Sumpf M", 0x07f9b2, 12.0f, 90.0f, 0xe0ffae, 0xffffffff, 6975545), + SWAMPLANDM(134, "swamplandM", "Sumpf M", 0x07f9b2, 12.0f, 90.0f), ICEPLAINSSPIKES(140, "icePlainsSpikes", "Eisebene + Spitzen", 0xd2ffff, -20.0f), JUNGLEM(149, "jungleM", "Urwald M", 0x537b09, 18.0f, 90.0f), JUNGLEEDGEM(151, "jungleEdgeM", "Urwald Gr. M", 0x628b17, 18.0f, 80.0f), @@ -81,28 +79,20 @@ public enum Biome { EXTREMEHILLSPLUSM(162, "extremeHillsPlusM", "Extremes Bergland + M", 0x507050, -12.0f, 30.0f), SAVANNAM(163, "savannaM", "Savanne M", 0xbdb25f, 24.0f, 0.0f), SAVANNAPLATEAUM(164, "savannaPlateauM", "Savannen-Plateau M", 0xa79d64, 20.0f, 0.0f), - MESABRYCE(165, "mesaBryce", "Mesa (Bryce)", 0xd94515, 0.0f, 0.0f, 0xffffff, 9470285, 10387789), - MESAPLATEAUFM(166, "mesaPlateauFM", "Mesa-Waldplateau M", 0xb09765, 0.0f, 0.0f, 0xffffff, 9470285, 10387789), - MESAPLATEAUM(167, "mesaPlateauM", "Mesa-Plateau M", 0xca8c65, 0.0f, 0.0f, 0xffffff, 9470285, 10387789); + MESABRYCE(165, "mesaBryce", "Mesa (Bryce)", 0xd94515, 0.0f, 0.0f), + MESAPLATEAUFM(166, "mesaPlateauFM", "Mesa-Waldplateau M", 0xb09765, 0.0f, 0.0f), + MESAPLATEAUM(167, "mesaPlateauM", "Mesa-Plateau M", 0xca8c65, 0.0f, 0.0f); public static final Biome DEF_BIOME = FOREST; private static final PerlinGen TEMP_NOISE = new PerlinGen(new Random(836430928262265276L), 1); - private static final PerlinGen COLOR_NOISE = new PerlinGen(new Random(6549321755809421L), 1); private static final Biome[] BIOMES = new Biome[256]; private static final Map LOOKUP = Maps.newTreeMap(); public final int id; public final String name; public final String display; - public final int color; public final float temperature; public final float humidity; - public final int waterColor; - public final int grassColor; - public final int foliageColor; - public final int skyColor; - public final int fogColor; - public final int cloudColor; static { for(Biome biome : values()) { @@ -159,35 +149,20 @@ public enum Biome { return biome; } - private Biome(int id, String name, String display, int color, float temperature, float humidity, int waterColor, int grassColor, int foliageColor, int skyColor, int fogColor, int cloudColor) { + private Biome(int id, String name, String display, int color, float temperature, float humidity) { this.id = id; this.name = name; this.display = display; this.temperature = temperature; this.humidity = humidity; - this.color = color; - this.waterColor = waterColor; - this.grassColor = grassColor; - this.foliageColor = foliageColor; - this.skyColor = skyColor; - this.fogColor = fogColor; - this.cloudColor = cloudColor; } - - private Biome(int id, String name, String display, int color, float temperature, float humidity, int waterColor, int grassColor, int foliageColor) { - this(id, name, display, color, temperature, humidity, waterColor, grassColor, foliageColor, 0xffffffff, 0xffffffff, 0xffffffff); - } - - private Biome(int id, String name, String display, int color, float temperature, float humidity) { - this(id, name, display, color, temperature, humidity, 0xffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff); - } - + private Biome(int id, String name, String display, int color, float temperature) { - this(id, name, display, color, temperature, 50.0f, 0xffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff); + this(id, name, display, color, temperature, 50.0f); } private Biome(int id, String name, String display, int color) { - this(id, name, display, color, 0.0f, 50.0f, 0xffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff); + this(id, name, display, color, 0.0f, 50.0f); } public final float getTemperature(BlockPos pos) { @@ -206,30 +181,4 @@ public enum Biome { public boolean isHighHumidity() { return this.humidity > 85.0f; } - - // skycolor = ((temp + 14) / 40 + 0.15) / 3 - - public int getGrassColorAtPos(BlockPos pos) { - if(this.grassColor != 0xffffffff) - return this.grassColor; - if(this == SWAMPLAND || this == SWAMPLANDM) { - double d0 = COLOR_NOISE.generate((double)pos.getX() * 0.0225D, (double)pos.getZ() * 0.0225D); - return d0 < -0.1D ? 5011004 : 6975545; - } - if(this == ELVENFOREST) - return Colorizer.getGrassColor(1.0f, this.humidity * 0.01f); - double d0 = (double)ExtMath.clampf((this.getTemperature(pos) + 14.0f) / 40.0f + 0.15f, 0.0F, 1.0F); - double d1 = (double)ExtMath.clampf(this.humidity * 0.01f, 0.0F, 1.0F); - return this == ROOFEDFOREST || this == ROOFEDFORESTM ? (Colorizer.getGrassColor(d0, d1) & 16711422) + 2634762 >> 1 : Colorizer.getGrassColor(d0, d1); - } - - public int getFoliageColorAtPos(BlockPos pos) { - if(this.foliageColor != 0xffffffff) - return this.foliageColor; - if(this == ELVENFOREST) - return Colorizer.getFoliageColor(1.0f, this.humidity * 0.01f); - double d0 = (double)ExtMath.clampf((this.getTemperature(pos) + 14.0f) / 40.0f + 0.15f, 0.0F, 1.0F); - double d1 = (double)ExtMath.clampf(this.humidity * 0.01f, 0.0F, 1.0F); - return Colorizer.getFoliageColor(d0, d1); - } } diff --git a/common/src/common/block/BlockFire.java b/common/src/common/block/BlockFire.java index e0bc2f7..0af399f 100755 --- a/common/src/common/block/BlockFire.java +++ b/common/src/common/block/BlockFire.java @@ -232,7 +232,7 @@ public class BlockFire extends Block } } - protected boolean canDie(World worldIn, BlockPos pos) + protected boolean canDie(AWorldServer worldIn, BlockPos pos) { return worldIn.isRainingAt(pos, true) || worldIn.isRainingAt(pos.west(), true) || worldIn.isRainingAt(pos.east(), true) || worldIn.isRainingAt(pos.north(), true) || worldIn.isRainingAt(pos.south(), true); } @@ -254,7 +254,7 @@ public class BlockFire extends Block return integer == null ? 0 : integer.intValue(); } - private void catchOnFire(World worldIn, BlockPos pos, int chance, Random random, int age) + private void catchOnFire(AWorldServer worldIn, BlockPos pos, int chance, Random random, int age) { int i = this.getFlammability(worldIn.getState(pos).getBlock()); diff --git a/common/src/common/block/BlockIce.java b/common/src/common/block/BlockIce.java index aa42cc3..438dd31 100755 --- a/common/src/common/block/BlockIce.java +++ b/common/src/common/block/BlockIce.java @@ -45,7 +45,7 @@ public class BlockIce extends BlockBreakable } else { - if (worldIn.doesWaterVaporize(pos)) + if (((AWorldServer)worldIn).doesWaterVaporize(pos)) { worldIn.setBlockToAir(pos); return; diff --git a/common/src/common/block/BlockLeaves.java b/common/src/common/block/BlockLeaves.java index 8c2014a..1c9a795 100755 --- a/common/src/common/block/BlockLeaves.java +++ b/common/src/common/block/BlockLeaves.java @@ -16,7 +16,6 @@ import common.item.ItemStack; import common.material.Material; import common.model.Model; import common.model.ModelProvider; -import common.model.ParticleType; import common.properties.IProperty; import common.properties.PropertyBool; import common.properties.PropertyEnum; @@ -215,13 +214,13 @@ public class BlockLeaves extends BlockLeavesBase public void randomDisplayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) { - if (worldIn.isRainingAt(pos.up(), true) && !worldIn.isBlockSolid(pos.down()) && rand.chance(15)) // == 1 - { - double d0 = (double)((float)pos.getX() + rand.floatv()); - double d1 = (double)pos.getY() - 0.05D; - double d2 = (double)((float)pos.getZ() + rand.floatv()); - worldIn.spawnParticle(ParticleType.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D); - } +// if (worldIn.isRainingAt(pos.up(), true) && !worldIn.isBlockSolid(pos.down()) && rand.chance(15)) // == 1 TODO: fix particles +// { +// double d0 = (double)((float)pos.getX() + rand.floatv()); +// double d1 = (double)pos.getY() - 0.05D; +// double d2 = (double)((float)pos.getZ() + rand.floatv()); +// worldIn.spawnParticle(ParticleType.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D); +// } } private void destroy(World worldIn, BlockPos pos) diff --git a/common/src/common/block/BlockLiquid.java b/common/src/common/block/BlockLiquid.java index 9f036fd..88ad69f 100755 --- a/common/src/common/block/BlockLiquid.java +++ b/common/src/common/block/BlockLiquid.java @@ -215,7 +215,7 @@ public abstract class BlockLiquid extends Block */ public int tickRate(World worldIn, BlockPos pos) { - return this.flowRate >= 0 ? this.flowRate : (worldIn.isLavaFaster(pos) ? (-this.flowRate / 3) : (-this.flowRate)); + return this.flowRate >= 0 ? this.flowRate : (!worldIn.client && ((AWorldServer)worldIn).isLavaFaster(pos) ? (-this.flowRate / 3) : (-this.flowRate)); } public int getMixedBrightnessForBlock(IWorldAccess worldIn, BlockPos pos) diff --git a/common/src/common/block/BlockReed.java b/common/src/common/block/BlockReed.java index 8d7b151..216f4dd 100755 --- a/common/src/common/block/BlockReed.java +++ b/common/src/common/block/BlockReed.java @@ -1,5 +1,6 @@ package common.block; +import common.color.Colorizer; import common.init.Blocks; import common.init.Config; import common.init.Items; @@ -154,7 +155,7 @@ public class BlockReed extends Block public int colorMultiplier(IWorldAccess worldIn, BlockPos pos, int renderPass) { - return worldIn.getBiomeGenForCoords(pos).getGrassColorAtPos(pos); + return Colorizer.getGrassColor(1.0f, 0.9f); } public BlockLayer getBlockLayer() diff --git a/common/src/common/block/BlockTallGrass.java b/common/src/common/block/BlockTallGrass.java index a527f19..1e169ee 100755 --- a/common/src/common/block/BlockTallGrass.java +++ b/common/src/common/block/BlockTallGrass.java @@ -82,7 +82,7 @@ public class BlockTallGrass extends BlockBush implements IGrowable public int colorMultiplier(IWorldAccess worldIn, BlockPos pos, int renderPass) { - return worldIn.getBiomeGenForCoords(pos).getGrassColorAtPos(pos); + return Colorizer.getGrassColor(1.0f, 0.9f); } /** diff --git a/common/src/common/block/BlockVine.java b/common/src/common/block/BlockVine.java index ed6f33b..968a396 100755 --- a/common/src/common/block/BlockVine.java +++ b/common/src/common/block/BlockVine.java @@ -226,7 +226,7 @@ public class BlockVine extends Block public int colorMultiplier(IWorldAccess worldIn, BlockPos pos, int renderPass) { - return worldIn.getBiomeGenForCoords(pos).getFoliageColorAtPos(pos); + return Colorizer.getFoliageColor(1.0f, 0.9f); } /** diff --git a/common/src/common/color/Colorizer.java b/common/src/common/color/Colorizer.java index dcae2c9..9e58742 100755 --- a/common/src/common/color/Colorizer.java +++ b/common/src/common/color/Colorizer.java @@ -1,6 +1,5 @@ package common.color; -import common.biome.Biome; import common.util.BlockPos; import common.world.IWorldAccess; @@ -8,22 +7,22 @@ public enum Colorizer { NONE(0xffffff), BASIC(0x37b500), PINE(0x3f993f), BIRCH(0x68a723); private interface ColorResolver { - int getColorAtPos(Biome biome, BlockPos pos); + int getColorAtPos(BlockPos pos); } private static final ColorResolver GRASS_COLOR = new ColorResolver() { - public int getColorAtPos(Biome biome, BlockPos pos) { - return biome.getGrassColorAtPos(pos); + public int getColorAtPos(BlockPos pos) { + return Colorizer.getGrassColor(1.0f, 0.9f); } }; private static final ColorResolver FOLIAGE_COLOR = new ColorResolver() { - public int getColorAtPos(Biome biome, BlockPos pos) { - return biome.getFoliageColorAtPos(pos); + public int getColorAtPos(BlockPos pos) { + return Colorizer.getFoliageColor(1.0f, 0.9f); } }; private static final ColorResolver WATER_COLOR_MULTIPLIER = new ColorResolver() { - public int getColorAtPos(Biome biome, BlockPos pos) { - return biome.waterColor; + public int getColorAtPos(BlockPos pos) { + return 0xffffff; } }; private static final int[] GRASS = new int[65536]; @@ -60,7 +59,7 @@ public enum Colorizer { int b = 0; for(BlockPos.MutableBlockPos loc : BlockPos.getAllInBoxMutable(pos.add(-1, 0, -1), pos.add(1, 0, 1))) { - int c = resolver.getColorAtPos(access.getBiomeGenForCoords(loc), loc); + int c = resolver.getColorAtPos(loc); r += (c & 16711680) >> 16; g += (c & 65280) >> 8; b += c & 255; diff --git a/common/src/common/entity/Entity.java b/common/src/common/entity/Entity.java index 59c59a1..04d12af 100755 --- a/common/src/common/entity/Entity.java +++ b/common/src/common/entity/Entity.java @@ -342,7 +342,7 @@ public abstract class Entity this.setOnFireFromLava(); this.fallDistance *= 0.5F; } - else if(this.worldObj.canBurnAt(this.getPosition()) && this.isInDownfall()) { + else if(!this.worldObj.client && ((AWorldServer)this.worldObj).canBurnAt(this.getPosition()) && this.isInDownfall()) { this.setOnFireFromMolten(); } @@ -773,7 +773,7 @@ public abstract class Entity this.doBlockCollisions(); - boolean flag2 = this.isWet(); + boolean flag2 = !this.worldObj.client && this.isWet(); if (this.worldObj.isFlammableWithin(this.getEntityBoundingBox().contract(0.001D, 0.001D, 0.001D))) { @@ -949,17 +949,14 @@ public abstract class Entity } } - /** - * Checks if this entity is either in water or on an open air block in rain (used in wolves). - */ public boolean isWet() { - return this.inLiquid || this.worldObj.isRainingAt(new BlockPos(this.posX, this.posY, this.posZ), true) || this.worldObj.isRainingAt(new BlockPos(this.posX, this.posY + (double)this.height, this.posZ), true); + return this.inLiquid || ((AWorldServer)this.worldObj).isRainingAt(new BlockPos(this.posX, this.posY, this.posZ), true) || ((AWorldServer)this.worldObj).isRainingAt(new BlockPos(this.posX, this.posY + (double)this.height, this.posZ), true); } public boolean isInDownfall() { - return this.worldObj.isRainingAt(new BlockPos(this.posX, this.posY, this.posZ), false) || this.worldObj.isRainingAt(new BlockPos(this.posX, this.posY + (double)this.height, this.posZ), false); + return ((AWorldServer)this.worldObj).isRainingAt(new BlockPos(this.posX, this.posY, this.posZ), false) || ((AWorldServer)this.worldObj).isRainingAt(new BlockPos(this.posX, this.posY + (double)this.height, this.posZ), false); } /** diff --git a/common/src/common/entity/animal/EntityHorse.java b/common/src/common/entity/animal/EntityHorse.java index 7352c24..b26f87e 100755 --- a/common/src/common/entity/animal/EntityHorse.java +++ b/common/src/common/entity/animal/EntityHorse.java @@ -38,6 +38,7 @@ import common.pathfinding.PathNavigateGround; import common.potion.Potion; import common.util.BlockPos; import common.util.ExtMath; +import common.world.AWorldServer; import common.world.World; public class EntityHorse extends EntityAnimal implements IInvBasic @@ -390,7 +391,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic { int i = ExtMath.floord(this.posX); int j = ExtMath.floord(this.posZ); - this.worldObj.getBiomeGenForCoords(new BlockPos(i, 0, j)); + ((AWorldServer)this.worldObj).getBiomeGenForCoords(new BlockPos(i, 0, j)); return true; } diff --git a/common/src/common/entity/animal/EntitySheep.java b/common/src/common/entity/animal/EntitySheep.java index dae424c..ab6c7ba 100755 --- a/common/src/common/entity/animal/EntitySheep.java +++ b/common/src/common/entity/animal/EntitySheep.java @@ -33,6 +33,7 @@ import common.nbt.NBTTagCompound; import common.pathfinding.PathNavigateGround; import common.rng.Random; import common.util.ExtMath; +import common.world.AWorldServer; import common.world.World; public class EntitySheep extends EntityAnimal @@ -347,7 +348,7 @@ public class EntitySheep extends EntityAnimal public Object onInitialSpawn(Object livingdata) { livingdata = super.onInitialSpawn(livingdata); - this.setFleeceColor(getRandomSheepColor(this.worldObj.rand, this.worldObj.getBiomeGenForCoords(this.getPosition()))); + this.setFleeceColor(getRandomSheepColor(this.worldObj.rand, ((AWorldServer)this.worldObj).getBiomeGenForCoords(this.getPosition()))); return livingdata; } diff --git a/common/src/common/entity/animal/EntityWolf.java b/common/src/common/entity/animal/EntityWolf.java index caa4b4a..c10da66 100755 --- a/common/src/common/entity/animal/EntityWolf.java +++ b/common/src/common/entity/animal/EntityWolf.java @@ -30,30 +30,15 @@ import common.init.SoundEvent; import common.item.Item; import common.item.ItemFood; import common.item.ItemStack; -import common.model.ParticleType; import common.nbt.NBTTagCompound; import common.pathfinding.PathNavigateGround; -import common.util.ExtMath; import common.world.World; public class EntityWolf extends EntityTameable { - /** Float used to smooth the rotation of the wolf head */ private float headRotationCourse; private float headRotationCourseOld; - - /** true is the wolf is wet else false */ - private boolean isWet; - - /** True if the wolf is shaking else False */ - private boolean isShaking; - - /** - * This time increases while wolf is shaking and emitting water particles. - */ - private float timeWolfIsShaking; - private float prevTimeWolfIsShaking; - + public EntityWolf(World worldIn) { super(worldIn); @@ -204,15 +189,7 @@ public class EntityWolf extends EntityTameable public void onLivingUpdate() { super.onLivingUpdate(); - - if (!this.worldObj.client && this.isWet && !this.isShaking && !this.hasPath() && this.onGround) - { - this.isShaking = true; - this.timeWolfIsShaking = 0.0F; - this.prevTimeWolfIsShaking = 0.0F; - this.worldObj.setEntityState(this, (byte)8); - } - + if (!this.worldObj.client && this.getAttackTarget() == null && this.isAngry()) { this.setAngry(false); @@ -235,79 +212,8 @@ public class EntityWolf extends EntityTameable { this.headRotationCourse += (0.0F - this.headRotationCourse) * 0.4F; } - - if (this.isWet()) - { - this.isWet = true; - this.isShaking = false; - this.timeWolfIsShaking = 0.0F; - this.prevTimeWolfIsShaking = 0.0F; - } - else if ((this.isWet || this.isShaking) && this.isShaking) - { - if (this.timeWolfIsShaking == 0.0F) - { - this.playSound(SoundEvent.WOLF_SHAKE, this.getSoundVolume()); - } - - this.prevTimeWolfIsShaking = this.timeWolfIsShaking; - this.timeWolfIsShaking += 0.05F; - - if (this.prevTimeWolfIsShaking >= 2.0F) - { - this.isWet = false; - this.isShaking = false; - this.prevTimeWolfIsShaking = 0.0F; - this.timeWolfIsShaking = 0.0F; - } - - if (this.timeWolfIsShaking > 0.4F) - { - float f = (float)this.getEntityBoundingBox().minY; - int i = (int)(ExtMath.sin((this.timeWolfIsShaking - 0.4F) * (float)Math.PI) * 7.0F); - - for (int j = 0; j < i; ++j) - { - float f1 = (this.rand.floatv() * 2.0F - 1.0F) * this.width * 0.5F; - float f2 = (this.rand.floatv() * 2.0F - 1.0F) * this.width * 0.5F; - this.worldObj.spawnParticle(ParticleType.WATER_SPLASH, this.posX + (double)f1, (double)(f + 0.8F), this.posZ + (double)f2, this.motionX, this.motionY, this.motionZ); - } - } - } } - - /** - * True if the wolf is wet - */ - public boolean isWolfWet() - { - return this.isWet; - } - - /** - * Used when calculating the amount of shading to apply while the wolf is wet. - */ - public float getShadingWhileWet(float p_70915_1_) - { - return 0.75F + (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70915_1_) / 2.0F * 0.25F; - } - - public float getShakeAngle(float p_70923_1_, float p_70923_2_) - { - float f = (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70923_1_ + p_70923_2_) / 1.8F; - - if (f < 0.0F) - { - f = 0.0F; - } - else if (f > 1.0F) - { - f = 1.0F; - } - - return ExtMath.sin(f * (float)Math.PI) * ExtMath.sin(f * (float)Math.PI * 11.0F) * 0.15F * (float)Math.PI; - } - + public float getInterestedAngle(float p_70917_1_) { return (this.headRotationCourseOld + (this.headRotationCourse - this.headRotationCourseOld) * p_70917_1_) * 0.15F * (float)Math.PI; @@ -475,21 +381,7 @@ public class EntityWolf extends EntityTameable return super.interact(player); } - - public void handleStatusUpdate(byte id) - { - if (id == 8) - { - this.isShaking = true; - this.timeWolfIsShaking = 0.0F; - this.prevTimeWolfIsShaking = 0.0F; - } - else - { - super.handleStatusUpdate(id); - } - } - + public float getTailRotation() { return this.isAngry() ? 1.5393804F : (this.isTamed() ? (0.55F - (20.0F - (float)this.dataWatcher.getWatchableObjectInt(18)) * 0.02F) * (float)Math.PI : ((float)Math.PI / 5F)); diff --git a/common/src/common/entity/npc/EntitySlime.java b/common/src/common/entity/npc/EntitySlime.java index 2fb6b0a..08e36f8 100755 --- a/common/src/common/entity/npc/EntitySlime.java +++ b/common/src/common/entity/npc/EntitySlime.java @@ -396,7 +396,7 @@ public class EntitySlime extends EntityNPC // { // if (this.worldObj.getDifficulty() != Difficulty.PEACEFUL) // { - Biome biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos); + Biome biomegenbase = ((AWorldServer)this.worldObj).getBiomeGenForCoords(blockpos); if (biomegenbase == Biome.SWAMPLAND && this.posY > 50.0D && this.posY < 70.0D && this.rand.floatv() < 0.5F && this.rand.floatv() < this.worldObj.getCurrentMoonPhaseFactor() && this.worldObj.getLightFromNeighbors(new BlockPos(this)) <= this.rand.zrange(8)) { diff --git a/common/src/common/entity/projectile/EntityArrow.java b/common/src/common/entity/projectile/EntityArrow.java index 3174775..507198b 100755 --- a/common/src/common/entity/projectile/EntityArrow.java +++ b/common/src/common/entity/projectile/EntityArrow.java @@ -454,7 +454,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData f4 = 0.6F; } - if (this.isWet()) + if (!this.worldObj.client && this.isWet()) { this.extinguish(); } diff --git a/common/src/common/entity/projectile/EntityHook.java b/common/src/common/entity/projectile/EntityHook.java index c2c13c9..6f44d35 100755 --- a/common/src/common/entity/projectile/EntityHook.java +++ b/common/src/common/entity/projectile/EntityHook.java @@ -388,7 +388,7 @@ public class EntityHook extends Entity implements IObjectData int l = 1; BlockPos blockpos = (new BlockPos(this)).up(); - if (this.rand.floatv() < 0.25F && this.worldObj.isRainingAt(blockpos, true)) + if (this.rand.floatv() < 0.25F && worldserver.isRainingAt(blockpos, true)) { l = 2; } diff --git a/common/src/common/entity/types/EntityLiving.java b/common/src/common/entity/types/EntityLiving.java index 117a3fd..abcd0db 100755 --- a/common/src/common/entity/types/EntityLiving.java +++ b/common/src/common/entity/types/EntityLiving.java @@ -314,7 +314,7 @@ public abstract class EntityLiving extends Entity // } // } - if (this.isEntityAlive() && this.isWet()) + if (!this.worldObj.client && this.isEntityAlive() && this.isWet()) { this.extinguish(); } diff --git a/common/src/common/item/ItemBucket.java b/common/src/common/item/ItemBucket.java index 94cb7c2..464a389 100755 --- a/common/src/common/item/ItemBucket.java +++ b/common/src/common/item/ItemBucket.java @@ -249,38 +249,32 @@ public class ItemBucket extends Item { return false; } - else + else if(!worldIn.client) { - if (worldIn.doesWaterVaporize(pos) && this.liquid.getMaterial() == Material.water) + if (((AWorldServer)worldIn).doesWaterVaporize(pos) && this.liquid.getMaterial() == Material.water) { int i = pos.getX(); int j = pos.getY(); int k = pos.getZ(); worldIn.playSound(SoundEvent.FIZZ, (double)((float)i + 0.5F), (double)((float)j + 0.5F), (double)((float)k + 0.5F), 0.5F); - - for (int l = 0; l < 8; ++l) - { - worldIn.spawnParticle(ParticleType.SMOKE_LARGE, (double)i + Math.random(), (double)j + Math.random(), (double)k + Math.random(), 0.0D, 0.0D, 0.0D); - } + ((AWorldServer)worldIn).spawnParticle(ParticleType.SMOKE_LARGE, (double)i, (double)j, (double)k, 8, 1.0D, 1.0D, 1.0D, 0.0f); } else { - if (!worldIn.client && flag && !material.isLiquid()) + if (flag && !material.isLiquid()) { worldIn.destroyBlock(pos, true); } if(this.recursive) { - if(!worldIn.client) - setRecursive((AWorldServer)worldIn, pos, 4, FluidRegistry.getStaticBlock(this.liquid)); + setRecursive((AWorldServer)worldIn, pos, 4, FluidRegistry.getStaticBlock(this.liquid)); } else { worldIn.setState(pos, this.liquid.getState(), 3); } } - - return true; } + return true; } } diff --git a/common/src/common/network/IClientPlayer.java b/common/src/common/network/IClientPlayer.java index b412c36..a1c0704 100644 --- a/common/src/common/network/IClientPlayer.java +++ b/common/src/common/network/IClientPlayer.java @@ -34,7 +34,6 @@ import common.packet.S39PacketPlayerAbilities; import common.packet.S3APacketTabComplete; import common.packet.S43PacketUpdateEntityNBT; import common.packet.SPacketAnimation; -import common.packet.SPacketBiomes; import common.packet.SPacketBlockAction; import common.packet.SPacketBlockBreakAnim; import common.packet.SPacketBlockChange; @@ -100,7 +99,6 @@ public interface IClientPlayer { void handlePlayerPosLook(SPacketPlayerPosLook packetIn); void handleMultiBlockChange(SPacketMultiBlockChange packetIn); void handleChunkData(SPacketChunkData packetIn); - void handleBiomes(SPacketBiomes packetIn); void handleBlockChange(SPacketBlockChange packetIn); void handleDisconnect(SPacketDisconnect packetIn); void handleCollectItem(SPacketCollectItem packetIn); diff --git a/common/src/common/network/PacketRegistry.java b/common/src/common/network/PacketRegistry.java index fd8e7c0..d905ace 100755 --- a/common/src/common/network/PacketRegistry.java +++ b/common/src/common/network/PacketRegistry.java @@ -56,7 +56,6 @@ import common.packet.S39PacketPlayerAbilities; import common.packet.S3APacketTabComplete; import common.packet.S43PacketUpdateEntityNBT; import common.packet.SPacketAnimation; -import common.packet.SPacketBiomes; import common.packet.SPacketBlockAction; import common.packet.SPacketBlockBreakAnim; import common.packet.SPacketBlockChange; @@ -177,7 +176,6 @@ public enum PacketRegistry this.server(SPacketWorld.class); // this.server(SPacketCapes.class); this.server(SPacketCamera.class); - this.server(SPacketBiomes.class); // this.server(S42PacketTitle.class); this.server(S43PacketUpdateEntityNBT.class); // this.server(SPacketBook.class); diff --git a/common/src/common/packet/S2BPacketChangeGameState.java b/common/src/common/packet/S2BPacketChangeGameState.java index 488573a..ba4ca54 100755 --- a/common/src/common/packet/S2BPacketChangeGameState.java +++ b/common/src/common/packet/S2BPacketChangeGameState.java @@ -65,6 +65,6 @@ public class S2BPacketChangeGameState implements Packet } public static enum Action { - SET_WEATHER, RAIN_STRENGTH, DARKNESS, FOG_STRENGTH, TEMPERATURE; + SET_WEATHER, RAIN_STRENGTH, DARKNESS, FOG_STRENGTH; } } diff --git a/common/src/common/packet/SPacketBiomes.java b/common/src/common/packet/SPacketBiomes.java deleted file mode 100755 index 3d83aed..0000000 --- a/common/src/common/packet/SPacketBiomes.java +++ /dev/null @@ -1,50 +0,0 @@ -package common.packet; - -import java.io.IOException; - -import common.network.IClientPlayer; -import common.network.Packet; -import common.network.PacketBuffer; - -public class SPacketBiomes implements Packet { - private int chunkX; - private int chunkZ; - private byte[] biomes; - - public SPacketBiomes() { - } - - public SPacketBiomes(int chunkX, int chunkZ, byte[] biomes) { - this.chunkX = chunkX; - this.chunkZ = chunkZ; - this.biomes = biomes; - } - - public void readPacketData(PacketBuffer buf) throws IOException { - this.chunkX = buf.readInt(); - this.chunkZ = buf.readInt(); - buf.readBytes(this.biomes = new byte[256]); - } - - public void writePacketData(PacketBuffer buf) throws IOException { - buf.writeInt(this.chunkX); - buf.writeInt(this.chunkZ); - buf.writeBytes(this.biomes); - } - - public void processPacket(IClientPlayer handler) { - handler.handleBiomes(this); - } - - public int getChunkX() { - return this.chunkX; - } - - public int getChunkZ() { - return this.chunkZ; - } - - public byte[] getBiomes() { - return this.biomes; - } -} diff --git a/common/src/common/packet/SPacketChunkData.java b/common/src/common/packet/SPacketChunkData.java index 6332281..0878dda 100755 --- a/common/src/common/packet/SPacketChunkData.java +++ b/common/src/common/packet/SPacketChunkData.java @@ -15,18 +15,18 @@ public class SPacketChunkData implements Packet private int chunkX; private int chunkZ; private SPacketChunkData.Extracted extractedData; - private boolean biomes; + private boolean resend; public SPacketChunkData() { } - public SPacketChunkData(Chunk chunkIn, boolean biomes, int segUpdate) + public SPacketChunkData(Chunk chunkIn, boolean resend, int segUpdate) { this.chunkX = chunkIn.xPos; this.chunkZ = chunkIn.zPos; - this.biomes = biomes; - this.extractedData = getExtractedData(chunkIn, biomes, segUpdate); + this.resend = resend; + this.extractedData = getExtractedData(chunkIn, resend, segUpdate); } /** @@ -36,7 +36,7 @@ public class SPacketChunkData implements Packet { this.chunkX = buf.readInt(); this.chunkZ = buf.readInt(); - this.biomes = buf.readBoolean(); + this.resend = buf.readBoolean(); this.extractedData = new SPacketChunkData.Extracted(); this.extractedData.dataSize = buf.readInt(); this.extractedData.data = buf.readByteArray(); @@ -49,7 +49,7 @@ public class SPacketChunkData implements Packet { buf.writeInt(this.chunkX); buf.writeInt(this.chunkZ); - buf.writeBoolean(this.biomes); + buf.writeBoolean(this.resend); buf.writeInt(this.extractedData.dataSize); buf.writeByteArray(this.extractedData.data); } @@ -67,12 +67,11 @@ public class SPacketChunkData implements Packet return this.extractedData.data; } - protected static int getSize(int segments, boolean biomes) + protected static int getSize(int segments) { int i = segments * 2 * 16 * 16 * 16; int j = segments * 16 * 16 * 16 / 2; - int l = biomes ? 256 : 0; - return i + j + l; + return i + j; } public static SPacketChunkData.Extracted getExtractedData(Chunk chunk, boolean biomes, int segUpdate) @@ -92,7 +91,7 @@ public class SPacketChunkData implements Packet } } - s21packetchunkdata$extracted.data = new byte[getSize(Integer.bitCount(s21packetchunkdata$extracted.dataSize), biomes)]; + s21packetchunkdata$extracted.data = new byte[getSize(Integer.bitCount(s21packetchunkdata$extracted.dataSize))]; int j = 0; for (BlockArray extendedblockstorage1 : list) @@ -111,11 +110,6 @@ public class SPacketChunkData implements Packet j = copyTo(extendedblockstorage2.getBlocklight().getData(), s21packetchunkdata$extracted.data, j); } - if (biomes) - { - copyTo(chunk.getBiomes(), s21packetchunkdata$extracted.data, j); - } - return s21packetchunkdata$extracted; } @@ -140,9 +134,9 @@ public class SPacketChunkData implements Packet return this.extractedData.dataSize; } - public boolean hasBiomes() + public boolean isResend() { - return this.biomes; + return this.resend; } public static class Extracted diff --git a/common/src/common/packet/SPacketMapChunkBulk.java b/common/src/common/packet/SPacketMapChunkBulk.java index 09172e0..653352e 100755 --- a/common/src/common/packet/SPacketMapChunkBulk.java +++ b/common/src/common/packet/SPacketMapChunkBulk.java @@ -51,7 +51,7 @@ public class SPacketMapChunkBulk implements Packet this.zPositions[j] = buf.readInt(); this.chunksData[j] = new SPacketChunkData.Extracted(); this.chunksData[j].dataSize = buf.readInt(); - this.chunksData[j].data = new byte[SPacketChunkData.getSize(Integer.bitCount(this.chunksData[j].dataSize), true)]; + this.chunksData[j].data = new byte[SPacketChunkData.getSize(Integer.bitCount(this.chunksData[j].dataSize))]; } for (int k = 0; k < i; ++k) diff --git a/common/src/common/packet/SPacketServerTick.java b/common/src/common/packet/SPacketServerTick.java index 0a9eac1..4cac35c 100644 --- a/common/src/common/packet/SPacketServerTick.java +++ b/common/src/common/packet/SPacketServerTick.java @@ -8,20 +8,24 @@ import common.network.PacketBuffer; public class SPacketServerTick implements Packet { private int time; + private String serverInfo; public SPacketServerTick() { } - public SPacketServerTick(int time) { + public SPacketServerTick(int time, String info) { this.time = time; + this.serverInfo = info; } public void readPacketData(PacketBuffer buf) throws IOException { this.time = buf.readInt(); + this.serverInfo = buf.readStringFromBuffer(64); } public void writePacketData(PacketBuffer buf) throws IOException { buf.writeInt(this.time); + buf.writeString(this.serverInfo); } public void processPacket(IClientPlayer handler) { @@ -31,4 +35,8 @@ public class SPacketServerTick implements Packet { public int getTime() { return this.time; } + + public String getServerinfo() { + return this.serverInfo; + } } diff --git a/common/src/common/tileentity/TileEntityMachine.java b/common/src/common/tileentity/TileEntityMachine.java index 45d9d6b..ab5df5e 100755 --- a/common/src/common/tileentity/TileEntityMachine.java +++ b/common/src/common/tileentity/TileEntityMachine.java @@ -12,6 +12,7 @@ import common.network.Packet; import common.packet.S35PacketUpdateTileEntity; import common.rng.Random; import common.util.ExtMath; +import common.world.AWorldServer; public abstract class TileEntityMachine extends TileEntityLockable implements IHopper, ITickable { public static enum Status { @@ -216,7 +217,7 @@ public abstract class TileEntityMachine extends TileEntityLockable implements IH public void update() { if(this.worldObj != null && !this.worldObj.client && this.status != Status.BROKEN) { - int envTemp = (int)this.worldObj.getTemperatureC(this.getPos()); + int envTemp = (int)((AWorldServer)this.worldObj).getTemperatureC(this.getPos()); if(this.executeFunction()) { this.temperature += this.getTempIncrement(); this.status = this.temperature >= (this.getMaxTemp() * 9) / 10 ? Status.OVERHEAT : Status.RUNNING; diff --git a/common/src/common/world/AWorldServer.java b/common/src/common/world/AWorldServer.java index 3ab7b11..b1d4457 100644 --- a/common/src/common/world/AWorldServer.java +++ b/common/src/common/world/AWorldServer.java @@ -2,7 +2,9 @@ package common.world; import java.util.List; +import common.biome.Biome; import common.block.Block; +import common.block.LeavesType; import common.dimension.Dimension; import common.entity.Entity; import common.entity.npc.EntityNPC; @@ -44,4 +46,12 @@ public abstract class AWorldServer extends World { public abstract boolean isBlockinHighHumidity(BlockPos pos); public abstract T findNearestEntityWithinAABB(Class entityType, BoundingBox aabb, T closestTo); public abstract long getTime(); + public abstract Biome getBiomeGenForCoords(BlockPos pos); + public abstract boolean canBurnAt(BlockPos pos); + public abstract boolean canFreezeAt(BlockPos pos); + public abstract boolean doesWaterVaporize(BlockPos pos); + public abstract boolean isLavaFaster(BlockPos pos); + public abstract LeavesType getLeavesGen(BlockPos pos); + public abstract float getTemperatureC(BlockPos pos); + public abstract boolean isRainingAt(BlockPos strikePosition, boolean wet); } diff --git a/common/src/common/world/Chunk.java b/common/src/common/world/Chunk.java index fb6f0a8..5720983 100755 --- a/common/src/common/world/Chunk.java +++ b/common/src/common/world/Chunk.java @@ -1,6 +1,5 @@ package common.world; -import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentLinkedQueue; @@ -24,7 +23,6 @@ import common.util.ClassInheritanceMultiMap; import common.util.ExtMath; import common.util.Facing; import common.util.NibbleArray; -import common.worldgen.BiomeGenerator; import common.worldgen.DebugStates; public class Chunk { @@ -53,10 +51,9 @@ public class Chunk { for(int y = 0; y < this.entities.length; ++y) { this.entities[y] = new ClassInheritanceMultiMap(Entity.class); } - Arrays.fill(this.biomes, (byte)-1); } - public Chunk(World world, short[] data, int height, State base, State ceil, Random rand, Biome[] biomes, int x, int z) { + public Chunk(World world, short[] data, int height, State base, State ceil, Random rand, int x, int z) { this(world, x, z); for(int bx = 0; bx < 16; ++bx) { for(int bz = 0; bz < 16; ++bz) { @@ -99,9 +96,6 @@ public class Chunk { } } } - for(int n = 0; n < this.biomes.length; ++n) { - this.biomes[n] = (byte)biomes[n].id; - } if(ceil != null) this.resetRelight(); } @@ -549,7 +543,7 @@ public class Chunk { } } - public void setData(byte[] data, int update, boolean biomes) { + public void setData(byte[] data, int update, boolean resend) { int pos = 0; for(int n = 0; n < this.blocks.length; ++n) { @@ -565,7 +559,7 @@ public class Chunk { pos += 2; } } - else if(biomes && this.blocks[n] != null) { + else if(resend && this.blocks[n] != null) { this.blocks[n] = null; } } @@ -578,11 +572,6 @@ public class Chunk { } } - if(biomes) { - System.arraycopy(data, pos, this.biomes, 0, this.biomes.length); -// int unk = pos + this.biomes.length; - } - for(int n = 0; n < this.blocks.length; ++n) { if(this.blocks[n] != null && (update & 1 << n) != 0) { this.blocks[n].update(); @@ -596,35 +585,19 @@ public class Chunk { } } - public Biome getBiome(BlockPos pos, BiomeGenerator gen) { + public Biome getBiome(BlockPos pos) { int x = pos.getX() & 15; int z = pos.getZ() & 15; int o = this.biomes[z << 4 | x] & 255; if(o == 255) { - Biome biome = gen == null ? Biome.DEF_BIOME : gen.getBiomeGenerator(pos, Biome.DEF_BIOME); - o = biome.id; + o = Biome.DEF_BIOME.id; this.biomes[z << 4 | x] = (byte)(o & 255); } return Biome.getBiomeDef(o); } - public byte[] getBiomes() { - return this.biomes; - } - - public void setBiomes(byte[] biomes) { - if(this.biomes.length != biomes.length) { - Log.JNI.warn("Konnte Biome des Chunks nicht setzen, Länge des Arrays ist " + biomes.length + " statt " + this.biomes.length); - } - else { - for(int n = 0; n < this.biomes.length; ++n) { - this.biomes[n] = biomes[n]; - } - } - } - public void resetRelight() { this.lightChecks = 0; } diff --git a/common/src/common/world/IWorldAccess.java b/common/src/common/world/IWorldAccess.java index b798152..3986e79 100755 --- a/common/src/common/world/IWorldAccess.java +++ b/common/src/common/world/IWorldAccess.java @@ -1,6 +1,5 @@ package common.world; -import common.biome.Biome; import common.tileentity.TileEntity; import common.util.BlockPos; @@ -8,5 +7,4 @@ public interface IWorldAccess extends IBlockAccess { TileEntity getTileEntity(BlockPos pos); int getCombinedLight(BlockPos pos, int lightValue); - Biome getBiomeGenForCoords(BlockPos pos); } diff --git a/common/src/common/world/World.java b/common/src/common/world/World.java index dfa0ac1..67d0743 100755 --- a/common/src/common/world/World.java +++ b/common/src/common/world/World.java @@ -6,14 +6,12 @@ import java.util.List; import java.util.Set; import java.util.function.Predicate; -import common.biome.Biome; import common.block.Block; import common.block.BlockHopper; import common.block.BlockLiquid; import common.block.BlockSlab; import common.block.BlockSnow; import common.block.BlockStairs; -import common.block.LeavesType; import common.collect.Lists; import common.collect.Sets; import common.dimension.Dimension; @@ -80,7 +78,6 @@ public abstract class World implements IWorldAccess { protected float rain; protected float darkness; protected float fog; - protected float temp; protected Weather weather; protected long daytime; @@ -132,14 +129,7 @@ public abstract class World implements IWorldAccess { if(Math.abs(this.gravity) < 0.075) this.gravity = Math.signum(this.gravity) * 0.075; } - - public Biome getBiomeGenForCoords(final BlockPos pos) { - if(this.isBlockLoaded(pos)) - return this.getChunk(pos).getBiome(pos, null); - else - return Biome.DEF_BIOME; - } - + public boolean isAirBlock(BlockPos pos) { return this.getState(pos).getBlock().getMaterial() == Material.air; } @@ -1482,7 +1472,6 @@ public abstract class World implements IWorldAccess { this.rain = this.weather.hasDownfall() ? 1.0f : 0.0f; this.darkness = this.weather.isDark() ? 1.0f : 0.0f; this.fog = this.weather.getFogIntensity(); - this.temp = this.getBaseTemperature() + this.weather.getTemperature(); } protected void setActivePlayerChunksAndCheckLight(int l) { @@ -1518,67 +1507,6 @@ public abstract class World implements IWorldAccess { // this.profiler.end(); } - public float getTempOffset() { - return this.temp; - } - - protected float getBaseTemperature() { - return this.dimension.getTemperature() + this.dimension.getOrbitOffset() * - ExtMath.sin((((float)(this.daytime % this.dimension.getOrbitalPeriod()) / (float)this.dimension.getOrbitalPeriod()) - -0.125f) * (float)Math.PI * 2.0f); - } - - public LeavesType getLeavesGen(BlockPos pos) { - return this.canFreezeAt(pos) ? LeavesType.SNOWY : ((!this.dimension.getType().days || this.dimension.getOrbitOffset() == 0.0f) ? - this.dimension.getLeavesType() : LeavesType.values()[(int)((this.daytime % - this.dimension.getOrbitalPeriod()) * (long)LeavesType.values().length / this.dimension.getOrbitalPeriod())]); - } - - public float getTemperatureK(BlockPos pos) { - return this.temp + this.getBiomeGenForCoords(pos).getTemperature(pos); - } - - public float getTemperatureC(BlockPos pos) { - return World.ABSOLUTE_ZERO + this.getTemperatureK(pos); - } - - public boolean canFreezeAt(BlockPos pos) { - return this.getTemperatureC(pos) <= 0.0F; - } - - public boolean canBurnAt(BlockPos pos) { - return this.getTemperatureC(pos) >= 194.0f; - } - - public boolean doesWaterVaporize(BlockPos pos) { - return this.getTemperatureC(pos) >= 100.0f; - } - - public boolean isLavaFaster(BlockPos pos) { - return this.getTemperatureC(pos) >= 314.0f; - } - - public boolean canSnowAt(BlockPos pos, boolean checkLight, boolean allowLayers) { - if(!this.canFreezeAt(pos)) { - return false; - } - else if(!checkLight) { - return true; - } - else { - if(pos.getY() >= 0 && pos.getY() < 512 && this.getLightFor(pos) < 10) { - Block block = this.getState(pos).getBlock(); - - if((block.getMaterial() == Material.air || (allowLayers && block == Blocks.snow_layer)) - && Blocks.snow_layer.canPlaceBlockAt(this, pos)) { - return true; - } - } - - return false; - } - } - public boolean checkLight(BlockPos pos) { return this.checkLightFor(pos); } @@ -2000,11 +1928,7 @@ public abstract class World implements IWorldAccess { public void setFogStrength(float strength) { this.fog = strength; } - - public void setTemperature(float temp) { - this.temp = temp; - } - + public boolean isDark() { return this.darkness > 0.9f; } @@ -2021,20 +1945,6 @@ public abstract class World implements IWorldAccess { return this.hasDownfall() && this.weather.canRain(); } - public boolean isRainingAt(BlockPos strikePosition, boolean wet) { - if(wet ? !this.isRaining() : !this.hasDownfall()) { - return false; - } - else if(this.getPrecipitationHeight(strikePosition, strikePosition.getY() + 46, 48).getY() > strikePosition.getY()) { - return false; - } - return !this.canSnowAt(strikePosition, false, false); -// else { -// Biome biomegenbase = this.getBiomeGenForCoords(strikePosition); -// return biomegenbase.isSnowyBiome() ? false : ( ? false : biomegenbase.canRain()); -// } - } - // public void setItemData(String dataID, WorldSavedData worldSavedDataIn) { // } // diff --git a/server/src/server/Server.java b/server/src/server/Server.java index 8f54ba4..b05cff8 100755 --- a/server/src/server/Server.java +++ b/server/src/server/Server.java @@ -1174,7 +1174,6 @@ public final class Server implements IThreadListener { conn.sendPacket(new S2BPacketChangeGameState(S2BPacketChangeGameState.Action.RAIN_STRENGTH, world.getRainStrength())); conn.sendPacket(new S2BPacketChangeGameState(S2BPacketChangeGameState.Action.DARKNESS, world.getDarkness())); conn.sendPacket(new S2BPacketChangeGameState(S2BPacketChangeGameState.Action.FOG_STRENGTH, world.getFogStrength())); - conn.sendPacket(new S2BPacketChangeGameState(S2BPacketChangeGameState.Action.TEMPERATURE, world.getTempOffset())); } public void syncPlayerInventory(EntityNPC player) { diff --git a/server/src/server/network/Player.java b/server/src/server/network/Player.java index f42a452..b5cbd23 100755 --- a/server/src/server/network/Player.java +++ b/server/src/server/network/Player.java @@ -254,7 +254,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer this.sendPacket(new SPacketKeepAlive(this.pingKey)); } if(this.admin && this.profiling) - this.sendPacket(new SPacketServerTick((int)this.server.getLastTick())); + this.sendPacket(new SPacketServerTick((int)this.server.getLastTick(), this.getTickInfo())); if(this.respawnTimer > 0) { if(--this.respawnTimer == 0) { this.respawnPlayer(); @@ -262,6 +262,18 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer } } + private String getTickInfo() { + if(this.charEditor || this.entity == null) + return ""; + WorldServer world = this.getEntityWorld(); + BlockPos pos = this.entity.getPosition(); + return String.format("Temperatur: %.2f K / %.2f °C, L: %s%s", + world.getTemperatureK(pos), world.getTemperatureC(pos), + !world.dimension.getType().days ? "*" : "", + world.getLeavesGen(pos).getDisplayName() + ); + } + public void displayLoading(String message) { this.sendPacket(new SPacketLoading(message)); } diff --git a/server/src/server/world/Region.java b/server/src/server/world/Region.java index de680a3..573f860 100755 --- a/server/src/server/world/Region.java +++ b/server/src/server/world/Region.java @@ -402,10 +402,6 @@ public class Region { chunk.setStorage(sections); - if(tag.hasKey("Biomes", 7)) { - chunk.setBiomes(tag.getByteArray("Biomes")); - } - NBTTagList entities = tag.getTagList("Entities", 10); if(entities != null) { @@ -529,7 +525,6 @@ public class Region { } tag.setTag("Sections", sects); - tag.setByteArray("Biomes", chunk.getBiomes()); chunk.setHasEntities(false); NBTTagList entities = new NBTTagList(); diff --git a/server/src/server/world/WorldServer.java b/server/src/server/world/WorldServer.java index 2282cfc..53461a0 100755 --- a/server/src/server/world/WorldServer.java +++ b/server/src/server/world/WorldServer.java @@ -20,6 +20,7 @@ import common.block.BlockEventData; import common.block.BlockFalling; import common.block.BlockLiquid; import common.block.BlockSnow; +import common.block.LeavesType; import common.collect.Lists; import common.collect.Maps; import common.collect.Sets; @@ -51,7 +52,6 @@ import common.packet.S29PacketSoundEffect; import common.packet.S2APacketParticles; import common.packet.S2BPacketChangeGameState; import common.packet.S2CPacketSpawnGlobalEntity; -import common.packet.SPacketBiomes; import common.packet.SPacketBlockAction; import common.packet.SPacketBlockBreakAnim; import common.packet.SPacketBlockChange; @@ -78,7 +78,6 @@ import common.world.AWorldServer; import common.world.State; import common.world.Weather; import common.world.World; -import common.worldgen.BiomeGenerator; import common.worldgen.FeatureLake; import common.worldgen.FeatureLiquid; import common.worldgen.FeatureOre; @@ -91,6 +90,7 @@ import server.village.VillageCollection; import server.worldgen.BiomeGenLayered; import server.worldgen.BiomeGenPerlin; import server.worldgen.BiomeGenSingle; +import server.worldgen.BiomeGenerator; import server.worldgen.BlockReplacer; import server.worldgen.ChunkGenerator; import server.worldgen.ChunkPrimer; @@ -177,6 +177,7 @@ public final class WorldServer extends AWorldServer { private boolean loadersModified; // private boolean warpsModified; private boolean exterminated; + private float temp; private int emptyTicks; private int blockEvtIdx; private int trackDistance; @@ -621,11 +622,84 @@ public final class WorldServer extends AWorldServer { return this.biomeGen; } - public Biome getBiomeGenForCoords(final BlockPos pos) { - if(this.isBlockLoaded(pos)) - return this.getChunk(pos).getBiome(pos, this.biomeGen); - else - return this.biomeGen.getBiomeGenerator(pos, Biome.DEF_BIOME); + public Biome getBiomeGenForCoords(BlockPos pos) { + return this.biomeGen.getBiomeGenerator(pos, Biome.DEF_BIOME); + } + + protected void calculateInitialWeather() { + super.calculateInitialWeather(); + this.temp = this.getBaseTemperature() + this.weather.getTemperature(); + } + + public float getTempOffset() { + return this.temp; + } + + protected float getBaseTemperature() { + return this.dimension.getTemperature() + this.dimension.getOrbitOffset() * + ExtMath.sin((((float)(this.daytime % this.dimension.getOrbitalPeriod()) / (float)this.dimension.getOrbitalPeriod()) + -0.125f) * (float)Math.PI * 2.0f); + } + + public LeavesType getLeavesGen(BlockPos pos) { + return this.canFreezeAt(pos) ? LeavesType.SNOWY : ((!this.dimension.getType().days || this.dimension.getOrbitOffset() == 0.0f) ? + this.dimension.getLeavesType() : LeavesType.values()[(int)((this.daytime % + this.dimension.getOrbitalPeriod()) * (long)LeavesType.values().length / this.dimension.getOrbitalPeriod())]); + } + + public float getTemperatureK(BlockPos pos) { + return this.temp + this.getBiomeGenForCoords(pos).getTemperature(pos); + } + + public float getTemperatureC(BlockPos pos) { + return World.ABSOLUTE_ZERO + this.getTemperatureK(pos); + } + + public boolean canFreezeAt(BlockPos pos) { + return this.getTemperatureC(pos) <= 0.0F; + } + + public boolean canBurnAt(BlockPos pos) { + return this.getTemperatureC(pos) >= 194.0f; + } + + public boolean doesWaterVaporize(BlockPos pos) { + return this.getTemperatureC(pos) >= 100.0f; + } + + public boolean isLavaFaster(BlockPos pos) { + return this.getTemperatureC(pos) >= 314.0f; + } + + public boolean canSnowAt(BlockPos pos, boolean checkLight, boolean allowLayers) { + if(!this.canFreezeAt(pos)) { + return false; + } + else if(!checkLight) { + return true; + } + else { + if(pos.getY() >= 0 && pos.getY() < 512 && this.getLightFor(pos) < 10) { + Block block = this.getState(pos).getBlock(); + + if((block.getMaterial() == Material.air || (allowLayers && block == Blocks.snow_layer)) + && Blocks.snow_layer.canPlaceBlockAt(this, pos)) { + return true; + } + } + + return false; + } + } + + public boolean isRainingAt(BlockPos strikePosition, boolean wet) { + if(wet ? !this.isRaining() : !this.hasDownfall()) { + return false; + } + else if(this.getPrecipitationHeight(strikePosition, strikePosition.getY() + 46, 48).getY() > strikePosition.getY()) { + return false; + } + return !this.canSnowAt(strikePosition, false, false); } public void setItemData(String dataID, WorldSavedData worldSavedDataIn) { @@ -1287,10 +1361,6 @@ public final class WorldServer extends AWorldServer { else if(this.temp > temp) { this.temp = Math.max((float)((double)this.temp - 0.01D), temp); } - - if(prevTemp != this.temp || force) { - this.server.sendPacket(new S2BPacketChangeGameState(S2BPacketChangeGameState.Action.TEMPERATURE, this.temp), this.dimension.getDimensionId()); - } } // if(this.resetWeather) @@ -1633,7 +1703,7 @@ public final class WorldServer extends AWorldServer { if(this.scatteredGen != null) { this.scatteredGen.generate(this, x, z, primer); } - return new Chunk(this, primer.getData(), primer.height, this.base, this.ceil, this.grng, this.biomes, x, z); + return new Chunk(this, primer.getData(), primer.height, this.base, this.ceil, this.grng, x, z); } public boolean isExterminated() { @@ -1867,17 +1937,6 @@ public final class WorldServer extends AWorldServer { return this.instances.get(v) != null; } - public boolean updateBiomes(int chunkX, int chunkZ) { - ChunkPos v = new ChunkPos(chunkX, chunkZ); - PlayerInstance ins = this.instances.get(v); - if(ins == null) - return false; - Chunk chunk = this.getChunk(chunkX, chunkZ); - chunk.setModified(); - ins.sendToAllPlayersWatchingChunk(new SPacketBiomes(chunkX, chunkZ, chunk.getBiomes())); - return true; - } - private PlayerInstance getPlayerInstance(int chunkX, int chunkZ, boolean create) { ChunkPos v = new ChunkPos(chunkX, chunkZ); PlayerInstance inst = this.instances.get(v); @@ -2243,29 +2302,6 @@ public final class WorldServer extends AWorldServer { // return new LazyBlock(state, this, position); // } - public final boolean setBiome(BlockPos position, Biome biome) { - Chunk chunk = this.getChunk(position); - if((chunk != null) && (chunk.isLoaded())) { - chunk.getBiomes()[((position.getZ() & 0xF) << 4 | position.getX() & 0xF)] = (byte)biome.id; - return true; - } - return false; - } - - public final void setBiomes(BlockPos start, BlockPos end, Biome biome) { - Set chunks = Sets.newHashSet(); - for(int x = start.getX(); x <= end.getX(); x++) { - for(int z = start.getZ(); z <= end.getZ(); z++) { - if(this.setBiome(new BlockPos(x, 0, z), biome)) - chunks.add(new ChunkPos(x >> 4, z >> 4)); - } - } - for(ChunkPos pos : chunks) { - this.updateBiomes(pos.x, pos.z); - } - chunks.clear(); - } - // public final List getEntities(EditRegion region) { // List entities = Lists.newArrayList(); // for(Entity entity : this.entities) { @@ -2802,7 +2838,7 @@ public final class WorldServer extends AWorldServer { private int updates; private int sections; private long prevTime; - private boolean biomes; + private boolean resend; public PlayerInstance(int chunkX, int chunkZ) { this.position = new ChunkPos(chunkX, chunkZ); @@ -2858,7 +2894,7 @@ public final class WorldServer extends AWorldServer { WorldServer.this.toUpdate.add(this); this.updates = 64; this.sections = 0xffffffff; - this.biomes = true; + this.resend = true; } private void increaseInhabitedTime(Chunk chunk) { @@ -2913,7 +2949,7 @@ public final class WorldServer extends AWorldServer { int x = this.position.x * 16; int z = this.position.z * 16; this.sendToAllPlayersWatchingChunk(new SPacketChunkData(WorldServer.this.getChunk(this.position.x, this.position.z), - this.biomes, this.sections)); + this.resend, this.sections)); for(int cy = 0; cy < 32; ++cy) { if((this.sections & 1 << cy) != 0) { @@ -2944,7 +2980,7 @@ public final class WorldServer extends AWorldServer { this.updates = 0; this.sections = 0; - this.biomes = false; + this.resend = false; } } diff --git a/server/src/server/worldgen/BiomeGenLayered.java b/server/src/server/worldgen/BiomeGenLayered.java index b2d892d..0a790ea 100755 --- a/server/src/server/worldgen/BiomeGenLayered.java +++ b/server/src/server/worldgen/BiomeGenLayered.java @@ -9,7 +9,6 @@ import common.collect.Lists; import common.collect.Maps; import common.util.BlockPos; import common.util.ChunkPos; -import common.worldgen.BiomeGenerator; import server.worldgen.layer.GenLayer; import server.worldgen.layer.GenLayerAddAreas; import server.worldgen.layer.GenLayerAddExtra; diff --git a/server/src/server/worldgen/BiomeGenSingle.java b/server/src/server/worldgen/BiomeGenSingle.java index 586058f..cd5bade 100755 --- a/server/src/server/worldgen/BiomeGenSingle.java +++ b/server/src/server/worldgen/BiomeGenSingle.java @@ -5,7 +5,6 @@ import java.util.Set; import common.biome.Biome; import common.util.BlockPos; -import common.worldgen.BiomeGenerator; public class BiomeGenSingle implements BiomeGenerator { private final Biome biome; diff --git a/common/src/common/worldgen/BiomeGenerator.java b/server/src/server/worldgen/BiomeGenerator.java similarity index 96% rename from common/src/common/worldgen/BiomeGenerator.java rename to server/src/server/worldgen/BiomeGenerator.java index b6ef4e9..6d75568 100755 --- a/common/src/common/worldgen/BiomeGenerator.java +++ b/server/src/server/worldgen/BiomeGenerator.java @@ -1,4 +1,4 @@ -package common.worldgen; +package server.worldgen; import java.util.Set; diff --git a/server/src/server/worldgen/structure/StructureVillage.java b/server/src/server/worldgen/structure/StructureVillage.java index 498cec0..0fb61ae 100755 --- a/server/src/server/worldgen/structure/StructureVillage.java +++ b/server/src/server/worldgen/structure/StructureVillage.java @@ -22,8 +22,8 @@ import common.rng.Random; import common.util.BlockPos; import common.util.Facing; import common.world.State; -import common.worldgen.BiomeGenerator; import server.world.WorldServer; +import server.worldgen.BiomeGenerator; import server.worldgen.LootConstants;