Skip to content
Permalink
Browse files

Drop version2/sidestes from block definitions json

  • Loading branch information...
UnknownShadow200 committed Aug 26, 2018
1 parent cace250 commit 6d31b5902c6feadd071de01268e90bd056a6bad3
@@ -1377,7 +1377,6 @@ static class CpeCommands {

p.currentBD = new BlockDefinition();
p.currentBD.BlockID = (byte)blockId;
p.currentBD.Version2 = true;
p.Message(" &bSet block id to: " + blockId);
p.Message("From now on, use &H{0} [value]&S to enter arguments.", name);
p.Message("You can abort the currently partially " +
@@ -1405,8 +1404,8 @@ static class CpeCommands {
p.Message("&3---Name&3:&a{0} &3ID:&a{1}&3---", def.Name, def.BlockID);
p.Message(" &3FallBack: &a{0}&3, Solidity: &a{2}&3, Speed: &a{1}",
Map.GetBlockName(p.World, fallback), def.Speed, def.CollideType);
p.Message(" &3Top ID: &a{0}&3, Side ID: &a{1}&3, Bottom ID: &a{2}",
def.TopTex, def.SideTex, def.BottomTex);
p.Message(" &3Top ID: &a{0}&3, Bottom ID: &a{1}",
def.TopTex, def.BottomTex);
p.Message(" &3Left ID: &a{0}&3, Right ID: &a{1}&3, Front ID: &a{2}&3, Back ID: &a{3}",
def.LeftTex, def.RightTex, def.FrontTex, def.BackTex);
p.Message(" &3Block Light: &a{0}&3, Sound: &a{1}&3, FullBright: &a{2}",
@@ -1723,7 +1722,7 @@ static class CpeCommands {

switch (option.ToLower()) {
case "name":
p.Message("&bChanged name of &a{0}&b to &A{1}", def.Name, args);
p.Message("&bChanged name of &a{0} &bto &A{1}", def.Name, args);
def.Name = args; def.BlockName = args.ToLower().Replace(" ", "");
hasChanged = true;
break;
@@ -1732,7 +1731,7 @@ static class CpeCommands {
case "collide":
case "collidetype":
if (byte.TryParse(args, out value)) {
p.Message("&bChanged solidity of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.CollideType, value);
p.Message("&bChanged solidity of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.CollideType, value);
def.CollideType = value;
hasChanged = true;
}
@@ -1741,7 +1740,7 @@ static class CpeCommands {
float speed;
if (float.TryParse(args, out speed)
&& speed >= 0.25f && value <= 3.96f) {
p.Message("&bChanged speed of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.Speed, speed);
p.Message("&bChanged speed of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.Speed, speed);
def.Speed = speed;
hasChanged = true;
}
@@ -1750,18 +1749,17 @@ static class CpeCommands {
case "alltex":
case "alltexture":
if (byte.TryParse(args, out value)) {
p.Message("&bChanged top, sides, and bottom texture index of &a{0}&b to &a{1}", def.Name, value);
def.TopTex = value; def.SideTex = value; def.BottomTex = value;
def.LeftTex = value; def.RightTex = value;
def.FrontTex = value; def.BackTex = value;
p.Message("&bChanged all textures of &a{0} &bto &a{1}", def.Name, value);
def.TopTex = value; def.BottomTex = value;
def.SetSidesTex(value);
hasChanged = true;
}
break;
case "topid":
case "toptex":
case "toptexture":
if (byte.TryParse(args, out value)) {
p.Message("&bChanged top texture index of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.TopTex, value);
p.Message("&bChanged top texture of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.TopTex, value);
def.TopTex = value;
hasChanged = true;
}
@@ -1770,7 +1768,7 @@ static class CpeCommands {
case "lefttex":
case "lefttexture":
if (byte.TryParse(args, out value)) {
p.Message("&bChanged left texture index of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.LeftTex, value);
p.Message("&bChanged left texture of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.LeftTex, value);
def.LeftTex = value;
hasChanged = true;
}
@@ -1779,7 +1777,7 @@ static class CpeCommands {
case "righttex":
case "righttexture":
if (byte.TryParse(args, out value)) {
p.Message("&bChanged right texture index of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.RightTex, value);
p.Message("&bChanged right texture of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.RightTex, value);
def.RightTex = value;
hasChanged = true;
}
@@ -1788,7 +1786,7 @@ static class CpeCommands {
case "fronttex":
case "fronttexture":
if (byte.TryParse(args, out value)) {
p.Message("&bChanged front texture index of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.FrontTex, value);
p.Message("&bChanged front texture of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.FrontTex, value);
def.FrontTex = value;
hasChanged = true;
}
@@ -1797,7 +1795,7 @@ static class CpeCommands {
case "backtex":
case "backtexture":
if (byte.TryParse(args, out value)) {
p.Message("&bChanged back texture index of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.BackTex, value);
p.Message("&bChanged back texture of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.BackTex, value);
def.BackTex = value;
hasChanged = true;
}
@@ -1806,7 +1804,7 @@ static class CpeCommands {
case "sidetex":
case "sidetexture":
if (byte.TryParse(args, out value)) {
p.Message("&bChanged sides texture index of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.SideTex, value);
p.Message("&bChanged all side textures of &a{0} &bto &a{1}", def.Name, value);
def.SetSidesTex(value);
hasChanged = true;
}
@@ -1815,90 +1813,90 @@ static class CpeCommands {
case "bottomtex":
case "bottomtexture":
if (byte.TryParse(args, out value)) {
p.Message("&bChanged bottom texture index of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.BottomTex, value);
p.Message("&bChanged bottom texture index of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.BottomTex, value);
def.BottomTex = value;
hasChanged = true;
}
break;
case "light":
case "blockslight":
if (bool.TryParse(args, out boolVal)) {
p.Message("&bChanged blocks light of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.BlocksLight, boolVal);
p.Message("&bChanged blocks light of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.BlocksLight, boolVal);
def.BlocksLight = boolVal;
hasChanged = true;
}
break;
case "sound":
case "walksound":
if (byte.TryParse(args, out value) && value <= 11) {
p.Message("&bChanged walk sound of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.WalkSound, value);
p.Message("&bChanged walk sound of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.WalkSound, value);
def.WalkSound = value;
hasChanged = true;
}
break;
case "fullbright":
if (bool.TryParse(args, out boolVal)) {
p.Message("&bChanged full bright of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.FullBright, boolVal);
p.Message("&bChanged full bright of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.FullBright, boolVal);
def.FullBright = boolVal;
hasChanged = true;
}
break;
case "sprite":
case "shape":
if (bool.TryParse(args, out boolVal) && value <= 16) {
p.Message("&bChanged is a sprite block of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.Shape == 0, value);
p.Message("&bChanged is a sprite block of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.Shape == 0, value);
def.Shape = boolVal ? (byte)0 : def.MaxZ;
hasChanged = true;
}
break;
case "draw":
case "blockdraw":
if (byte.TryParse(args, out value)) {
p.Message("&bChanged block draw type of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.BlockDraw, value);
p.Message("&bChanged block draw type of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.BlockDraw, value);
def.BlockDraw = value;
hasChanged = true;
}
break;
case "fogdensity":
case "fogd":
if (byte.TryParse(args, out value)) {
p.Message("&bChanged density of fog of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.FogDensity, value);
p.Message("&bChanged density of fog of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.FogDensity, value);
def.FogDensity = value;
hasChanged = true;
}
break;
case "foghex":
if (IsValidHex(args)) {
CustomColor col = Color.ParseHex(args);
p.Message("&bChanged red fog component of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.FogR, col.R);
p.Message("&bChanged red fog component of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.FogR, col.R);
def.FogR = col.R;
p.Message("&bChanged green fog component of fog of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.FogG, col.G);
p.Message("&bChanged green fog component of fog of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.FogG, col.G);
def.FogG = col.G;
p.Message("&bChanged blue fog component of fog of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.FogB, col.B);
p.Message("&bChanged blue fog component of fog of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.FogB, col.B);
def.FogB = col.B;
hasChanged = true;
}
break;
case "fogr":
case "fogred":
if (byte.TryParse(args, out value)) {
p.Message("&bChanged red fog component of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.FogR, value);
p.Message("&bChanged red fog component of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.FogR, value);
def.FogG = value;
hasChanged = true;
}
break;
case "fogg":
case "foggreen":
if (byte.TryParse(args, out value)) {
p.Message("&bChanged green fog component of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.FogG, value);
p.Message("&bChanged green fog component of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.FogG, value);
def.FogG = value;
hasChanged = true;
}
break;
case "fogb":
case "fogblue":
if (byte.TryParse(args, out value)) {
p.Message("&bChanged blue fog component of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.FogB, value);
p.Message("&bChanged blue fog component of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.FogB, value);
def.FogB = value;
hasChanged = true;
}
@@ -1912,7 +1910,7 @@ static class CpeCommands {
"or a block defined in the CustomBlocks extension.");
break;
}
p.Message("&bChanged fallback block of &a{0}&b from &a{1}&b to &a{2}", def.Name, def.FallBack, newBlock.ToString());
p.Message("&bChanged fallback block of &a{0} &bfrom &a{1} &bto &a{2}", def.Name, def.FallBack, newBlock.ToString());
def.FallBack = (byte)newBlock;

DisplayEditMessage(p, def, global);
@@ -2021,7 +2019,7 @@ static class CpeCommands {
string args, byte origValue, ref bool hasChanged) {
byte value;
if (byte.TryParse(args, out value) && value <= 16) {
p.Message("&bChanged {0} coordinate of &a{1}&b from &a{2}&b to &a{3}", coord, name, origValue, value);
p.Message("&bChanged {0} coordinate of &a{1} &bfrom &a{2} &bto &a{3}", coord, name, origValue, value);
hasChanged = true;
return value;
}
@@ -299,7 +299,7 @@ public static Packet HackControl(bool flying, bool noclip, bool speedhack, bool
packet.Bytes[index++] = def.FrontTex;
packet.Bytes[index++] = def.BackTex;
} else {
packet.Bytes[index++] = def.SideTex;
packet.Bytes[index++] = def.RightTex;
}

packet.Bytes[index++] = def.BottomTex;
@@ -342,7 +342,7 @@ public sealed partial class Player {
return true;
}

if((message.IndexOf('&') != -1) && (!(Can(Permission.UseColorCodes)))) {
if (message.IndexOf('&') != -1 && !Can(Permission.UseColorCodes)) {
message = Color.StripColors( message, false);
}
if (longerMessage == 1) {
@@ -13,7 +13,6 @@ public sealed class BlockDefinition {
public byte CollideType { get; set; }
public float Speed { get; set; }
public byte TopTex { get; set; }
public byte SideTex { get; set; }
public byte BottomTex { get; set; }
public bool BlocksLight { get; set; }
public byte WalkSound { get; set; }
@@ -34,7 +33,6 @@ public sealed class BlockDefinition {
public byte MaxY { get; set; }
public byte MaxZ { get; set; }
// BlockDefinitionsExt v2 fields
public bool Version2 { get; set; }
public byte LeftTex { get; set; }
public byte RightTex { get; set; }
public byte FrontTex { get; set; }
@@ -47,7 +45,6 @@ public sealed class BlockDefinition {
public string BlockName;

public void SetSidesTex(byte tex) {
SideTex = tex;
LeftTex = tex; RightTex = tex;
FrontTex = tex; BackTex = tex;
}
@@ -56,16 +53,14 @@ public sealed class BlockDefinition {
BlockDefinition def = new BlockDefinition();
def.BlockID = BlockID; def.Name = Name; def.BlockName = BlockName;
def.CollideType = CollideType; def.Speed = Speed;
def.TopTex = TopTex; def.SideTex = SideTex;
def.BottomTex = BottomTex; def.BlocksLight = BlocksLight;
def.WalkSound = WalkSound; def.FullBright = FullBright;
def.Shape = Shape; def.BlockDraw = BlockDraw;
def.FogDensity = FogDensity; def.FogR = FogR;
def.FogG = FogG; def.FogB = FogB;
def.TopTex = TopTex; def.BottomTex = BottomTex;
def.BlocksLight = BlocksLight; def.WalkSound = WalkSound;
def.FullBright = FullBright; def.Shape = Shape;
def.BlockDraw = BlockDraw; def.FogDensity = FogDensity;
def.FogR = FogR; def.FogG = FogG; def.FogB = FogB;
def.FallBack = FallBack;
def.MinX = MinX; def.MinY = MinY; def.MinZ = MinZ;
def.MaxX = MaxX; def.MaxY = MaxY; def.MaxZ = MaxZ;
def.Version2 = Version2;
def.LeftTex = LeftTex; def.RightTex = RightTex;
def.FrontTex = FrontTex; def.BackTex = BackTex;
return def;
@@ -270,11 +265,6 @@ public sealed class BlockDefinition {
def.MaxY = 16;
if (def.MinZ == 0 && def.MaxZ == 0)
def.MaxZ = def.Shape == 0 ? (byte)16 : def.Shape;
if (!def.Version2) {
def.Version2 = true;
def.LeftTex = def.SideTex; def.RightTex = def.SideTex;
def.FrontTex = def.SideTex; def.BackTex = def.SideTex;
}
}
#endregion
}
@@ -38,7 +38,6 @@ public static class DefaultSet {
def.FallBack = raw;

def.MaxX = 16; def.MaxZ = Height(b); def.MaxY = 16;
def.Version2 = true;
return def;
}

0 comments on commit 6d31b59

Please sign in to comment.
You can’t perform that action at this time.