fix exterminated state
This commit is contained in:
parent
8b983f15c2
commit
d09b9516a8
13 changed files with 88 additions and 64 deletions
|
@ -23,7 +23,7 @@ public enum Biome implements Identifyable, Displayable {
|
|||
TAIGA(5, "taiga", "Taiga", 0x0b6659, -10.0f, 80.0f),
|
||||
SWAMPLAND(6, "swampland", "Sumpf", 0x07f9b2, 12.0f, 90.0f, 0xe0ffae, 0xffffffff, 6975545),
|
||||
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, 0x202020, 0x303030, 0x303030),
|
||||
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),
|
||||
|
@ -102,9 +102,6 @@ public enum Biome implements Identifyable, Displayable {
|
|||
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()) {
|
||||
|
@ -161,7 +158,7 @@ public enum Biome implements Identifyable, Displayable {
|
|||
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, int waterColor, int grassColor, int foliageColor) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.display = display;
|
||||
|
@ -171,25 +168,18 @@ public enum Biome implements Identifyable, Displayable {
|
|||
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);
|
||||
this(id, name, display, color, temperature, humidity, 0xffffff, 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, 0xffffff, 0xffffffff, 0xffffffff);
|
||||
}
|
||||
|
||||
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, 0xffffff, 0xffffffff, 0xffffffff);
|
||||
}
|
||||
|
||||
public final float getTemperature(BlockPos pos) {
|
||||
|
|
|
@ -779,6 +779,10 @@ public abstract class Dimension extends Nameable {
|
|||
protected int[] calcMoonColors() {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
public boolean isBaseDestroyed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public final int getSunColor() {
|
||||
return this.sunColor != 0xffffffff ? this.sunColor : this.calcSunColor();
|
||||
|
|
|
@ -31,4 +31,8 @@ public final class Moon extends Dimension {
|
|||
Planet planet = UniverseRegistry.getPlanet(this);
|
||||
return planet == null ? super.calcMoonColors() : new int[] {planet.getSkyColor() | (planet.isExterminated() ? 0x80000000 : 0)};
|
||||
}
|
||||
|
||||
public boolean isBaseDestroyed() {
|
||||
return (this.getSunColor() & 0xff000000) != 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,4 +54,8 @@ public final class Planet extends Dimension {
|
|||
}
|
||||
return colors;
|
||||
}
|
||||
|
||||
public boolean isBaseDestroyed() {
|
||||
return (this.getSunColor() & 0xff000000) != 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import common.network.Packet;
|
|||
import common.network.PacketBuffer;
|
||||
|
||||
public class SPacketCelestials implements Packet<IClientPlayer> {
|
||||
private boolean exterminated;
|
||||
private int sunColor;
|
||||
private int[] moonColors;
|
||||
|
||||
|
@ -15,6 +16,7 @@ public class SPacketCelestials implements Packet<IClientPlayer> {
|
|||
}
|
||||
|
||||
public SPacketCelestials(Dimension dim) {
|
||||
this.exterminated = dim.isExterminated();
|
||||
this.sunColor = dim.getSunColor();
|
||||
this.moonColors = dim.getMoonColors();
|
||||
}
|
||||
|
@ -24,6 +26,7 @@ public class SPacketCelestials implements Packet<IClientPlayer> {
|
|||
}
|
||||
|
||||
public void readPacketData(PacketBuffer buf) throws IOException {
|
||||
this.exterminated = buf.readBoolean();
|
||||
this.sunColor = buf.readInt();
|
||||
this.moonColors = new int[buf.readVarInt()];
|
||||
for(int z = 0; z < this.moonColors.length; z++) {
|
||||
|
@ -32,12 +35,17 @@ public class SPacketCelestials implements Packet<IClientPlayer> {
|
|||
}
|
||||
|
||||
public void writePacketData(PacketBuffer buf) throws IOException {
|
||||
buf.writeBoolean(this.exterminated);
|
||||
buf.writeInt(this.sunColor);
|
||||
buf.writeVarInt(this.moonColors.length);
|
||||
for(int z = 0; z < this.moonColors.length; z++) {
|
||||
buf.writeInt(this.moonColors[z]);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getExterminated() {
|
||||
return this.exterminated;
|
||||
}
|
||||
|
||||
public int getSunColor() {
|
||||
return this.sunColor;
|
||||
|
|
|
@ -30,16 +30,16 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
|
|||
this.dimId = -2;
|
||||
}
|
||||
else {
|
||||
this.dimType = dim.getType();
|
||||
this.dimData = dim.writeData();
|
||||
if(this.dimType.celestials) {
|
||||
this.sunColor = dim.getSunColor();
|
||||
this.moonColors = dim.getMoonColors();
|
||||
}
|
||||
if(dim.isCustom()) {
|
||||
this.dimType = dim.getType();
|
||||
this.dimName = UniverseRegistry.getName(dim);
|
||||
this.dimDisplay = dim.getCustomName();
|
||||
this.dimFull = dim.getFormattedName(true);
|
||||
if(this.dimType.celestials) {
|
||||
this.sunColor = dim.getSunColor();
|
||||
this.moonColors = dim.getMoonColors();
|
||||
}
|
||||
this.dimId = -1;
|
||||
}
|
||||
else {
|
||||
|
@ -56,13 +56,9 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
|
|||
|
||||
public void readPacketData(PacketBuffer buf) throws IOException {
|
||||
this.dimId = buf.readVarInt();
|
||||
if(this.dimId >= -1)
|
||||
this.dimData = buf.readTag();
|
||||
if(this.dimId == -1) {
|
||||
if(this.dimId >= -1) {
|
||||
this.dimType = buf.readEnumValue(DimType.class);
|
||||
this.dimName = buf.readString(1024);
|
||||
this.dimDisplay = buf.readString(1024);
|
||||
this.dimFull = buf.readString(4096);
|
||||
this.dimData = buf.readTag();
|
||||
if(this.dimType.celestials) {
|
||||
this.sunColor = buf.readInt();
|
||||
this.moonColors = new int[buf.readVarInt()];
|
||||
|
@ -71,19 +67,20 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
|
|||
}
|
||||
}
|
||||
}
|
||||
if(this.dimId == -1) {
|
||||
this.dimName = buf.readString(1024);
|
||||
this.dimDisplay = buf.readString(1024);
|
||||
this.dimFull = buf.readString(4096);
|
||||
}
|
||||
this.type = buf.readUnsignedShort();
|
||||
this.editor = buf.readBoolean();
|
||||
}
|
||||
|
||||
public void writePacketData(PacketBuffer buf) throws IOException {
|
||||
buf.writeVarInt(this.dimId);
|
||||
if(this.dimId >= -1)
|
||||
buf.writeTag(this.dimData);
|
||||
if(this.dimId == -1) {
|
||||
if(this.dimId >= -1) {
|
||||
buf.writeEnumValue(this.dimType);
|
||||
buf.writeString(this.dimName);
|
||||
buf.writeString(this.dimDisplay);
|
||||
buf.writeString(this.dimFull);
|
||||
buf.writeTag(this.dimData);
|
||||
if(this.dimType.celestials) {
|
||||
buf.writeInt(this.sunColor);
|
||||
buf.writeVarInt(this.moonColors.length);
|
||||
|
@ -92,6 +89,11 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
|
|||
}
|
||||
}
|
||||
}
|
||||
if(this.dimId == -1) {
|
||||
buf.writeString(this.dimName);
|
||||
buf.writeString(this.dimDisplay);
|
||||
buf.writeString(this.dimFull);
|
||||
}
|
||||
buf.writeShort(this.type & 65535);
|
||||
buf.writeBoolean(this.editor);
|
||||
}
|
||||
|
@ -101,14 +103,14 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
|
|||
return null;
|
||||
Dimension dim = this.dimId >= 0 ? UniverseRegistry.getDimension(this.dimId) : Dimension.create(this.dimType);
|
||||
dim.readData(this.dimData);
|
||||
if(!dim.isCustom())
|
||||
return dim;
|
||||
dim.setCustomName(this.dimDisplay);
|
||||
dim.setDisplayName(this.dimFull);
|
||||
if(this.dimType.celestials) {
|
||||
dim.setSunColor(this.sunColor);
|
||||
dim.setMoonColors(this.moonColors);
|
||||
}
|
||||
if(!dim.isCustom())
|
||||
return dim;
|
||||
dim.setCustomName(this.dimDisplay);
|
||||
dim.setDisplayName(this.dimFull);
|
||||
return dim;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public abstract class Chunk {
|
|||
this.world = world;
|
||||
this.xPos = x;
|
||||
this.zPos = z;
|
||||
this.filler = world.dimension.getFiller();
|
||||
this.filler = world.dimension.isExterminated() ? Blocks.coal_block.getState() : world.dimension.getFiller();
|
||||
this.fillerBlock = this.filler.getBlock();
|
||||
for(int y = 0; y < this.entities.length; ++y) {
|
||||
this.entities[y] = new InheritanceMultiMap(Entity.class);
|
||||
|
|
|
@ -890,7 +890,7 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
|
||||
public int calculateSkylightSubtracted(boolean current) {
|
||||
float f = !this.dimension.getType().days ? 0.5f : this.calculateCelestialAngle(current ? this.daytime :
|
||||
float f = !this.dimension.getType().days || (current && this.dimension.isBaseDestroyed()) ? 0.5f : this.calculateCelestialAngle(current ? this.daytime :
|
||||
(this.dimension.getRotationalPeriod() / 4L), 1.0f);
|
||||
float f1 = 1.0F - (ExtMath.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F);
|
||||
f1 = ExtMath.clampf(f1, 0.0F, 1.0F);
|
||||
|
@ -915,8 +915,7 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
|
||||
public float getCelestialAngleRadians(float partialTicks) {
|
||||
float f = this.getCelestialAngle(partialTicks);
|
||||
return f * (float)Math.PI * 2.0F;
|
||||
return (this.dimension.isBaseDestroyed() ? 0.5f : this.getCelestialAngle(partialTicks)) * (float)Math.PI * 2.0F;
|
||||
}
|
||||
|
||||
public BlockPos getPrecipitationHeight(BlockPos pos) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue