27 lines
1.1 KiB
Java
27 lines
1.1 KiB
Java
|
package com.thebrokenrail.slightlyvanilla.mixin;
|
||
|
|
||
|
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
||
|
import net.minecraft.block.entity.BlockEntityType;
|
||
|
import net.minecraft.block.entity.LockableContainerBlockEntity;
|
||
|
import net.minecraft.block.entity.LootableContainerBlockEntity;
|
||
|
import net.minecraft.entity.player.PlayerEntity;
|
||
|
import org.spongepowered.asm.mixin.Mixin;
|
||
|
import org.spongepowered.asm.mixin.injection.At;
|
||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||
|
|
||
|
@SuppressWarnings("unused")
|
||
|
@Mixin(LootableContainerBlockEntity.class)
|
||
|
public abstract class MixinLootableContainerBlockEntity extends LockableContainerBlockEntity {
|
||
|
protected MixinLootableContainerBlockEntity(BlockEntityType<?> blockEntityType) {
|
||
|
super(blockEntityType);
|
||
|
}
|
||
|
|
||
|
@Inject(at = @At("HEAD"), method = "checkUnlocked", cancellable = true)
|
||
|
public void checkUnlocked(PlayerEntity player, CallbackInfoReturnable<Boolean> info) {
|
||
|
if (SlightlyVanilla.getConfig().openLootChestsInSpectatorMode) {
|
||
|
info.setReturnValue(super.checkUnlocked(player));
|
||
|
}
|
||
|
}
|
||
|
}
|