From 804ffe06d15da4c1ad26be73da36e8b416f17e71 Mon Sep 17 00:00:00 2001 From: PssbleTrngle Date: Fri, 26 Mar 2021 13:34:43 +0100 Subject: [PATCH] Fix mixin refmaps --- CHANGELOG.md | 6 +++++- .../brazier/Conditional.java | 19 ++++++++++++++++--- .../possible_triangle/brazier/Content.java | 1 + .../tags/blocks/brazier_base_blocks.json | 6 +++++- forge/build.gradle | 9 --------- .../brazier/forge/ForgeEvents.java | 9 ++++++++- gradle.properties | 2 +- 7 files changed, 36 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 155d346..3b2f627 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -117,4 +117,8 @@ Initial 1.16.3 release ## [3.0.1] - 2021-03-25 ### Fixed -- Correct java build target version \ No newline at end of file +- Correct java build target version. + +## [3.0.2] - 2021-03-26 +### Fixed +- Mixin refmaps being generated \ No newline at end of file diff --git a/common/src/main/java/com/possible_triangle/brazier/Conditional.java b/common/src/main/java/com/possible_triangle/brazier/Conditional.java index 1b27951..4305461 100644 --- a/common/src/main/java/com/possible_triangle/brazier/Conditional.java +++ b/common/src/main/java/com/possible_triangle/brazier/Conditional.java @@ -4,6 +4,7 @@ import com.possible_triangle.brazier.config.ServerConfig; import me.shedaniel.architectury.registry.RegistrySupplier; import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagContainer; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.entries.LootTableReference; @@ -21,6 +22,7 @@ public class Conditional { private static final List CONDITIONALS = new ArrayList<>(); + @SafeVarargs public static Conditional when(Predicate condition, RegistrySupplier... items) { Conditional conditional = new Conditional(condition); CONDITIONALS.add(conditional); @@ -50,6 +52,16 @@ public static void injectLoot(ResourceLocation target, Consumer itemTags = tags.getItems(); + disabled().map(ItemLike::asItem).forEach(item -> { + tags.getItems().getMatchingTags(item).stream() + .map(itemTags::getTag); + }); + */ + } + public final Predicate condition; public final List> items = new ArrayList<>(); public final List> loot = new ArrayList<>(); @@ -58,17 +70,18 @@ private Conditional(Predicate condition) { this.condition = condition; } - Conditional add(RegistrySupplier... item) { + @SafeVarargs + final Conditional add(RegistrySupplier... item) { items.addAll(Arrays.asList(item)); return this; } - Conditional loot(ResourceLocation target, ResourceLocation inject) { + final Conditional loot(ResourceLocation target, ResourceLocation inject) { loot.add(new Pair<>(target, inject)); return this; } - Conditional loot(ResourceLocation target, String inject) { + final Conditional loot(ResourceLocation target, String inject) { return loot(target, new ResourceLocation(Brazier.MOD_ID, "inject/" + inject)); } diff --git a/common/src/main/java/com/possible_triangle/brazier/Content.java b/common/src/main/java/com/possible_triangle/brazier/Content.java index c9f16d7..e98ce17 100644 --- a/common/src/main/java/com/possible_triangle/brazier/Content.java +++ b/common/src/main/java/com/possible_triangle/brazier/Content.java @@ -127,6 +127,7 @@ public static void setup() { Conditional.when(config -> config.JUNGLE_LOOT).loot(BuiltInLootTables.JUNGLE_TEMPLE, "flame_jungle_temple"); Conditional.when($ -> !Platform.isModLoaded("nether_extension")) + .add(Content.ASH, Content.WARPED_NETHERWART) .loot(EntityType.WITHER_SKELETON.getDefaultLootTable(), "wither_ash") .loot(Blocks.NETHER_WART.getLootTable(), "warped_wart"); } diff --git a/common/src/main/resources/data/brazier/tags/blocks/brazier_base_blocks.json b/common/src/main/resources/data/brazier/tags/blocks/brazier_base_blocks.json index f150d75..0cd90c0 100644 --- a/common/src/main/resources/data/brazier/tags/blocks/brazier_base_blocks.json +++ b/common/src/main/resources/data/brazier/tags/blocks/brazier_base_blocks.json @@ -4,6 +4,10 @@ "minecraft:netherite_block", "minecraft:crying_obsidian", "minecraft:ancient_debris", - "minecraft:gilded_blackstone" + "minecraft:gilded_blackstone", + { + "id": "caverns_and_chasms:necromium_block", + "required": false + } ] } \ No newline at end of file diff --git a/forge/build.gradle b/forge/build.gradle index a3d61c6..6e4ffe0 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -26,15 +26,6 @@ loom { mixinConfigs = ["brazier-forge.mixins.json", "brazier-common.mixins.json"] } -minecraft { - runs { - client { - property 'mixin.env.remapRefMap', 'true' - property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" - } - } -} - dependencies { forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}" // Remove the next line if you don't want to depend on the API diff --git a/forge/src/main/java/com/possible_triangle/brazier/forge/ForgeEvents.java b/forge/src/main/java/com/possible_triangle/brazier/forge/ForgeEvents.java index c536e1d..059cdc9 100644 --- a/forge/src/main/java/com/possible_triangle/brazier/forge/ForgeEvents.java +++ b/forge/src/main/java/com/possible_triangle/brazier/forge/ForgeEvents.java @@ -1,7 +1,9 @@ package com.possible_triangle.brazier.forge; +import com.possible_triangle.brazier.Conditional; import com.possible_triangle.brazier.block.BrazierBlock; import net.minecraftforge.event.LootTableLoadEvent; +import net.minecraftforge.event.TagsUpdatedEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -19,7 +21,12 @@ public static void onMobSpawn(LivingSpawnEvent.CheckSpawn event) { @SubscribeEvent public static void onLootLoaded(LootTableLoadEvent event) { - //Conditional.injectLoot(event.getName(), p -> event.getTable().addPool(p.build())); + Conditional.injectLoot(event.getName(), p -> event.getTable().addPool(p.build())); + } + + @SubscribeEvent + public static void onTagLoaded(TagsUpdatedEvent event) { + Conditional.removeTags(event.getTagManager()); } } diff --git a/gradle.properties b/gradle.properties index 9dd2a9c..0354c28 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ minecraft_version=1.16.5 # Mod archives_base_name=brazier -mod_version=3.0.1 +mod_version=3.0.2 maven_group=com.possible_triangle # Architectury