Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ private StatusUpdateTask(@NotNull Craft craft) {

Counter<RequiredBlockEntry> flyblocks = new Counter<>();
Counter<RequiredBlockEntry> moveblocks = new Counter<>();

// Pre-fill the moveblocks counter to avoid ignoring moveblocks
for(RequiredBlockEntry entry : craft.getType().getRequiredBlockProperty(CraftType.MOVE_BLOCKS)) {
moveblocks.add(entry, 0);
}

for(Material material : materials.getKeySet()) {
for(RequiredBlockEntry entry : craft.getType().getRequiredBlockProperty(CraftType.FLY_BLOCKS)) {
if(entry.contains(material)) {
Expand Down Expand Up @@ -143,9 +149,12 @@ public void onCraftStatusUpdate(@NotNull CraftStatusUpdateEvent e) {
if(!entry.check(flyBlocks.get(entry), nonNegligibleBlocks, sinkPercent))
sinking = true;
}
for (RequiredBlockEntry entry : moveBlocks.getKeySet()) {
if (!entry.check(moveBlocks.get(entry), nonNegligibleBlocks, sinkPercent))
disabled = true;
// If the craft has MOveblocks defined, then validate them, if there are any aboard
if (craft.getType().getRequiredBlockProperty(CraftType.MOVE_BLOCKS).size() > 0) {
for (RequiredBlockEntry entry : moveBlocks.getKeySet()) {
if (!entry.check(moveBlocks.get(entry), nonNegligibleBlocks, sinkPercent))
disabled = true;
}
}

// And check the OverallSinkPercent
Expand Down