Core: allow overwriting core blocks with /lb

This commit is contained in:
UnknownShadow200 2016-10-04 15:24:14 +11:00
parent e69498af48
commit 2033bc330b
3 changed files with 5 additions and 7 deletions

View File

@ -539,9 +539,6 @@ namespace MCGalaxy.Commands.CPE {
if (blockId <= 0 || blockId >= 255) {
Player.Message(p, "&cBlock id must be between 1-254"); return false;
}
if (!global && blockId < Block.CpeCount) {
Player.Message(p, "&cYou can only redefine standard blocks with /gb."); return false;
}
return true;
}

View File

@ -187,12 +187,13 @@ namespace MCGalaxy {
for (int i = 1; i < defs.Length; i++) {
BlockDefinition def = defs[i];
if (def == null) continue;
if (pl.HasCpeExt(CpeExt.BlockDefinitionsExt, 2) && def.Shape != 0)
if (pl.HasCpeExt(CpeExt.BlockDefinitionsExt, 2) && def.Shape != 0) {
SendDefineBlockExt(pl, def, true);
else if (pl.HasCpeExt(CpeExt.BlockDefinitionsExt) && def.Shape != 0)
} else if (pl.HasCpeExt(CpeExt.BlockDefinitionsExt) && def.Shape != 0) {
SendDefineBlockExt(pl, def, false);
else
} else {
SendDefineBlock(pl, def);
}
if (pl.HasCpeExt(CpeExt.BlockPermissions))
pl.SendSetBlockPermission(def.BlockID, pl.level.CanPlace, pl.level.CanDelete);

View File

@ -381,7 +381,7 @@ namespace MCGalaxy {
void RemoveOldLevelCustomBlocks(Level oldLevel) {
BlockDefinition[] defs = oldLevel.CustomBlockDefs;
for (int i = Block.CpeCount; i < 256; i++) {
for (int i = 1; i < 256; i++) {
BlockDefinition def = defs[i];
if (def == null || def == BlockDefinition.GlobalDefs[i]) continue;
SendRaw(Opcode.CpeRemoveBlockDefinition, (byte)i);