Skip to content

Commit

Permalink
Merge branch 'feature/miner-recipe-conditions'
Browse files Browse the repository at this point in the history
  • Loading branch information
klikli-dev committed Mar 24, 2020
2 parents a475875 + 78004d2 commit 3797d53
Show file tree
Hide file tree
Showing 48 changed files with 465 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,28 +116,7 @@ public MinerRecipe read(ResourceLocation recipeId, JsonObject json) {
"ingredient") : JSONUtils.getJsonObject(json, "ingredient");
Ingredient ingredient = Ingredient.deserialize(ingredientElement);
JsonElement resultElement = JSONUtils.getJsonObject(json, "result");
Ingredient result;
try {
result = Ingredient.deserialize(resultElement);
} catch (JsonSyntaxException e) {
//Special handling for unknown tags, because we add a whole bunch by default.
if (e.getMessage().contains("Unknown item tag")) {
//fail silently (minus the null-warning that forge will log) because it's fine.
Occultism.LOGGER
.debug("Unknown tag in MinerRecipe. This is expected to happen because we add a lot of common ones, but in some cases may indicate a typo in the tag, so it's being logged. Original message: {}",
e.getMessage());
return null;
}
//Special handling for unknown items, because we add a whole bunch by default.
else if(e.getMessage().contains("Unknown item")){
Occultism.LOGGER
.debug("Unknown item in MinerRecipe. This is expected to happen because we add a lot of common ones, but in some cases may indicate a typo in the tag, so it's being logged. Original message: {}",
e.getMessage());
return null;
}
//if the error is not related to the tag, throw.
throw e;
}
Ingredient result = Ingredient.deserialize(resultElement);
int weight = JSONUtils.getInt(json, "weight");

return new MinerRecipe(recipeId, ingredient, new WeightedIngredient(result, weight));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/agate"
},
"weight": 200
"weight": 200,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/agate"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/aluminum"
},
"weight": 422
"weight": 422,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/aluminum"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/amber"
},
"weight": 184
"weight": 184,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/amber"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/amethyst"
},
"weight": 200
"weight": 200,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/amethyst"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/aquamarine"
},
"weight": 200
"weight": 200,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/aquamarine"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/ardite"
},
"weight": 159
"weight": 159,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/ardite"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/beryl"
},
"weight": 200
"weight": 200,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/beryl"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/boron"
},
"weight": 199
"weight": 199,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/boron"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/certus_quartz"
},
"weight": 187
"weight": 187,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/certus_quartz"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/charged_certus_quartz"
},
"weight": 109
"weight": 109,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/charged_certus_quartz"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/cinnabar"
},
"weight": 190
"weight": 190,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/cinnabar"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/cobalt"
},
"weight": 163
"weight": 163,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/cobalt"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/copper"
},
"weight": 584
"weight": 584,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/copper"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@
"result":{
"item": "rftools:dimensional_shard_ore"
},
"weight": 127
"weight": 127,
"conditions": [
{
"type": "forge:item_exists",
"item": "rftools:dimensional_shard_ore"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@
"result":{
"item": "draconicevolution:draconium_ore"
},
"weight": 142
"weight": 142,
"conditions": [
{
"type": "forge:item_exists",
"item": "draconicevolution:draconium_ore"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/electrotine"
},
"weight": 155
"weight": 155,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/electrotine"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/garnet"
},
"weight": 200
"weight": 200,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/garnet"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/heliodore"
},
"weight": 200
"weight": 200,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/heliodore"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/indicolite"
},
"weight": 200
"weight": 200,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/indicolite"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/inferium"
},
"weight": 190
"weight": 190,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/inferium"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/iolite"
},
"weight": 200
"weight": 200,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/iolite"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"result":{
"tag": "forge:ores/lead"
},
"weight": 500
"weight": 500,
"conditions": [
{
"type": "forge:not",
"value": {
"type": "forge:tag_empty",
"tag": "forge:ores/lead"
}
}
]
}
Loading

0 comments on commit 3797d53

Please sign in to comment.