diff --git a/annotations/src/io/anuke/annotations/Annotations.java b/annotations/src/io/anuke/annotations/Annotations.java index cc60478fee..eeef7c2599 100644 --- a/annotations/src/io/anuke/annotations/Annotations.java +++ b/annotations/src/io/anuke/annotations/Annotations.java @@ -80,9 +80,6 @@ public class Annotations{ */ boolean unreliable() default false; - /** The simple class name where this method is placed. */ - String in() default "Call"; - /** Priority of this event. */ PacketPriority priority() default PacketPriority.normal; } diff --git a/annotations/src/io/anuke/annotations/RemoteMethodAnnotationProcessor.java b/annotations/src/io/anuke/annotations/RemoteMethodAnnotationProcessor.java index b0402b2c55..879cf1f202 100644 --- a/annotations/src/io/anuke/annotations/RemoteMethodAnnotationProcessor.java +++ b/annotations/src/io/anuke/annotations/RemoteMethodAnnotationProcessor.java @@ -35,6 +35,8 @@ public class RemoteMethodAnnotationProcessor extends AbstractProcessor{ private static final String readServerName = "RemoteReadServer"; /** Name of class that handles reading and invoking packets on the client. */ private static final String readClientName = "RemoteReadClient"; + /**Simple class name of generated class name.*/ + private static final String callLocation = "Call"; /** Processing round number. */ private int round; @@ -102,15 +104,15 @@ public class RemoteMethodAnnotationProcessor extends AbstractProcessor{ } //get and create class entry if needed - if(!classMap.containsKey(annotation.in())){ - ClassEntry clas = new ClassEntry(annotation.in()); - classMap.put(annotation.in(), clas); + if(!classMap.containsKey(callLocation)){ + ClassEntry clas = new ClassEntry(callLocation); + classMap.put(callLocation, clas); classes.add(clas); Utils.messager.printMessage(Kind.NOTE, "Generating class '" + clas.name + "'."); } - ClassEntry entry = classMap.get(annotation.in()); + ClassEntry entry = classMap.get(callLocation); //create and add entry MethodEntry method = new MethodEntry(entry.name, Utils.getMethodName(element), annotation.targets(), annotation.variants(), diff --git a/core/src/io/anuke/mindustry/content/blocks/DebugBlocks.java b/core/src/io/anuke/mindustry/content/blocks/DebugBlocks.java index b23a545823..4a47ff9e07 100644 --- a/core/src/io/anuke/mindustry/content/blocks/DebugBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/DebugBlocks.java @@ -6,8 +6,7 @@ import io.anuke.annotations.Annotations.Remote; import io.anuke.mindustry.content.Liquids; import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.TileEntity; -import io.anuke.mindustry.gen.CallBlocks; -import io.anuke.mindustry.net.In; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.type.ContentList; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Liquid; @@ -28,7 +27,7 @@ import java.io.IOException; public class DebugBlocks extends BlockList implements ContentList{ public static Block powerVoid, powerInfinite, itemSource, liquidSource, itemVoid; - @Remote(targets = Loc.both, called = Loc.both, in = In.blocks, forward = true) + @Remote(targets = Loc.both, called = Loc.both, forward = true) public static void setLiquidSourceLiquid(Player player, Tile tile, Liquid liquid){ LiquidSourceEntity entity = tile.entity(); entity.source = liquid; @@ -114,7 +113,7 @@ public class DebugBlocks extends BlockList implements ContentList{ if(i == 0) continue; final int f = i; ImageButton button = cont.addImageButton("white", "toggle", 24, () -> { - CallBlocks.setLiquidSourceLiquid(null, tile, items.get(f)); + Call.setLiquidSourceLiquid(null, tile, items.get(f)); }).size(38, 42).padBottom(-5.1f).group(group).get(); button.getStyle().imageUpColor = items.get(i).color; button.setChecked(entity.source.id == f); diff --git a/core/src/io/anuke/mindustry/entities/Damage.java b/core/src/io/anuke/mindustry/entities/Damage.java index 0c7ac56454..1d7a86ff08 100644 --- a/core/src/io/anuke/mindustry/entities/Damage.java +++ b/core/src/io/anuke/mindustry/entities/Damage.java @@ -9,7 +9,7 @@ import io.anuke.mindustry.content.fx.Fx; import io.anuke.mindustry.entities.effect.Fire; import io.anuke.mindustry.entities.effect.Lightning; import io.anuke.mindustry.game.Team; -import io.anuke.mindustry.gen.CallEntity; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.world.Tile; import io.anuke.ucore.core.Effects; @@ -43,7 +43,7 @@ public class Damage{ } for(int i = 0; i < Mathf.clamp(flammability / 4, 0, 30); i++){ - Timers.run(i / 2, () -> CallEntity.createBullet(TurretBullets.fireball, x, y, Mathf.random(360f))); + Timers.run(i / 2, () -> Call.createBullet(TurretBullets.fireball, x, y, Mathf.random(360f))); } int waves = Mathf.clamp((int) (explosiveness / 4), 0, 30); diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index 39161a9a8d..1dec7b45e6 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -14,10 +14,9 @@ import io.anuke.mindustry.entities.effect.ItemDrop; import io.anuke.mindustry.entities.effect.ScorchDecal; import io.anuke.mindustry.entities.traits.*; import io.anuke.mindustry.game.Team; -import io.anuke.mindustry.gen.CallEntity; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.graphics.Trail; -import io.anuke.mindustry.net.In; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.NetConnection; import io.anuke.mindustry.type.*; @@ -83,7 +82,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra //region unit and event overrides, utility methods - @Remote(in = In.entities, targets = Loc.server, called = Loc.server) + @Remote(targets = Loc.server, called = Loc.server) public static void onPlayerDamage(Player player, float amount){ if(player == null) return; @@ -91,7 +90,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra player.health -= amount; } - @Remote(in = In.entities, targets = Loc.server, called = Loc.server) + @Remote(targets = Loc.server, called = Loc.server) public static void onPlayerDeath(Player player){ if(player == null) return; @@ -228,10 +227,10 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra @Override public void damage(float amount){ - CallEntity.onPlayerDamage(this, calculateDamage(amount)); + Call.onPlayerDamage(this, calculateDamage(amount)); if(health <= 0 && !dead){ - CallEntity.onPlayerDeath(this); + Call.onPlayerDeath(this); } } @@ -511,7 +510,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra if(!ui.chatfrag.chatOpen() && Inputs.keyTap("drop_unit")){ if(!mech.flying){ if(getCarrier() != null){ - CallEntity.dropSelf(this); + Call.dropSelf(this); } }else if(getCarry() != null){ dropCarry(); diff --git a/core/src/io/anuke/mindustry/entities/TileEntity.java b/core/src/io/anuke/mindustry/entities/TileEntity.java index 59b05c68df..651b968760 100644 --- a/core/src/io/anuke/mindustry/entities/TileEntity.java +++ b/core/src/io/anuke/mindustry/entities/TileEntity.java @@ -10,8 +10,7 @@ import io.anuke.mindustry.content.fx.Fx; import io.anuke.mindustry.entities.bullet.Bullet; import io.anuke.mindustry.entities.traits.TargetTrait; import io.anuke.mindustry.game.Team; -import io.anuke.mindustry.gen.CallBlocks; -import io.anuke.mindustry.net.In; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Edges; import io.anuke.mindustry.world.Tile; @@ -55,14 +54,14 @@ public class TileEntity extends BaseEntity implements TargetTrait{ private boolean sleeping; private float sleepTime; - @Remote(called = Loc.server, in = In.blocks) + @Remote(called = Loc.server) public static void onTileDamage(Tile tile, float health){ if(tile.entity != null){ tile.entity.health = health; } } - @Remote(called = Loc.server, in = In.blocks) + @Remote(called = Loc.server) public static void onTileDestroyed(Tile tile){ if(tile.entity == null) return; tile.entity.onDeath(); @@ -159,10 +158,10 @@ public class TileEntity extends BaseEntity implements TargetTrait{ public void damage(float damage){ if(dead) return; - CallBlocks.onTileDamage(tile, health - tile.block().handleDamage(tile, damage)); + Call.onTileDamage(tile, health - tile.block().handleDamage(tile, damage)); if(health <= 0){ - CallBlocks.onTileDestroyed(tile); + Call.onTileDestroyed(tile); } } diff --git a/core/src/io/anuke/mindustry/entities/bullet/Bullet.java b/core/src/io/anuke/mindustry/entities/bullet/Bullet.java index 0e9322928f..0a59be1469 100644 --- a/core/src/io/anuke/mindustry/entities/bullet/Bullet.java +++ b/core/src/io/anuke/mindustry/entities/bullet/Bullet.java @@ -85,7 +85,7 @@ public class Bullet extends BulletEntity implements TeamTrait, SyncT create(type, parent.owner, parent.team, x, y, angle, velocityScl); } - @Remote(called = Loc.server, in = In.entities) + @Remote(called = Loc.server) public static void createBullet(BulletType type, float x, float y, float angle){ create(type, null, Team.none, x, y, angle); } diff --git a/core/src/io/anuke/mindustry/entities/effect/Fire.java b/core/src/io/anuke/mindustry/entities/effect/Fire.java index e933e5dfbf..b2f2051f6f 100644 --- a/core/src/io/anuke/mindustry/entities/effect/Fire.java +++ b/core/src/io/anuke/mindustry/entities/effect/Fire.java @@ -12,8 +12,7 @@ import io.anuke.mindustry.entities.Damage; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.traits.SaveTrait; import io.anuke.mindustry.entities.traits.SyncTrait; -import io.anuke.mindustry.gen.CallEntity; -import io.anuke.mindustry.net.In; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; @@ -77,7 +76,7 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable{ } } - @Remote(called = Loc.server, in = In.entities) + @Remote(called = Loc.server) public static void onFireRemoved(int fireid){ fireGroup.removeByID(fireid); } @@ -104,7 +103,7 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable{ time = Mathf.clamp(time + Timers.delta(), 0, lifetime()); if(time >= lifetime() || tile == null){ - CallEntity.onFireRemoved(getID()); + Call.onFireRemoved(getID()); remove(); return; } @@ -133,7 +132,7 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable{ create(other); if(Mathf.chance(0.05 * Timers.delta() * Mathf.clamp(flammability / 10.0))){ - CallEntity.createBullet(TurretBullets.fireball, x, y, Mathf.random(360f)); + Call.createBullet(TurretBullets.fireball, x, y, Mathf.random(360f)); } } diff --git a/core/src/io/anuke/mindustry/entities/effect/ItemDrop.java b/core/src/io/anuke/mindustry/entities/effect/ItemDrop.java index 3ee9a9d8ef..87430d7978 100644 --- a/core/src/io/anuke/mindustry/entities/effect/ItemDrop.java +++ b/core/src/io/anuke/mindustry/entities/effect/ItemDrop.java @@ -12,8 +12,7 @@ import io.anuke.mindustry.entities.traits.SaveTrait; import io.anuke.mindustry.entities.traits.SyncTrait; import io.anuke.mindustry.entities.traits.TargetTrait; import io.anuke.mindustry.game.Team; -import io.anuke.mindustry.gen.CallEntity; -import io.anuke.mindustry.net.In; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.net.Interpolator; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.type.Item; @@ -69,7 +68,7 @@ public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawT create(item, amount, x, y, 0).getVelocity().set(velocityX, velocityY); } - @Remote(called = Loc.server, in = In.entities) + @Remote(called = Loc.server) public static void onPickup(int itemid){ ItemDrop drop = itemGroup.getByID(itemid); if(drop != null){ @@ -133,7 +132,7 @@ public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawT amount -= used; if(amount <= 0){ - CallEntity.onPickup(getID()); + Call.onPickup(getID()); } } } @@ -166,14 +165,14 @@ public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawT updateVelocity(0.2f); updateTime(); if(time >= lifetime()){ - CallEntity.onPickup(getID()); + Call.onPickup(getID()); } } Tile tile = world.tileWorld(x, y); if(tile != null && tile.solid()){ - CallEntity.onPickup(getID()); + Call.onPickup(getID()); } if(tile != null && tile.floor().isLiquid){ diff --git a/core/src/io/anuke/mindustry/entities/effect/ItemTransfer.java b/core/src/io/anuke/mindustry/entities/effect/ItemTransfer.java index b27b8abbd5..804cf33d8c 100644 --- a/core/src/io/anuke/mindustry/entities/effect/ItemTransfer.java +++ b/core/src/io/anuke/mindustry/entities/effect/ItemTransfer.java @@ -35,7 +35,7 @@ public class ItemTransfer extends TimedEntity implements DrawTrait{ public ItemTransfer(){ } - @Remote(in = In.entities, called = Loc.server, unreliable = true) + @Remote(called = Loc.server, unreliable = true) public static void transferAmmo(Item item, float x, float y, Unit to){ if(to == null) return; to.addAmmo(item); @@ -43,20 +43,20 @@ public class ItemTransfer extends TimedEntity implements DrawTrait{ }); } - @Remote(in = In.entities, called = Loc.server, unreliable = true) + @Remote(called = Loc.server, unreliable = true) public static void transferItemEffect(Item item, float x, float y, Unit to){ if(to == null) return; create(item, x, y, to, () -> { }); } - @Remote(in = In.entities, called = Loc.server, unreliable = true) + @Remote(called = Loc.server, unreliable = true) public static void transferItemToUnit(Item item, float x, float y, Unit to){ if(to == null) return; create(item, x, y, to, () -> to.inventory.addItem(item, 1)); } - @Remote(in = In.entities, called = Loc.server) + @Remote(called = Loc.server) public static void transferItemTo(Item item, int amount, float x, float y, Tile tile){ if(tile == null) return; for(int i = 0; i < Mathf.clamp(amount / 3, 1, 8); i++){ diff --git a/core/src/io/anuke/mindustry/entities/effect/Lightning.java b/core/src/io/anuke/mindustry/entities/effect/Lightning.java index 2ab599b003..6642238948 100644 --- a/core/src/io/anuke/mindustry/entities/effect/Lightning.java +++ b/core/src/io/anuke/mindustry/entities/effect/Lightning.java @@ -11,9 +11,8 @@ import io.anuke.mindustry.content.StatusEffects; import io.anuke.mindustry.entities.Units; import io.anuke.mindustry.entities.traits.SyncTrait; import io.anuke.mindustry.game.Team; -import io.anuke.mindustry.gen.CallEntity; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.graphics.Palette; -import io.anuke.mindustry.net.In; import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects.Effect; import io.anuke.ucore.entities.EntityGroup; @@ -56,10 +55,10 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT * Create a lighting branch at a location. Use Team.none to damage everyone. */ public static void create(Team team, Effect effect, Color color, float damage, float x, float y, float targetAngle, int length){ - CallEntity.createLighting(lastSeed++, team, effect, color, damage, x, y, targetAngle, length); + Call.createLighting(lastSeed++, team, effect, color, damage, x, y, targetAngle, length); } - @Remote(called = Loc.server, in = In.entities) + @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); diff --git a/core/src/io/anuke/mindustry/entities/effect/Puddle.java b/core/src/io/anuke/mindustry/entities/effect/Puddle.java index 1fa0cd8a0b..cacd218c5b 100644 --- a/core/src/io/anuke/mindustry/entities/effect/Puddle.java +++ b/core/src/io/anuke/mindustry/entities/effect/Puddle.java @@ -15,7 +15,7 @@ import io.anuke.mindustry.content.fx.EnvironmentFx; import io.anuke.mindustry.entities.Units; import io.anuke.mindustry.entities.traits.SaveTrait; import io.anuke.mindustry.entities.traits.SyncTrait; -import io.anuke.mindustry.gen.CallEntity; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.net.In; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.type.Liquid; @@ -136,7 +136,7 @@ public class Puddle extends BaseEntity implements SaveTrait, Poolable, DrawTrait (liquid.flammability > 0.3f && dest.temperature > 0.7f)){ //flammable liquid + hot liquid Fire.create(tile); if(Mathf.chance(0.006 * amount)){ - CallEntity.createBullet(TurretBullets.fireball, x, y, Mathf.random(360f)); + Call.createBullet(TurretBullets.fireball, x, y, Mathf.random(360f)); } }else if(dest.temperature > 0.7f && liquid.temperature < 0.55f){ //cold liquid poured onto hot puddle if(Mathf.chance(0.5f * amount)){ @@ -152,7 +152,7 @@ public class Puddle extends BaseEntity implements SaveTrait, Poolable, DrawTrait return 0f; } - @Remote(called = Loc.server, in = In.entities) + @Remote(called = Loc.server) public static void onPuddleRemoved(int puddleid){ puddleGroup.removeByID(puddleid); } @@ -190,7 +190,7 @@ public class Puddle extends BaseEntity implements SaveTrait, Poolable, DrawTrait amount = Mathf.clamp(amount, 0, maxLiquid); if(amount <= 0f){ - CallEntity.onPuddleRemoved(getID()); + Call.onPuddleRemoved(getID()); } } diff --git a/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java b/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java index bbf7df9f9d..35ace24606 100644 --- a/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java +++ b/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java @@ -8,7 +8,7 @@ import io.anuke.mindustry.content.fx.BlockFx; import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.Unit; -import io.anuke.mindustry.gen.CallEntity; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Recipe; @@ -243,7 +243,7 @@ public interface BuilderTrait extends Entity{ if(unit.inventory.canAcceptItem(item) && Mathf.chance(Timers.delta() * (0.06 - item.hardness * 0.01) * getMinePower())){ - CallEntity.transferItemToUnit(item, + Call.transferItemToUnit(item, tile.worldx() + Mathf.range(tilesize / 2f), tile.worldy() + Mathf.range(tilesize / 2f), unit); diff --git a/core/src/io/anuke/mindustry/entities/traits/CarryTrait.java b/core/src/io/anuke/mindustry/entities/traits/CarryTrait.java index 63c10a4578..bbf89e58e6 100644 --- a/core/src/io/anuke/mindustry/entities/traits/CarryTrait.java +++ b/core/src/io/anuke/mindustry/entities/traits/CarryTrait.java @@ -4,20 +4,19 @@ import io.anuke.annotations.Annotations.Loc; import io.anuke.annotations.Annotations.Remote; import io.anuke.mindustry.content.fx.UnitFx; import io.anuke.mindustry.entities.Player; -import io.anuke.mindustry.gen.CallEntity; -import io.anuke.mindustry.net.In; +import io.anuke.mindustry.gen.Call; import io.anuke.ucore.core.Effects; import io.anuke.ucore.entities.trait.SolidTrait; public interface CarryTrait extends TeamTrait, SolidTrait, TargetTrait{ - @Remote(called = Loc.both, targets = Loc.both, forward = true, in = In.entities) + @Remote(called = Loc.both, targets = Loc.both, forward = true) static void dropSelf(Player player){ if(player.getCarrier() != null){ player.getCarrier().dropCarry(); } } - @Remote(called = Loc.both, targets = Loc.both, forward = true, in = In.entities) + @Remote(called = Loc.both, targets = Loc.both, forward = true) static void setCarryOf(Player player, CarryTrait trait, CarriableTrait unit){ if(trait == null) return; if(player != null){ //when a server recieves this called from a player, set the carrier to the player. @@ -72,6 +71,6 @@ public interface CarryTrait extends TeamTrait, SolidTrait, TargetTrait{ * Carries a unit. To drop a unit, call with {@code null}. */ default void carry(CarriableTrait unit){ - CallEntity.setCarryOf(this instanceof Player ? (Player) this : null, this, unit); + Call.setCarryOf(this instanceof Player ? (Player) this : null, this, unit); } } diff --git a/core/src/io/anuke/mindustry/entities/units/BaseUnit.java b/core/src/io/anuke/mindustry/entities/units/BaseUnit.java index b0444d2a28..e54f8d0daf 100644 --- a/core/src/io/anuke/mindustry/entities/units/BaseUnit.java +++ b/core/src/io/anuke/mindustry/entities/units/BaseUnit.java @@ -16,7 +16,7 @@ import io.anuke.mindustry.entities.traits.SpawnerTrait; import io.anuke.mindustry.entities.traits.TargetTrait; import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.TeamInfo.TeamData; -import io.anuke.mindustry.gen.CallEntity; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.net.In; import io.anuke.mindustry.net.Net; @@ -62,7 +62,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{ public BaseUnit(){ } - @Remote(called = Loc.server, in = In.entities) + @Remote(called = Loc.server) public static void onUnitDeath(BaseUnit unit){ if(unit == null) return; @@ -370,7 +370,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{ @Override public void onDeath(){ - CallEntity.onUnitDeath(this); + Call.onUnitDeath(this); } @Override diff --git a/core/src/io/anuke/mindustry/entities/units/types/Drone.java b/core/src/io/anuke/mindustry/entities/units/types/Drone.java index 4be5aa60d9..bddd870569 100644 --- a/core/src/io/anuke/mindustry/entities/units/types/Drone.java +++ b/core/src/io/anuke/mindustry/entities/units/types/Drone.java @@ -12,7 +12,7 @@ import io.anuke.mindustry.entities.units.BaseUnit; import io.anuke.mindustry.entities.units.FlyingUnit; import io.anuke.mindustry.entities.units.UnitState; import io.anuke.mindustry.game.EventType.BlockBuildEvent; -import io.anuke.mindustry.gen.CallEntity; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.type.Item; @@ -227,7 +227,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{ if(distanceTo(target) < type.range){ if(tile.tile.block().acceptStack(inventory.getItem().item, inventory.getItem().amount, tile.tile, Drone.this) == inventory.getItem().amount){ - CallEntity.transferItemTo(inventory.getItem().item, inventory.getItem().amount, x, y, tile.tile); + Call.transferItemTo(inventory.getItem().item, inventory.getItem().amount, x, y, tile.tile); inventory.clearItem(); } @@ -288,7 +288,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{ float dist = Math.min(entity.distanceTo(x, y) - placeDistance, 0); if(dist / type.maxVelocity < timeToBuild * 0.9f){ - //CallEntity.onDroneBeginBuild(this, entity.tile, entity.recipe); + //Call.onDroneBeginBuild(this, entity.tile, entity.recipe); target = entity; setState(build); } diff --git a/core/src/io/anuke/mindustry/input/InputHandler.java b/core/src/io/anuke/mindustry/input/InputHandler.java index d82020a712..e22505d3e6 100644 --- a/core/src/io/anuke/mindustry/input/InputHandler.java +++ b/core/src/io/anuke/mindustry/input/InputHandler.java @@ -10,9 +10,7 @@ import io.anuke.mindustry.entities.Units; import io.anuke.mindustry.entities.effect.ItemDrop; import io.anuke.mindustry.entities.effect.ItemTransfer; import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest; -import io.anuke.mindustry.gen.CallBlocks; -import io.anuke.mindustry.gen.CallEntity; -import io.anuke.mindustry.net.In; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.ValidateException; import io.anuke.mindustry.type.ItemStack; @@ -57,7 +55,7 @@ public abstract class InputHandler extends InputAdapter{ //methods to override - @Remote(targets = Loc.client, called = Loc.server, in = In.entities) + @Remote(targets = Loc.client, called = Loc.server) public static void dropItem(Player player, float angle){ if(Net.server() && !player.inventory.hasItem()){ throw new ValidateException(player, "Player cannot drop an item."); @@ -67,7 +65,7 @@ public abstract class InputHandler extends InputAdapter{ player.inventory.clearItem(); } - @Remote(targets = Loc.both, forward = true, called = Loc.server, in = In.blocks) + @Remote(targets = Loc.both, forward = true, called = Loc.server) public static void transferInventory(Player player, Tile tile){ if(Net.server() && (!player.inventory.hasItem() || player.isTransferring)){ throw new ValidateException(player, "Player cannot transfer an item."); @@ -118,7 +116,7 @@ public abstract class InputHandler extends InputAdapter{ }); } - @Remote(targets = Loc.both, called = Loc.server, forward = true, in = In.blocks) + @Remote(targets = Loc.both, called = Loc.server, forward = true) public static void onTileTapped(Player player, Tile tile){ if(tile == null || player == null) return; tile.block().tapped(tile, player); @@ -189,7 +187,7 @@ public abstract class InputHandler extends InputAdapter{ //call tapped event if(tile.getTeam() == player.getTeam()){ - CallBlocks.onTileTapped(player, tile); + Call.onTileTapped(player, tile); } //consume tap event if necessary @@ -303,9 +301,9 @@ public abstract class InputHandler extends InputAdapter{ ItemStack stack = player.inventory.getItem(); if(tile.block().acceptStack(stack.item, stack.amount, tile, player) > 0 && tile.block().hasItems){ - CallBlocks.transferInventory(player, tile); + Call.transferInventory(player, tile); }else{ - CallEntity.dropItem(player.angleTo(x, y)); + Call.dropItem(player.angleTo(x, y)); } } diff --git a/core/src/io/anuke/mindustry/net/In.java b/core/src/io/anuke/mindustry/net/In.java index d00e0aba41..a441e34f74 100644 --- a/core/src/io/anuke/mindustry/net/In.java +++ b/core/src/io/anuke/mindustry/net/In.java @@ -4,7 +4,4 @@ package io.anuke.mindustry.net; * Stores class nameas for remote method invocation for consistency's sake. */ public class In{ - public static final String normal = "Call"; - public static final String entities = "CallEntity"; - public static final String blocks = "CallBlocks"; } diff --git a/core/src/io/anuke/mindustry/type/Weapon.java b/core/src/io/anuke/mindustry/type/Weapon.java index a5d3610048..623be27e86 100644 --- a/core/src/io/anuke/mindustry/type/Weapon.java +++ b/core/src/io/anuke/mindustry/type/Weapon.java @@ -9,8 +9,7 @@ import io.anuke.mindustry.content.fx.Fx; import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.bullet.Bullet; import io.anuke.mindustry.entities.traits.ShooterTrait; -import io.anuke.mindustry.gen.CallEntity; -import io.anuke.mindustry.net.In; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.net.Net; import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects.Effect; @@ -82,7 +81,7 @@ public class Weapon extends Upgrade{ super(name); } - @Remote(targets = Loc.server, called = Loc.both, in = In.entities, unreliable = true) + @Remote(targets = Loc.server, called = Loc.both, unreliable = true) public static void onPlayerShootWeapon(Player player, float x, float y, float rotation, boolean left){ if(player == null) return; //clients do not see their own shoot events: they are simulated completely clientside to prevent laggy visuals @@ -94,7 +93,7 @@ public class Weapon extends Upgrade{ shootDirect(player, x, y, rotation, left); } - @Remote(targets = Loc.server, called = Loc.both, in = In.entities, unreliable = true) + @Remote(targets = Loc.server, called = Loc.both, unreliable = true) public static void onGenericShootWeapon(ShooterTrait shooter, float x, float y, float rotation, boolean left){ if(shooter == null) return; shootDirect(shooter, x, y, rotation, left); @@ -176,9 +175,9 @@ public class Weapon extends Upgrade{ shootDirect(p, x, y, angle, left); }else{ if(p instanceof Player){ //players need special weapon handling logic - CallEntity.onPlayerShootWeapon((Player) p, x, y, angle, left); + Call.onPlayerShootWeapon((Player) p, x, y, angle, left); }else{ - CallEntity.onGenericShootWeapon(p, x, y, angle, left); + Call.onGenericShootWeapon(p, x, y, angle, left); } } diff --git a/core/src/io/anuke/mindustry/ui/fragments/BlockInventoryFragment.java b/core/src/io/anuke/mindustry/ui/fragments/BlockInventoryFragment.java index 75f83b032e..a933e1b579 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/BlockInventoryFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/BlockInventoryFragment.java @@ -8,10 +8,8 @@ import io.anuke.annotations.Annotations.Loc; import io.anuke.annotations.Annotations.Remote; import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.entities.Player; -import io.anuke.mindustry.gen.CallBlocks; -import io.anuke.mindustry.gen.CallEntity; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.input.InputHandler; -import io.anuke.mindustry.net.In; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.ui.ItemImage; import io.anuke.mindustry.world.Tile; @@ -44,7 +42,7 @@ public class BlockInventoryFragment extends Fragment{ this.input = input; } - @Remote(called = Loc.server, targets = Loc.both, in = In.blocks, forward = true) + @Remote(called = Loc.server, targets = Loc.both, forward = true) public static void requestItem(Player player, Tile tile, Item item, int amount){ if(player == null) return; @@ -52,7 +50,7 @@ public class BlockInventoryFragment extends Fragment{ player.inventory.addItem(item, removed); for(int j = 0; j < Mathf.clamp(removed / 3, 1, 8); j++){ - Timers.run(j * 3f, () -> CallEntity.transferItemEffect(item, tile.drawx(), tile.drawy(), player)); + Timers.run(j * 3f, () -> Call.transferItemEffect(item, tile.drawx(), tile.drawy(), player)); } } @@ -99,7 +97,7 @@ public class BlockInventoryFragment extends Fragment{ if(holdTime >= holdWithdraw){ int amount = Math.min(tile.entity.items.get(lastItem), player.inventory.itemCapacityUsed(lastItem)); - CallBlocks.requestItem(player, tile, lastItem, amount); + Call.requestItem(player, tile, lastItem, amount); holding = false; holdTime = 0f; } @@ -149,7 +147,7 @@ public class BlockInventoryFragment extends Fragment{ public boolean touchDown(InputEvent event, float x, float y, int pointer, int button){ if(!canPick.get() || !tile.entity.items.has(item)) return false; int amount = Math.min(1, player.inventory.itemCapacityUsed(item)); - CallBlocks.requestItem(player, tile, item, amount); + Call.requestItem(player, tile, item, amount); lastItem = item; holding = true; holdTime = 0f; diff --git a/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java b/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java index b3bba5714d..1905e53683 100644 --- a/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java @@ -11,7 +11,7 @@ import io.anuke.mindustry.entities.Unit; import io.anuke.mindustry.entities.effect.RubbleDecal; import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest; import io.anuke.mindustry.game.Team; -import io.anuke.mindustry.gen.CallBlocks; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.graphics.Layer; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.graphics.Shaders; @@ -46,13 +46,13 @@ public class BuildBlock extends Block{ solidifes = true; } - @Remote(called = Loc.server, in = In.blocks) + @Remote(called = Loc.server) public static void onDeconstructFinish(Tile tile, Block block){ Effects.effect(Fx.breakBlock, tile.drawx(), tile.drawy(), block.size); world.removeBlock(tile); } - @Remote(called = Loc.server, in = In.blocks) + @Remote(called = Loc.server) public static void onConstructFinish(Tile tile, Block block, int builderID, byte rotation, Team team){ world.setBlock(tile, block, team); tile.setRotation(rotation); @@ -210,7 +210,7 @@ public class BuildBlock extends Block{ } if(progress >= 1f || debug){ - CallBlocks.onConstructFinish(tile, recipe.result, builderID, tile.getRotation(), builder.getTeam()); + Call.onConstructFinish(tile, recipe.result, builderID, tile.getRotation(), builder.getTeam()); } } @@ -238,7 +238,7 @@ public class BuildBlock extends Block{ progress = Mathf.clamp(progress - amount); if(progress <= 0 || debug){ - CallBlocks.onDeconstructFinish(tile, this.recipe == null ? previous : this.recipe.result); + Call.onDeconstructFinish(tile, this.recipe == null ? previous : this.recipe.result); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/ItemBridge.java b/core/src/io/anuke/mindustry/world/blocks/distribution/ItemBridge.java index d54992df5f..fd4d50b489 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/ItemBridge.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/ItemBridge.java @@ -9,7 +9,7 @@ import io.anuke.annotations.Annotations.Loc; import io.anuke.annotations.Annotations.Remote; import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.TileEntity; -import io.anuke.mindustry.gen.CallBlocks; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.graphics.Layer; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.net.In; @@ -52,7 +52,7 @@ public class ItemBridge extends Block{ hasItems = true; } - @Remote(targets = Loc.both, called = Loc.both, in = In.blocks, forward = true) + @Remote(targets = Loc.both, called = Loc.both, forward = true) public static void linkItemBridge(Player player, Tile tile, Tile other){ ItemBridgeEntity entity = tile.entity(); ItemBridgeEntity oe = other.entity(); @@ -60,7 +60,7 @@ public class ItemBridge extends Block{ oe.incoming.add(tile.packedPosition()); } - @Remote(targets = Loc.both, called = Loc.server, in = In.blocks, forward = true) + @Remote(targets = Loc.both, called = Loc.server, forward = true) public static void unlinkItemBridge(Player player, Tile tile, Tile other){ ItemBridgeEntity entity = tile.entity(); entity.link = -1; @@ -85,7 +85,7 @@ public class ItemBridge extends Block{ if(linkValid(tile, last)){ ItemBridgeEntity entity = last.entity(); if(!linkValid(last, world.tile(entity.link))){ - CallBlocks.linkItemBridge(null, last, tile); + Call.linkItemBridge(null, last, tile); } } lastPlaced = tile.packedPosition(); @@ -138,9 +138,9 @@ public class ItemBridge extends Block{ if(linkValid(tile, other)){ if(entity.link == other.packedPosition()){ - CallBlocks.unlinkItemBridge(null, tile, other); + Call.unlinkItemBridge(null, tile, other); }else{ - CallBlocks.linkItemBridge(null, tile, other); + Call.linkItemBridge(null, tile, other); } return false; } diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java b/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java index ac20aefb83..0a3cc3136c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java @@ -11,7 +11,7 @@ import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.bullet.Bullet; import io.anuke.mindustry.entities.effect.ItemDrop; -import io.anuke.mindustry.gen.CallBlocks; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.graphics.Layer; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.net.In; @@ -56,7 +56,7 @@ public class MassDriver extends Block{ hasPower = true; } - @Remote(targets = Loc.both, called = Loc.server, in = In.blocks, forward = true) + @Remote(targets = Loc.both, called = Loc.server, forward = true) public static void linkMassDriver(Player player, Tile tile, int position){ MassDriverEntity entity = tile.entity(); @@ -64,7 +64,7 @@ public class MassDriver extends Block{ threads.run(() -> entity.link = position); } - @Remote(called = Loc.server, in = In.blocks) + @Remote(called = Loc.server) public static void onMassDriverFire(Tile tile, Tile target){ //just in case the client has invalid data if(!(tile.entity instanceof MassDriverEntity) || !(target.entity instanceof MassDriverEntity)) return; @@ -137,7 +137,7 @@ public class MassDriver extends Block{ if(Mathf.angNear(entity.rotation, target, 1f) && Mathf.angNear(other.rotation, target + 180f, 1f)){ - CallBlocks.onMassDriverFire(tile, link); + Call.onMassDriverFire(tile, link); } } } @@ -182,10 +182,10 @@ public class MassDriver extends Block{ MassDriverEntity entity = tile.entity(); if(entity.link == other.packedPosition()){ - CallBlocks.linkMassDriver(null, tile, -1); + Call.linkMassDriver(null, tile, -1); return false; }else if(other.block() instanceof MassDriver && other.distanceTo(tile) <= range){ - CallBlocks.linkMassDriver(null, tile, other.packedPosition()); + Call.linkMassDriver(null, tile, other.packedPosition()); return false; } diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/Sorter.java b/core/src/io/anuke/mindustry/world/blocks/distribution/Sorter.java index d45bb84078..da0a16b65d 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/Sorter.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/Sorter.java @@ -5,8 +5,7 @@ import io.anuke.annotations.Annotations.Remote; import io.anuke.mindustry.content.Items; import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.TileEntity; -import io.anuke.mindustry.gen.CallBlocks; -import io.anuke.mindustry.net.In; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; @@ -32,7 +31,7 @@ public class Sorter extends Block implements SelectionTrait{ configurable = true; } - @Remote(targets = Loc.both, called = Loc.both, in = In.blocks, forward = true) + @Remote(targets = Loc.both, called = Loc.both, forward = true) public static void setSorterItem(Player player, Tile tile, Item item){ SorterEntity entity = tile.entity(); entity.sortItem = item; @@ -107,7 +106,7 @@ public class Sorter extends Block implements SelectionTrait{ @Override public void buildTable(Tile tile, Table table){ SorterEntity entity = tile.entity(); - buildItemTable(table, () -> entity.sortItem, item -> CallBlocks.setSorterItem(null, tile, item)); + buildItemTable(table, () -> entity.sortItem, item -> Call.setSorterItem(null, tile, item)); } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/WarpGate.java b/core/src/io/anuke/mindustry/world/blocks/distribution/WarpGate.java index 0ed512555b..921ed20126 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/WarpGate.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/WarpGate.java @@ -9,8 +9,7 @@ import io.anuke.mindustry.content.Liquids; import io.anuke.mindustry.content.fx.BlockFx; import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.TileEntity; -import io.anuke.mindustry.gen.CallBlocks; -import io.anuke.mindustry.net.In; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Liquid; import io.anuke.mindustry.world.Tile; @@ -75,7 +74,7 @@ public class WarpGate extends PowerBlock{ configurable = true; } - @Remote(targets = Loc.both, called = Loc.both, in = In.blocks, forward = true) + @Remote(targets = Loc.both, called = Loc.both, forward = true) public static void setTeleporterColor(Player player, Tile tile, byte color){ TeleporterEntity entity = tile.entity(); entity.color = color; @@ -88,7 +87,7 @@ public class WarpGate extends PowerBlock{ @Override public void placed(Tile tile){ - CallBlocks.setTeleporterColor(null, tile, lastColor); + Call.setTeleporterColor(null, tile, lastColor); } @Override @@ -254,7 +253,7 @@ public class WarpGate extends PowerBlock{ final int f = i; ImageButton button = cont.addImageButton("white", "toggle", 24, () -> { lastColor = (byte) f; - CallBlocks.setTeleporterColor(null, tile, (byte) f); + Call.setTeleporterColor(null, tile, (byte) f); }).size(34, 38).padBottom(-5.1f).group(group).get(); button.getStyle().imageUpColor = colorArray[f]; button.setChecked(entity.color == f); diff --git a/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java b/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java index 13c92a5b54..f031a9636b 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java @@ -6,10 +6,9 @@ import io.anuke.annotations.Annotations.Loc; import io.anuke.annotations.Annotations.Remote; import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.TileEntity; -import io.anuke.mindustry.gen.CallBlocks; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.graphics.Layer; import io.anuke.mindustry.graphics.Palette; -import io.anuke.mindustry.net.In; import io.anuke.mindustry.world.Edges; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.PowerBlock; @@ -52,7 +51,7 @@ public class PowerNode extends PowerBlock{ configurable = true; } - @Remote(targets = Loc.both, called = Loc.server, in = In.blocks, forward = true) + @Remote(targets = Loc.both, called = Loc.server, forward = true) public static void linkPowerDistributors(Player player, Tile tile, Tile other){ DistributorEntity entity = tile.entity(); @@ -70,7 +69,7 @@ public class PowerNode extends PowerBlock{ } } - @Remote(targets = Loc.both, called = Loc.server, in = In.blocks, forward = true) + @Remote(targets = Loc.both, called = Loc.server, forward = true) public static void unlinkPowerDistributors(Player player, Tile tile, Tile other){ DistributorEntity entity = tile.entity(); @@ -91,7 +90,7 @@ public class PowerNode extends PowerBlock{ public void placed(Tile tile){ Tile before = world.tile(lastPlaced); if(linkValid(tile, before) && before.block() instanceof PowerNode){ - CallBlocks.linkPowerDistributors(null, tile, before); + Call.linkPowerDistributors(null, tile, before); } lastPlaced = tile.packedPosition(); @@ -119,9 +118,9 @@ public class PowerNode extends PowerBlock{ if(linkValid(tile, other)){ if(linked(tile, other)){ - threads.run(() -> CallBlocks.unlinkPowerDistributors(null, tile, result)); + threads.run(() -> Call.unlinkPowerDistributors(null, tile, result)); }else if(entity.links.size < maxNodes){ - threads.run(() -> CallBlocks.linkPowerDistributors(null, tile, result)); + threads.run(() -> Call.linkPowerDistributors(null, tile, result)); } return false; } diff --git a/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java b/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java index 6bc1afbeb9..d6d90797e6 100644 --- a/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java @@ -14,11 +14,9 @@ import io.anuke.mindustry.entities.Units; import io.anuke.mindustry.entities.traits.SpawnerTrait; import io.anuke.mindustry.entities.units.BaseUnit; import io.anuke.mindustry.entities.units.UnitType; -import io.anuke.mindustry.gen.CallBlocks; -import io.anuke.mindustry.gen.CallEntity; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.graphics.Shaders; -import io.anuke.mindustry.net.In; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.ItemType; @@ -66,7 +64,7 @@ public class CoreBlock extends StorageBlock{ flags = EnumSet.of(BlockFlag.resupplyPoint, BlockFlag.target); } - @Remote(called = Loc.server, in = In.blocks) + @Remote(called = Loc.server) public static void onUnitRespawn(Tile tile, Unit player){ if(player == null) return; @@ -82,7 +80,7 @@ public class CoreBlock extends StorageBlock{ entity.currentUnit = null; } - @Remote(called = Loc.server, in = In.blocks) + @Remote(called = Loc.server) public static void setCoreSolid(Tile tile, boolean solid){ CoreEntity entity = tile.entity(); entity.solid = solid; @@ -193,7 +191,7 @@ public class CoreBlock extends StorageBlock{ CoreEntity entity = tile.entity(); if(!entity.solid && !Units.anyEntities(tile)){ - CallBlocks.setCoreSolid(tile, true); + Call.setCoreSolid(tile, true); } if(entity.currentUnit != null){ @@ -207,7 +205,7 @@ public class CoreBlock extends StorageBlock{ } if(entity.progress >= 1f){ - CallBlocks.onUnitRespawn(tile, entity.currentUnit); + Call.onUnitRespawn(tile, entity.currentUnit); } }else{ entity.warmup += Timers.delta(); @@ -250,7 +248,7 @@ public class CoreBlock extends StorageBlock{ if(tile.entity.items.get(item) > 0 && unit.acceptsAmmo(item)){ tile.entity.items.remove(item, 1); unit.addAmmo(item); - CallEntity.transferAmmo(item, tile.drawx(), tile.drawy(), unit); + Call.transferAmmo(item, tile.drawx(), tile.drawy(), unit); return; } } @@ -264,7 +262,7 @@ public class CoreBlock extends StorageBlock{ } /* - @Remote(called = Loc.server, in = In.blocks) + @Remote(called = Loc.server) public static void onCoreUnitSet(Tile tile, Unit player){ CoreEntity entity = tile.entity(); entity.currentUnit = player; diff --git a/core/src/io/anuke/mindustry/world/blocks/storage/SortedUnloader.java b/core/src/io/anuke/mindustry/world/blocks/storage/SortedUnloader.java index 20363f7f31..994d819977 100644 --- a/core/src/io/anuke/mindustry/world/blocks/storage/SortedUnloader.java +++ b/core/src/io/anuke/mindustry/world/blocks/storage/SortedUnloader.java @@ -3,11 +3,9 @@ package io.anuke.mindustry.world.blocks.storage; import com.badlogic.gdx.graphics.Color; import io.anuke.annotations.Annotations.Loc; import io.anuke.annotations.Annotations.Remote; -import io.anuke.mindustry.content.Items; import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.TileEntity; -import io.anuke.mindustry.gen.CallBlocks; -import io.anuke.mindustry.net.In; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.SelectionTrait; @@ -25,7 +23,7 @@ public class SortedUnloader extends Unloader implements SelectionTrait{ configurable = true; } - @Remote(targets = Loc.both, called = Loc.both, in = In.blocks, forward = true) + @Remote(targets = Loc.both, called = Loc.both, forward = true) public static void setSortedUnloaderItem(Player player, Tile tile, Item item){ SortedUnloaderEntity entity = tile.entity(); entity.sortItem = item; @@ -63,7 +61,7 @@ public class SortedUnloader extends Unloader implements SelectionTrait{ @Override public void buildTable(Tile tile, Table table){ SortedUnloaderEntity entity = tile.entity(); - buildItemTable(table, true, () -> entity.sortItem, item -> CallBlocks.setSortedUnloaderItem(null, tile, item)); + buildItemTable(table, true, () -> entity.sortItem, item -> Call.setSortedUnloaderItem(null, tile, item)); } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/units/CommandCenter.java b/core/src/io/anuke/mindustry/world/blocks/units/CommandCenter.java index 04d7247dc0..6cfb52c5d0 100644 --- a/core/src/io/anuke/mindustry/world/blocks/units/CommandCenter.java +++ b/core/src/io/anuke/mindustry/world/blocks/units/CommandCenter.java @@ -52,7 +52,7 @@ public class CommandCenter extends Block{ //TODO } - @Remote(called = Loc.server, forward = true, in = In.blocks, targets = Loc.both) + @Remote(called = Loc.server, forward = true, targets = Loc.both) public static void onCommandCenterSet(Player player, Tile tile, UnitCommand command){ for(Tile center : world.indexer().getAllied(tile.getTeam(), BlockFlag.comandCenter)){ if(center.block() instanceof CommandCenter){ diff --git a/core/src/io/anuke/mindustry/world/blocks/units/MechFactory.java b/core/src/io/anuke/mindustry/world/blocks/units/MechFactory.java index df2c2db165..0560ce9067 100644 --- a/core/src/io/anuke/mindustry/world/blocks/units/MechFactory.java +++ b/core/src/io/anuke/mindustry/world/blocks/units/MechFactory.java @@ -11,7 +11,7 @@ import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.Unit; import io.anuke.mindustry.entities.Units; import io.anuke.mindustry.entities.traits.SpawnerTrait; -import io.anuke.mindustry.gen.CallBlocks; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.graphics.Shaders; import io.anuke.mindustry.net.In; @@ -44,7 +44,7 @@ public class MechFactory extends Block{ solidifes = true; } - @Remote(targets = Loc.both, called = Loc.server, in = In.blocks) + @Remote(targets = Loc.both, called = Loc.server) public static void onMechFactoryTap(Player player, Tile tile){ if(!checkValidTap(tile, player)) return; @@ -52,7 +52,7 @@ public class MechFactory extends Block{ player.beginRespawning(entity); } - @Remote(called = Loc.server, in = In.blocks) + @Remote(called = Loc.server) public static void onMechFactoryDone(Tile tile){ MechFactoryEntity entity = tile.entity(); @@ -93,7 +93,7 @@ public class MechFactory extends Block{ if(mobile && !mech.flying) return; if(checkValidTap(tile, player)){ - CallBlocks.onMechFactoryTap(player, tile); + Call.onMechFactoryTap(player, tile); }else if(player.isLocal && mobile){ player.moveTarget = tile.entity; } @@ -159,7 +159,7 @@ public class MechFactory extends Block{ entity.time += 0.5f; if(entity.progress >= 1f){ - CallBlocks.onMechFactoryDone(tile); + Call.onMechFactoryDone(tile); } }else{ if(Units.anyEntities(tile, 4f, unit -> unit.getTeam() == entity.getTeam() && unit instanceof Player)){ diff --git a/core/src/io/anuke/mindustry/world/blocks/units/Reconstructor.java b/core/src/io/anuke/mindustry/world/blocks/units/Reconstructor.java index 02e74a5f1e..7865b4a65c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/units/Reconstructor.java +++ b/core/src/io/anuke/mindustry/world/blocks/units/Reconstructor.java @@ -10,10 +10,9 @@ import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.Unit; import io.anuke.mindustry.entities.Units; import io.anuke.mindustry.entities.traits.SpawnerTrait; -import io.anuke.mindustry.gen.CallBlocks; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.graphics.Shaders; -import io.anuke.mindustry.net.In; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; import io.anuke.ucore.core.Effects; @@ -71,7 +70,7 @@ public class Reconstructor extends Block{ entity.link = -1; } - @Remote(targets = Loc.both, called = Loc.server, in = In.blocks, forward = true) + @Remote(targets = Loc.both, called = Loc.server, forward = true) public static void reconstructPlayer(Player player, Tile tile){ ReconstructorEntity entity = tile.entity(); @@ -91,7 +90,7 @@ public class Reconstructor extends Block{ //player.setRespawning(); } - @Remote(targets = Loc.both, called = Loc.server, in = In.blocks, forward = true) + @Remote(targets = Loc.both, called = Loc.server, forward = true) public static void linkReconstructor(Player player, Tile tile, Tile other){ //just in case the client has invalid data if(!(tile.entity instanceof ReconstructorEntity) || !(other.entity instanceof ReconstructorEntity)) return; @@ -109,7 +108,7 @@ public class Reconstructor extends Block{ }); } - @Remote(targets = Loc.both, called = Loc.server, in = In.blocks, forward = true) + @Remote(targets = Loc.both, called = Loc.server, forward = true) public static void unlinkReconstructor(Player player, Tile tile, Tile other){ //just in case the client has invalid data if(!(tile.entity instanceof ReconstructorEntity) || !(other.entity instanceof ReconstructorEntity)) return; @@ -163,10 +162,10 @@ public class Reconstructor extends Block{ ReconstructorEntity entity = tile.entity(); if(entity.link == other.packedPosition()){ - CallBlocks.unlinkReconstructor(null, tile, other); + Call.unlinkReconstructor(null, tile, other); return false; }else if(other.block() instanceof Reconstructor){ - CallBlocks.linkReconstructor(null, tile, other); + Call.linkReconstructor(null, tile, other); return false; } @@ -296,7 +295,7 @@ public class Reconstructor extends Block{ if(!checkValidTap(tile, entity, player)) return; - CallBlocks.reconstructPlayer(player, tile); + Call.reconstructPlayer(player, tile); } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java b/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java index 5eb92f5260..e6eca20d80 100644 --- a/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java +++ b/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java @@ -9,10 +9,9 @@ import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.Units; import io.anuke.mindustry.entities.units.BaseUnit; import io.anuke.mindustry.entities.units.UnitType; -import io.anuke.mindustry.gen.CallBlocks; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.graphics.Shaders; -import io.anuke.mindustry.net.In; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.ItemStack; @@ -52,7 +51,7 @@ public class UnitFactory extends Block{ consumes.require(ConsumeItems.class); } - @Remote(called = Loc.server, in = In.blocks) + @Remote(called = Loc.server) public static void onUnitFactorySpawn(Tile tile){ UnitFactoryEntity entity = tile.entity(); UnitFactory factory = (UnitFactory) tile.block(); @@ -175,7 +174,7 @@ public class UnitFactory extends Block{ if(entity.buildTime >= produceTime && !entity.open){ entity.open = true; - Timers.run(openDuration / 1.5f, () -> CallBlocks.onUnitFactorySpawn(tile)); + Timers.run(openDuration / 1.5f, () -> Call.onUnitFactorySpawn(tile)); useContent(type); entity.openCountdown = openDuration;