Block names are no longer quite so hardcoded.

This commit is contained in:
UnknownShadow200 2016-04-06 17:17:30 +10:00
parent 99a40ae05e
commit 4be21585a9
4 changed files with 161 additions and 679 deletions

View File

@ -1,19 +1,19 @@
/*
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
@ -21,612 +21,39 @@ namespace MCGalaxy
{
public sealed partial class Block
{
public static string Name(byte type)
{
switch (type)
{
case air: return "air";
case rock: return "stone";
case grass: return "grass";
case dirt: return "dirt";
case stone: return "cobblestone";
case wood: return "wood";
case shrub: return "plant";
case blackrock: return "adminium";
case water: return "active_water";
case waterstill: return "water";
case lava: return "active_lava";
case lavastill: return "lava";
case sand: return "sand";
case gravel: return "gravel";
case goldrock: return "gold_ore";
case ironrock: return "iron_ore";
case coal: return "coal";
case trunk: return "tree";
case leaf: return "leaves";
case sponge: return "sponge";
case glass: return "glass";
case red: return "red";
case orange: return "orange";
case yellow: return "yellow";
case lightgreen: return "greenyellow";
case green: return "green";
case aquagreen: return "springgreen";
case cyan: return "cyan";
case lightblue: return "blue";
case blue: return "blueviolet";
case purple: return "indigo";
case lightpurple: return "purple";
case pink: return "magenta";
case darkpink: return "pink";
case darkgrey: return "black";
case lightgrey: return "gray";
case white: return "white";
case yellowflower: return "yellow_flower";
case redflower: return "red_flower";
case mushroom: return "brown_shroom";
case redmushroom: return "red_shroom";
case goldsolid: return "gold";
case iron: return "iron";
case staircasefull: return "double_stair";
case staircasestep: return "stair";
case brick: return "brick";
case tnt: return "tnt";
case bookcase: return "bookcase";
case stonevine: return "mossy_cobblestone";
case obsidian: return "obsidian";
case cobblestoneslab: return "cobblestoneslab";
case rope: return "rope";
case sandstone: return "sandstone";
case snow: return "snow";
case fire: return "fire";
case lightpink: return "lightpink";
case forestgreen: return "forestgreen";
case brown: return "brown";
case deepblue: return "deepblue";
case turquoise: return "turquoise";
case ice: return "ice";
case ceramictile: return "ceramictile";
case magmablock: return "magmablock";
case pillar: return "pillar";
case crate: return "crate";
case stonebrick: return "stonebrick";
case flagbase: return "flagbase";
case fastdeathlava: return "fast_hot_lava";
case op_glass: return "op_glass";
case opsidian: return "opsidian"; //TODO Add command or just use bind?
case op_brick: return "op_brick"; //TODO
case op_stone: return "op_stone"; //TODO
case op_cobblestone: return "op_cobblestone"; //TODO
case op_air: return "op_air"; //TODO
case op_water: return "op_water"; //TODO
case op_lava: return "op_lava";
case griefer_stone: return "griefer_stone";
case lava_sponge: return "lava_sponge";
case wood_float: return "wood_float"; //TODO
case door_tree: return "door_wood";
case lava_fast: return "lava_fast";
case door_obsidian: return "door_obsidian";
case door_glass: return "door_glass";
case door_stone: return "door_stone";
case door_leaves: return "door_leaves";
case door_sand: return "door_sand";
case door_wood: return "door_wood";
case door_green: return "door_green";
case door_tnt: return "door_tnt";
case door_stair: return "door_stair";
case door_iron: return "door_iron";
case door_gold: return "door_gold";
case door_cobblestone: return "door_cobblestone";
case door_red: return "door_red";
case door_grass: return "door_grass";
case door_dirt: return "door_dirt";
case door_blue: return "door_blue";
case door_book: return "door_book";
case door_orange: return "door_orange";
case door_yellow: return "door_yellow";
case door_lightgreen: return "door_lightgreen";
case door_aquagreen: return "door_aquagreen";
case door_cyan: return "door_cyan";
case door_lightblue: return "door_lightblue";
case door_purple: return "door_purple";
case door_lightpurple: return "door_lightpurple";
case door_pink: return "door_pink";
case door_darkpink: return "door_darkpink";
case door_darkgrey: return "door_darkgrey";
case door_lightgrey: return "door_lightgrey";
case door_white: return "door_white";
case tdoor: return "tdoor_wood";
case tdoor2: return "tdoor_obsidian";
case tdoor3: return "tdoor_glass";
case tdoor4: return "tdoor_stone";
case tdoor5: return "tdoor_leaves";
case tdoor6: return "tdoor_sand";
case tdoor7: return "tdoor_wood";
case tdoor8: return "tdoor_green";
case tdoor9: return "tdoor_tnt";
case tdoor10: return "tdoor_stair";
case tdoor11: return "tdoor_air";
case tdoor12: return "tdoor_water";
case tdoor13: return "tdoor_lava";
case odoor1: return "odoor_wood";
case odoor2: return "odoor_obsidian";
case odoor3: return "odoor_glass";
case odoor4: return "odoor_stone";
case odoor5: return "odoor_leaves";
case odoor6: return "odoor_sand";
case odoor7: return "odoor_wood";
case odoor8: return "odoor_green";
case odoor9: return "odoor_tnt";
case odoor10: return "odoor_stair";
case odoor11: return "odoor_lava";
case odoor12: return "odoor_water";
case odoor1_air: return "odoor_wood_air";
case odoor2_air: return "odoor_obsidian_air";
case odoor3_air: return "odoor_glass_air";
case odoor4_air: return "odoor_stone_air";
case odoor5_air: return "odoor_leaves_air";
case odoor6_air: return "odoor_sand_air";
case odoor7_air: return "odoor_wood_air";
case odoor8_air: return "odoor_red";
case odoor9_air: return "odoor_tnt_air";
case odoor10_air: return "odoor_stair_air";
case odoor11_air: return "odoor_lava_air";
case odoor12_air: return "odoor_water_air";
case MsgWhite: return "white_message";
case MsgBlack: return "black_message";
case MsgAir: return "air_message";
case MsgWater: return "water_message";
case MsgLava: return "lava_message";
case WaterDown: return "waterfall";
case LavaDown: return "lavafall";
case WaterFaucet: return "water_faucet";
case LavaFaucet: return "lava_faucet";
case finiteWater: return "finite_water";
case finiteLava: return "finite_lava";
case finiteFaucet: return "finite_faucet";
case air_portal: return "air_portal";
case water_portal: return "water_portal";
case lava_portal: return "lava_portal";
case custom_block: return "custom_block";
case air_door: return "air_door";
case air_switch: return "air_switch";
case water_door: return "door_water";
case lava_door: return "door_lava";
case blue_portal: return "blue_portal";
case orange_portal: return "orange_portal";
case c4: return "c4";
case c4det: return "c4_det";
case smalltnt: return "small_tnt";
case bigtnt: return "big_tnt";
case nuketnt: return "nuke_tnt";
case tntexplosion: return "tnt_explosion";
case lava_fire: return "lava_fire";
case rocketstart: return "rocketstart";
case rockethead: return "rockethead";
case firework: return "firework";
case Block.deathlava: return "hot_lava";
case Block.deathwater: return "cold_water";
case Block.deathair: return "nerve_gas";
case activedeathwater: return "active_cold_water";
case activedeathlava: return "active_hot_lava";
case Block.magma: return "magma";
case Block.geyser: return "geyser";
case Block.checkpoint: return "checkpoint";
//Blocks after this are converted before saving
case air_flood: return "air_flood";
case door_tree_air: return "door_air";
case air_flood_layer: return "air_flood_layer";
case air_flood_down: return "air_flood_down";
case air_flood_up: return "air_flood_up";
case door_obsidian_air: return "door2_air";
case door_glass_air: return "door3_air";
case door_stone_air: return "door4_air";
case door_leaves_air: return "door5_air";
case door_sand_air: return "door6_air";
case door_wood_air: return "door7_air";
case door_green_air: return "door8_air";
case door_tnt_air: return "door9_air";
case door_stair_air: return "door10_air";
case air_switch_air: return "door11_air";
case water_door_air: return "door12_air";
case lava_door_air: return "door13_air";
case air_door_air: return "door14_air";
case door_iron_air: return "door_iron_air";
case door_gold_air: return "door_gold_air";
case door_dirt_air: return "door_dirt_air";
case door_grass_air: return "door_grass_air";
case door_blue_air: return "door_blue_air";
case door_book_air: return "door_book_air";
case door_cobblestone_air: return "door_cobblestone_air";
case door_red_air: return "door_red_air";
case door_darkpink_air: return "door_darkpink_air";
case door_darkgrey_air: return "door_darkgrey_air";
case door_lightgrey_air: return "door_lightgrey_air";
case door_white_air: return "door_white_air";
//"AI" blocks
case train: return "train";
case snake: return "snake";
case snaketail: return "snake_tail";
case creeper: return "creeper";
case zombiebody: return "zombie";
case zombiehead: return "zombie_head";
case Block.birdblue: return "blue_bird";
case Block.birdred: return "red_robin";
case Block.birdwhite: return "dove";
case Block.birdblack: return "pidgeon";
case Block.birdwater: return "duck";
case Block.birdlava: return "phoenix";
case Block.birdkill: return "killer_phoenix";
case fishbetta: return "betta_fish";
case fishgold: return "goldfish";
case fishsalmon: return "salmon";
case fishshark: return "shark";
case fishsponge: return "sea_sponge";
case fishlavashark: return "lava_shark";
default: return "unknown";
}
}
public static string Name(byte type) { return Properties[type].Name; }
public static byte Byte(string type)
{
public static byte Byte(string type) {
byte block;
if (byte.TryParse(type, out block) && block < CpeCount)
return block;
switch (type.ToLower())
{
case "air": return air;
case "stone": return rock;
case "grass": return grass;
case "dirt": return dirt;
case "cobblestone": return stone;
case "wood": return wood;
case "plant": return shrub;
case "solid":
case "admintite":
case "blackrock":
case "adminium": return blackrock;
case "activewater":
case "active_water": return water;
case "water": return waterstill;
case "activelava":
case "active_lava": return lava;
case "lava": return lavastill;
case "sand": return sand;
case "gravel": return gravel;
case "gold_ore": return goldrock;
case "iron_ore": return ironrock;
case "coal": return coal;
case "tree": return trunk;
case "leaves": return leaf;
case "sponge": return sponge;
case "glass": return glass;
case "red": return red;
case "orange": return orange;
case "yellow": return yellow;
case "greenyellow": return lightgreen;
case "green": return green;
case "springgreen": return aquagreen;
case "cyan": return cyan;
case "blue": return lightblue;
case "blueviolet": return blue;
case "indigo": return purple;
case "purple": return lightpurple;
case "magenta": return pink;
case "pink": return darkpink;
case "black": return darkgrey;
case "gray": return lightgrey;
case "white": return white;
case "yellow_flower": return yellowflower;
case "red_flower": return redflower;
case "brown_shroom": return mushroom;
case "red_shroom": return redmushroom;
case "gold": return goldsolid;
case "iron": return iron;
case "double_stair": return staircasefull;
case "stair": return staircasestep;
case "brick": return brick;
case "tnt": return tnt;
case "bookcase": return bookcase;
case "mossy_cobblestone": return stonevine;
case "obsidian": return obsidian;
case "cobblestoneslab": return cobblestoneslab;
case "rope": return rope;
case "sandstone": return sandstone;
case "snow": return snow;
case "fire": return fire;
case "lightpink": return lightpink;
case "forestgreen": return forestgreen;
case "brown": return brown;
case "deepblue": return deepblue;
case "turquoise": return turquoise;
case "ice": return ice;
case "ceramictile": return ceramictile;
case "magmablock": return magmablock;
case "pillar": return pillar;
case "crate": return crate;
case "stonebrick": return stonebrick;
case "fhl":
case "fast_hot_lava": return fastdeathlava;
case "op_glass": return op_glass;
case "opsidian": return opsidian; //TODO Add command or just use bind?
case "op_brick": return op_brick; //TODO
case "op_stone": return op_stone; //TODO
case "op_cobblestone": return op_cobblestone; //TODO
case "op_air": return op_air; //TODO
case "op_water": return op_water; //TODO
case "op_lava": return op_lava;
case "griefer_stone": return griefer_stone;
case "lava_sponge": return lava_sponge;
case "wood_float": return wood_float; //TODO
case "lava_fast": return lava_fast;
case "door":
case "door_tree": return door_tree;
case "door2":
case "door_obsidian": return door_obsidian;
case "door3":
case "door_glass": return door_glass;
case "door4":
case "door_stone": return door_stone;
case "door5":
case "door_leaves": return door_leaves;
case "door6":
case "door_sand": return door_sand;
case "door7":
case "door_wood": return door_wood;
case "door8":
case "door_green": return door_green;
case "door9":
case "door_tnt": return door_tnt;
case "door10":
case "door_stair": return door_stair;
case "door11":
case "door_iron": return door_iron;
case "door12":
case "door_dirt": return door_dirt;
case "door13":
case "door_grass": return door_grass;
case "door14":
case "door_blue": return door_blue;
case "door15":
case "door_book": return door_book;
case "door16":
case "door_gold": return door_gold;
case "door17":
case "door_cobblestone": return door_cobblestone;
case "door18":
case "door_red": return door_red;
case "door_orange": return door_orange;
case "door_yellow": return door_yellow;
case "door_lightgreen": return door_lightgreen;
case "door_aquagreen": return door_aquagreen;
case "door_cyan": return door_cyan;
case "door_lightblue": return door_lightblue;
case "door_purple": return door_purple;
case "door_lightpurple": return door_lightpurple;
case "door_pink": return door_pink;
case "door_darkpink": return door_darkpink;
case "door_darkgrey": return door_darkgrey;
case "door_lightgrey": return door_lightgrey;
case "door_white": return door_white;
case "tdoor_tree":
case "tdoor": return tdoor;
case "tdoor_obsidian":
case "tdoor2": return tdoor2;
case "tdoor_glass":
case "tdoor3": return tdoor3;
case "tdoor_stone":
case "tdoor4": return tdoor4;
case "tdoor_leaves":
case "tdoor5": return tdoor5;
case "tdoor_sand":
case "tdoor6": return tdoor6;
case "tdoor_wood":
case "tdoor7": return tdoor7;
case "tdoor_green":
case "tdoor8": return tdoor8;
case "tdoor_tnt":
case "tdoor9": return tdoor9;
case "tdoor_stair":
case "tdoor10": return tdoor10;
case "tair_switch":
case "tdoor11": return tdoor11;
case "tdoor_water":
case "tdoor12": return tdoor12;
case "tdoor_lava":
case "tdoor13": return tdoor13;
case "odoor_tree":
case "odoor": return odoor1;
case "odoor_obsidian":
case "odoor2": return odoor2;
case "odoor_glass":
case "odoor3": return odoor3;
case "odoor_stone":
case "odoor4": return odoor4;
case "odoor_leaves":
case "odoor5": return odoor5;
case "odoor_sand":
case "odoor6": return odoor6;
case "odoor_wood":
case "odoor7": return odoor7;
case "odoor_green":
case "odoor8": return odoor8;
case "odoor_tnt":
case "odoor9": return odoor9;
case "odoor_stair":
case "odoor10": return odoor10;
case "odoor_lava":
case "odoor11": return odoor11;
case "odoor_water":
case "odoor12": return odoor12;
case "odoor_red": return odoor8_air;
case "white_message": return MsgWhite;
case "black_message": return MsgBlack;
case "air_message": return MsgAir;
case "water_message": return MsgWater;
case "lava_message": return MsgLava;
case "waterfall": return 140;
case "lavafall": return 141;
case "water_faucet": return WaterFaucet;
case "lava_faucet": return LavaFaucet;
case "finite_water": return finiteWater;
case "finite_lava": return finiteLava;
case "finite_faucet": return finiteFaucet;
case "air_portal": return 160;
case "water_portal": return 161;
case "lava_portal": return 162;
case "air_door": return air_door;
case "air_switch": return air_switch;
case "door_water":
case "water_door": return water_door;
case "door_lava":
case "lava_door": return lava_door;
case "blue_portal": return 175;
case "orange_portal": return 176;
case "c4": return c4;
case "c4_det": return c4det;
case "small_tnt": return 182;
case "big_tnt": return 183;
case "nuke_tnt": return 186;
case "tnt_explosion": return 184;
case "lava_fire": return lava_fire;
case "rocketstart": return rocketstart;
case "rockethead": return rockethead;
case "firework": return firework;
case "hot_lava": return deathlava;
case "cold_water": return deathwater;
case "nerve_gas": return deathair;
case "acw":
case "active_cold_water": return activedeathwater;
case "ahl":
case "active_hot_lava": return activedeathlava;
case "magma": return magma;
case "geyser": return geyser;
case "checkpoint": return checkpoint;
//Blocks after this are converted before saving
case "air_flood": return air_flood;
case "air_flood_layer": return air_flood_layer;
case "air_flood_down": return air_flood_down;
case "air_flood_up": return air_flood_up;
case "door_air": return door_tree_air;
case "door2_air": return door_obsidian_air;
case "door3_air": return door_glass_air;
case "door4_air": return door_stone_air;
case "door5_air": return door_leaves_air;
case "door6_air": return door_sand_air;
case "door7_air": return door_wood_air;
case "door8_air": return door_green_air;
case "door9_air": return door_tnt_air;
case "door10_air": return door_stair_air;
case "door11_air": return air_switch_air;
case "door12_air": return water_door_air;
case "door13_air": return lava_door_air;
case "door14_air": return air_door_air;
case "door_iron_air": return door_iron_air;
case "door_dirt_air": return door_dirt_air;
case "door_grass_air": return door_grass_air;
case "door_blue_air": return door_blue_air;
case "door_book_air": return door_book_air;
case "door_gold_air": return door_gold_air;
case "door_cobblestone_air": return door_cobblestone_air;
case "door_red_air": return door_red_air;
case "door_darkpink_air": return door_darkpink_air;
case "door_darkgrey_air": return door_darkgrey_air;
case "door_lightgrey_air": return door_lightgrey_air;
case "door_white_air": return door_white_air;
case "train": return train;
case "snake": return snake;
case "snake_tail": return snaketail;
case "creeper": return creeper;
case "zombie": return zombiebody;
case "zombie_head": return zombiehead;
case "blue_bird": return Block.birdblue;
case "red_robin": return Block.birdred;
case "dove": return Block.birdwhite;
case "pidgeon": return Block.birdblack;
case "duck": return Block.birdwater;
case "phoenix": return Block.birdlava;
case "killer_phoenix": return Block.birdkill;
case "betta_fish": return fishbetta;
case "goldfish": return fishgold;
case "salmon": return fishsalmon;
case "shark": return fishshark;
case "sea_sponge": return fishsponge;
case "lava_shark": return fishlavashark;
default: return Zero;
}
if (Aliases.TryGetValue(type.ToLower(), out block))
return block;
return Block.Zero;
}
public static byte ConvertCPE( byte b ) {
switch ( b ) {
case cobblestoneslab: return staircasestep;
case rope: return mushroom;
case sandstone: return sand;
case snow: return air;
case fire: return lava;
case lightpink: return darkpink;
case forestgreen: return green;
case brown: return dirt;
case deepblue: return blue;
case turquoise: return lightblue;
case ice: return glass;
case ceramictile: return iron;
case magmablock: return obsidian;
case pillar: return white;
case crate: return wood;
case stonebrick: return rock;
default:
return b;
}
}
public static byte ConvertCPE( byte b ) {
switch ( b ) {
case cobblestoneslab: return staircasestep;
case rope: return mushroom;
case sandstone: return sand;
case snow: return air;
case fire: return lava;
case lightpink: return darkpink;
case forestgreen: return green;
case brown: return dirt;
case deepblue: return blue;
case turquoise: return lightblue;
case ice: return glass;
case ceramictile: return iron;
case magmablock: return obsidian;
case pillar: return white;
case crate: return wood;
case stonebrick: return rock;
default:
return b;
}
}
public static byte Convert(byte b)
{
@ -665,7 +92,7 @@ namespace MCGalaxy
case door_grass: return grass;
case door_blue: return blue;
case door_book: return bookcase;
case door_gold: return goldsolid;
case door_gold: return goldsolid;
case door_cobblestone: return 4;
case door_red: return red;
@ -765,7 +192,7 @@ namespace MCGalaxy
case door_tree_air:
case air_flood_layer:
case air_flood_down:
case air_flood_up:
case air_flood_up:
case door_obsidian_air:
case door_glass_air:
case door_stone_air:
@ -778,7 +205,7 @@ namespace MCGalaxy
case lava_door_air:
case air_door_air:
case door_iron_air:
case door_gold_air:
case door_gold_air:
case door_cobblestone_air:
case door_dirt_air:
case door_grass_air:
@ -840,10 +267,10 @@ namespace MCGalaxy
{
switch (b)
{
case air_flood:
case air_flood_layer:
case air_flood_down:
case air_flood_up:
case air_flood:
case air_flood_layer:
case air_flood_down:
case air_flood_up:
return air; //air_flood must be converted to air on save to prevent issues
case door_tree_air: return door_tree;
case door_obsidian_air: return door_obsidian;
@ -860,7 +287,7 @@ namespace MCGalaxy
case lava_door_air: return lava_door;
case air_door_air: return air_door;
case door_iron_air: return door_iron;
case door_gold_air: return door_gold;
case door_gold_air: return door_gold;
case door_dirt_air: return door_dirt;
case door_grass_air: return door_grass;
case door_blue_air: return door_blue;

View File

@ -16,6 +16,7 @@
permissions and limitations under the Licenses.
*/
using System;
using System.Collections.Generic;
using MCGalaxy.Blocks;
namespace MCGalaxy {
@ -23,6 +24,7 @@ namespace MCGalaxy {
public sealed partial class Block {
public static BlockProps[] Properties = new BlockProps[256];
public static Dictionary<string, byte> Aliases = new Dictionary<string, byte>();
static void SetCoreProperties() {
for (int i = 0; i < 256; i++) {
@ -35,14 +37,110 @@ namespace MCGalaxy {
if ((i >= tdoor && i <= tdoor8) || (i >= tdoor9 && i <= tdoor13))
Properties[i].IsTDoor = true;
if (i >= MsgWhite && i <= MsgLava)
Properties[i].IsMessageBlock = true;
if (i == blue_portal || i == orange_portal || (i >= air_portal && i <= lava_portal))
Properties[i].IsPortal = true;
// ODoor blocks
if (i >= odoor1 && i <= odoor7)
Properties[i].ODoorId = (byte)(odoor1_air + (i - odoor1));
if (i >= odoor8 && i <= odoor12)
Properties[i].ODoorId = (byte)(odoor8_air + (i - odoor8));
if (i >= odoor1_air && i <= odoor7_air)
Properties[i].ODoorId = (byte)(odoor1 + (i - odoor1_air));
if (i >= odoor8_air && i <= odoor12_air)
Properties[i].ODoorId = (byte)(odoor8 + (i - odoor8_air));
if (i >= red && i <= white)
Properties[i].KilledByLava = true;
}
SetupDefaultNames();
}
static void SetupDefaultNames() {
string[] names = { "air", "stone", "grass", "dirt", "cobblestone", "wood", "plant",
"adminium", "active_water", "water", "active_lava", "lava", "sand", "gravel",
"gold_ore", "iron_ore", "coal", "tree", "leaves", "sponge", "glass", "red",
"orange", "yellow", "greenyellow", "green", "springgreen", "cyan", "blue",
"blueviolet", "indigo", "purple", "magenta", "pink", "black", "gray", "white",
"yellow_flower", "red_flower", "brown_shroom", "red_shroom", "gold", "iron",
"double_stair", "stair", "brick", "tnt", "bookcase", "mossy_cobblestone",
"obsidian", "cobblestoneslab", "rope", "sandstone", "snow", "fire", "lightpink",
"forestgreen", "brown", "deepblue", "turquoise", "ice", "ceramictile", "magmablock",
"pillar", "crate", "stonebrick", "door_darkpink_air", "door_darkgrey_air",
"door_lightgrey_air", "door_white_air", "flagbase", "unknown", "unknown",
"fast_hot_lava", "c4", "c4_det", "unknown", "unknown", "unknown", "unknown",
"door_cobblestone", "door_cobblestone_air", "unknown", "door_red", "door_red_air",
"door_orange", "door_yellow", "door_lightgreen", "unknown", "door_aquagreen",
"door_cyan", "door_lightblue", "door_purple", "door_lightpurple", "door_pink",
"door_darkpink", "door_darkgrey", "door_lightgrey", "door_white", "unknown",
"op_glass", "opsidian", "op_brick", "op_stone", "op_cobblestone", "op_air",
"op_water", "op_lava", "griefer_stone", "lava_sponge", "wood_float", "door",
"lava_fast", "door_obsidian", "door_glass", "door_stone", "door_leaves", "door_sand",
"door_wood", "door_green", "door_tnt", "door_stair", "tdoor", "tdoor_obsidian",
"tdoor_glass", "tdoor_stone", "tdoor_leaves", "tdoor_sand", "tdoor_wood",
"tdoor_green", "white_message", "black_message", "air_message", "water_message",
"lava_message", "tdoor_tnt", "tdoor_stair", "tdoor_air", "tdoor_water", "tdoor_lava",
"waterfall", "lavafall", "unknown", "water_faucet", "lava_faucet", "finite_water",
"finite_lava", "finite_faucet", "odoor", "odoor_obsidian", "odoor_glass",
"odoor_stone", "odoor_leaves", "odoor_sand", "odoor_wood", "odoor_green",
"odoor_tnt", "odoor_stair", "odoor_lava", "odoor_water", "air_portal", "water_portal",
"lava_portal", "custom_block", "air_door", "air_switch", "door_water", "door_lava",
"odoor_wood_air", "odoor_obsidian_air", "odoor_glass_air", "odoor_stone_air",
"odoor_leaves_air", "odoor_sand_air", "odoor_wood_air", "blue_portal", "orange_portal",
"odoor_red", "odoor_tnt_air", "odoor_stair_air", "odoor_lava_air", "odoor_water_air",
"small_tnt", "big_tnt", "tnt_explosion", "lava_fire", "nuke_tnt", "rocketstart",
"rockethead", "firework", "hot_lava", "cold_water", "nerve_gas", "active_cold_water",
"active_hot_lava", "magma", "geyser", "checkpoint", "unknown", "unknown", "air_flood",
"door_air", "air_flood_layer", "air_flood_down", "air_flood_up", "door2_air",
"door3_air", "door4_air", "door5_air", "door6_air", "door7_air", "door8_air",
"door9_air", "door10_air", "door11_air", "door12_air", "door13_air", "door14_air",
"unknown", "unknown", "door_iron", "door_dirt", "door_grass", "door_blue", "door_book",
"door_iron_air", "door_dirt_air", "door_grass_air", "door_blue_air", "door_book_air",
"train", "creeper", "zombie", "zombie_head", "unknown", "dove", "pidgeon", "duck",
"phoenix", "red_robin", "blue_bird", "unknown", "killer_phoenix", "unknown", "unknown",
"goldfish", "sea_sponge", "shark", "salmon", "betta_fish", "lava_shark", "snake",
"snake_tail", "door_gold", "door_gold_air", "unknown" };
for (int i = 0; i < names.Length; i++) {
Properties[i].Name = names[i];
if (names[i] != "unknown")
Aliases[names[i]] = (byte)i;
}
// Add other aliases
Aliases["solid"] = blackrock; Aliases["admintite"] = blackrock;
Aliases["blackrock"] = blackrock; Aliases["activewater"] = water;
Aliases["activelava"] = lava; Aliases["fhl"] = fastdeathlava;
Aliases["water_door"] = water_door; Aliases["lava_door"] = lava_door;
Aliases["acw"] = activedeathwater; Aliases["ahl"] = activedeathlava;
Aliases["door_tree"] = door_tree; Aliases["door2"] = door_obsidian;
Aliases["door3"] = door_glass; Aliases["door4"] = door_stone;
Aliases["door5"] = door_leaves; Aliases["door6"] = door_sand;
Aliases["door7"] = door_wood; Aliases["door8"] = door_green;
Aliases["door9"] = door_tnt; Aliases["door10"] = door_stair;
Aliases["door11"] = door_iron; Aliases["door12"] = door_dirt;
Aliases["door13"] = door_grass; Aliases["door14"] = door_blue;
Aliases["door15"] = door_book; Aliases["door16"] = door_gold;
Aliases["door17"] = door_cobblestone; Aliases["door18"] = door_red;
Aliases["tdoor_tree"] = tdoor; Aliases["tdoor2"] = tdoor2;
Aliases["tdoor3"] = tdoor3; Aliases["tdoor4"] = tdoor4;
Aliases["tdoor5"] = tdoor5; Aliases["tdoor6"] = tdoor6;
Aliases["tdoor7"] = tdoor7; Aliases["tdoor8"] = tdoor8;
Aliases["tdoor9"] = tdoor9; Aliases["tdoor10"] = tdoor10;
Aliases["tair_switch"] = tdoor11; Aliases["tdoor11"] = tdoor11;
Aliases["tdoor12"] = tdoor12; Aliases["tdoor13"] = tdoor13;
Aliases["odoor_tree"] = odoor1; Aliases["odoor2"] = odoor2;
Aliases["odoor3"] = odoor3; Aliases["odoor4"] = odoor4;
Aliases["odoor5"] = odoor5; Aliases["odoor6"] = odoor6;
Aliases["odoor7"] = odoor7; Aliases["odoor8"] = odoor8;
Aliases["odoor9"] = odoor9; Aliases["odoor10"] = odoor10;
Aliases["odoor11"] = odoor11; Aliases["odoor12"] = odoor12;
}
}
}

View File

@ -181,8 +181,7 @@ namespace MCGalaxy
return false;
}
public static bool Mover(byte type)
{
public static bool Mover(byte type) {
return walkthroughHandlers[type] != null;
}
@ -200,22 +199,6 @@ namespace MCGalaxy
case Block.trunk:
case Block.leaf:
case Block.sponge:
case Block.red:
case Block.orange:
case Block.yellow:
case Block.lightgreen:
case Block.green:
case Block.aquagreen:
case Block.cyan:
case Block.lightblue:
case Block.blue:
case Block.purple:
case Block.lightpurple:
case Block.pink:
case Block.darkpink:
case Block.darkgrey:
case Block.lightgrey:
case Block.white:
case Block.yellowflower:
case Block.redflower:
case Block.mushroom:
@ -223,7 +206,7 @@ namespace MCGalaxy
case Block.bookcase:
return true;
}
return false;
return Properties[type].KilledByLava;
}
public static bool WaterKill(byte type)
{
@ -238,7 +221,7 @@ namespace MCGalaxy
case Block.redmushroom:
return true;
}
return false;
return Properties[type].KilledByWater;
}
public static bool LightPass(byte type, byte extType, BlockDefinition[] defs) {
@ -444,37 +427,6 @@ namespace MCGalaxy
public static bool tDoor(byte type) { return Properties[type].IsTDoor; }
public static byte odoor(byte b)
{
switch (b)
{
case odoor1: return odoor1_air;
case odoor2: return odoor2_air;
case odoor3: return odoor3_air;
case odoor4: return odoor4_air;
case odoor5: return odoor5_air;
case odoor6: return odoor6_air;
case odoor7: return odoor7_air;
case odoor8: return odoor8_air;
case odoor9: return odoor9_air;
case odoor10: return odoor10_air;
case odoor11: return odoor11_air;
case odoor12: return odoor12_air;
case odoor1_air: return odoor1;
case odoor2_air: return odoor2;
case odoor3_air: return odoor3;
case odoor4_air: return odoor4;
case odoor5_air: return odoor5;
case odoor6_air: return odoor6;
case odoor7_air: return odoor7;
case odoor8_air: return odoor8;
case odoor9_air: return odoor9;
case odoor10_air: return odoor10;
case odoor11_air: return odoor11;
case odoor12_air: return odoor12;
}
return Zero;
}
public static byte odoor(byte type) { return Properties[type].ODoorId; }
}
}

View File

@ -35,17 +35,21 @@ namespace MCGalaxy.Blocks {
/// <summary> Whether this block is considered a tdoor. </summary>
public bool IsTDoor;
/// <summary> Block id this block is converted to when toggled by a neighbouring door. </summary>
public byte ODoorId;
/// <summary> Whether this block is considered a message block. </summary>
public bool IsMessageBlock;
/// <summary> Whether this block is considered a portal. </summary>
public bool IsPortal;
/// <summary> Whether this block is overwritten/killed by water blocks. </summary>
public bool KilledByWater;
/// <summary> Whether this block is overwritten/killed by lava blocks. </summary>
public bool KilledByLava;
/// <summary> Whether walkinhg through this block causes the death of that player. </summary>
public bool CausesDeath;
/// <summary> Whether light passes through this block. </summary>
public bool LightPasses;
/// <summary> Whether this block is an OP block (cannot be replaced by physics changes). </summary>
public bool OPBlock;
@ -55,6 +59,7 @@ namespace MCGalaxy.Blocks {
ConvertId = type;
SaveConvertId = type;
Name = "unknown";
ODoorId = Block.Zero;
}
}
}