Fixed delay in block update when placing a cable block
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
- Grids now do not sort if you interact with it while holding shift (Darkere)
|
- Grids now do not sort if you interact with it while holding shift (Darkere)
|
||||||
- Fixed Pattern Grid causing world hanging on load (raoulvdberge)
|
- Fixed Pattern Grid causing world hanging on load (raoulvdberge)
|
||||||
- Fixed External Storage not refreshing when the storage is broken or replaced (raoulvdberge)
|
- Fixed External Storage not refreshing when the storage is broken or replaced (raoulvdberge)
|
||||||
|
- Fixed delay in block update when placing a cable block (raoulvdberge)
|
||||||
|
|
||||||
### 1.7
|
### 1.7
|
||||||
NOTE: This is an alpha release. Bugs may happen. Remember to take backups.
|
NOTE: This is an alpha release. Bugs may happen. Remember to take backups.
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import net.minecraft.util.math.shapes.ISelectionContext;
|
|||||||
import net.minecraft.util.math.shapes.VoxelShape;
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.IWorld;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@@ -57,10 +57,8 @@ public class CableBlock extends NetworkNodeBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
|
public BlockState updatePostPlacement(BlockState state, Direction dir, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) {
|
||||||
super.neighborChanged(state, world, pos, block, fromPos, isMoving);
|
return getState(state, world, pos);
|
||||||
|
|
||||||
world.setBlockState(pos, getState(state, world, pos));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -101,7 +99,7 @@ public class CableBlock extends NetworkNodeBlock {
|
|||||||
return getState(getDefaultState(), ctx.getWorld(), ctx.getPos());
|
return getState(getDefaultState(), ctx.getWorld(), ctx.getPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasNode(World world, BlockPos pos, BlockState state, Direction direction) {
|
private boolean hasNode(IWorld world, BlockPos pos, BlockState state, Direction direction) {
|
||||||
if (getDirection() != BlockDirection.NONE && state.get(getDirection().getProperty()).getOpposite() == direction) {
|
if (getDirection() != BlockDirection.NONE && state.get(getDirection().getProperty()).getOpposite() == direction) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -114,7 +112,7 @@ public class CableBlock extends NetworkNodeBlock {
|
|||||||
return tile.getCapability(NetworkNodeProxyCapability.NETWORK_NODE_PROXY_CAPABILITY, direction).isPresent();
|
return tile.getCapability(NetworkNodeProxyCapability.NETWORK_NODE_PROXY_CAPABILITY, direction).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockState getState(BlockState currentState, World world, BlockPos pos) {
|
private BlockState getState(BlockState currentState, IWorld world, BlockPos pos) {
|
||||||
boolean north = hasNode(world, pos.offset(Direction.NORTH), currentState, Direction.SOUTH);
|
boolean north = hasNode(world, pos.offset(Direction.NORTH), currentState, Direction.SOUTH);
|
||||||
boolean east = hasNode(world, pos.offset(Direction.EAST), currentState, Direction.WEST);
|
boolean east = hasNode(world, pos.offset(Direction.EAST), currentState, Direction.WEST);
|
||||||
boolean south = hasNode(world, pos.offset(Direction.SOUTH), currentState, Direction.NORTH);
|
boolean south = hasNode(world, pos.offset(Direction.SOUTH), currentState, Direction.NORTH);
|
||||||
|
|||||||
Reference in New Issue
Block a user