Fixed conditional recipe tag dependency (issue #120).
This commit is contained in:
parent
cd95ef1906
commit
7356e91c37
4 changed files with 14 additions and 7 deletions
|
@ -5,4 +5,4 @@ version_minecraft=1.16.1
|
|||
version_forge_minecraft=1.16.1-32.0.106
|
||||
version_fml_mappings=20200514-1.16
|
||||
version_jei=1.16.1:7.0.0.6
|
||||
version_engineersdecor=1.1.2
|
||||
version_engineersdecor=1.1.3
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
|
||||
"1.16.1": {
|
||||
"1.1.3": "[F] Fixed conditional recipe tag dependency (thx Blu, Cyborgmas).",
|
||||
"1.1.2": "[F] Fixed Crafting Table Patchouli manual entry.",
|
||||
"1.1.1": "[R] Intial 1.16.1 release.",
|
||||
"1.1.1-b7": "[F] Fixed AI-open-path bug (issue #116, ty KrAzYGEEK32, desht).\n[F] Conditional recipes extended to additional vanilla ingredients in case of oredict tag issues.\n[M] Lang file update zh_cn (PR#117, Moonisky).",
|
||||
|
@ -13,7 +14,7 @@
|
|||
"1.1.1-a1": "[A] Initial port."
|
||||
},
|
||||
"promos": {
|
||||
"1.16.1-recommended": "1.1.2",
|
||||
"1.16.1-latest": "1.1.2"
|
||||
"1.16.1-recommended": "1.1.3",
|
||||
"1.16.1-latest": "1.1.3"
|
||||
}
|
||||
}
|
|
@ -11,6 +11,8 @@ Mod sources for Minecraft version 1.16.1.
|
|||
|
||||
## Version history
|
||||
|
||||
- v1.1.3 [F] Fixed conditional recipe tag dependency (thx Blu, Cyborgmas).
|
||||
|
||||
- v1.1.2 [F] Fixed Crafting Table Patchouli manual entry.
|
||||
|
||||
- v1.1.1 [R] Intial 1.16.1 release.
|
||||
|
|
|
@ -10,7 +10,9 @@ package wile.engineersdecor.libmc.detail;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagCollectionManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraftforge.common.crafting.conditions.ICondition;
|
||||
|
@ -24,6 +26,7 @@ import org.apache.logging.log4j.Logger;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
|
||||
|
@ -95,6 +98,7 @@ public class OptionalRecipeCondition implements ICondition
|
|||
if(without_recipes) return false;
|
||||
if((experimental) && (!with_experimental)) return false;
|
||||
final IForgeRegistry<Item> item_registry = ForgeRegistries.ITEMS;
|
||||
final Map<ResourceLocation, ITag<Item>> item_tags = TagCollectionManager.func_232928_e_/*getInstance?*/().func_232925_b_/*getItemTags()?*/().getTagMap();
|
||||
if(result != null) {
|
||||
boolean item_registered = item_registry.containsKey(result);
|
||||
if(!item_registered) return false; // required result not registered
|
||||
|
@ -108,8 +112,8 @@ public class OptionalRecipeCondition implements ICondition
|
|||
}
|
||||
if(!all_required_tags.isEmpty()) {
|
||||
for(ResourceLocation rl:all_required_tags) {
|
||||
if(!ItemTags.getCollection().getTagMap().containsKey(rl)) return false;
|
||||
if(ItemTags.getCollection().getTagMap().get(rl).func_230236_b_().isEmpty()) return false;
|
||||
if(!item_tags.containsKey(rl)) return false;
|
||||
if(item_tags.get(rl).func_230236_b_()/*getAllElements()*/.isEmpty()) return false;
|
||||
}
|
||||
}
|
||||
if(!any_missing.isEmpty()) {
|
||||
|
@ -120,8 +124,8 @@ public class OptionalRecipeCondition implements ICondition
|
|||
}
|
||||
if(!any_missing_tags.isEmpty()) {
|
||||
for(ResourceLocation rl:any_missing_tags) {
|
||||
if(!ItemTags.getCollection().getTagMap().containsKey(rl)) return true;
|
||||
if(ItemTags.getCollection().getTagMap().get(rl).func_230236_b_().isEmpty()) return true;
|
||||
if(!item_tags.containsKey(rl)) return true;
|
||||
if(item_tags.get(rl).func_230236_b_()/*getAllElements()*/.isEmpty()) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue