diff --git a/src/main/java/org/violetmoon/quark/integration/lootr/ILootrIntegration.java b/src/main/java/org/violetmoon/quark/integration/lootr/ILootrIntegration.java index 7c7b3ad57f..d880ce588a 100644 --- a/src/main/java/org/violetmoon/quark/integration/lootr/ILootrIntegration.java +++ b/src/main/java/org/violetmoon/quark/integration/lootr/ILootrIntegration.java @@ -3,11 +3,10 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.ChestBlockEntity; - import org.jetbrains.annotations.Nullable; - import org.violetmoon.zeta.module.ZetaModule; +import java.util.Map; import java.util.function.BooleanSupplier; /** @@ -33,6 +32,10 @@ default Block lootrVariant(Block base) { return null; } + default void populate(Map map) { + // NO-OP + } + default void postRegister() { // NO-OP } diff --git a/src/main/java/org/violetmoon/quark/integration/lootr/LootrIntegration.java b/src/main/java/org/violetmoon/quark/integration/lootr/LootrIntegration.java index 5b4f7617e1..dc94d885fa 100644 --- a/src/main/java/org/violetmoon/quark/integration/lootr/LootrIntegration.java +++ b/src/main/java/org/violetmoon/quark/integration/lootr/LootrIntegration.java @@ -4,10 +4,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.ChestBlockEntity; -import net.minecraft.world.level.block.state.BlockBehaviour; - import org.jetbrains.annotations.Nullable; - import org.violetmoon.quark.base.Quark; import org.violetmoon.quark.base.util.BlockPropertyUtil; import org.violetmoon.zeta.module.ZetaModule; @@ -62,6 +59,11 @@ public Block lootrVariant(Block base) { return chestMappings.get(base); } + @Override + public void populate(Map map) { + map.putAll(chestMappings); + } + @Override public void postRegister() { chestTEType = BlockEntityType.Builder.of(LootrVariantChestBlockEntity::new, lootrRegularChests.toArray(new Block[0])).build(null); diff --git a/src/main/java/org/violetmoon/quark/integration/mixin/lootr/ConfigManagerMixin.java b/src/main/java/org/violetmoon/quark/integration/mixin/lootr/ConfigManagerMixin.java index cd5439b973..012c93c52d 100644 --- a/src/main/java/org/violetmoon/quark/integration/mixin/lootr/ConfigManagerMixin.java +++ b/src/main/java/org/violetmoon/quark/integration/mixin/lootr/ConfigManagerMixin.java @@ -1,18 +1,19 @@ package org.violetmoon.quark.integration.mixin.lootr; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; - +import noobanidus.mods.lootr.config.ConfigManager; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyVariable; - import org.violetmoon.quark.base.Quark; -import noobanidus.mods.lootr.config.ConfigManager; +import java.util.Map; @Pseudo @Mixin(value = ConfigManager.class, remap = false) @@ -28,4 +29,11 @@ private static Block replacement(Block original, ResourceLocation location) { return original; } + + @WrapOperation(method = "replacement", at = @At(value = "INVOKE", target = "Ljava/util/HashMap;()V"), remap = false) + private static Map addQuarkChests(Operation> original) { + Map map = original.call(); + Quark.LOOTR_INTEGRATION.populate(map); + return map; + } }