public WeightedRandomLoot(JsonObject json, int weight) throws Exception{
this.name = json.get("name").getAsString();
ResourceLocation location = new ResourceLocation(name);
this.item = (Item) Item.REGISTRY.getObject(location);
try{
this.item.getUnlocalizedName();
} catch (NullPointerException e){
throw new Exception("Invalid item: " + this.name);
}
this.damage = json.has("meta") ? json.get("meta").getAsInt() : 0;
this.weight = weight;
this.enchLevel = json.has("ench") ? json.get("ench").getAsInt() : 0;
if(json.has("min") && json.has("max")){
min = json.get("min").getAsInt();
max = json.get("max").getAsInt();
} else {
min = 1;
max = 1;
}
if(json.has("nbt")) this.nbt = JsonToNBT.getTagFromJson(json.get("nbt").getAsString());
}
WeightedRandomLoot.java 文件源码
java
阅读 16
收藏 0
点赞 0
评论 0
项目:minecraft-roguelike
作者:
评论列表
文章目录