Skip to content

Commit

Permalink
add redstone output to sword pedestal
Browse files Browse the repository at this point in the history
  • Loading branch information
IchHabeHunger54 committed Dec 28, 2023
1 parent 2c36644 commit d337fa7
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,16 @@ public ItemStack getCloneItemStack(BlockState state, HitResult target, LevelRead
protected MapCodec<SwordPedestalBlock> 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;
}
}

0 comments on commit d337fa7

Please sign in to comment.