本文整理汇总了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() + "\"");
}
}
}
}
示例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() + "\"");
}
}
示例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;
}
}
示例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);
}
示例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() + "\"");
}
}
}
示例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);
}
示例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() + "\"");
}
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}