Fixed leaves cascade update, basic structure classes separation
This commit is contained in:
parent
d87b98fcd7
commit
d0135e83e9
16 changed files with 136 additions and 53 deletions
|
@ -29,10 +29,26 @@ public class PosInfo implements Comparable<PosInfo> {
|
|||
return state;
|
||||
}
|
||||
|
||||
public BlockState getState(BlockPos pos) {
|
||||
PosInfo info = blocks.get(pos);
|
||||
if (info == null) {
|
||||
info = add.get(pos);
|
||||
return info == null ? AIR : info.getState();
|
||||
}
|
||||
return info.getState();
|
||||
}
|
||||
|
||||
public void setState(BlockState state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public void setState(BlockPos pos, BlockState state) {
|
||||
PosInfo info = blocks.get(pos);
|
||||
if (info != null) {
|
||||
info.setState(state);
|
||||
}
|
||||
}
|
||||
|
||||
public BlockState getState(Direction dir) {
|
||||
PosInfo info = blocks.get(pos.offset(dir));
|
||||
if (info == null) {
|
||||
|
|
|
@ -236,8 +236,10 @@ public abstract class SDF {
|
|||
if (infos.size() > 0) {
|
||||
Collections.sort(infos);
|
||||
infos.forEach((info) -> {
|
||||
BlockState state = postProcess.apply(info);
|
||||
BlocksHelper.setWithoutUpdate(world, info.getPos(), state);
|
||||
info.setState(postProcess.apply(info));
|
||||
});
|
||||
infos.forEach((info) -> {
|
||||
BlocksHelper.setWithoutUpdate(world, info.getPos(), info.getState());
|
||||
});
|
||||
|
||||
infos.clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue