Entity type cleanup
This commit is contained in:
@@ -139,6 +139,7 @@ public class Block extends BlockStorage{
|
|||||||
|
|
||||||
protected TextureRegion[] cacheRegions = {};
|
protected TextureRegion[] cacheRegions = {};
|
||||||
protected Array<String> cacheRegionStrings = new Array<>();
|
protected Array<String> cacheRegionStrings = new Array<>();
|
||||||
|
protected Prov<TileEntity> entityType = TileEntity::new;
|
||||||
|
|
||||||
protected Array<Tile> tempTiles = new Array<>();
|
protected Array<Tile> tempTiles = new Array<>();
|
||||||
protected TextureRegion[] generatedIcons;
|
protected TextureRegion[] generatedIcons;
|
||||||
@@ -856,8 +857,8 @@ public class Block extends BlockStorage{
|
|||||||
return destructible || update;
|
return destructible || update;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileEntity newEntity(){
|
public final TileEntity newEntity(){
|
||||||
return new TileEntity();
|
return entityType.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Offset for placing and drawing multiblocks. */
|
/** Offset for placing and drawing multiblocks. */
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public class BuildBlock extends Block{
|
|||||||
layer = Layer.placement;
|
layer = Layer.placement;
|
||||||
consumesTap = true;
|
consumesTap = true;
|
||||||
solidifes = true;
|
solidifes = true;
|
||||||
|
entityType = BuildEntity::new;
|
||||||
|
|
||||||
buildBlocks[size - 1] = this;
|
buildBlocks[size - 1] = this;
|
||||||
}
|
}
|
||||||
@@ -197,11 +198,6 @@ public class BuildBlock extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new BuildEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class BuildEntity extends TileEntity{
|
public class BuildEntity extends TileEntity{
|
||||||
/**
|
/**
|
||||||
* The recipe of the block that is being constructed.
|
* The recipe of the block that is being constructed.
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public class DeflectorWall extends Wall{
|
|||||||
|
|
||||||
public DeflectorWall(String name){
|
public DeflectorWall(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
entityType = DeflectorEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -72,11 +73,6 @@ public class DeflectorWall extends Wall{
|
|||||||
((DeflectorEntity)entity).hit = 1f;
|
((DeflectorEntity)entity).hit = 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new DeflectorEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class DeflectorEntity extends TileEntity{
|
public static class DeflectorEntity extends TileEntity{
|
||||||
public float hit;
|
public float hit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public class Door extends Wall{
|
|||||||
solid = false;
|
solid = false;
|
||||||
solidifes = true;
|
solidifes = true;
|
||||||
consumesTap = true;
|
consumesTap = true;
|
||||||
|
entityType = DoorEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Remote(called = Loc.server)
|
@Remote(called = Loc.server)
|
||||||
@@ -89,11 +90,6 @@ public class Door extends Wall{
|
|||||||
Call.onDoorToggle(null, tile, !entity.open);
|
Call.onDoorToggle(null, tile, !entity.open);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new DoorEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DoorEntity extends TileEntity{
|
public class DoorEntity extends TileEntity{
|
||||||
public boolean open = false;
|
public boolean open = false;
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ public class ForceProjector extends Block{
|
|||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.1f)).boost().update(false);
|
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.1f)).boost().update(false);
|
||||||
|
entityType = ForceEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -179,11 +180,6 @@ public class ForceProjector extends Block{
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new ForceEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
class ForceEntity extends TileEntity{
|
class ForceEntity extends TileEntity{
|
||||||
ShieldEntity shield;
|
ShieldEntity shield;
|
||||||
boolean broken = true;
|
boolean broken = true;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public class MendProjector extends Block{
|
|||||||
update = true;
|
update = true;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
|
entityType = MendEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -137,11 +138,6 @@ public class MendProjector extends Block{
|
|||||||
renderer.lights.add(tile.drawx(), tile.drawy(), 50f * tile.entity.efficiency(), color, 0.7f * tile.entity.efficiency());
|
renderer.lights.add(tile.drawx(), tile.drawy(), 50f * tile.entity.efficiency(), color, 0.7f * tile.entity.efficiency());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new MendEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
class MendEntity extends TileEntity{
|
class MendEntity extends TileEntity{
|
||||||
float heat;
|
float heat;
|
||||||
float charge = Mathf.random(reload);
|
float charge = Mathf.random(reload);
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public class OverdriveProjector extends Block{
|
|||||||
hasPower = true;
|
hasPower = true;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
canOverdrive = false;
|
canOverdrive = false;
|
||||||
|
entityType = OverdriveEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -137,11 +138,6 @@ public class OverdriveProjector extends Block{
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new OverdriveEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
class OverdriveEntity extends TileEntity{
|
class OverdriveEntity extends TileEntity{
|
||||||
float heat;
|
float heat;
|
||||||
float charge = Mathf.random(reload);
|
float charge = Mathf.random(reload);
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
package io.anuke.mindustry.world.blocks.defense.turrets;
|
package io.anuke.mindustry.world.blocks.defense.turrets;
|
||||||
|
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.content.Fx;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.entities.Effects;
|
import io.anuke.mindustry.entities.*;
|
||||||
import io.anuke.mindustry.entities.Effects.Effect;
|
import io.anuke.mindustry.entities.Effects.*;
|
||||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
import io.anuke.mindustry.entities.bullet.*;
|
||||||
import io.anuke.mindustry.entities.type.TileEntity;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.world.Tile;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
|
|
||||||
@@ -21,6 +20,7 @@ public class ChargeTurret extends PowerTurret{
|
|||||||
|
|
||||||
public ChargeTurret(String name){
|
public ChargeTurret(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
entityType = LaserTurretEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -59,11 +59,6 @@ public class ChargeTurret extends PowerTurret{
|
|||||||
return !entity.shooting;
|
return !entity.shooting;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new LaserTurretEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class LaserTurretEntity extends TurretEntity{
|
public class LaserTurretEntity extends TurretEntity{
|
||||||
public boolean shooting;
|
public boolean shooting;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class ItemTurret extends CooledTurret{
|
|||||||
public ItemTurret(String name){
|
public ItemTurret(String name){
|
||||||
super(name);
|
super(name);
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
|
entityType = ItemTurretEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Initializes accepted ammo map. Format: [item1, bullet1, item2, bullet2...] */
|
/** Initializes accepted ammo map. Format: [item1, bullet1, item2, bullet2...] */
|
||||||
@@ -148,11 +149,6 @@ public class ItemTurret extends CooledTurret{
|
|||||||
return ammo != null && ammo.get(item) != null && entity.totalAmmo + ammo.get(item).ammoMultiplier <= maxAmmo;
|
return ammo != null && ammo.get(item) != null && entity.totalAmmo + ammo.get(item).ammoMultiplier <= maxAmmo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new ItemTurretEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ItemTurretEntity extends TurretEntity{
|
public class ItemTurretEntity extends TurretEntity{
|
||||||
@Override
|
@Override
|
||||||
public void write(DataOutput stream) throws IOException{
|
public void write(DataOutput stream) throws IOException{
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public class LaserTurret extends PowerTurret{
|
|||||||
|
|
||||||
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.01f)).update(false);
|
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.01f)).update(false);
|
||||||
coolantMultiplier = 1f;
|
coolantMultiplier = 1f;
|
||||||
|
entityType = LaserTurretEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,11 +100,6 @@ public class LaserTurret extends PowerTurret{
|
|||||||
entity.bulletLife = shootDuration;
|
entity.bulletLife = shootDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new LaserTurretEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldActiveSound(Tile tile){
|
public boolean shouldActiveSound(Tile tile){
|
||||||
LaserTurretEntity entity = tile.entity();
|
LaserTurretEntity entity = tile.entity();
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ public abstract class Turret extends Block{
|
|||||||
group = BlockGroup.turrets;
|
group = BlockGroup.turrets;
|
||||||
flags = EnumSet.of(BlockFlag.turret);
|
flags = EnumSet.of(BlockFlag.turret);
|
||||||
outlineIcon = true;
|
outlineIcon = true;
|
||||||
|
entityType = TurretEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -305,11 +306,6 @@ public abstract class Turret extends Block{
|
|||||||
return (tile.entity instanceof TurretEntity);
|
return (tile.entity instanceof TurretEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new TurretEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static abstract class AmmoEntry{
|
public static abstract class AmmoEntry{
|
||||||
public int amount;
|
public int amount;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package io.anuke.mindustry.world.blocks.distribution;
|
package io.anuke.mindustry.world.blocks.distribution;
|
||||||
|
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.mindustry.entities.type.TileEntity;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.world.ItemBuffer;
|
|
||||||
import io.anuke.mindustry.world.Tile;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
@@ -18,6 +16,7 @@ public class BufferedItemBridge extends ExtendingItemBridge{
|
|||||||
super(name);
|
super(name);
|
||||||
hasPower = false;
|
hasPower = false;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
|
entityType = BufferedItemBridgeEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -38,11 +37,6 @@ public class BufferedItemBridge extends ExtendingItemBridge{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new BufferedItemBridgeEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
class BufferedItemBridgeEntity extends ItemBridgeEntity{
|
class BufferedItemBridgeEntity extends ItemBridgeEntity{
|
||||||
ItemBuffer buffer = new ItemBuffer(bufferCapacity, speed);
|
ItemBuffer buffer = new ItemBuffer(bufferCapacity, speed);
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public class Conveyor extends Block implements Autotiler{
|
|||||||
hasItems = true;
|
hasItems = true;
|
||||||
itemCapacity = 4;
|
itemCapacity = 4;
|
||||||
conveyorPlacement = true;
|
conveyorPlacement = true;
|
||||||
|
entityType = ConveyorEntity::new;
|
||||||
|
|
||||||
idleSound = Sounds.conveyor;
|
idleSound = Sounds.conveyor;
|
||||||
idleSoundVolume = 0.004f;
|
idleSoundVolume = 0.004f;
|
||||||
@@ -342,11 +343,6 @@ public class Conveyor extends Block implements Autotiler{
|
|||||||
entity.lastInserted = (byte)(entity.convey.size - 1);
|
entity.lastInserted = (byte)(entity.convey.size - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new ConveyorEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ConveyorEntity extends TileEntity{
|
public static class ConveyorEntity extends TileEntity{
|
||||||
|
|
||||||
LongArray convey = new LongArray();
|
LongArray convey = new LongArray();
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ public class ItemBridge extends Block{
|
|||||||
hasItems = true;
|
hasItems = true;
|
||||||
unloadable = false;
|
unloadable = false;
|
||||||
group = BlockGroup.transportation;
|
group = BlockGroup.transportation;
|
||||||
|
entityType = ItemBridgeEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -340,11 +341,6 @@ public class ItemBridge extends Block{
|
|||||||
return rel != rel2;
|
return rel != rel2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new ItemBridgeEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean linkValid(Tile tile, Tile other){
|
public boolean linkValid(Tile tile, Tile other){
|
||||||
return linkValid(tile, other, true);
|
return linkValid(tile, other, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public class Junction extends Block{
|
|||||||
instantTransfer = true;
|
instantTransfer = true;
|
||||||
group = BlockGroup.transportation;
|
group = BlockGroup.transportation;
|
||||||
unloadable = false;
|
unloadable = false;
|
||||||
|
entityType = JunctionEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -87,11 +88,6 @@ public class Junction extends Block{
|
|||||||
return to != null && to.link().entity != null;
|
return to != null && to.link().entity != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new JunctionEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
class JunctionEntity extends TileEntity{
|
class JunctionEntity extends TileEntity{
|
||||||
DirectionalItemBuffer buffer = new DirectionalItemBuffer(capacity, speed);
|
DirectionalItemBuffer buffer = new DirectionalItemBuffer(capacity, speed);
|
||||||
|
|
||||||
|
|||||||
@@ -42,16 +42,9 @@ public class MassDriver extends Block{
|
|||||||
layer = Layer.turret;
|
layer = Layer.turret;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
outlineIcon = true;
|
outlineIcon = true;
|
||||||
|
entityType = MassDriverEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
|
||||||
public static void linkMassDriver(Player player, Tile tile, int position){
|
|
||||||
if(!Units.canInteract(player, tile)) return;
|
|
||||||
MassDriverEntity entity = tile.entity();
|
|
||||||
entity.link = position;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configured(Tile tile, Player player, int value){
|
public void configured(Tile tile, Player player, int value){
|
||||||
tile.<MassDriverEntity>entity().link = value;
|
tile.<MassDriverEntity>entity().link = value;
|
||||||
@@ -213,11 +206,6 @@ public class MassDriver extends Block{
|
|||||||
return tile.entity.items.total() < itemCapacity && linkValid(tile);
|
return tile.entity.items.total() < itemCapacity && linkValid(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new MassDriverEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void fire(Tile tile, Tile target){
|
protected void fire(Tile tile, Tile target){
|
||||||
MassDriverEntity entity = tile.entity();
|
MassDriverEntity entity = tile.entity();
|
||||||
MassDriverEntity other = target.entity();
|
MassDriverEntity other = target.entity();
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public class OverflowGate extends Block{
|
|||||||
update = true;
|
update = true;
|
||||||
group = BlockGroup.transportation;
|
group = BlockGroup.transportation;
|
||||||
unloadable = false;
|
unloadable = false;
|
||||||
|
entityType = OverflowGateEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -108,11 +109,6 @@ public class OverflowGate extends Block{
|
|||||||
return to;
|
return to;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new OverflowGateEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class OverflowGateEntity extends TileEntity{
|
public class OverflowGateEntity extends TileEntity{
|
||||||
Item lastItem;
|
Item lastItem;
|
||||||
Tile lastInput;
|
Tile lastInput;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public class Router extends Block{
|
|||||||
itemCapacity = 1;
|
itemCapacity = 1;
|
||||||
group = BlockGroup.transportation;
|
group = BlockGroup.transportation;
|
||||||
unloadable = false;
|
unloadable = false;
|
||||||
|
entityType = RouterEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -82,11 +83,6 @@ public class Router extends Block{
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new RouterEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class RouterEntity extends TileEntity{
|
public class RouterEntity extends TileEntity{
|
||||||
Item lastItem;
|
Item lastItem;
|
||||||
Tile lastInput;
|
Tile lastInput;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class Sorter extends Block{
|
|||||||
group = BlockGroup.transportation;
|
group = BlockGroup.transportation;
|
||||||
configurable = true;
|
configurable = true;
|
||||||
unloadable = false;
|
unloadable = false;
|
||||||
|
entityType = SorterEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -137,12 +138,6 @@ public class Sorter extends Block{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new SorterEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class SorterEntity extends TileEntity{
|
public class SorterEntity extends TileEntity{
|
||||||
@Nullable Item sortItem;
|
@Nullable Item sortItem;
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
|||||||
solid = false;
|
solid = false;
|
||||||
floating = true;
|
floating = true;
|
||||||
conveyorPlacement = true;
|
conveyorPlacement = true;
|
||||||
|
entityType = ConduitEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -130,11 +131,6 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
|||||||
&& ((source.absoluteRelativeTo(tile.x, tile.y) + 2) % 4 != tile.rotation());
|
&& ((source.absoluteRelativeTo(tile.x, tile.y) + 2) % 4 != tile.rotation());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new ConduitEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ConduitEntity extends TileEntity{
|
public static class ConduitEntity extends TileEntity{
|
||||||
public float smoothLiquid;
|
public float smoothLiquid;
|
||||||
|
|
||||||
|
|||||||
@@ -7,14 +7,12 @@ import io.anuke.arc.graphics.*;
|
|||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.math.geom.*;
|
import io.anuke.arc.math.geom.*;
|
||||||
import io.anuke.arc.scene.ui.*;
|
import io.anuke.arc.scene.ui.*;
|
||||||
import io.anuke.arc.scene.ui.TextField.*;
|
|
||||||
import io.anuke.arc.scene.ui.layout.*;
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.pooling.*;
|
import io.anuke.arc.util.pooling.*;
|
||||||
import io.anuke.mindustry.entities.*;
|
import io.anuke.mindustry.entities.*;
|
||||||
import io.anuke.mindustry.entities.type.*;
|
import io.anuke.mindustry.entities.type.*;
|
||||||
import io.anuke.mindustry.gen.*;
|
import io.anuke.mindustry.gen.*;
|
||||||
import io.anuke.mindustry.net.Net;
|
|
||||||
import io.anuke.mindustry.net.*;
|
import io.anuke.mindustry.net.*;
|
||||||
import io.anuke.mindustry.ui.*;
|
import io.anuke.mindustry.ui.*;
|
||||||
import io.anuke.mindustry.ui.dialogs.*;
|
import io.anuke.mindustry.ui.dialogs.*;
|
||||||
@@ -33,6 +31,7 @@ public class MessageBlock extends Block{
|
|||||||
configurable = true;
|
configurable = true;
|
||||||
solid = true;
|
solid = true;
|
||||||
destructible = true;
|
destructible = true;
|
||||||
|
entityType = MessageBlockEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
||||||
@@ -147,11 +146,6 @@ public class MessageBlock extends Block{
|
|||||||
table.setPosition(pos.x, pos.y, Align.bottom);
|
table.setPosition(pos.x, pos.y, Align.bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new MessageBlockEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MessageBlockEntity extends TileEntity{
|
public class MessageBlockEntity extends TileEntity{
|
||||||
protected String message = "";
|
protected String message = "";
|
||||||
protected String[] lines = {""};
|
protected String[] lines = {""};
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import io.anuke.arc.math.*;
|
|||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.content.*;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.entities.*;
|
import io.anuke.mindustry.entities.*;
|
||||||
import io.anuke.mindustry.entities.type.*;
|
|
||||||
import io.anuke.mindustry.game.EventType.*;
|
import io.anuke.mindustry.game.EventType.*;
|
||||||
import io.anuke.mindustry.gen.*;
|
import io.anuke.mindustry.gen.*;
|
||||||
import io.anuke.mindustry.graphics.*;
|
import io.anuke.mindustry.graphics.*;
|
||||||
@@ -39,6 +38,7 @@ public class ImpactReactor extends PowerGenerator{
|
|||||||
liquidCapacity = 30f;
|
liquidCapacity = 30f;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
outputsPower = consumesPower = true;
|
outputsPower = consumesPower = true;
|
||||||
|
entityType = FusionReactorEntity::new;
|
||||||
|
|
||||||
bottomRegion = reg("-bottom");
|
bottomRegion = reg("-bottom");
|
||||||
plasmaRegions = new int[plasmas];
|
plasmaRegions = new int[plasmas];
|
||||||
@@ -127,11 +127,6 @@ public class ImpactReactor extends PowerGenerator{
|
|||||||
return new TextureRegion[]{Core.atlas.find(name + "-bottom"), Core.atlas.find(name)};
|
return new TextureRegion[]{Core.atlas.find(name + "-bottom"), Core.atlas.find(name)};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new FusionReactorEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyed(Tile tile){
|
public void onDestroyed(Tile tile){
|
||||||
super.onDestroyed(tile);
|
super.onDestroyed(tile);
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import io.anuke.arc.util.*;
|
|||||||
import io.anuke.mindustry.content.*;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.entities.*;
|
import io.anuke.mindustry.entities.*;
|
||||||
import io.anuke.mindustry.entities.Effects.*;
|
import io.anuke.mindustry.entities.Effects.*;
|
||||||
import io.anuke.mindustry.entities.type.*;
|
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.world.consumers.*;
|
import io.anuke.mindustry.world.consumers.*;
|
||||||
@@ -37,15 +36,15 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
|||||||
protected boolean defaults = false;
|
protected boolean defaults = false;
|
||||||
|
|
||||||
public ItemLiquidGenerator(boolean hasItems, boolean hasLiquids, String name){
|
public ItemLiquidGenerator(boolean hasItems, boolean hasLiquids, String name){
|
||||||
super(name);
|
this(name);
|
||||||
this.hasItems = hasItems;
|
this.hasItems = hasItems;
|
||||||
this.hasLiquids = hasLiquids;
|
this.hasLiquids = hasLiquids;
|
||||||
|
|
||||||
setDefaults();
|
setDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemLiquidGenerator(String name){
|
public ItemLiquidGenerator(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
this.entityType = ItemLiquidGeneratorEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setDefaults(){
|
protected void setDefaults(){
|
||||||
@@ -189,11 +188,6 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
|||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new ItemLiquidGeneratorEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ItemLiquidGeneratorEntity extends GeneratorEntity{
|
public static class ItemLiquidGeneratorEntity extends GeneratorEntity{
|
||||||
public float explosiveness;
|
public float explosiveness;
|
||||||
public float heat;
|
public float heat;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.power;
|
|||||||
|
|
||||||
import io.anuke.arc.graphics.*;
|
import io.anuke.arc.graphics.*;
|
||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
|
import io.anuke.mindustry.entities.type.*;
|
||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.renderer;
|
import static io.anuke.mindustry.Vars.renderer;
|
||||||
@@ -17,6 +18,8 @@ public class LightBlock extends Block{
|
|||||||
hasPower = true;
|
hasPower = true;
|
||||||
update = true;
|
update = true;
|
||||||
topRegion = reg("-top");
|
topRegion = reg("-top");
|
||||||
|
configurable = true;
|
||||||
|
entityType = LightEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -29,8 +32,17 @@ public class LightBlock extends Block{
|
|||||||
Draw.blend();
|
Draw.blend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configured(Tile tile, Player player, int value){
|
||||||
|
tile.<LightEntity>entity().color = value;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLight(Tile tile){
|
public void drawLight(Tile tile){
|
||||||
renderer.lights.add(tile.drawx(), tile.drawy(), radius, color, brightness * tile.entity.efficiency());
|
renderer.lights.add(tile.drawx(), tile.drawy(), radius, color, brightness * tile.entity.efficiency());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class LightEntity extends TileEntity{
|
||||||
|
public int color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import io.anuke.arc.math.geom.*;
|
|||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.content.*;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.entities.*;
|
import io.anuke.mindustry.entities.*;
|
||||||
import io.anuke.mindustry.entities.type.*;
|
|
||||||
import io.anuke.mindustry.game.EventType.*;
|
import io.anuke.mindustry.game.EventType.*;
|
||||||
import io.anuke.mindustry.gen.*;
|
import io.anuke.mindustry.gen.*;
|
||||||
import io.anuke.mindustry.graphics.*;
|
import io.anuke.mindustry.graphics.*;
|
||||||
@@ -46,6 +45,7 @@ public class NuclearReactor extends PowerGenerator{
|
|||||||
liquidCapacity = 30;
|
liquidCapacity = 30;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
|
entityType = NuclearReactorEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -181,11 +181,6 @@ public class NuclearReactor extends PowerGenerator{
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new NuclearReactorEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class NuclearReactorEntity extends GeneratorEntity{
|
public static class NuclearReactorEntity extends GeneratorEntity{
|
||||||
public float heat;
|
public float heat;
|
||||||
public float flash;
|
public float flash;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public class PowerGenerator extends PowerDistributor{
|
|||||||
super(name);
|
super(name);
|
||||||
baseExplosiveness = 5f;
|
baseExplosiveness = 5f;
|
||||||
flags = EnumSet.of(BlockFlag.producer);
|
flags = EnumSet.of(BlockFlag.producer);
|
||||||
|
entityType = GeneratorEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -51,11 +52,6 @@ public class PowerGenerator extends PowerDistributor{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new GeneratorEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class GeneratorEntity extends TileEntity{
|
public static class GeneratorEntity extends TileEntity{
|
||||||
public float generateTime;
|
public float generateTime;
|
||||||
/** The efficiency of the producer. An efficiency of 1.0 means 100% */
|
/** The efficiency of the producer. An efficiency of 1.0 means 100% */
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
package io.anuke.mindustry.world.blocks.power;
|
package io.anuke.mindustry.world.blocks.power;
|
||||||
|
|
||||||
import io.anuke.arc.collection.EnumSet;
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.mindustry.entities.type.TileEntity;
|
|
||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.world.meta.StatUnit;
|
import io.anuke.mindustry.world.meta.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.state;
|
import static io.anuke.mindustry.Vars.state;
|
||||||
|
|
||||||
@@ -13,6 +12,7 @@ public class SolarGenerator extends PowerGenerator{
|
|||||||
super(name);
|
super(name);
|
||||||
// Remove the BlockFlag.producer flag to make this a lower priority target than other generators.
|
// Remove the BlockFlag.producer flag to make this a lower priority target than other generators.
|
||||||
flags = EnumSet.of();
|
flags = EnumSet.of();
|
||||||
|
entityType = GeneratorEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -27,12 +27,4 @@ public class SolarGenerator extends PowerGenerator{
|
|||||||
stats.remove(generationType);
|
stats.remove(generationType);
|
||||||
stats.add(generationType, powerProduction * 60.0f, StatUnit.powerSecond);
|
stats.add(generationType, powerProduction * 60.0f, StatUnit.powerSecond);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new GeneratorEntity(){{
|
|
||||||
productionEfficiency = 1.0f;
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class Cultivator extends GenericCrafter{
|
|||||||
public Cultivator(String name){
|
public Cultivator(String name){
|
||||||
super(name);
|
super(name);
|
||||||
craftEffect = Fx.none;
|
craftEffect = Fx.none;
|
||||||
|
entityType = CultivatorEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -94,11 +95,6 @@ public class Cultivator extends GenericCrafter{
|
|||||||
return new TextureRegion[]{Core.atlas.find(name), Core.atlas.find(name + "-top"),};
|
return new TextureRegion[]{Core.atlas.find(name), Core.atlas.find(name + "-top"),};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new CultivatorEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProximityAdded(Tile tile){
|
public void onProximityAdded(Tile tile){
|
||||||
super.onProximityAdded(tile);
|
super.onProximityAdded(tile);
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ public class Drill extends Block{
|
|||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
liquidCapacity = 5f;
|
liquidCapacity = 5f;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
|
entityType = DrillEntity::new;
|
||||||
|
|
||||||
idleSound = Sounds.drill;
|
idleSound = Sounds.drill;
|
||||||
idleSoundVolume = 0.003f;
|
idleSoundVolume = 0.003f;
|
||||||
@@ -300,11 +301,6 @@ public class Drill extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new DrillEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int tier(){
|
public int tier(){
|
||||||
return tier;
|
return tier;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package io.anuke.mindustry.world.blocks.production;
|
|||||||
|
|
||||||
import io.anuke.arc.*;
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.mindustry.entities.type.*;
|
|
||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.world.meta.*;
|
import io.anuke.mindustry.world.meta.*;
|
||||||
|
|
||||||
@@ -16,6 +15,7 @@ public class Fracker extends SolidPump{
|
|||||||
public Fracker(String name){
|
public Fracker(String name){
|
||||||
super(name);
|
super(name);
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
|
entityType = FrackerEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -85,11 +85,6 @@ public class Fracker extends SolidPump{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new FrackerEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float typeLiquid(Tile tile){
|
public float typeLiquid(Tile tile){
|
||||||
return tile.entity.liquids.get(result);
|
return tile.entity.liquids.get(result);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class GenericCrafter extends Block{
|
|||||||
health = 60;
|
health = 60;
|
||||||
idleSound = Sounds.machine;
|
idleSound = Sounds.machine;
|
||||||
idleSoundVolume = 0.03f;
|
idleSoundVolume = 0.03f;
|
||||||
|
entityType = GenericCrafterEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -142,11 +143,6 @@ public class GenericCrafter extends Block{
|
|||||||
return outputLiquid == null || !(tile.entity.liquids.get(outputLiquid.liquid) >= liquidCapacity);
|
return outputLiquid == null || !(tile.entity.liquids.get(outputLiquid.liquid) >= liquidCapacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new GenericCrafterEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaximumAccepted(Tile tile, Item item){
|
public int getMaximumAccepted(Tile tile, Item item){
|
||||||
return itemCapacity;
|
return itemCapacity;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public class Incinerator extends Block{
|
|||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
update = true;
|
update = true;
|
||||||
solid = true;
|
solid = true;
|
||||||
|
entityType = IncineratorEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -84,11 +85,6 @@ public class Incinerator extends Block{
|
|||||||
return entity.heat > 0.5f;
|
return entity.heat > 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new IncineratorEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class IncineratorEntity extends TileEntity{
|
public static class IncineratorEntity extends TileEntity{
|
||||||
public float heat;
|
public float heat;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,15 @@
|
|||||||
package io.anuke.mindustry.world.blocks.production;
|
package io.anuke.mindustry.world.blocks.production;
|
||||||
|
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.*;
|
||||||
import io.anuke.arc.graphics.g2d.Draw;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.graphics.g2d.Lines;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.math.Mathf;
|
|
||||||
import io.anuke.arc.util.ArcAnnotate.*;
|
import io.anuke.arc.util.ArcAnnotate.*;
|
||||||
import io.anuke.mindustry.entities.type.TileEntity;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.type.ItemStack;
|
import io.anuke.mindustry.world.blocks.production.GenericCrafter.*;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.consumers.*;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.meta.*;
|
||||||
import io.anuke.mindustry.world.blocks.production.GenericCrafter.GenericCrafterEntity;
|
import io.anuke.mindustry.world.meta.values.*;
|
||||||
import io.anuke.mindustry.world.consumers.ConsumeLiquidBase;
|
|
||||||
import io.anuke.mindustry.world.consumers.ConsumeType;
|
|
||||||
import io.anuke.mindustry.world.meta.BlockStat;
|
|
||||||
import io.anuke.mindustry.world.meta.StatUnit;
|
|
||||||
import io.anuke.mindustry.world.meta.values.ItemFilterValue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts a random list of items from an input item and an input liquid.
|
* Extracts a random list of items from an input item and an input liquid.
|
||||||
@@ -39,6 +33,7 @@ public class Separator extends Block{
|
|||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
|
|
||||||
liquidRegion = reg("-liquid");
|
liquidRegion = reg("-liquid");
|
||||||
|
entityType = GenericCrafterEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -123,9 +118,4 @@ public class Separator extends Block{
|
|||||||
tryDump(tile);
|
tryDump(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new GenericCrafterEntity();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public class SolidPump extends Pump{
|
|||||||
public SolidPump(String name){
|
public SolidPump(String name){
|
||||||
super(name);
|
super(name);
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
|
entityType = SolidPumpEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -134,11 +135,6 @@ public class SolidPump extends Pump{
|
|||||||
return tile != null && !tile.floor().isLiquid;
|
return tile != null && !tile.floor().isLiquid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new SolidPumpEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProximityAdded(Tile tile){
|
public void onProximityAdded(Tile tile){
|
||||||
super.onProximityAdded(tile);
|
super.onProximityAdded(tile);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public class ItemSource extends Block{
|
|||||||
solid = true;
|
solid = true;
|
||||||
group = BlockGroup.transportation;
|
group = BlockGroup.transportation;
|
||||||
configurable = true;
|
configurable = true;
|
||||||
|
entityType = ItemSourceEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -91,11 +92,6 @@ public class ItemSource extends Block{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new ItemSourceEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ItemSourceEntity extends TileEntity{
|
public class ItemSourceEntity extends TileEntity{
|
||||||
Item outputItem;
|
Item outputItem;
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public class LiquidSource extends Block{
|
|||||||
liquidCapacity = 100f;
|
liquidCapacity = 100f;
|
||||||
configurable = true;
|
configurable = true;
|
||||||
outputsLiquid = true;
|
outputsLiquid = true;
|
||||||
|
entityType = LiquidSourceEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -106,11 +107,6 @@ public class LiquidSource extends Block{
|
|||||||
table.add(cont);
|
table.add(cont);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new LiquidSourceEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configured(Tile tile, Player player, int value){
|
public void configured(Tile tile, Player player, int value){
|
||||||
tile.<LiquidSourceEntity>entity().source = value == -1 ? null : content.liquid(value);
|
tile.<LiquidSourceEntity>entity().source = value == -1 ? null : content.liquid(value);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class CoreBlock extends StorageBlock{
|
|||||||
activeSound = Sounds.respawning;
|
activeSound = Sounds.respawning;
|
||||||
activeSoundVolume = 1f;
|
activeSoundVolume = 1f;
|
||||||
layer = Layer.overlay;
|
layer = Layer.overlay;
|
||||||
|
entityType = CoreEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Remote(called = Loc.server)
|
@Remote(called = Loc.server)
|
||||||
@@ -229,11 +230,6 @@ public class CoreBlock extends StorageBlock{
|
|||||||
return entity.spawnPlayer != null;
|
return entity.spawnPlayer != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new CoreEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CoreEntity extends TileEntity implements SpawnerTrait{
|
public class CoreEntity extends TileEntity implements SpawnerTrait{
|
||||||
protected Player spawnPlayer;
|
protected Player spawnPlayer;
|
||||||
protected float progress;
|
protected float progress;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ public abstract class StorageBlock extends Block{
|
|||||||
public StorageBlock(String name){
|
public StorageBlock(String name){
|
||||||
super(name);
|
super(name);
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
|
entityType = StorageBlockEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -69,11 +70,6 @@ public abstract class StorageBlock extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new StorageBlockEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class StorageBlockEntity extends TileEntity{
|
public class StorageBlockEntity extends TileEntity{
|
||||||
protected @Nullable
|
protected @Nullable
|
||||||
Tile linkedCore;
|
Tile linkedCore;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public class Unloader extends Block{
|
|||||||
health = 70;
|
health = 70;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
configurable = true;
|
configurable = true;
|
||||||
|
entityType = UnloaderEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -128,11 +129,6 @@ public class Unloader extends Block{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new UnloaderEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class UnloaderEntity extends TileEntity{
|
public static class UnloaderEntity extends TileEntity{
|
||||||
public Item sortItem = null;
|
public Item sortItem = null;
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class CommandCenter extends Block{
|
|||||||
destructible = true;
|
destructible = true;
|
||||||
solid = true;
|
solid = true;
|
||||||
configurable = true;
|
configurable = true;
|
||||||
|
entityType = CommandCenterEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -122,11 +123,6 @@ public class CommandCenter extends Block{
|
|||||||
Events.fire(new CommandIssueEvent(tile, command));
|
Events.fire(new CommandIssueEvent(tile, command));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new CommandCenterEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CommandCenterEntity extends TileEntity{
|
public class CommandCenterEntity extends TileEntity{
|
||||||
public UnitCommand command = UnitCommand.attack;
|
public UnitCommand command = UnitCommand.attack;
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public class MechPad extends Block{
|
|||||||
hasPower = true;
|
hasPower = true;
|
||||||
layer = Layer.overlay;
|
layer = Layer.overlay;
|
||||||
flags = EnumSet.of(BlockFlag.mechPad);
|
flags = EnumSet.of(BlockFlag.mechPad);
|
||||||
|
entityType = MechFactoryEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -134,11 +135,6 @@ public class MechPad extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new MechFactoryEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MechFactoryEntity extends TileEntity implements SpawnerTrait{
|
public class MechFactoryEntity extends TileEntity implements SpawnerTrait{
|
||||||
Player player;
|
Player player;
|
||||||
boolean sameMech;
|
boolean sameMech;
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class RepairPoint extends Block{
|
|||||||
layer2 = Layer.power;
|
layer2 = Layer.power;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
outlineIcon = true;
|
outlineIcon = true;
|
||||||
|
entityType = RepairPointEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -126,11 +127,6 @@ public class RepairPoint extends Block{
|
|||||||
return entity.target != null;
|
return entity.target != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new RepairPointEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class RepairPointEntity extends TileEntity{
|
public class RepairPointEntity extends TileEntity{
|
||||||
public Unit target;
|
public Unit target;
|
||||||
public float strength, rotation = 90;
|
public float strength, rotation = 90;
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ public class UnitFactory extends Block{
|
|||||||
hasItems = true;
|
hasItems = true;
|
||||||
solid = false;
|
solid = false;
|
||||||
flags = EnumSet.of(BlockFlag.producer);
|
flags = EnumSet.of(BlockFlag.producer);
|
||||||
|
entityType = UnitFactoryEntity::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Remote(called = Loc.server)
|
@Remote(called = Loc.server)
|
||||||
@@ -175,16 +176,12 @@ public class UnitFactory extends Block{
|
|||||||
entity.cons.trigger();
|
entity.cons.trigger();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaximumAccepted(Tile tile, Item item){
|
public int getMaximumAccepted(Tile tile, Item item){
|
||||||
return capacities[item.id];
|
return capacities[item.id];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity newEntity(){
|
|
||||||
return new UnitFactoryEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldConsume(Tile tile){
|
public boolean shouldConsume(Tile tile){
|
||||||
UnitFactoryEntity entity = tile.entity();
|
UnitFactoryEntity entity = tile.entity();
|
||||||
|
|||||||
Reference in New Issue
Block a user