Fix horizon/border blocks over 65, this time for sure (Thanks KawaiiCube)

This commit is contained in:
UnknownShadow200 2018-03-31 16:00:40 +11:00
parent 078c285aec
commit 6a05bf10a3
4 changed files with 16 additions and 12 deletions

View File

@ -81,9 +81,9 @@ namespace MCGalaxy.Levels.IO {
static void ParseEnvMapAppearance(NbtCompound cpe, Level lvl) {
NbtCompound comp = (NbtCompound)cpe["EnvMapAppearance"];
lvl.Config.HorizonBlock = comp["EdgeBlock"].ByteValue;
lvl.Config.EdgeBlock = comp["SideBlock"].ByteValue;
lvl.Config.EdgeLevel = comp["SideLevel"].ShortValue;
lvl.Config.HorizonBlock = Block.FromRaw(comp["EdgeBlock"].ByteValue);
lvl.Config.EdgeBlock = Block.FromRaw(comp["SideBlock"].ByteValue);
lvl.Config.EdgeLevel = comp["SideLevel"].ShortValue;
if (lvl.Config.EdgeLevel == -1)
lvl.Config.EdgeLevel = (short)(lvl.Height / 2);
@ -98,10 +98,10 @@ namespace MCGalaxy.Levels.IO {
static void ParseEnvColors(NbtCompound cpe, Level lvl) {
NbtCompound comp = (NbtCompound)cpe["EnvColors"];
lvl.Config.SkyColor = GetColor(comp, "Sky");
lvl.Config.CloudColor = GetColor(comp, "Cloud");
lvl.Config.FogColor = GetColor(comp, "Fog");
lvl.Config.LightColor = GetColor(comp, "Sunlight");
lvl.Config.SkyColor = GetColor(comp, "Sky");
lvl.Config.CloudColor = GetColor(comp, "Cloud");
lvl.Config.FogColor = GetColor(comp, "Fog");
lvl.Config.LightColor = GetColor(comp, "Sunlight");
lvl.Config.ShadowColor = GetColor(comp, "Ambient");
}

View File

@ -332,7 +332,7 @@ namespace MCGalaxy {
Blockchange(PosToInt(x, y, z), block, false, default(PhysicsArgs)); //Block change made by physics
}
internal bool DoPhysicsBlockchange(int b, BlockID block, bool overRide = false,
public bool DoPhysicsBlockchange(int b, BlockID block, bool overRide = false,
PhysicsArgs data = default(PhysicsArgs), bool addUndo = true) {
if (blocks == null || b < 0 || b >= blocks.Length) return false;
BlockID old = blocks[b];

View File

@ -113,8 +113,10 @@ namespace MCGalaxy {
string lastUrl = "";
public void SendCurrentTextures() {
BlockID side = level.Config.EdgeBlock; if (side > MaxRawBlock) side = level.RawFallback(side);
BlockID edge = level.Config.HorizonBlock; if (edge > MaxRawBlock) edge = level.RawFallback(edge);
BlockID side = Block.ToRaw(level.Config.EdgeBlock);
if (side > MaxRawBlock) side = level.RawFallback(level.Config.EdgeBlock);
BlockID edge = Block.ToRaw(level.Config.HorizonBlock);
if (edge > MaxRawBlock) edge = level.RawFallback(level.Config.HorizonBlock);
string url = GetTextureUrl();
if (Supports(CpeExt.EnvMapAspect)) {
@ -124,7 +126,7 @@ namespace MCGalaxy {
} else if (Supports(CpeExt.EnvMapAppearance, 2)) {
// reset all other textures back to client default.
if (url != lastUrl) {
Send(Packet.MapAppearanceV2("", (byte)side, (byte)edge, level.Config.EdgeLevel,
Send(Packet.MapAppearanceV2("", (byte)side, (byte)edge, level.Config.EdgeLevel,
level.Config.CloudsHeight, level.Config.MaxFogDistance, hasCP437));
}
Send(Packet.MapAppearanceV2(url, (byte)side, (byte)edge, level.Config.EdgeLevel,

View File

@ -396,7 +396,9 @@ namespace MCGalaxy {
value = zone.Config.GetEnvProp(i);
}
if (value > MaxRawBlock) value = level.RawFallback((BlockID)value);
BlockID raw = Block.ToRaw((BlockID)value);
if (raw > MaxRawBlock) raw = level.RawFallback((BlockID)value);
value = raw;
} else {
if (zone != null && zone.Config.GetEnvProp(i) != -1) {
value = zone.Config.GetEnvProp(i);