Pools replace with Pooling / Removed all core reflection

This commit is contained in:
Anuken
2018-09-09 17:44:10 -04:00
parent 2cb6e454c8
commit 65f911909b
20 changed files with 29 additions and 37 deletions
@@ -4,7 +4,6 @@ import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Pools;
import com.badlogic.gdx.utils.Queue;
import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote;
@@ -373,7 +372,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
}
public void drawName(){
GlyphLayout layout = Pools.obtain(GlyphLayout.class);
GlyphLayout layout = Pooling.obtain(GlyphLayout.class, GlyphLayout::new);
Draw.tscl(0.25f / 2);
layout.setText(Core.font, name);
@@ -390,7 +389,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
}
Draw.reset();
Pools.free(layout);
Pooling.free(layout);
Draw.tscl(fontScale);
}
@@ -57,7 +57,7 @@ public class StatusController implements Saveable{
}
//otherwise, no opposites found, add direct effect
StatusEntry entry = Pooling.obtain(StatusEntry.class);
StatusEntry entry = Pooling.obtain(StatusEntry.class, StatusEntry::new);
entry.set(effect, newTime);
statuses.add(entry);
}
@@ -146,7 +146,7 @@ public class StatusController implements Saveable{
for(int i = 0; i < amount; i++){
byte id = stream.readByte();
float time = stream.readShort() / 2f;
StatusEntry entry = Pooling.obtain(StatusEntry.class);
StatusEntry entry = Pooling.obtain(StatusEntry.class, StatusEntry::new);
entry.set(content.getByID(ContentType.status, id), time);
statuses.add(entry);
}
@@ -54,7 +54,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
}
public static void create(BulletType type, Entity owner, Team team, float x, float y, float angle, float velocityScl, float lifetimeScl, Object data){
Bullet bullet = Pooling.obtain(Bullet.class);
Bullet bullet = Pooling.obtain(Bullet.class, Bullet::new);
bullet.type = type;
bullet.owner = owner;
bullet.data = data;
@@ -56,7 +56,7 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable{
Fire fire = map.get(tile.packedPosition());
if(fire == null){
fire = Pooling.obtain(Fire.class);
fire = Pooling.obtain(Fire.class, Fire::new);
fire.tile = tile;
fire.lifetime = baseLifetime;
fire.set(tile.worldx(), tile.worldy());
@@ -58,7 +58,7 @@ public class ItemTransfer extends TimedEntity implements DrawTrait{
}
public static void create(Item item, float fromx, float fromy, PosTrait to, Runnable done){
ItemTransfer tr = Pooling.obtain(ItemTransfer.class);
ItemTransfer tr = Pooling.obtain(ItemTransfer.class, ItemTransfer::new);
tr.item = item;
tr.from.set(fromx, fromy);
tr.to = to;
@@ -59,7 +59,7 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
/**Do not invoke!*/
@Remote(called = Loc.server)
public static void createLighting(int seed, Team team, Effect effect, Color color, float damage, float x, float y, float targetAngle, int length){
Lightning l = Pooling.obtain(Lightning.class);
Lightning l = Pooling.obtain(Lightning.class, Lightning::new);
//TODO hacky workaround
if(checkShield(team, x, y)) return;
@@ -105,7 +105,7 @@ public class Puddle extends BaseEntity implements SaveTrait, Poolable, DrawTrait
if(p == null){
if(Net.client()) return; //not clientside.
Puddle puddle = Pooling.obtain(Puddle.class);
Puddle puddle = Pooling.obtain(Puddle.class, Puddle::new);
puddle.tile = tile;
puddle.liquid = liquid;
puddle.amount = amount;