Merge branches 'master' and 'mech-rework' of https://github.com/Anuken/Mindustry into mech-rework
# Conflicts: # core/assets/sprites/block_colors.png # core/assets/sprites/sprites.atlas # core/assets/sprites/sprites.png # core/assets/sprites/sprites3.png # core/assets/sprites/sprites5.png # core/src/mindustry/ai/BlockIndexer.java # core/src/mindustry/core/World.java # core/src/mindustry/entities/traits/Entity.java # core/src/mindustry/entities/type/BaseEntity.java # core/src/mindustry/entities/type/TileEntity.java # core/src/mindustry/world/blocks/defense/MendProjector.java # core/src/mindustry/world/blocks/defense/OverdriveProjector.java # core/src/mindustry/world/blocks/production/Drill.java # gradle.properties
This commit is contained in:
51
core/src/mindustry/entities/traits/Entity.java
Normal file
51
core/src/mindustry/entities/traits/Entity.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package mindustry.entities.traits;
|
||||
|
||||
import mindustry.*;
|
||||
import mindustry.entities.*;
|
||||
|
||||
public interface Entity extends MoveTrait{
|
||||
|
||||
int getID();
|
||||
|
||||
void resetID(int id);
|
||||
|
||||
default void update(){}
|
||||
|
||||
default void removed(){}
|
||||
|
||||
default void added(){}
|
||||
|
||||
default int tileX(){
|
||||
return Vars.world.toTile(getX());
|
||||
}
|
||||
|
||||
default int tileY(){
|
||||
return Vars.world.toTile(getY());
|
||||
}
|
||||
|
||||
EntityGroup targetGroup();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default void add(){
|
||||
if(targetGroup() != null){
|
||||
targetGroup().add(this);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default void remove(){
|
||||
if(getGroup() != null){
|
||||
getGroup().remove(this);
|
||||
}
|
||||
|
||||
setGroup(null);
|
||||
}
|
||||
|
||||
EntityGroup getGroup();
|
||||
|
||||
void setGroup(EntityGroup group);
|
||||
|
||||
default boolean isAdded(){
|
||||
return getGroup() != null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user