Handle the redstone property different
This commit is contained in:
parent
65a21bcefc
commit
58a732782d
2 changed files with 16 additions and 13 deletions
|
@ -53,7 +53,7 @@ mod_name=Zontreck's Library Mod
|
|||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=GPLv3
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1201.13.043024.0307
|
||||
mod_version=1201.13.043024.0404
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
|
|
@ -64,32 +64,35 @@ public abstract class RedstoneBlock extends RotatableBlock
|
|||
|
||||
@Override
|
||||
public void onNeighborChange(BlockState state, LevelReader level, BlockPos pos, BlockPos neighbor) {
|
||||
onRedstone(level, pos, redstoneIsActivated(level, pos));
|
||||
boolean rs = redstoneIsActivated(level, pos);
|
||||
onRedstone(level, pos, rs);
|
||||
boolean inp = state.getValue(INPUT_POWER);
|
||||
state.setValue(INPUT_POWER, redstoneIsActivated(level, pos));
|
||||
state.setValue(INPUT_POWER, rs);
|
||||
|
||||
if(inp != redstoneIsActivated(level,pos))
|
||||
onRedstoneInputChanged(level, pos, state.getValue(INPUT_POWER));
|
||||
if(inp != rs)
|
||||
onRedstoneInputChanged(level, pos, rs);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, BlockPos other, boolean unknown) {
|
||||
onRedstone(level, pos, redstoneIsActivated(level, pos));
|
||||
boolean rs = redstoneIsActivated(level, pos);
|
||||
onRedstone(level, pos, rs);
|
||||
boolean inp = state.getValue(INPUT_POWER);
|
||||
state.setValue(INPUT_POWER, redstoneIsActivated(level, pos));
|
||||
state.setValue(INPUT_POWER, rs);
|
||||
|
||||
if(inp != redstoneIsActivated(level,pos))
|
||||
onRedstoneInputChanged(level, pos, state.getValue(INPUT_POWER));
|
||||
if(inp != rs)
|
||||
onRedstoneInputChanged(level, pos, rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlace(BlockState state, Level level, BlockPos pos, BlockState p_60569_, boolean p_60570_) {
|
||||
onRedstone(level, pos, redstoneIsActivated(level, pos));
|
||||
boolean rs = redstoneIsActivated(level, pos);
|
||||
onRedstone(level, pos, rs);
|
||||
boolean inp = state.getValue(INPUT_POWER);
|
||||
state.setValue(INPUT_POWER, redstoneIsActivated(level, pos));
|
||||
state.setValue(INPUT_POWER, rs);
|
||||
|
||||
if(inp != redstoneIsActivated(level,pos))
|
||||
onRedstoneInputChanged(level, pos, state.getValue(INPUT_POWER));
|
||||
if(inp != rs)
|
||||
onRedstoneInputChanged(level, pos, rs);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue