2525// - iambibi_
2626public class Cube extends MultiBlock {
2727 public BukkitTask corruptedBubbleTask ;
28+ public BukkitTask particuleBubbleTask ;
29+
2830 public ReproductionTask reproductionTask ;
2931 public BossBar cubeBossBar ;
3032 public boolean showBossBar ;
@@ -199,15 +201,17 @@ public void startMagneticShock() {
199201 }
200202 }
201203
202- public final int RADIUS_BUBBLE = this .radius * 3 ;
204+ public final int RADIUS_BUBBLE = this .radius * 4 ;
203205
204206 public void startCorruptedBubble () {
205207 Location center = this .getCenter ();
206208
207- int totalTicks = 20 * 3600 ;
209+ int totalTicks = 20 * 1300 ;
208210
209211 startBubbleParticles ();
210212
213+ if (corruptedBubbleTask != null ) corruptedBubbleTask .cancel ();
214+
211215 int intervalCorruption = 20 * 15 ;
212216 corruptedBubbleTask = new BukkitRunnable () {
213217 int elapsed = 0 ;
@@ -231,7 +235,7 @@ public void run() {
231235
232236 if (isPartOf (new Location (origin .getWorld (), x , y , z ))) continue ;
233237
234- Location loc = center .clone (). add (x , y , z );
238+ Location loc = center .add (x , y , z );
235239 Block block = loc .getBlock ();
236240 Material type = block .getType ();
237241
@@ -264,31 +268,36 @@ public void startBubbleParticles() {
264268 Location center = this .getCenter ();
265269 double radius = RADIUS_BUBBLE ;
266270
267- Bukkit .getScheduler ().runTaskTimer (OMCPlugin .getInstance (), () -> {
268- for (int i = 0 ; i < 50 ; i ++) {
269- double theta = Math .random () * 2 * Math .PI ;
270- double phi = Math .random () * Math .PI ;
271- double x = radius * Math .sin (phi ) * Math .cos (theta );
272- double y = radius * Math .cos (phi );
273- double z = radius * Math .sin (phi ) * Math .sin (theta );
271+ if (particuleBubbleTask != null ) particuleBubbleTask .cancel ();
274272
275- Location particleLoc = center . clone (). add ( x , y , z );
276- world . spawnParticle ( Particle . OMINOUS_SPAWNING , particleLoc , 1 , 0.1 , 0.1 , 0.1 , 0 );
277- }
278-
279- for ( double theta = 0 ; theta < Math . PI ; theta + = Math .PI / 16 ) {
280- for ( double phi = 0 ; phi < 2 * Math .PI ; phi += Math .PI / 16 ) {
281- double x = radius * Math .sin (theta ) * Math .cos (phi );
282- double y = radius * Math .cos (theta );
283- double z = radius * Math .sin (theta ) * Math .sin (phi );
273+ particuleBubbleTask = new BukkitRunnable () {
274+ @ Override
275+ public void run () {
276+ for ( int i = 0 ; i < 50 ; i ++) {
277+ double theta = Math .random () * 2 * Math . PI ;
278+ double phi = Math .random () * Math .PI ;
279+ double x = radius * Math .sin (phi ) * Math .cos (theta );
280+ double y = radius * Math .cos (phi );
281+ double z = radius * Math .sin (phi ) * Math .sin (theta );
284282
285283 Location particleLoc = center .clone ().add (x , y , z );
284+ world .spawnParticle (Particle .OMINOUS_SPAWNING , particleLoc , 1 , 0.1 , 0.1 , 0.1 , 0 );
285+ }
286286
287- Vector dir = center .clone ().subtract (particleLoc ).toVector ().normalize ();
288- world .spawnParticle (Particle .SNEEZE , particleLoc , 1 , dir .getX (), dir .getY (), dir .getZ (), 0.1 );
287+ for (double theta = 0 ; theta < Math .PI ; theta += Math .PI / 16 ) {
288+ for (double phi = 0 ; phi < 2 * Math .PI ; phi += Math .PI / 16 ) {
289+ double x = radius * Math .sin (theta ) * Math .cos (phi );
290+ double y = radius * Math .cos (theta );
291+ double z = radius * Math .sin (theta ) * Math .sin (phi );
292+
293+ Location particleLoc = center .clone ().add (x , y , z );
294+
295+ Vector dir = center .clone ().subtract (particleLoc ).toVector ().normalize ();
296+ world .spawnParticle (Particle .SNEEZE , particleLoc , 1 , dir .getX (), dir .getY (), dir .getZ (), 0.1 );
297+ }
289298 }
290299 }
291- }, 0L , 20L );
300+ }. runTaskTimer ( OMCPlugin . getInstance () , 0L , 20L );
292301 }
293302
294303 public void startReproduction () {
@@ -345,14 +354,13 @@ public void startEventsCycle() {
345354 public void run () {
346355 double roll = ThreadLocalRandom .current ().nextDouble ();
347356
348- if (roll < 0.5 ) {
357+ if (roll < 0.7 ) {
349358 startMagneticShock ();
350359 } else {
351- if (corruptedBubbleTask == null )
352- startCorruptedBubble ();
360+ startCorruptedBubble ();
353361 }
354362 }
355- }.runTaskTimer (OMCPlugin .getInstance (), 20L * 60 * 5 , 20L * 60 * 20 );
363+ }.runTaskTimer (OMCPlugin .getInstance (), 20L * 60 * 5 , 20L * 60 * 10 );
356364 }
357365
358366 public void startSoundCycle () {
0 commit comments