Apply update flag on later change (#2037)

* Apply update flag on later change

* Checkstyle

* Move entry point for UPDATE
This commit is contained in:
Maddy Miller 2022-03-05 13:32:03 +10:00 committed by GitHub
parent eac5b51b0f
commit 30e1601489
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 0 deletions

View File

@ -153,6 +153,12 @@ public void notifyNeighbors(BlockPos pos, net.minecraft.world.level.block.state.
}
}
@Override
public void updateBlock(BlockPos pos, net.minecraft.world.level.block.state.BlockState oldState, net.minecraft.world.level.block.state.BlockState newState) {
ServerLevel world = getWorld();
newState.onPlace(world, pos, oldState, false);
}
private void fireNeighborChanged(BlockPos pos, ServerLevel world, Block block, BlockPos neighborPos) {
world.getBlockState(neighborPos).neighborChanged(world, neighborPos, block, pos, false);
}

View File

@ -153,6 +153,12 @@ public void notifyNeighbors(BlockPos pos, net.minecraft.world.level.block.state.
}
}
@Override
public void updateBlock(BlockPos pos, net.minecraft.world.level.block.state.BlockState oldState, net.minecraft.world.level.block.state.BlockState newState) {
ServerLevel world = getWorld();
newState.onPlace(world, pos, oldState, false);
}
private void fireNeighborChanged(BlockPos pos, ServerLevel world, Block block, BlockPos neighborPos) {
world.getBlockState(neighborPos).neighborChanged(world, neighborPos, block, pos, false);
}

View File

@ -97,6 +97,10 @@ default void applySideEffects(BlockVector3 position, BlockState previousType, Si
NBS oldData = toNative(previousType);
NBS newData = getBlockState(chunk, pos);
if (sideEffectSet.shouldApply(SideEffect.UPDATE)) {
updateBlock(pos, oldData, newData);
}
if (sideEffectSet.getState(SideEffect.LIGHTING) == SideEffect.State.ON) {
updateLightingForBlock(pos);
}
@ -146,6 +150,9 @@ default void setCurrentSideEffectSet(SideEffectSet sideEffectSet) {
void notifyNeighbors(NP pos, NBS oldState, NBS newState);
default void updateBlock(NP pos, NBS oldState, NBS newState) {
}
void updateNeighbors(NP pos, NBS oldState, NBS newState, int recursionLimit);
void onBlockStateChange(NP pos, NBS oldState, NBS newState);

View File

@ -141,6 +141,12 @@ public void notifyNeighbors(BlockPos pos, BlockState oldState, BlockState newSta
}
}
@Override
public void updateBlock(BlockPos pos, BlockState oldState, BlockState newState) {
Level world = getWorld();
newState.onPlace(world, pos, oldState, false);
}
@Override
public void updateNeighbors(BlockPos pos, BlockState oldState, BlockState newState, int recursionLimit) {
Level world = getWorld();

View File

@ -145,6 +145,12 @@ public void notifyNeighbors(BlockPos pos, BlockState oldState, BlockState newSta
}
}
@Override
public void updateBlock(BlockPos pos, BlockState oldState, BlockState newState) {
ServerLevel world = getWorld();
newState.onPlace(world, pos, oldState, false);
}
@Override
public void updateNeighbors(BlockPos pos, BlockState oldState, BlockState newState, int recursionLimit) {
ServerLevel world = getWorld();

View File

@ -137,6 +137,12 @@ public void notifyNeighbors(BlockPos pos, BlockState oldState, BlockState newSta
}
}
@Override
public void updateBlock(BlockPos pos, BlockState oldState, BlockState newState) {
ServerLevel world = getWorld();
newState.onPlace(world, pos, oldState, false);
}
@Override
public void updateNeighbors(BlockPos pos, BlockState oldState, BlockState newState, int recursionLimit) {
ServerLevel world = getWorld();