1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 11:45:51 +00:00

Merge pull request #618 from meiamsome/altar-animation-cleanup

Simplify the RitualAnimation
This commit is contained in:
TheBusyBiscuit 2018-03-02 22:42:44 +01:00 committed by GitHub
commit fd8967e773
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,6 +28,7 @@ public class RitualAnimation implements Runnable {
List<Location> particles; List<Location> particles;
boolean running; boolean running;
int stage;
public RitualAnimation(List<Block> altars, Block altar, Location drop, ItemStack output, List<Block> pedestals, List<ItemStack> items) { public RitualAnimation(List<Block> altars, Block altar, Location drop, ItemStack output, List<Block> pedestals, List<ItemStack> items) {
this.l = drop; this.l = drop;
@ -39,209 +40,21 @@ public class RitualAnimation implements Runnable {
this.particles = new ArrayList<Location>(); this.particles = new ArrayList<Location>();
this.running = true; this.running = true;
this.stage = 0;
} }
@Override @Override
public void run() { public void run() {
idle(); idle();
schedule(new Runnable() { if(this.stage == 36) {
finish();
@Override return;
public void run() { }
idle(); if(this.stage > 0 && this.stage % 4 == 0) {
schedule(new Runnable() { checkPedestal(pedestals.get(this.stage / 4 - 1));
}
@Override this.stage += 1;
public void run() { SlimefunStartup.instance.getServer().getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, this, 8);
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
checkPedestal(pedestals.get(0));
schedule(new Runnable() {
@Override
public void run() {
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
checkPedestal(pedestals.get(1));
schedule(new Runnable() {
@Override
public void run() {
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
checkPedestal(pedestals.get(2));
schedule(new Runnable() {
@Override
public void run() {
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
checkPedestal(pedestals.get(3));
schedule(new Runnable() {
@Override
public void run() {
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
checkPedestal(pedestals.get(4));
schedule(new Runnable() {
@Override
public void run() {
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
checkPedestal(pedestals.get(5));
schedule(new Runnable() {
@Override
public void run() {
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
checkPedestal(pedestals.get(6));
schedule(new Runnable() {
@Override
public void run() {
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
checkPedestal(pedestals.get(7));
schedule(new Runnable() {
@Override
public void run() {
idle();
schedule(new Runnable() {
@Override
public void run() {
idle();
finish();
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
}
});
} }
private void idle() { private void idle() {
@ -257,10 +70,6 @@ public class RitualAnimation implements Runnable {
} }
} }
private void schedule(Runnable runnable) {
if (running) SlimefunStartup.instance.getServer().getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, runnable, 8);
}
private void checkPedestal(Block pedestal) { private void checkPedestal(Block pedestal) {
Item item = AncientAltarListener.findItem(pedestal); Item item = AncientAltarListener.findItem(pedestal);
if (item == null) abort(); if (item == null) abort();