Is there a way to test whether a block (block type?) can transfer a redstone current? Eg. powered wire on one side, lit up redstone lamp on the opposite. This only works for certain blocks.
I believe SolidCubeProperty
is what you’re looking for. If a block is solid, as far as I know it should be able to pass current.
Is glowstone Solid? Transperent? Opaque?
The problem is these words get thrown around the Minecraft redstone community pretty loosely. Honestly the only real way would be to test it empirically as well as tracing it back from the Minecraft internals.
tl;dr vanilla has a method boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
in the Block
class that probably returns what you want.
I have taken a look at the code for vanilla and it does the following:
BlockRedstoneLight
checks World.isBlockPowered
with the position of the lamp:
isBlockPowered
tests each adjacent block for getRedstonePower
, returning true
if any adjacent block has a power above 0
getRedstonePower
makes the following choice:
iblockstate.isNormalCube() ? this.getStrongPower(pos) : iblockstate.getWeakPower(this, pos, facing);
By default, isNormalCube
does the following check:
return state.getMaterial().isOpaque() && state.isFullCube() && !state.canProvidePower();
That is, the block’s material must be opaque (glowstone for example is not), it must be a full cube (e.g not a slab) and is must not be a source of redstone power (e.g. lever).
So if the block is a “normal cube”, then getStrongPower
is called.
This method checks all adjacent blocks and returns them maximum “strong power” property of the adjacent blocks (this property is normally 0
for most blocks other than redstone sources and wire)
If the block is not a “normal cube”, it will return that block’s weak power property (quite similar to strong power).