diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index f393f731ec..6bc2796dd1 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -79,9 +79,8 @@ public class Fx{ }), unitControl = new Effect(30f, e -> { - if(!(e.data instanceof Unit)) return; + if(!(e.data instanceof Unit select)) return; - Unit select = e.data(); boolean block = select instanceof BlockUnitc; mixcol(Pal.accent, 1f); @@ -96,9 +95,8 @@ public class Fx{ }), unitDespawn = new Effect(100f, e -> { - if(!(e.data instanceof Unit) || e.data().type == null) return; + if(!(e.data instanceof Unit select) || select.type == null) return; - Unit select = e.data(); float scl = e.fout(Interp.pow2Out); float p = Draw.scl; Draw.scl *= scl; @@ -111,8 +109,7 @@ public class Fx{ }), unitSpirit = new Effect(17f, e -> { - if(!(e.data instanceof Position)) return; - Position to = e.data(); + if(!(e.data instanceof Position to)) return; color(Pal.accent); @@ -130,8 +127,7 @@ public class Fx{ }), itemTransfer = new Effect(12f, e -> { - if(!(e.data instanceof Position)) return; - Position to = e.data(); + if(!(e.data instanceof Position to)) return; Tmp.v1.set(e.x, e.y).interpolate(Tmp.v2.set(to), e.fin(), Interp.pow3) .add(Tmp.v2.sub(e.x, e.y).nor().rotate90(1).scl(Mathf.randomSeedRange(e.id, 1f) * e.fslope() * 10f)); float x = Tmp.v1.x, y = Tmp.v1.y; @@ -145,9 +141,7 @@ public class Fx{ }), pointBeam = new Effect(25f, 300f, e -> { - if(!(e.data instanceof Position)) return; - - Position pos = e.data(); + if(!(e.data instanceof Position pos)) return; Draw.color(e.color, e.fout()); Lines.stroke(1.5f); @@ -241,11 +235,10 @@ public class Fx{ }), unitWreck = new Effect(200f, e -> { - if(!(e.data instanceof TextureRegion)) return; + if(!(e.data instanceof TextureRegion reg)) return; Draw.mixcol(Pal.rubble, 1f); - TextureRegion reg = e.data(); float vel = e.fin(Interp.pow5Out) * 2f * Mathf.randomSeed(e.id, 1f); float totalRot = Mathf.randomSeed(e.id + 1, 10f); Tmp.v1.trns(Mathf.randomSeed(e.id + 2, 360f), vel); @@ -1900,9 +1893,7 @@ public class Fx{ }).layer(Layer.groundUnit + 1f), unitShieldBreak = new Effect(35, e -> { - if(!(e.data instanceof Unitc)) return; - - Unit unit = e.data(); + if(!(e.data instanceof Unit unit)) return; float radius = unit.hitSize() * 1.3f;