Skip to content

Make blocks transmit redstone signal from buttons and levers #157

@Danielxs01

Description

@Danielxs01

Make blocks transmit redstone signal

Current behaviour:
Currently blocks are unable to pass redstone.

Wanted behaviour:
Blocks pass redstone signal provided by buttons, levers or redstone wires.

Code example:

public class Tile??? extends BlockEntity implements IRedstoneProvider {
    
    @TagField
    private int redstonePass = 0;

    @Override
    public void onNeighborChange(Vec3i neighbor) {
        redstonePass = 0;
        int newRedstonePass = getWorld().getRedstone(getPos());
        if(this.redstonePass != newRedstonePass){
            this.redstonePass = newRedstonePass;
            getWorld().notifyNeighborsOfStateChange(getPos(), LOSBlocks.BLOCK_???, true);
        }
    }

    @Override
    public int getStrongPower(Facing from) {
        return redstonePass;
    }

    @Override
    public int getWeakPower(Facing from) {
        return redstonePass;
    }

}

Metadata

Metadata

Assignees

Labels

Forge (all versions)Priority: HighIndicates that the issue or enhancement is of high prioritySignalsProblem belongs to the signals partStellwandProblem belongs to the stellwand partenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions