Fix datagen resolving tags and exploding. (#6865)

This commit is contained in:
Cyborgmas 2020-06-29 19:39:04 -04:00 committed by GitHub
parent 20d231bbed
commit d5aa0c4a91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 377 additions and 19 deletions

View file

@ -122,7 +122,7 @@ project(':clean') {
clean_server {
taskName 'clean_server'
main 'net.minecraft.server.MinecraftServer'
main 'net.minecraft.server.Main'
workingDirectory project.file('run')
}
}

View file

@ -20,7 +20,7 @@
this.field_199807_b = p_i49381_1_.toArray((p_209360_0_) -> {
return new Ingredient.IItemList[p_209360_0_];
});
+ this.isSimple = !Arrays.stream(field_199807_b).anyMatch(list -> list.func_199799_a().stream().anyMatch(stack -> stack.func_77973_b().func_77645_m()));
+ this.isSimple = !net.minecraftforge.fml.ModLoader.isDataGenRunning() && !Arrays.stream(field_199807_b).anyMatch(list -> list.func_199799_a().stream().anyMatch(stack -> stack.func_77973_b().func_77645_m()));
+ Ingredient.INSTANCES.add(this);
}

View file

@ -0,0 +1,22 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:nether_sprouts"
}
],
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"tag": "forge:shears"
}
}
]
}
]
}

View file

@ -0,0 +1,61 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:alternative",
"terms": [
{
"condition": "minecraft:match_tool",
"predicate": {
"tag": "forge:shears"
}
},
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
]
}
],
"name": "minecraft:twisting_vines"
},
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:table_bonus",
"enchantment": "minecraft:fortune",
"chances": [
0.33,
0.55,
0.77,
1.0
]
}
],
"name": "minecraft:twisting_vines"
}
]
}
]
}
]
}

View file

@ -0,0 +1,61 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:alternative",
"terms": [
{
"condition": "minecraft:match_tool",
"predicate": {
"tag": "forge:shears"
}
},
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
]
}
],
"name": "minecraft:weeping_vines"
},
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:table_bonus",
"enchantment": "minecraft:fortune",
"chances": [
0.33,
0.55,
0.77,
1.0
]
}
],
"name": "minecraft:weeping_vines"
}
]
}
]
}
]
}

View file

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"N",
"I",
"N"
],
"key": {
"I": {
"tag": "forge:ingots/iron"
},
"N": {
"item": "minecraft:iron_nugget"
}
},
"result": {
"item": "minecraft:chain"
}
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:crafting_shaped",
"group": "wooden_fence",
"pattern": [
"W#W",
"W#W"
],
"key": {
"#": {
"tag": "forge:rods/wooden"
},
"W": {
"item": "minecraft:crimson_planks"
}
},
"result": {
"item": "minecraft:crimson_fence",
"count": 3
}
}

View file

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"group": "wooden_fence_gate",
"pattern": [
"#W#",
"#W#"
],
"key": {
"#": {
"tag": "forge:rods/wooden"
},
"W": {
"item": "minecraft:crimson_planks"
}
},
"result": {
"item": "minecraft:crimson_fence_gate"
}
}

View file

@ -0,0 +1,21 @@
{
"type": "minecraft:crafting_shaped",
"group": "sign",
"pattern": [
"###",
"###",
" X "
],
"key": {
"#": {
"item": "minecraft:crimson_planks"
},
"X": {
"tag": "forge:rods/wooden"
}
},
"result": {
"item": "minecraft:crimson_sign",
"count": 3
}
}

View file

@ -1,16 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"# #",
"###"
],
"key": {
"#": {
"tag": "forge:cobblestone"
}
},
"result": {
"item": "minecraft:furnace"
}
}

View file

@ -0,0 +1,33 @@
{
"type": "minecraft:crafting_shapeless",
"group": "netherite_ingot",
"ingredients": [
{
"item": "minecraft:netherite_scrap"
},
{
"item": "minecraft:netherite_scrap"
},
{
"item": "minecraft:netherite_scrap"
},
{
"item": "minecraft:netherite_scrap"
},
{
"tag": "forge:ingots/gold"
},
{
"tag": "forge:ingots/gold"
},
{
"tag": "forge:ingots/gold"
},
{
"tag": "forge:ingots/gold"
}
],
"result": {
"item": "minecraft:netherite_ingot"
}
}

