Faster weapon copy
This commit is contained in:
@@ -9,9 +9,8 @@ import mindustry.entities.*;
|
|||||||
import mindustry.entities.bullet.*;
|
import mindustry.entities.bullet.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.io.*;
|
|
||||||
|
|
||||||
public class Weapon{
|
public class Weapon implements Cloneable{
|
||||||
/** displayed weapon region */
|
/** displayed weapon region */
|
||||||
public String name = "";
|
public String name = "";
|
||||||
/** bullet shot */
|
/** bullet shot */
|
||||||
@@ -98,9 +97,11 @@ public class Weapon{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Weapon copy(){
|
public Weapon copy(){
|
||||||
Weapon out = new Weapon();
|
try{
|
||||||
JsonIO.json().copyFields(this, out);
|
return (Weapon)clone();
|
||||||
return out;
|
}catch(CloneNotSupportedException suck){
|
||||||
|
throw new RuntimeException("very good language design", suck);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load(){
|
public void load(){
|
||||||
|
|||||||
Reference in New Issue
Block a user