mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-09 20:29:06 +07:00
Parsing fixes / Moved annotations to Arc
This commit is contained in:
parent
f17e46015a
commit
33416aadef
@ -22,20 +22,6 @@ public class Annotations{
|
||||
public @interface OverrideCallSuper {
|
||||
}
|
||||
|
||||
/** Indicates that a method return or field can be null.*/
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Nullable{
|
||||
|
||||
}
|
||||
|
||||
/** Indicates that a method return or field cannot be null.*/
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface NonNull{
|
||||
|
||||
}
|
||||
|
||||
/** Marks a class as serializable. */
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
|
@ -6,6 +6,7 @@ import io.anuke.arc.collection.*;
|
||||
import io.anuke.arc.function.*;
|
||||
import io.anuke.arc.math.geom.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.arc.util.async.*;
|
||||
import io.anuke.mindustry.game.EventType.*;
|
||||
import io.anuke.mindustry.game.*;
|
||||
@ -32,7 +33,8 @@ public class Pathfinder implements Runnable{
|
||||
/** handles task scheduling on the update thread. */
|
||||
private TaskQueue queue = new TaskQueue();
|
||||
/** current pathfinding thread */
|
||||
private @Nullable Thread thread;
|
||||
private @Nullable
|
||||
Thread thread;
|
||||
|
||||
public Pathfinder(){
|
||||
Events.on(WorldLoadEvent.class, event -> {
|
||||
|
@ -48,7 +48,7 @@ public class WaveSpawner{
|
||||
for(SpawnGroup group : state.rules.spawns){
|
||||
int spawned = group.getUnitsSpawned(state.wave - 1);
|
||||
|
||||
if(group.type.isFlying){
|
||||
if(group.type.flying){
|
||||
float spread = margin / 1.5f;
|
||||
|
||||
eachFlyerSpawn((spawnX, spawnY) -> {
|
||||
|
@ -18,7 +18,7 @@ public class UnitTypes implements ContentList{
|
||||
@Override
|
||||
public void load(){
|
||||
draug = new UnitType("draug", Draug.class, Draug::new){{
|
||||
isFlying = true;
|
||||
flying = true;
|
||||
drag = 0.01f;
|
||||
speed = 0.3f;
|
||||
maxVelocity = 1.2f;
|
||||
@ -33,7 +33,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
|
||||
spirit = new UnitType("spirit", Spirit.class, Spirit::new){{
|
||||
isFlying = true;
|
||||
flying = true;
|
||||
drag = 0.01f;
|
||||
speed = 0.4f;
|
||||
maxVelocity = 1.6f;
|
||||
@ -54,7 +54,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
|
||||
phantom = new UnitType("phantom", Phantom.class, Phantom::new){{
|
||||
isFlying = true;
|
||||
flying = true;
|
||||
drag = 0.01f;
|
||||
mass = 2f;
|
||||
speed = 0.45f;
|
||||
@ -244,7 +244,7 @@ public class UnitTypes implements ContentList{
|
||||
maxVelocity = 1.9f;
|
||||
drag = 0.01f;
|
||||
mass = 1.5f;
|
||||
isFlying = true;
|
||||
flying = true;
|
||||
health = 75;
|
||||
engineOffset = 5.5f;
|
||||
range = 140f;
|
||||
@ -264,7 +264,7 @@ public class UnitTypes implements ContentList{
|
||||
maxVelocity = 1.4f;
|
||||
mass = 3f;
|
||||
drag = 0.01f;
|
||||
isFlying = true;
|
||||
flying = true;
|
||||
targetAir = false;
|
||||
engineOffset = 7.8f;
|
||||
range = 140f;
|
||||
@ -291,7 +291,7 @@ public class UnitTypes implements ContentList{
|
||||
drag = 0.01f;
|
||||
range = 80f;
|
||||
shootCone = 40f;
|
||||
isFlying = true;
|
||||
flying = true;
|
||||
rotateWeapon = true;
|
||||
engineOffset = 12f;
|
||||
engineSize = 3f;
|
||||
@ -322,7 +322,7 @@ public class UnitTypes implements ContentList{
|
||||
drag = 0.02f;
|
||||
range = 80f;
|
||||
shootCone = 20f;
|
||||
isFlying = true;
|
||||
flying = true;
|
||||
rotateWeapon = true;
|
||||
engineOffset = 21;
|
||||
engineSize = 5.3f;
|
||||
@ -355,7 +355,7 @@ public class UnitTypes implements ContentList{
|
||||
drag = 0.02f;
|
||||
range = 80f;
|
||||
shootCone = 30f;
|
||||
isFlying = true;
|
||||
flying = true;
|
||||
rotateWeapon = true;
|
||||
engineOffset = 40;
|
||||
engineSize = 7.3f;
|
||||
|
@ -60,7 +60,9 @@ public class ContentLoader{
|
||||
|
||||
setupMapping();
|
||||
|
||||
if(mods != null){
|
||||
mods.loadContent();
|
||||
}
|
||||
|
||||
setupMapping();
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package io.anuke.mindustry.core;
|
||||
|
||||
import io.anuke.annotations.Annotations.*;
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.collection.*;
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.arc.math.geom.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.core.GameState.*;
|
||||
import io.anuke.mindustry.game.EventType.*;
|
||||
@ -82,7 +82,8 @@ public class World{
|
||||
return height()*tilesize;
|
||||
}
|
||||
|
||||
public @Nullable Tile tile(int pos){
|
||||
public @Nullable
|
||||
Tile tile(int pos){
|
||||
return tiles == null ? null : tile(Pos.x(pos), Pos.y(pos));
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.anuke.mindustry.entities.traits;
|
||||
|
||||
import io.anuke.annotations.Annotations.*;
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.collection.Queue;
|
||||
import io.anuke.arc.collection.*;
|
||||
@ -8,6 +7,7 @@ import io.anuke.arc.graphics.g2d.*;
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.arc.math.geom.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.mindustry.*;
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.entities.type.*;
|
||||
@ -200,7 +200,8 @@ public interface BuilderTrait extends Entity, TeamTrait{
|
||||
* Return the build requests currently active, or the one at the top of the queue.
|
||||
* May return null.
|
||||
*/
|
||||
default @Nullable BuildRequest buildRequest(){
|
||||
default @Nullable
|
||||
BuildRequest buildRequest(){
|
||||
return buildQueue().size == 0 ? null : buildQueue().first();
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import io.anuke.arc.graphics.g2d.*;
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.arc.math.geom.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.mindustry.*;
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.entities.*;
|
||||
@ -93,7 +94,8 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
||||
}
|
||||
}
|
||||
|
||||
public @Nullable Tile getSpawner(){
|
||||
public @Nullable
|
||||
Tile getSpawner(){
|
||||
return world.tile(spawner);
|
||||
}
|
||||
|
||||
@ -263,7 +265,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
||||
|
||||
@Override
|
||||
public boolean isFlying(){
|
||||
return type.isFlying;
|
||||
return type.flying;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -10,6 +10,7 @@ import io.anuke.arc.math.geom.*;
|
||||
import io.anuke.arc.scene.ui.*;
|
||||
import io.anuke.arc.scene.ui.layout.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.arc.util.pooling.*;
|
||||
import io.anuke.mindustry.*;
|
||||
import io.anuke.mindustry.content.*;
|
||||
@ -48,7 +49,8 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
||||
public float baseRotation;
|
||||
public float pointerX, pointerY;
|
||||
public String name = "noname";
|
||||
public @Nullable String uuid, usid;
|
||||
public @Nullable
|
||||
String uuid, usid;
|
||||
public boolean isAdmin, isTransferring, isShooting, isBoosting, isMobile, isTyping;
|
||||
public float boostHeat, shootHeat, destructTime;
|
||||
public boolean achievedFlight;
|
||||
|
@ -7,6 +7,7 @@ import io.anuke.arc.collection.ObjectSet;
|
||||
import io.anuke.arc.math.geom.Point2;
|
||||
import io.anuke.arc.math.geom.Vector2;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.mindustry.entities.EntityGroup;
|
||||
import io.anuke.mindustry.entities.traits.HealthTrait;
|
||||
import io.anuke.mindustry.entities.traits.TargetTrait;
|
||||
@ -42,7 +43,8 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
|
||||
private boolean dead = false;
|
||||
private boolean sleeping;
|
||||
private float sleepTime;
|
||||
private @Nullable SoundLoop sound;
|
||||
private @Nullable
|
||||
SoundLoop sound;
|
||||
|
||||
@Remote(called = Loc.server, unreliable = true)
|
||||
public static void onTileDamage(Tile tile, float health){
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.anuke.mindustry.entities.type;
|
||||
|
||||
import io.anuke.annotations.Annotations.*;
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.collection.*;
|
||||
import io.anuke.arc.graphics.*;
|
||||
@ -9,6 +8,7 @@ import io.anuke.arc.math.*;
|
||||
import io.anuke.arc.math.geom.*;
|
||||
import io.anuke.arc.scene.ui.layout.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.entities.*;
|
||||
import io.anuke.mindustry.entities.effect.*;
|
||||
@ -234,7 +234,8 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
}
|
||||
}
|
||||
|
||||
public @Nullable TileEntity getClosestCore(){
|
||||
public @Nullable
|
||||
TileEntity getClosestCore(){
|
||||
TeamData data = state.teams.get(team);
|
||||
|
||||
Tile tile = Geometry.findClosest(x, y, data.cores);
|
||||
|
@ -2,7 +2,6 @@ package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.arc.math.geom.Geometry;
|
||||
import io.anuke.mindustry.entities.type.FlyingUnit;
|
||||
import io.anuke.mindustry.entities.units.*;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.meta.BlockFlag;
|
||||
|
@ -1,6 +1,4 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
import io.anuke.mindustry.entities.type.GroundUnit;
|
||||
|
||||
public class Crawler extends GroundUnit{
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
import io.anuke.mindustry.entities.type.GroundUnit;
|
||||
|
||||
public class Dagger extends GroundUnit{
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
import io.anuke.mindustry.entities.type.GroundUnit;
|
||||
|
||||
public class Eruptor extends GroundUnit{
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.anuke.mindustry.entities.type;
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
import io.anuke.arc.graphics.*;
|
||||
import io.anuke.arc.graphics.g2d.*;
|
||||
@ -8,6 +8,7 @@ import io.anuke.arc.util.*;
|
||||
import io.anuke.mindustry.*;
|
||||
import io.anuke.mindustry.entities.*;
|
||||
import io.anuke.mindustry.entities.bullet.*;
|
||||
import io.anuke.mindustry.entities.type.*;
|
||||
import io.anuke.mindustry.entities.units.*;
|
||||
import io.anuke.mindustry.graphics.*;
|
||||
import io.anuke.mindustry.world.*;
|
||||
@ -15,7 +16,7 @@ import io.anuke.mindustry.world.meta.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public abstract class FlyingUnit extends BaseUnit{
|
||||
public class FlyingUnit extends BaseUnit{
|
||||
protected float[] weaponAngles = {0,0};
|
||||
|
||||
protected final UnitState
|
@ -1,6 +1,4 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
import io.anuke.mindustry.entities.type.GroundUnit;
|
||||
|
||||
public class Fortress extends GroundUnit{
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
import io.anuke.mindustry.entities.type.FlyingUnit;
|
||||
|
||||
public class Ghoul extends FlyingUnit{
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.anuke.mindustry.entities.type;
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
import io.anuke.arc.graphics.*;
|
||||
import io.anuke.arc.graphics.g2d.*;
|
||||
@ -9,6 +9,7 @@ import io.anuke.mindustry.*;
|
||||
import io.anuke.mindustry.ai.Pathfinder.*;
|
||||
import io.anuke.mindustry.entities.*;
|
||||
import io.anuke.mindustry.entities.bullet.*;
|
||||
import io.anuke.mindustry.entities.type.*;
|
||||
import io.anuke.mindustry.entities.units.*;
|
||||
import io.anuke.mindustry.game.*;
|
||||
import io.anuke.mindustry.type.*;
|
||||
@ -18,7 +19,7 @@ import io.anuke.mindustry.world.meta.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public abstract class GroundUnit extends BaseUnit{
|
||||
public class GroundUnit extends BaseUnit{
|
||||
protected static Vector2 vec = new Vector2();
|
||||
|
||||
protected float walkTime;
|
@ -4,7 +4,6 @@ import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.math.Angles;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.entities.type.FlyingUnit;
|
||||
|
||||
public class Revenant extends FlyingUnit{
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
import io.anuke.mindustry.entities.type.GroundUnit;
|
||||
|
||||
public class Titan extends GroundUnit{
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
import io.anuke.mindustry.entities.type.FlyingUnit;
|
||||
|
||||
public class Wraith extends FlyingUnit{
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.anuke.mindustry.game;
|
||||
|
||||
import io.anuke.annotations.Annotations.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.traits.BuilderTrait;
|
||||
import io.anuke.mindustry.entities.type.*;
|
||||
@ -195,7 +195,8 @@ public class EventType{
|
||||
public static class BlockBuildEndEvent{
|
||||
public final Tile tile;
|
||||
public final Team team;
|
||||
public final @Nullable Player player;
|
||||
public final @Nullable
|
||||
Player player;
|
||||
public final boolean breaking;
|
||||
|
||||
public BlockBuildEndEvent(Tile tile, @Nullable Player player, Team team, boolean breaking){
|
||||
|
@ -1,11 +1,11 @@
|
||||
package io.anuke.mindustry.game;
|
||||
|
||||
import io.anuke.annotations.Annotations.*;
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.audio.*;
|
||||
import io.anuke.arc.collection.*;
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.mindustry.core.GameState.*;
|
||||
import io.anuke.mindustry.game.EventType.*;
|
||||
import io.anuke.mindustry.gen.*;
|
||||
@ -22,7 +22,8 @@ public class MusicControl{
|
||||
public Array<Music> darkMusic = Array.with();
|
||||
private Music lastRandomPlayed;
|
||||
private Interval timer = new Interval();
|
||||
private @Nullable Music current;
|
||||
private @Nullable
|
||||
Music current;
|
||||
private float fade;
|
||||
private boolean silenced;
|
||||
|
||||
|
@ -1,17 +1,18 @@
|
||||
package io.anuke.mindustry.graphics;
|
||||
|
||||
import io.anuke.annotations.Annotations.*;
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.arc.graphics.glutils.Shader;
|
||||
import io.anuke.arc.scene.ui.layout.Scl;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.arc.util.Time;
|
||||
|
||||
public class Shaders{
|
||||
public static Shadow shadow;
|
||||
public static BlockBuild blockbuild;
|
||||
public static @Nullable Shield shield;
|
||||
public static @Nullable
|
||||
Shield shield;
|
||||
public static UnitBuild build;
|
||||
public static FogShader fog;
|
||||
public static MenuShader menu;
|
||||
|
@ -1,11 +1,16 @@
|
||||
package io.anuke.mindustry.mod;
|
||||
|
||||
import io.anuke.arc.collection.*;
|
||||
import io.anuke.arc.graphics.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.arc.util.reflect.*;
|
||||
import io.anuke.arc.util.serialization.*;
|
||||
import io.anuke.arc.util.serialization.Json.*;
|
||||
import io.anuke.mindustry.*;
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.entities.bullet.*;
|
||||
import io.anuke.mindustry.entities.type.*;
|
||||
import io.anuke.mindustry.game.*;
|
||||
import io.anuke.mindustry.type.*;
|
||||
import io.anuke.mindustry.world.*;
|
||||
@ -17,10 +22,21 @@ public class ContentParser{
|
||||
|
||||
private Json parser = new Json(){
|
||||
public <T> T readValue(Class<T> type, Class elementType, JsonValue jsonData){
|
||||
try{
|
||||
if(type == BulletType.class){
|
||||
BulletType b = (BulletType)Bullets.class.getField(jsonData.asString()).get(null);
|
||||
if(b == null) throw new IllegalArgumentException("Bullet type not found: " + jsonData.asString());
|
||||
return (T)b;
|
||||
}
|
||||
|
||||
if(type != null && Content.class.isAssignableFrom(type)){
|
||||
return (T)Vars.content.getByName(contentTypes.getThrow(type, () -> new IllegalArgumentException("No content type for class: " + type.getSimpleName())), jsonData.asString());
|
||||
}
|
||||
|
||||
return super.readValue(type, elementType, jsonData);
|
||||
}catch(Exception e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -38,6 +54,27 @@ public class ContentParser{
|
||||
}
|
||||
|
||||
return block;
|
||||
},
|
||||
ContentType.item, (TypeParser<Item>)(mod, name, value) -> {
|
||||
Item item = new Item(mod + "-" + name, new Color(Color.black));
|
||||
readFields(item, value);
|
||||
return item;
|
||||
},
|
||||
ContentType.unit, (TypeParser<UnitType>)(mod, name, value) -> {
|
||||
String clas = value.getString("type");
|
||||
Class<BaseUnit> type = resolve("io.anuke.mindustry.entities.type.base." + clas);
|
||||
java.lang.reflect.Constructor<BaseUnit> cons = type.getDeclaredConstructor();
|
||||
UnitType unit = new UnitType(mod + "-" + name, type, () -> {
|
||||
try{
|
||||
return cons.newInstance();
|
||||
}catch(Exception e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
value.remove("type");
|
||||
readFields(unit, value);
|
||||
|
||||
return unit;
|
||||
}
|
||||
);
|
||||
|
||||
@ -73,7 +110,35 @@ public class ContentParser{
|
||||
throw new SerializationException("No parsers for content type '" + type + "'");
|
||||
}
|
||||
|
||||
return parsers.get(type).parse(mod, name, value);
|
||||
Content c = parsers.get(type).parse(mod, name, value);
|
||||
checkNulls(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
private void checkNulls(Object object){
|
||||
checkNulls(object, new ObjectSet<>());
|
||||
}
|
||||
|
||||
private void checkNulls(Object object, ObjectSet<Object> checked){
|
||||
checked.add(object);
|
||||
|
||||
parser.getFields(object.getClass()).each((name, field) -> {
|
||||
try{
|
||||
if(field.field.getType().isPrimitive()) return;
|
||||
|
||||
Object obj = field.field.get(object);
|
||||
if(field.field.isAnnotationPresent(NonNull.class) && field.field.get(object) == null){
|
||||
throw new RuntimeException("Field '" + name + "' in " + object.getClass().getSimpleName() + " is missing!");
|
||||
}
|
||||
|
||||
if(obj != null && !checked.contains(obj)){
|
||||
checkNulls(obj, checked);
|
||||
checked.add(obj);
|
||||
}
|
||||
}catch(Exception e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void readFields(Object object, JsonValue jsonMap){
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.anuke.mindustry.mod;
|
||||
|
||||
import io.anuke.annotations.Annotations.*;
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.assets.*;
|
||||
import io.anuke.arc.collection.*;
|
||||
@ -11,6 +10,7 @@ import io.anuke.arc.graphics.Pixmap.*;
|
||||
import io.anuke.arc.graphics.Texture.*;
|
||||
import io.anuke.arc.graphics.g2d.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.arc.util.io.*;
|
||||
import io.anuke.arc.util.serialization.*;
|
||||
import io.anuke.mindustry.game.*;
|
||||
@ -43,7 +43,8 @@ public class Mods implements Loadable{
|
||||
}
|
||||
|
||||
/** @return the loaded mod found by class, or null if not found. */
|
||||
public @Nullable LoadedMod getMod(Class<? extends Mod> type){
|
||||
public @Nullable
|
||||
LoadedMod getMod(Class<? extends Mod> type){
|
||||
return loaded.find(l -> l.mod.getClass() == type);
|
||||
}
|
||||
|
||||
@ -186,7 +187,7 @@ public class Mods implements Loadable{
|
||||
if(mod.root.child("content").exists()){
|
||||
FileHandle contentRoot = mod.root.child("content");
|
||||
for(ContentType type : ContentType.all){
|
||||
FileHandle folder = contentRoot.child(type.name() + "s");
|
||||
FileHandle folder = contentRoot.child(type.name().toLowerCase() + "s");
|
||||
if(folder.exists()){
|
||||
for(FileHandle file : folder.list()){
|
||||
if(file.extension().equals("json")){
|
||||
|
@ -26,7 +26,7 @@ public class CrashSender{
|
||||
exception.printStackTrace();
|
||||
|
||||
//don't create crash logs for custom builds, as it's expected
|
||||
if(Version.build == -1) return;
|
||||
if(Version.build == -1 || (System.getProperty("user.name").equals("anuke") && "release".equals(Version.modifier))) return;
|
||||
|
||||
//attempt to load version regardless
|
||||
if(Version.number == 0){
|
||||
|
@ -1,10 +1,10 @@
|
||||
package io.anuke.mindustry.net;
|
||||
|
||||
import io.anuke.annotations.Annotations.*;
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.collection.*;
|
||||
import io.anuke.arc.function.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.arc.util.pooling.*;
|
||||
import io.anuke.mindustry.gen.*;
|
||||
import io.anuke.mindustry.net.Packets.*;
|
||||
@ -21,7 +21,8 @@ public class Net{
|
||||
private boolean server;
|
||||
private boolean active;
|
||||
private boolean clientLoaded;
|
||||
private @Nullable StreamBuilder currentStream;
|
||||
private @Nullable
|
||||
StreamBuilder currentStream;
|
||||
|
||||
private final Array<Object> packetQueue = new Array<>();
|
||||
private final ObjectMap<Class<?>, Consumer> clientListeners = new ObjectMap<>();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package io.anuke.mindustry.net;
|
||||
|
||||
import io.anuke.annotations.Annotations.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.mindustry.entities.type.*;
|
||||
import io.anuke.mindustry.gen.*;
|
||||
import io.anuke.mindustry.net.Administration.*;
|
||||
@ -15,7 +15,8 @@ import static io.anuke.mindustry.Vars.netServer;
|
||||
public abstract class NetConnection{
|
||||
public final String address;
|
||||
public boolean mobile, modclient;
|
||||
public @Nullable Player player;
|
||||
public @Nullable
|
||||
Player player;
|
||||
|
||||
/** ID of last recieved client snapshot. */
|
||||
public int lastRecievedClientSnapshot = -1;
|
||||
|
@ -6,6 +6,7 @@ import io.anuke.arc.collection.*;
|
||||
import io.anuke.arc.function.*;
|
||||
import io.anuke.arc.graphics.g2d.*;
|
||||
import io.anuke.arc.scene.ui.layout.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.entities.type.*;
|
||||
import io.anuke.mindustry.game.*;
|
||||
@ -13,8 +14,9 @@ import io.anuke.mindustry.gen.*;
|
||||
import io.anuke.mindustry.ui.*;
|
||||
|
||||
public class UnitType extends UnlockableContent{
|
||||
public final TypeID typeID;
|
||||
public final Supplier<? extends BaseUnit> constructor;
|
||||
public final @NonNull
|
||||
TypeID typeID;
|
||||
public final @NonNull Supplier<? extends BaseUnit> constructor;
|
||||
|
||||
public float health = 60;
|
||||
public float hitsize = 7f;
|
||||
@ -25,7 +27,7 @@ public class UnitType extends UnlockableContent{
|
||||
public float baseRotateSpeed = 0.1f;
|
||||
public float shootCone = 15f;
|
||||
public float mass = 1f;
|
||||
public boolean isFlying;
|
||||
public boolean flying;
|
||||
public boolean targetAir = true;
|
||||
public boolean rotateWeapon = false;
|
||||
public float drag = 0.1f;
|
||||
@ -34,7 +36,7 @@ public class UnitType extends UnlockableContent{
|
||||
public int itemCapacity = 30;
|
||||
public ObjectSet<Item> toMine = ObjectSet.with(Items.lead, Items.copper);
|
||||
public float buildPower = 0.3f, minePower = 0.7f;
|
||||
public Weapon weapon;
|
||||
public @NonNull Weapon weapon;
|
||||
public float weaponOffsetY, engineOffset = 6f, engineSize = 2f;
|
||||
public ObjectSet<StatusEffect> immunities = new ObjectSet<>();
|
||||
public Sound deathSound = Sounds.bang;
|
||||
|
@ -6,6 +6,7 @@ import io.anuke.arc.audio.*;
|
||||
import io.anuke.arc.graphics.g2d.*;
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.mindustry.*;
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.entities.*;
|
||||
@ -25,7 +26,7 @@ public class Weapon{
|
||||
protected static float minPlayerDist = 20f;
|
||||
protected static int sequenceNum = 0;
|
||||
/** bullet shot */
|
||||
public BulletType bullet;
|
||||
public @NonNull BulletType bullet;
|
||||
/** shell ejection effect */
|
||||
public Effect ejectEffect = Fx.none;
|
||||
/** weapon reload in frames */
|
||||
|
@ -1,10 +1,10 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import io.anuke.annotations.Annotations.*;
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.scene.ui.*;
|
||||
import io.anuke.arc.scene.ui.layout.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.mindustry.game.*;
|
||||
import io.anuke.mindustry.gen.*;
|
||||
import io.anuke.mindustry.maps.*;
|
||||
@ -15,7 +15,8 @@ import static io.anuke.mindustry.Vars.*;
|
||||
public class MapPlayDialog extends FloatingDialog{
|
||||
CustomRulesDialog dialog = new CustomRulesDialog();
|
||||
Rules rules;
|
||||
@NonNull Gamemode selectedGamemode = Gamemode.survival;
|
||||
@NonNull
|
||||
Gamemode selectedGamemode = Gamemode.survival;
|
||||
Map lastMap;
|
||||
|
||||
public MapPlayDialog(){
|
||||
|
@ -8,6 +8,7 @@ import io.anuke.arc.Graphics.Cursor.SystemCursor;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.mindustry.content.Fx;
|
||||
import io.anuke.mindustry.entities.Effects;
|
||||
import io.anuke.mindustry.entities.effect.RubbleDecal;
|
||||
@ -172,7 +173,8 @@ public class BuildBlock extends Block{
|
||||
* The recipe of the block that is being constructed.
|
||||
* If there is no recipe for this block, as is the case with rocks, 'previous' is used.
|
||||
*/
|
||||
public @Nullable Block cblock;
|
||||
public @Nullable
|
||||
Block cblock;
|
||||
|
||||
public float progress = 0;
|
||||
public float buildCost;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks.storage;
|
||||
|
||||
import io.anuke.annotations.Annotations.*;
|
||||
import io.anuke.arc.util.ArcAnnotate.*;
|
||||
import io.anuke.mindustry.entities.type.TileEntity;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
@ -75,6 +75,7 @@ public abstract class StorageBlock extends Block{
|
||||
}
|
||||
|
||||
public class StorageBlockEntity extends TileEntity{
|
||||
protected @Nullable Tile linkedCore;
|
||||
protected @Nullable
|
||||
Tile linkedCore;
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=d4519a9721927165850bfe3135ef6b095c990474
|
||||
archash=029f47c10a8e269cd8e20d13b0d06fddb572c484
|
||||
|
@ -218,7 +218,7 @@ public class Generators{
|
||||
});
|
||||
|
||||
ImagePacker.generate("unit-icons", () -> {
|
||||
content.<UnitType>getBy(ContentType.unit).each(type -> !type.isFlying, type -> {
|
||||
content.<UnitType>getBy(ContentType.unit).each(type -> !type.flying, type -> {
|
||||
type.load();
|
||||
type.weapon.load();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user