Fix edge/side block not working with custom blocks

This commit is contained in:
UnknownShadow200 2018-02-28 15:26:54 +11:00
parent 33f25ed326
commit 08286625f3
2 changed files with 9 additions and 4 deletions

View File

@ -47,7 +47,7 @@ namespace MCGalaxy {
} }
string type = value == 0 ? "%SSun" : (value == 1 ? "&1Rain" : "&fSnow"); string type = value == 0 ? "%SSun" : (value == 1 ? "&1Rain" : "&fSnow");
Player.Message(p, "Set weather for {0} %Sto {1} ({2}%S)", area, value, type); Player.Message(p, "Set weather for {0} %Sto {1} ({2}%S)", area, value, type);
} }
target = value; target = value;
} }
@ -76,7 +76,7 @@ namespace MCGalaxy {
target = (short)defValue; target = (short)defValue;
} else { } else {
int value = 0; int value = 0;
if (!CommandParser.GetInt(p, input, variable, ref value, if (!CommandParser.GetInt(p, input, variable, ref value,
short.MinValue, short.MaxValue)) return; short.MinValue, short.MaxValue)) return;
target = (short)value; target = (short)value;
@ -139,6 +139,10 @@ namespace MCGalaxy {
internal static void UpdateAppearance(Predicate<Player> selector, EnvProp prop, int value) { internal static void UpdateAppearance(Predicate<Player> selector, EnvProp prop, int value) {
Player[] players = PlayerInfo.Online.Items; Player[] players = PlayerInfo.Online.Items;
if (prop == EnvProp.SidesBlock || prop == EnvProp.EdgeBlock) {
value = (byte)value;
}
foreach (Player pl in players) { foreach (Player pl in players) {
if (!selector(pl)) continue; if (!selector(pl)) continue;

View File

@ -381,17 +381,18 @@ namespace MCGalaxy {
for (EnvProp i = 0; i < EnvProp.Max; i++) { for (EnvProp i = 0; i < EnvProp.Max; i++) {
int value = level.Config.GetEnvProp(i); int value = level.Config.GetEnvProp(i);
if (i == EnvProp.SidesBlock || i == EnvProp.EdgeBlock) { if (i == EnvProp.SidesBlock || i == EnvProp.EdgeBlock) {
if (zone != null && zone.Config.GetEnvProp(i) != Block.Invalid) { if (zone != null && zone.Config.GetEnvProp(i) != Block.Invalid) {
value = zone.Config.GetEnvProp(i); value = zone.Config.GetEnvProp(i);
} }
value = (byte)value;
if (!hasBlockDefs) value = level.RawFallback((byte)value); if (!hasBlockDefs) value = level.RawFallback((byte)value);
} else { } else {
if (zone != null && zone.Config.GetEnvProp(i) != -1) { if (zone != null && zone.Config.GetEnvProp(i) != -1) {
value = zone.Config.GetEnvProp(i); value = zone.Config.GetEnvProp(i);
} }
} }
if (Supports(CpeExt.EnvMapAspect)) Send(Packet.EnvMapProperty(i, value)); if (Supports(CpeExt.EnvMapAspect)) Send(Packet.EnvMapProperty(i, value));
} }
if (Supports(CpeExt.EnvWeatherType)) { if (Supports(CpeExt.EnvWeatherType)) {