From d337fa780446ca7c074a3cf28d52d3747c30988d Mon Sep 17 00:00:00 2001 From: IchHabeHunger54 Date: Thu, 28 Dec 2023 09:58:16 +0100 Subject: [PATCH] add redstone output to sword pedestal --- .../content/swordpedestal/SwordPedestalBlock.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/com/github/minecraftschurlimods/bibliocraft/content/swordpedestal/SwordPedestalBlock.java b/src/main/java/com/github/minecraftschurlimods/bibliocraft/content/swordpedestal/SwordPedestalBlock.java index 6c04eb9b..10f67bea 100644 --- a/src/main/java/com/github/minecraftschurlimods/bibliocraft/content/swordpedestal/SwordPedestalBlock.java +++ b/src/main/java/com/github/minecraftschurlimods/bibliocraft/content/swordpedestal/SwordPedestalBlock.java @@ -78,4 +78,16 @@ public ItemStack getCloneItemStack(BlockState state, HitResult target, LevelRead protected MapCodec codec() { return simpleCodec(SwordPedestalBlock::new); } + + @Override + public boolean hasAnalogOutputSignal(BlockState state) { + return true; + } + + @Override + public int getAnalogOutputSignal(BlockState state, Level level, BlockPos pos) { + if (level.isClientSide() || !(level.getBlockEntity(pos) instanceof SwordPedestalBlockEntity spbe)) + return super.getAnalogOutputSignal(state, level, pos); + return spbe.getItem(0).isEmpty() ? 0 : 15; + } }