當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonObject.Member方法代碼示例

本文整理匯總了Java中com.eclipsesource.json.JsonObject.Member方法的典型用法代碼示例。如果您正苦於以下問題:Java JsonObject.Member方法的具體用法?Java JsonObject.Member怎麽用?Java JsonObject.Member使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.eclipsesource.json.JsonObject的用法示例。


在下文中一共展示了JsonObject.Member方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addBlockMining

import com.eclipsesource.json.JsonObject; //導入方法依賴的package包/類
private static void addBlockMining(JsonArray prop, JBlock block) {
	if (prop != null) {
		JsonObject object = prop.asObject();
		for (JsonObject.Member member : object) {
			switch (member.getName()) {
			case "speed":
				block.setMiningTime(member.getValue().asFloat());
				break;
			case "tool":
				block.setMiningTool(ItemJson.toolType(member.getValue().asString()));
				break;
			case "toolLevel":
				block.setMiningToolLevel(member.getValue().asInt());
				break;
			case "other":
				block.setMiningOther(member.getValue().asBoolean());
				break;
			default:
				throw new JsonException("Unexpected item tool member \"" + member.getName() + "\"");
			}
		}
	}
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:24,代碼來源:BlockJson.java

示例2: parseSwitch

import com.eclipsesource.json.JsonObject; //導入方法依賴的package包/類
private void parseSwitch(JsonObject.Member member, String[] textures, String value) {
	parseSwitch2(member, textures, value);
	switch (member.getName()) {
	case "posZ":
		textures[BlockFace.posZ.index] = value;
		break;
	case "negZ":
		textures[BlockFace.negZ.index] = value;
		break;
	case "side":
		textures[BlockFace.posX.index] = value;
		textures[BlockFace.negX.index] = value;
		textures[BlockFace.posZ.index] = value;
		textures[BlockFace.negZ.index] = value;
		break;
	case "other":
		parseSwitchFor(textures, value);
		break;
	default:
		throw new JsonException("Unexpected block texture member \"" + member.getName() + "\"");
	}
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:23,代碼來源:BlockJson.java

示例3: parseSwitch2

import com.eclipsesource.json.JsonObject; //導入方法依賴的package包/類
private static void parseSwitch2(JsonObject.Member member, String[] textures, String value) {
	switch (member.getName()) {
	case "posX":
		textures[BlockFace.posX.index] = value;
		break;
	case "negX":
		textures[BlockFace.negX.index] = value;
		break;
	case "posY":
		break;
	case "top":
		textures[BlockFace.posY.index] = value;
		break;
	case "negY":
		break;
	case "bottom":
		textures[BlockFace.negY.index] = value;
		break;
	default:
		break;
	}
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:23,代碼來源:BlockJson.java

示例4: addItem

import com.eclipsesource.json.JsonObject; //導入方法依賴的package包/類
public static void addItem(JsonObject js) {
	if (js.get("tool") != null) {
		addItemTool(js);
		return;
	}
	String id = json.getString("id", null);
	if (id == null)
		throw new JsonException("No item id");
	JItem item = new JItem(id);

	JsonValue prop;

	prop = js.get("texture");
	if (prop != null) {
		item.textureString = prop.asString();
	} else {
		item.textureString = id;
	}

	for (JsonObject.Member member : js) {
		switch (member.getName()) {
		case "id":
		case "texture":
			break;
		default:
			throw new JsonException("Unexpected block member \"" + member.getName() + "\"");
		}
	}

	IDManager.register(item);
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:32,代碼來源:ItemJson.java

示例5: addItemToolFor

import com.eclipsesource.json.JsonObject; //導入方法依賴的package包/類
private void addItemToolFor(JsonObject tool, JItemTool item) {
	for (JsonObject.Member member : tool) {
		switch (member.getName()) {
		case "type":
			item.setToolType(toolType(member.getValue().asString()));
			break;
		case "level":
			item.setToolLevel(member.getValue().asInt());
			break;
		default:
			throw new JsonException("Unexpected item tool member \"" + member.getName() + "\"");
		}
	}
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:15,代碼來源:ItemJson.java

示例6: addItemTool

import com.eclipsesource.json.JsonObject; //導入方法依賴的package包/類
public static void addItemTool(JsonObject js) {
	String id = js.getString("id", null);
	if (id == null) {
		throw new JsonException("No item id");
	}
	JItemTool item = new JItemTool(id);

	JsonObject tool = js.get("tool").asObject();

	addItemToolFor(tool, item);

	JsonValue prop;

	prop = js.get("texture");
	if (prop != null) {
		item.textureString = prop.asString();
	} else {
		item.textureString = id;
	}

	for (JsonObject.Member member : js) {
		switch (member.getName()) {
		case "id":
		case "texture":
		case "tool":
			break;
		default:
			throw new JsonException("Unexpected block member \"" + member.getName() + "\"");
		}
	}

	IDManager.register(item);
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:34,代碼來源:ItemJson.java

示例7: addBlockSwitch

import com.eclipsesource.json.JsonObject; //導入方法依賴的package包/類
private static void addBlockSwitch(JsonObject.Member member) {
	addBlockSwitch2(member);
	switch (member.getName()) {
	case "displayMeta":
		break;
	case "mining":
		break;
	case "drops":
		break;
	case "transparent":
		break;
	default:
		throw new JsonException("Unexpected block member \"" + member.getName() + "\"");
	}
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:16,代碼來源:BlockJson.java

示例8: addBlock

import com.eclipsesource.json.JsonObject; //導入方法依賴的package包/類
public static void addBlock(JsonObject jsB) {
	String id = jsB.getString("id", null);
	if (id == null)
		throw new JsonException("No block id");
	int meta = jsB.getInt("meta", 1);
	JBlock block = new JBlock(id, meta);

	block.textures = parseMetaElement(jsB, "texture", new String[meta][], textureParser);
	block.lightLevel = parseMetaElement(jsB, "lightLevel", new Integer[meta], integerParser);
	block.transparent = parseMetaElement(jsB, "transparent", new Boolean[meta], booleanParser);
	block.drops = parseMetaElement(jsB, "drops", new ItemStackPlaceholder[meta][], itemStackArrayParser);

	JsonValue prop;

	prop = jsB.get("displayMeta");
	addBlockDisplay(prop, block, meta);

	prop = jsB.get("mining");
	addBlockMining(prop, block);

	for (JsonObject.Member member : jsB) {
		addBlockSwitch(member);
	}

	block.jsonFinish();
	IDManager.register(block);
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:28,代碼來源:BlockJson.java

示例9: parse

import com.eclipsesource.json.JsonObject; //導入方法依賴的package包/類
@Override
public String[] parse(JsonValue p3) {
	String[] textures = new String[6];
	if (p3.isString()) {
		Arrays.fill(textures, p3.asString());
	} else {
		JsonObject texture = p3.asObject();
		for (JsonObject.Member member : texture) {
			String value = member.getValue().asString();
			parseSwitch(member, textures, value);
		}
	}
	return textures;
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:15,代碼來源:BlockJson.java

示例10: addItem

import com.eclipsesource.json.JsonObject; //導入方法依賴的package包/類
public static void addItem(JsonObject json) {
  if (json.get("tool") != null) {
    addItemTool(json);
    return;
  }
  String id = json.getString("id", null);
  if (id == null) throw new JsonException("No item id");
  JItem item = new JItem(id);

  JsonValue prop;

  prop = json.get("texture");
  if (prop != null) {
    item.textureString = prop.asString();
  } else {
    item.textureString = id;
  }

  for (JsonObject.Member member : json) {
    switch (member.getName()) {
      case "id":
      case "texture":
        break;
      default:
        throw new JsonException("Unexpected block member \"" + member.getName() + "\"");
    }
  }

  IDManager.register(item);
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:31,代碼來源:ItemJson.java

示例11: parse

import com.eclipsesource.json.JsonObject; //導入方法依賴的package包/類
@Override
public String[] parse(JsonValue prop) {
  String[] textures = new String[6];
  if (prop.isString()) {
    Arrays.fill(textures, prop.asString());
  } else {
    JsonObject texture = prop.asObject();
    for (JsonObject.Member member : texture) {
      String value = member.getValue().asString();
      switch (member.getName()) {
        case "posX":
          textures[BlockFace.posX.index] = value;
          break;
        case "negX":
          textures[BlockFace.negX.index] = value;
          break;
        case "posY":
        case "top":
          textures[BlockFace.posY.index] = value;
          break;
        case "negY":
        case "bottom":
          textures[BlockFace.negY.index] = value;
          break;
        case "posZ":
          textures[BlockFace.posZ.index] = value;
          break;
        case "negZ":
          textures[BlockFace.negZ.index] = value;
          break;
        case "side":
          textures[BlockFace.posX.index] = value;
          textures[BlockFace.negX.index] = value;
          textures[BlockFace.posZ.index] = value;
          textures[BlockFace.negZ.index] = value;
          break;
        case "other":
          for (int i = 0; i < textures.length; i++) {
            if (textures[i] == null) textures[i] = value;
          }
          break;
        default:
          throw new JsonException("Unexpected block texture member \"" + member.getName() + "\"");
      }
    }
  }
  return textures;
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:49,代碼來源:BlockJson.java


注:本文中的com.eclipsesource.json.JsonObject.Member方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。