use of net.countercraft.movecraft.craft.CraftStatus in project Movecraft by APDevTeam.
the class AsyncManager method detectSinking.
private void detectSinking() {
for (Craft craft : CraftManager.getInstance()) {
if (craft instanceof SinkingCraft)
continue;
if (craft.getType().getDoubleProperty(CraftType.SINK_PERCENT) == 0.0 || !craft.isNotProcessing())
continue;
long ticksElapsed = (System.currentTimeMillis() - craft.getLastBlockCheck()) / 50;
if (ticksElapsed <= Settings.SinkCheckTicks)
continue;
CraftStatus status = checkCraftStatus(craft);
// Only do this if the craft isn't already disabled.
if (status.isDisabled() && craft.isNotProcessing() && !craft.getDisabled()) {
craft.setDisabled(true);
craft.getAudience().playSound(Sound.sound(Key.key("entity.iron_golem.death"), Sound.Source.NEUTRAL, 5.0f, 5.0f));
}
// update the time for the next check
if (status.isSinking() && craft.isNotProcessing()) {
craft.getAudience().sendMessage(I18nSupport.getInternationalisedComponent("Player - Craft is sinking"));
craft.setCruising(false);
CraftManager.getInstance().sink(craft);
} else {
craft.setLastBlockCheck(System.currentTimeMillis());
}
}
}
Aggregations