Skip to content

Commit

Permalink
Fix sinking deleting blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
oh-noey committed Oct 5, 2019
1 parent 1b1d7e3 commit 349289e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import net.countercraft.movecraft.events.CraftDetectEvent;
import net.countercraft.movecraft.localisation.I18nSupport;
import net.countercraft.movecraft.mapUpdater.MapUpdateManager;
import net.countercraft.movecraft.mapUpdater.update.BlockCreateCommand;
import net.countercraft.movecraft.mapUpdater.update.UpdateCommand;
import net.countercraft.movecraft.utils.CollectionUtils;
import net.countercraft.movecraft.utils.HashHitBox;
import net.countercraft.movecraft.utils.HitBox;
Expand Down Expand Up @@ -855,9 +857,12 @@ private void processFadingBlocks() {
final HitBox hitBox = entry.getKey();
final Map<MovecraftLocation, Material> phaseBlocks = wreckPhases.get(hitBox);
final World world = wreckWorlds.get(hitBox);
ArrayList<UpdateCommand> commands = new ArrayList<>();
for (MovecraftLocation location : hitBox){
handler.setBlockFast(location.toBukkit(world), phaseBlocks.getOrDefault(location, Material.AIR),(byte) 0);
commands.add(new BlockCreateCommand(world, location, phaseBlocks.getOrDefault(location, Material.AIR)));

}
MapUpdateManager.getInstance().scheduleUpdates(commands);
processed.add(hitBox);
}
for(HitBox hitBox : processed){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ protected void execute() {
}
}
List<MovecraftLocation> toRemove = new ArrayList<>();
MovecraftLocation next = location;
do {
MovecraftLocation next = location.translate(-dx,-dy,-dz);
while(oldHitBox.contains(next)) {
toRemove.add(next);
next = next.add(new MovecraftLocation(0,1,0));
}while (newHitBox.contains(next));
next = next.translate(0,1,0);
}
craft.getCollapsedHitBox().addAll(toRemove);
newHitBox.removeAll(toRemove);
}
Expand Down

0 comments on commit 349289e

Please sign in to comment.