Skip to content

Commit

Permalink
probably fix #4757, fix #4652
Browse files Browse the repository at this point in the history
  • Loading branch information
yrsegal committed Aug 13, 2024
1 parent d26e377 commit 747c12c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -33,6 +32,10 @@ default Block lootrVariant(Block base) {
return null;
}

default void populate(Map<Block, Block> map) {
// NO-OP
}

default void postRegister() {
// NO-OP
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -62,6 +59,11 @@ public Block lootrVariant(Block base) {
return chestMappings.get(base);
}

@Override
public void populate(Map<Block, Block> map) {
map.putAll(chestMappings);
}

@Override
public void postRegister() {
chestTEType = BlockEntityType.Builder.of(LootrVariantChestBlockEntity::new, lootrRegularChests.toArray(new Block[0])).build(null);
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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;<init>()V"), remap = false)
private static Map<Block, Block> addQuarkChests(Operation<Map<Block, Block>> original) {
Map<Block, Block> map = original.call();
Quark.LOOTR_INTEGRATION.populate(map);
return map;
}
}

0 comments on commit 747c12c

Please sign in to comment.