View file

@ -0,0 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
" S ",
"S#S",
"LLL"
],
"key": {
"L": {
"tag": "minecraft:logs"
},
"S": {
"tag": "forge:rods/wooden"
},
"#": {
"tag": "minecraft:soul_fire_base_blocks"
}
},
"result": {
"item": "minecraft:soul_campfire"
}
}

View file

@ -0,0 +1,28 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"X",
"#",
"S"
],
"key": {
"X": [
{
"item": "minecraft:coal"
},
{
"item": "minecraft:charcoal"
}
],
"#": {
"tag": "forge:rods/wooden"
},
"S": {
"tag": "minecraft:soul_fire_base_blocks"
}
},
"result": {
"item": "minecraft:soul_torch",
"count": 4
}
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:crafting_shaped",
"group": "wooden_fence",
"pattern": [
"W#W",
"W#W"
],
"key": {
"#": {
"tag": "forge:rods/wooden"
},
"W": {
"item": "minecraft:warped_planks"
}
},
"result": {
"item": "minecraft:warped_fence",
"count": 3
}
}

View file

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"group": "wooden_fence_gate",
"pattern": [
"#W#",
"#W#"
],
"key": {
"#": {
"tag": "forge:rods/wooden"
},
"W": {
"item": "minecraft:warped_planks"
}
},
"result": {
"item": "minecraft:warped_fence_gate"
}
}

View file

@ -0,0 +1,21 @@
{
"type": "minecraft:crafting_shaped",
"group": "sign",
"pattern": [
"###",
"###",
" X "
],
"key": {
"#": {
"item": "minecraft:warped_planks"
},
"X": {
"tag": "forge:rods/wooden"
}
},
"result": {
"item": "minecraft:warped_sign",
"count": 3
}
}

View file

@ -131,6 +131,7 @@ public class ForgeItemTagsProvider extends ItemTagsProvider
func_240522_a_(Tags.Items.SEEDS_MELON).func_240534_a_(Items.MELON_SEEDS);
func_240522_a_(Tags.Items.SEEDS_PUMPKIN).func_240534_a_(Items.PUMPKIN_SEEDS);
func_240522_a_(Tags.Items.SEEDS_WHEAT).func_240534_a_(Items.WHEAT_SEEDS);
func_240522_a_(Tags.Items.SHEARS).func_240534_a_(Items.SHEARS);
func_240522_a_(Tags.Items.SLIMEBALLS).func_240534_a_(Items.SLIME_BALL);
func_240521_a_(Tags.Blocks.STAINED_GLASS, Tags.Items.STAINED_GLASS);
func_240521_a_(Tags.Blocks.STAINED_GLASS_PANES, Tags.Items.STAINED_GLASS_PANES);

View file

@ -153,7 +153,7 @@ public class ForgeRecipeProvider extends RecipeProvider
boolean modified = false;
List<IItemList> items = new ArrayList<>();
IItemList[] vanillaItems = getField(Ingredient.class, vanilla, 3);
IItemList[] vanillaItems = getField(Ingredient.class, vanilla, 2); //This will probably crash between versions, if null fix index
for (IItemList entry : vanillaItems)
{
if (entry instanceof SingleItemList)

View file

@ -285,9 +285,16 @@ public class ModLoader
this.loadingWarnings.add(warning);
}
private static boolean runningDataGen = false;
public static boolean isDataGenRunning () {
return runningDataGen;
}
public void runDataGenerator(final Set<String> mods, final Path path, final Collection<Path> inputs, Collection<Path> existingPacks, final boolean serverGenerators, final boolean clientGenerators, final boolean devToolGenerators, final boolean reportsGenerator, final boolean structureValidator, final boolean flat) {
if (mods.contains("minecraft") && mods.size() == 1) return;
LOGGER.info("Initializing Data Gatherer for mods {}", mods);
runningDataGen = true;
Bootstrap.register();
dataGeneratorConfig = new GatherDataEvent.DataGeneratorConfig(mods, path, inputs, serverGenerators, clientGenerators, devToolGenerators, reportsGenerator, structureValidator, flat);
existingFileHelper = new ExistingFileHelper(existingPacks, structureValidator);