diff --git a/annotations/src/main/java/mindustry/annotations/Annotations.java b/annotations/src/main/java/mindustry/annotations/Annotations.java index e194525896..4f718807e3 100644 --- a/annotations/src/main/java/mindustry/annotations/Annotations.java +++ b/annotations/src/main/java/mindustry/annotations/Annotations.java @@ -50,6 +50,7 @@ public class Annotations{ @Retention(RetentionPolicy.SOURCE) public @interface EntityDef{ Class[] value(); + boolean isFinal() default true; } /** Indicates an internal interface for entity components. */ diff --git a/annotations/src/main/java/mindustry/annotations/BaseProcessor.java b/annotations/src/main/java/mindustry/annotations/BaseProcessor.java index bcbf2dd9a5..189075bccf 100644 --- a/annotations/src/main/java/mindustry/annotations/BaseProcessor.java +++ b/annotations/src/main/java/mindustry/annotations/BaseProcessor.java @@ -1,7 +1,7 @@ package mindustry.annotations; import arc.files.*; -import arc.struct.*; +import arc.struct.Array; import arc.util.*; import com.squareup.javapoet.*; import com.sun.source.util.*; @@ -16,6 +16,7 @@ import javax.tools.Diagnostic.*; import javax.tools.*; import java.io.*; import java.lang.annotation.*; +import java.lang.reflect.*; import java.util.*; @SupportedSourceVersion(SourceVersion.RELEASE_8) @@ -47,6 +48,12 @@ public abstract class BaseProcessor extends AbstractProcessor{ return str.contains(".") ? str.substring(str.lastIndexOf('.') + 1) : str; } + public static TypeName tname(String name) throws Exception{ + Constructor cons = TypeName.class.getDeclaredConstructor(String.class); + cons.setAccessible(true); + return cons.newInstance(name); + } + public static TypeVariableName getTVN(TypeParameterElement element) { String name = element.getSimpleName().toString(); List boundsMirrors = element.getBounds(); diff --git a/annotations/src/main/java/mindustry/annotations/impl/EntityProcess.java b/annotations/src/main/java/mindustry/annotations/impl/EntityProcess.java index 123aab91d5..ec0aaf2ff7 100644 --- a/annotations/src/main/java/mindustry/annotations/impl/EntityProcess.java +++ b/annotations/src/main/java/mindustry/annotations/impl/EntityProcess.java @@ -134,11 +134,13 @@ public class EntityProcess extends BaseProcessor{ //look at each definition for(Stype type : allDefs){ + boolean isFinal = type.annotation(EntityDef.class).isFinal(); if(!type.name().endsWith("Def")){ err("All entity def names must end with 'Def'", type.e); } - String name = type.name().replace("Def", "_"); //TODO remove extra underscore - TypeSpec.Builder builder = TypeSpec.classBuilder(name).addModifiers(Modifier.PUBLIC, Modifier.FINAL); + String name = type.name().replace("Def", "Entity"); //TODO remove extra underscore + TypeSpec.Builder builder = TypeSpec.classBuilder(name).addModifiers(Modifier.PUBLIC); + if(isFinal) builder.addModifiers(Modifier.FINAL); Array components = allComponents(type); Array groups = groupDefs.select(g -> !g.components.contains(s -> !components.contains(s))); @@ -185,7 +187,8 @@ public class EntityProcess extends BaseProcessor{ } //build method using same params/returns - MethodSpec.Builder mbuilder = MethodSpec.methodBuilder(first.name()).addModifiers(first.is(Modifier.PRIVATE) ? Modifier.PRIVATE : Modifier.PUBLIC, Modifier.FINAL); + MethodSpec.Builder mbuilder = MethodSpec.methodBuilder(first.name()).addModifiers(first.is(Modifier.PRIVATE) ? Modifier.PRIVATE : Modifier.PUBLIC); + if(isFinal) mbuilder.addModifiers(Modifier.FINAL); mbuilder.addTypeVariables(first.typeVariables().map(TypeVariableName::get)); mbuilder.returns(first.retn()); mbuilder.addExceptions(first.thrownt()); @@ -244,6 +247,14 @@ public class EntityProcess extends BaseProcessor{ builder.addMethod(mbuilder.build()); } + //make constructor private + builder.addMethod(MethodSpec.constructorBuilder().addModifiers(Modifier.PROTECTED).build()); + + //add create() method + builder.addMethod(MethodSpec.methodBuilder("create").addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns(tname(packageName + "." + name)) + .addStatement("return new $L()", name).build()); + definitions.add(new EntityDefinition("mindustry.gen." + name, builder, type, components, groups)); } diff --git a/annotations/src/main/resources/classids.properties b/annotations/src/main/resources/classids.properties index 50814953c7..7fd4893247 100644 --- a/annotations/src/main/resources/classids.properties +++ b/annotations/src/main/resources/classids.properties @@ -1,5 +1,4 @@ #Maps entity names to IDs. Autogenerated. -#Wed Feb 05 12:35:36 EST 2020 mindustry.entities.def.EntityDefs.DecalDef=1 mindustry.entities.def.EntityDefs.EffectDef=2 diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 069a196214..963227c1bc 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -424,7 +424,7 @@ public class UnitTypes implements ContentList{ public void update(Playerc player){ if(player.timer.get(Playerc.timerAbility, healReload)){ if(indexer.eachBlock(player, healRange, other -> other.entity.damaged(), other -> { - other.entity.healBy(other.entity.maxHealth() * healPercent / 100f); + other.entity.heal(other.entity.maxHealth() * healPercent / 100f); Fx.healBlockFull.at(other.drawx(), other.drawy(), other.block().size, Pal.heal); })){ Fx.healWave.at(player); @@ -468,7 +468,7 @@ public class UnitTypes implements ContentList{ @Override public void update(Playerc player){ - player.healBy(Time.delta() * 0.09f); + player.heal(Time.delta() * 0.09f); } }; @@ -546,7 +546,7 @@ public class UnitTypes implements ContentList{ Fx.heal.at(unit); wasHealed = true; } - unit.healBy(healAmount); + unit.heal(healAmount); }); if(wasHealed){ diff --git a/core/src/mindustry/entities/def/EntityDefs.java b/core/src/mindustry/entities/def/EntityDefs.java index c4ad565a17..7c6873b4c8 100644 --- a/core/src/mindustry/entities/def/EntityDefs.java +++ b/core/src/mindustry/entities/def/EntityDefs.java @@ -8,7 +8,7 @@ class EntityDefs{ @EntityDef({BulletComp.class, VelComp.class, TimedComp.class}) class BulletDef{} - @EntityDef({TileComp.class}) + @EntityDef(value = {TileComp.class}, isFinal = false) class TileDef{} @EntityDef({EffectComp.class}) diff --git a/core/src/mindustry/io/versions/LegacyTypeTable.java b/core/src/mindustry/io/versions/LegacyTypeTable.java index ce5df0cc25..36b184f93f 100644 --- a/core/src/mindustry/io/versions/LegacyTypeTable.java +++ b/core/src/mindustry/io/versions/LegacyTypeTable.java @@ -1,9 +1,5 @@ package mindustry.io.versions; -import arc.func.Prov; -import mindustry.gen.*; -import mindustry.entities.type.base.*; - /* Latest data: [build 81] @@ -75,7 +71,7 @@ public class LegacyTypeTable{ 11 = Wraith 12 = Ghoul 13 = Revenant - */ + private static final Prov[] build81Table = { Playerc::new, Fire::new, @@ -139,5 +135,5 @@ public class LegacyTypeTable{ }else{ return build79Table; } - } + }*/ } diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 67303eaafd..3cebc54660 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -19,7 +19,6 @@ import arc.util.pooling.*; import mindustry.annotations.Annotations.*; import mindustry.ctype.*; import mindustry.entities.*; -import mindustry.gen.*; import mindustry.entities.units.*; import mindustry.gen.*; import mindustry.graphics.*; @@ -143,7 +142,7 @@ public class Block extends BlockStorage{ protected TextureRegion[] cacheRegions = {}; protected Array cacheRegionStrings = new Array<>(); - protected Prov entityType = TileData::new; + protected Prov entityType = TileEntity::create; protected Array tempTiles = new Array<>(); protected TextureRegion[] generatedIcons; @@ -631,7 +630,8 @@ public class Block extends BlockStorage{ Time.run(i / 2f, () -> { Tile other = world.tile(tile.x + Mathf.range(size / 2), tile.y + Mathf.range(size / 2)); if(other != null){ - Puddle.deposit(other, liquid, splash); + //TODO puddle + //Puddle.deposit(other, liquid, splash); } }); } @@ -640,7 +640,8 @@ public class Block extends BlockStorage{ Damage.dynamicExplosion(x, y, flammability, explosiveness * 3.5f, power, tilesize * size / 2f, Pal.darkFlame); if(!tile.floor().solid && !tile.floor().isLiquid){ - RubbleDecal.create(tile.drawx(), tile.drawy(), size); + //TODO rubble decal + //RubbleDecal.create(tile.drawx(), tile.drawy(), size); } } @@ -855,7 +856,7 @@ public class Block extends BlockStorage{ return destructible || update; } - public final TileData newData(){ + public final Tilec newEntity(){ return entityType.get(); } diff --git a/core/src/mindustry/world/BlockStorage.java b/core/src/mindustry/world/BlockStorage.java index a83e68de56..9807952b88 100644 --- a/core/src/mindustry/world/BlockStorage.java +++ b/core/src/mindustry/world/BlockStorage.java @@ -176,7 +176,8 @@ public abstract class BlockStorage extends UnlockableContent{ } }else if(leakResistance != 100f && !next.block().solid && !next.block().hasLiquids){ float leakAmount = tile.entity.liquids().get(liquid) / leakResistance; - Puddle.deposit(next, tile, liquid, leakAmount); + //TODO deposit puddle + //Puddle.deposit(next, tile, liquid, leakAmount); tile.entity.liquids().remove(liquid, leakAmount); } return 0; diff --git a/core/src/mindustry/world/Tile.java b/core/src/mindustry/world/Tile.java index 4462b2a174..ccfcf51d53 100644 --- a/core/src/mindustry/world/Tile.java +++ b/core/src/mindustry/world/Tile.java @@ -102,7 +102,7 @@ public class Tile implements Position{ } @SuppressWarnings("unchecked") - public T ent(){ + public T ent(){ return (T)entity; } @@ -458,7 +458,7 @@ public class Tile implements Position{ if(block.hasEntity()){ //TODO assign data and don't use new entity - //entity = block.newEntity().init(this, block.update); + entity = block.newEntity().init(this, block.update); entity.cons(new ConsumeModule(entity)); if(block.hasItems) entity.items(new ItemModule()); if(block.hasLiquids) entity.liquids(new LiquidModule()); diff --git a/core/src/mindustry/world/blocks/BuildBlock.java b/core/src/mindustry/world/blocks/BuildBlock.java index f67506ecfc..805c3f2878 100644 --- a/core/src/mindustry/world/blocks/BuildBlock.java +++ b/core/src/mindustry/world/blocks/BuildBlock.java @@ -196,7 +196,7 @@ public class BuildBlock extends Block{ } } - public class BuildEntity extends Tilec{ + public class BuildEntity extends TileEntity{ /** * The recipe of the block that is being constructed. * If there is no recipe for this block, as is the case with rocks, 'previous' is used. @@ -364,8 +364,8 @@ public class BuildBlock extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); progress = stream.readFloat(); short pid = stream.readShort(); short rid = stream.readShort(); diff --git a/core/src/mindustry/world/blocks/defense/DeflectorWall.java b/core/src/mindustry/world/blocks/defense/DeflectorWall.java index ab11c5faaa..0273ca981a 100644 --- a/core/src/mindustry/world/blocks/defense/DeflectorWall.java +++ b/core/src/mindustry/world/blocks/defense/DeflectorWall.java @@ -5,6 +5,7 @@ import arc.graphics.g2d.*; import arc.math.*; import arc.math.geom.*; import arc.util.*; +import mindustry.gen.*; import mindustry.world.*; import static mindustry.Vars.tilesize; @@ -40,17 +41,18 @@ public class DeflectorWall extends Wall{ } @Override - public void handleBulletHit(Tilec entity, Bullet bullet){ + public void handleBulletHit(Tilec entity, Bulletc bullet){ super.handleBulletHit(entity, bullet); + //TODO fix and test //doesn't reflect powerful bullets - if(bullet.damage() > maxDamageDeflect || bullet.isDeflected()) return; + if(bullet.damage() > maxDamageDeflect) return; - float penX = Math.abs(entity.getX() - bullet.x), penY = Math.abs(entity.getY() - bullet.y); + float penX = Math.abs(entity.getX() - bullet.x()), penY = Math.abs(entity.getY() - bullet.y()); bullet.hitbox(rect2); - Vec2 position = Geometry.raycastRect(bullet.x - bullet.vel().x*Time.delta(), bullet.y - bullet.vel().y*Time.delta(), bullet.x + bullet.vel().x*Time.delta(), bullet.y + bullet.vel().y*Time.delta(), + Vec2 position = Geometry.raycastRect(bullet.x() - bullet.vel().x*Time.delta(), bullet.y() - bullet.vel().y*Time.delta(), bullet.x() + bullet.vel().x*Time.delta(), bullet.y() + bullet.vel().y*Time.delta(), rect.setSize(size * tilesize + rect2.width*2 + rect2.height*2).setCenter(entity.getX(), entity.getY())); if(position != null){ @@ -64,14 +66,16 @@ public class DeflectorWall extends Wall{ } //bullet.updateVelocity(); - bullet.resetOwner(entity, entity.team()); - bullet.scaleTime(1f); - bullet.deflect(); + bullet.owner(entity); + bullet.team(entity.team()); + bullet.time(bullet.time() + 1f); + //TODO deflect + //bullet.deflect(); ((DeflectorEntity)entity).hit = 1f; } - public static class DeflectorEntity extends Tilec{ + public static class DeflectorEntity extends TileEntity{ public float hit; } } diff --git a/core/src/mindustry/world/blocks/defense/Door.java b/core/src/mindustry/world/blocks/defense/Door.java index de5a409736..020311c2f0 100644 --- a/core/src/mindustry/world/blocks/defense/Door.java +++ b/core/src/mindustry/world/blocks/defense/Door.java @@ -89,7 +89,7 @@ public class Door extends Wall{ Call.onDoorToggle(null, tile, !entity.open); } - public class DoorEntity extends Tilec{ + public class DoorEntity extends TileEntity{ public boolean open = false; @Override @@ -99,8 +99,8 @@ public class Door extends Wall{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); open = stream.readBoolean(); } } diff --git a/core/src/mindustry/world/blocks/defense/ForceProjector.java b/core/src/mindustry/world/blocks/defense/ForceProjector.java index 129ca4c5b2..85c2ca226e 100644 --- a/core/src/mindustry/world/blocks/defense/ForceProjector.java +++ b/core/src/mindustry/world/blocks/defense/ForceProjector.java @@ -8,7 +8,6 @@ import arc.math.*; import arc.math.geom.*; import arc.util.*; import mindustry.content.*; -import mindustry.entities.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.world.*; @@ -90,8 +89,9 @@ public class ForceProjector extends Block{ ForceEntity entity = tile.ent(); if(entity.shield == null){ - entity.shield = new ShieldEntity(tile); - entity.shield.add(); + //TODO implement + //entity.shield = new ShieldEntity(tile); + //entity.shield.add(); } boolean phaseValid = consumes.get(ConsumeType.item).valid(tile.entity); @@ -115,7 +115,7 @@ public class ForceProjector extends Block{ ConsumeLiquidFilter cons = consumes.get(ConsumeType.liquid); if(cons.valid(entity)){ cons.update(entity); - scale *= (cooldownLiquid * (1f + (entity.getLiquids().current().heatCapacity - 0.4f) * 0.9f)); + scale *= (cooldownLiquid * (1f + (entity.liquids().current().heatCapacity - 0.4f) * 0.9f)); } entity.buildup -= Time.delta() * scale; @@ -140,7 +140,8 @@ public class ForceProjector extends Block{ paramTile = tile; paramEntity = entity; paramBlock = this; - bulletGroup.intersect(tile.drawx() - realRadius, tile.drawy() - realRadius, realRadius*2f, realRadius * 2f, shieldConsumer); + //TODO fix + //bulletGroup.intersect(tile.drawx() - realRadius, tile.drawy() - realRadius, realRadius*2f, realRadius * 2f, shieldConsumer); } float realRadius(ForceEntity entity){ @@ -161,7 +162,7 @@ public class ForceProjector extends Block{ Draw.reset(); } - class ForceEntity extends Tilec{ + class ForceEntity extends TileEntity{ ShieldEntity shield; boolean broken = true; float buildup = 0f; @@ -181,8 +182,8 @@ public class ForceProjector extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); broken = stream.readBoolean(); buildup = stream.readFloat(); radscl = stream.readFloat(); @@ -191,6 +192,14 @@ public class ForceProjector extends Block{ } } + //TODO fix + class ShieldEntity{ + + } + /* + //@EntityDef({Drawc.class}) + //class ShieldDef{} + public class ShieldEntity extends BaseEntity implements DrawTrait{ final ForceEntity entity; @@ -245,5 +254,5 @@ public class ForceProjector extends Block{ public EntityGroup targetGroup(){ return shieldGroup; } - } + }*/ } diff --git a/core/src/mindustry/world/blocks/defense/MendProjector.java b/core/src/mindustry/world/blocks/defense/MendProjector.java index e71bf18764..03f42fcced 100644 --- a/core/src/mindustry/world/blocks/defense/MendProjector.java +++ b/core/src/mindustry/world/blocks/defense/MendProjector.java @@ -67,9 +67,9 @@ public class MendProjector extends Block{ entity.heat = Mathf.lerpDelta(entity.heat, entity.consValid() || tile.isEnemyCheat() ? 1f : 0f, 0.08f); entity.charge += entity.heat * entity.delta(); - entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, Mathf.num(entity.cons.optionalValid()), 0.1f); + entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, Mathf.num(entity.cons().optionalValid()), 0.1f); - if(entity.cons.optionalValid() && entity.timer(timerUse, useTime) && entity.efficiency() > 0){ + if(entity.cons().optionalValid() && entity.timer(timerUse, useTime) && entity.efficiency() > 0){ entity.consume(); } @@ -78,7 +78,7 @@ public class MendProjector extends Block{ entity.charge = 0f; indexer.eachBlock(entity, realRange, other -> other.entity.damaged(), other -> { - other.entity.healBy(other.entity.maxHealth() * (healPercent + entity.phaseHeat * phaseBoost) / 100f * entity.efficiency()); + other.entity.heal(other.entity.maxHealth() * (healPercent + entity.phaseHeat * phaseBoost) / 100f * entity.efficiency()); Fx.healBlockFull.at(other.drawx(), other.drawy(), other.block().size, Tmp.c1.set(baseColor).lerp(phaseColor, entity.phaseHeat)); }); } @@ -120,7 +120,7 @@ public class MendProjector extends Block{ renderer.lights.add(tile.drawx(), tile.drawy(), 50f * tile.entity.efficiency(), baseColor, 0.7f * tile.entity.efficiency()); } - class MendEntity extends Tilec{ + class MendEntity extends TileEntity{ float heat; float charge = Mathf.random(reload); float phaseHeat; @@ -133,8 +133,8 @@ public class MendProjector extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); heat = stream.readFloat(); phaseHeat = stream.readFloat(); } diff --git a/core/src/mindustry/world/blocks/defense/OverdriveProjector.java b/core/src/mindustry/world/blocks/defense/OverdriveProjector.java index 31beb4d377..899872c5ac 100644 --- a/core/src/mindustry/world/blocks/defense/OverdriveProjector.java +++ b/core/src/mindustry/world/blocks/defense/OverdriveProjector.java @@ -78,7 +78,7 @@ public class OverdriveProjector extends Block{ entity.heat = Mathf.lerpDelta(entity.heat, entity.consValid() ? 1f : 0f, 0.08f); entity.charge += entity.heat * Time.delta(); - entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, Mathf.num(entity.cons.optionalValid()), 0.1f); + entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, Mathf.num(entity.cons().optionalValid()), 0.1f); if(entity.timer(timerUse, useTime) && entity.efficiency() > 0){ entity.consume(); @@ -118,7 +118,7 @@ public class OverdriveProjector extends Block{ Draw.reset(); } - class OverdriveEntity extends Tilec{ + class OverdriveEntity extends TileEntity{ float heat; float charge = Mathf.random(reload); float phaseHeat; @@ -131,8 +131,8 @@ public class OverdriveProjector extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); heat = stream.readFloat(); phaseHeat = stream.readFloat(); } diff --git a/core/src/mindustry/world/blocks/defense/ShockMine.java b/core/src/mindustry/world/blocks/defense/ShockMine.java index 624015adab..8a1426d7ac 100644 --- a/core/src/mindustry/world/blocks/defense/ShockMine.java +++ b/core/src/mindustry/world/blocks/defense/ShockMine.java @@ -1,13 +1,11 @@ package mindustry.world.blocks.defense; -import arc.graphics.g2d.Draw; -import arc.graphics.g2d.Fill; -import arc.math.Mathf; -import mindustry.entities.effect.Lightning; -import mindustry.graphics.Layer; -import mindustry.graphics.Pal; -import mindustry.world.Block; -import mindustry.world.Tile; +import arc.graphics.g2d.*; +import arc.math.*; +import mindustry.entities.*; +import mindustry.gen.*; +import mindustry.graphics.*; +import mindustry.world.*; public class ShockMine extends Block{ public final int timerDamage = timers++; diff --git a/core/src/mindustry/world/blocks/defense/turrets/ItemTurret.java b/core/src/mindustry/world/blocks/defense/turrets/ItemTurret.java index 355184dc1c..bf7369de2f 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/ItemTurret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/ItemTurret.java @@ -162,8 +162,8 @@ public class ItemTurret extends CooledTurret{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); byte amount = stream.readByte(); for(int i = 0; i < amount; i++){ Item item = Vars.content.item(stream.readByte()); diff --git a/core/src/mindustry/world/blocks/defense/turrets/Turret.java b/core/src/mindustry/world/blocks/defense/turrets/Turret.java index fd92997bbc..21b94bdc50 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/Turret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/Turret.java @@ -309,7 +309,7 @@ public abstract class Turret extends Block{ public abstract BulletType type(); } - public static class TurretEntity extends Tilec{ + public static class TurretEntity extends TileEntity{ public Array ammo = new Array<>(); public int totalAmmo; public float reload; @@ -327,8 +327,8 @@ public abstract class Turret extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); if(revision == 1){ reload = stream.readFloat(); rotation = stream.readFloat(); diff --git a/core/src/mindustry/world/blocks/distribution/BufferedItemBridge.java b/core/src/mindustry/world/blocks/distribution/BufferedItemBridge.java index 87e7ce7e1e..caac4aa7cf 100644 --- a/core/src/mindustry/world/blocks/distribution/BufferedItemBridge.java +++ b/core/src/mindustry/world/blocks/distribution/BufferedItemBridge.java @@ -47,8 +47,8 @@ public class BufferedItemBridge extends ExtendingItemBridge{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); buffer.read(stream); } } diff --git a/core/src/mindustry/world/blocks/distribution/Conveyor.java b/core/src/mindustry/world/blocks/distribution/Conveyor.java index 5ecbcf57bc..24fdd7ee64 100644 --- a/core/src/mindustry/world/blocks/distribution/Conveyor.java +++ b/core/src/mindustry/world/blocks/distribution/Conveyor.java @@ -179,7 +179,7 @@ public class Conveyor extends Block implements Autotiler{ return; } - float nextMax = e.nextc != null && tile.rotation() == e.nextc.tile.rotation() ? 1f - Math.max(itemSpace - e.nextc.minitem, 0) : 1f; + float nextMax = e.nextc != null && tile.rotation() == e.nextc.tile().rotation() ? 1f - Math.max(itemSpace - e.nextc.minitem, 0) : 1f; for(int i = e.len - 1; i >= 0; i--){ float nextpos = (i == e.len - 1 ? 100f : e.ys[i + 1]) - itemSpace; @@ -197,7 +197,7 @@ public class Conveyor extends Block implements Autotiler{ e.nextc.xs[e.nextc.lastInserted] = e.xs[i]; } //remove last item - e.items.remove(e.ids[i], e.len - i); + e.items().remove(e.ids[i], e.len - i); e.len = Math.min(i, e.len); }else if(e.ys[i] < e.minitem){ e.minitem = e.ys[i]; @@ -244,7 +244,7 @@ public class Conveyor extends Block implements Autotiler{ } } - e.items.remove(item, removed); + e.items().remove(item, removed); return removed; } @@ -255,13 +255,13 @@ public class Conveyor extends Block implements Autotiler{ } @Override - public int acceptStack(Item item, int amount, Tile tile, Unitc source){ + public int acceptStack(Item item, int amount, Tile tile, Teamc source){ ConveyorEntity entity = tile.ent(); return Math.min((int)(entity.minitem / itemSpace), amount); } @Override - public void handleStack(Item item, int amount, Tile tile, Unitc source){ + public void handleStack(Item item, int amount, Tile tile, Teamc source){ ConveyorEntity e = tile.ent(); for(int i = amount - 1; i >= 0; i--){ @@ -269,7 +269,7 @@ public class Conveyor extends Block implements Autotiler{ e.xs[0] = 0; e.ys[0] = i * itemSpace; e.ids[0] = item; - e.items.add(item, 1); + e.items().add(item, 1); } e.noSleep(); @@ -293,7 +293,7 @@ public class Conveyor extends Block implements Autotiler{ float x = (ang == -1 || ang == 3) ? 1 : (ang == 1 || ang == -3) ? -1 : 0; e.noSleep(); - e.items.add(item, 1); + e.items().add(item, 1); if(Math.abs(source.relativeTo(tile.x, tile.y) - r) == 0){ //idx = 0 e.add(0); @@ -308,7 +308,7 @@ public class Conveyor extends Block implements Autotiler{ } } - public static class ConveyorEntity extends Tilec{ + public static class ConveyorEntity extends TileEntity{ //parallel array data Item[] ids = new Item[capacity]; float[] xs = new float[capacity]; @@ -360,8 +360,8 @@ public class Conveyor extends Block implements Autotiler{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); int amount = stream.readInt(); len = Math.min(amount, capacity); diff --git a/core/src/mindustry/world/blocks/distribution/ItemBridge.java b/core/src/mindustry/world/blocks/distribution/ItemBridge.java index 89a178fd70..59ce04d733 100644 --- a/core/src/mindustry/world/blocks/distribution/ItemBridge.java +++ b/core/src/mindustry/world/blocks/distribution/ItemBridge.java @@ -361,7 +361,7 @@ public class ItemBridge extends Block{ return other.block() == this && (!checkDouble || other.ent().link != tile.pos()); } - public static class ItemBridgeEntity extends Tilec{ + public static class ItemBridgeEntity extends TileEntity{ public int link = Pos.invalid; public IntSet incoming = new IntSet(); public float uptime; @@ -389,8 +389,8 @@ public class ItemBridge extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); link = stream.readInt(); uptime = stream.readFloat(); byte links = stream.readByte(); diff --git a/core/src/mindustry/world/blocks/distribution/Junction.java b/core/src/mindustry/world/blocks/distribution/Junction.java index c9d8ae9c03..8bcf06377a 100644 --- a/core/src/mindustry/world/blocks/distribution/Junction.java +++ b/core/src/mindustry/world/blocks/distribution/Junction.java @@ -86,7 +86,7 @@ public class Junction extends Block{ return to != null && to.link().entity != null && to.team() == tile.team(); } - class JunctionEntity extends Tilec{ + class JunctionEntity extends TileEntity{ DirectionalItemBuffer buffer = new DirectionalItemBuffer(capacity, speed); @Override @@ -96,8 +96,8 @@ public class Junction extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); buffer.read(stream); } } diff --git a/core/src/mindustry/world/blocks/distribution/MassDriver.java b/core/src/mindustry/world/blocks/distribution/MassDriver.java index 0cd82d98ef..47710572a3 100644 --- a/core/src/mindustry/world/blocks/distribution/MassDriver.java +++ b/core/src/mindustry/world/blocks/distribution/MassDriver.java @@ -311,7 +311,7 @@ public class MassDriver extends Block{ } } - public class MassDriverEntity extends Tilec{ + public class MassDriverEntity extends TileEntity{ int link = -1; float rotation = 90; float reload = 0f; @@ -340,8 +340,8 @@ public class MassDriver extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); link = stream.readInt(); rotation = stream.readFloat(); state = DriverState.values()[stream.readByte()]; diff --git a/core/src/mindustry/world/blocks/distribution/OverflowGate.java b/core/src/mindustry/world/blocks/distribution/OverflowGate.java index ebc8559481..9f2340073c 100644 --- a/core/src/mindustry/world/blocks/distribution/OverflowGate.java +++ b/core/src/mindustry/world/blocks/distribution/OverflowGate.java @@ -113,7 +113,7 @@ public class OverflowGate extends Block{ return to; } - public class OverflowGateEntity extends Tilec{ + public class OverflowGateEntity extends TileEntity{ Item lastItem; Tile lastInput; float time; @@ -129,8 +129,8 @@ public class OverflowGate extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); if(revision == 1){ new DirectionalItemBuffer(25, 50f).read(stream); } diff --git a/core/src/mindustry/world/blocks/distribution/Router.java b/core/src/mindustry/world/blocks/distribution/Router.java index 9dea3e0e01..6058d80de7 100644 --- a/core/src/mindustry/world/blocks/distribution/Router.java +++ b/core/src/mindustry/world/blocks/distribution/Router.java @@ -83,7 +83,7 @@ public class Router extends Block{ return result; } - public class RouterEntity extends Tilec{ + public class RouterEntity extends TileEntity{ Item lastItem; Tile lastInput; float time; diff --git a/core/src/mindustry/world/blocks/distribution/Sorter.java b/core/src/mindustry/world/blocks/distribution/Sorter.java index 8241a00aad..ef2548b666 100644 --- a/core/src/mindustry/world/blocks/distribution/Sorter.java +++ b/core/src/mindustry/world/blocks/distribution/Sorter.java @@ -139,7 +139,7 @@ public class Sorter extends Block{ }); } - public class SorterEntity extends Tilec{ + public class SorterEntity extends TileEntity{ @Nullable Item sortItem; @Override @@ -159,8 +159,8 @@ public class Sorter extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); sortItem = content.item(stream.readShort()); if(revision == 1){ new DirectionalItemBuffer(20, 45f).read(stream); diff --git a/core/src/mindustry/world/blocks/liquid/Conduit.java b/core/src/mindustry/world/blocks/liquid/Conduit.java index ea7f701979..7c3f8fcf34 100644 --- a/core/src/mindustry/world/blocks/liquid/Conduit.java +++ b/core/src/mindustry/world/blocks/liquid/Conduit.java @@ -9,6 +9,7 @@ import arc.struct.*; import arc.util.*; import mindustry.content.*; import mindustry.entities.units.*; +import mindustry.gen.*; import mindustry.type.*; import mindustry.world.*; import mindustry.world.blocks.*; @@ -128,7 +129,7 @@ public class Conduit extends LiquidBlock implements Autotiler{ && ((source.absoluteRelativeTo(tile.x, tile.y) + 2) % 4 != tile.rotation()); } - public static class ConduitEntity extends Tilec{ + public static class ConduitEntity extends TileEntity{ public float smoothLiquid; int blendbits; diff --git a/core/src/mindustry/world/blocks/logic/MessageBlock.java b/core/src/mindustry/world/blocks/logic/MessageBlock.java index 3fdc47cf09..7bd04a7e49 100644 --- a/core/src/mindustry/world/blocks/logic/MessageBlock.java +++ b/core/src/mindustry/world/blocks/logic/MessageBlock.java @@ -146,7 +146,7 @@ public class MessageBlock extends Block{ table.setPosition(pos.x, pos.y, Align.bottom); } - public class MessageBlockEntity extends Tilec{ + public class MessageBlockEntity extends TileEntity{ public String message = ""; public String[] lines = {""}; @@ -157,8 +157,8 @@ public class MessageBlock extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); message = stream.readUTF(); } } diff --git a/core/src/mindustry/world/blocks/power/ImpactReactor.java b/core/src/mindustry/world/blocks/power/ImpactReactor.java index 2bee3473d3..fc7f248b4c 100644 --- a/core/src/mindustry/world/blocks/power/ImpactReactor.java +++ b/core/src/mindustry/world/blocks/power/ImpactReactor.java @@ -171,8 +171,8 @@ public class ImpactReactor extends PowerGenerator{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); warmup = stream.readFloat(); } } diff --git a/core/src/mindustry/world/blocks/power/LightBlock.java b/core/src/mindustry/world/blocks/power/LightBlock.java index 6720331e2e..8601914af8 100644 --- a/core/src/mindustry/world/blocks/power/LightBlock.java +++ b/core/src/mindustry/world/blocks/power/LightBlock.java @@ -72,7 +72,7 @@ public class LightBlock extends Block{ renderer.lights.add(tile.drawx(), tile.drawy(), radius, Tmp.c1.set(entity.color), brightness * tile.entity.efficiency()); } - public class LightEntity extends Tilec{ + public class LightEntity extends TileEntity{ public int color = Pal.accent.rgba(); @Override @@ -87,8 +87,8 @@ public class LightBlock extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); color = stream.readInt(); } } diff --git a/core/src/mindustry/world/blocks/power/NuclearReactor.java b/core/src/mindustry/world/blocks/power/NuclearReactor.java index 35488349d0..f6ee6da005 100644 --- a/core/src/mindustry/world/blocks/power/NuclearReactor.java +++ b/core/src/mindustry/world/blocks/power/NuclearReactor.java @@ -192,8 +192,8 @@ public class NuclearReactor extends PowerGenerator{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); heat = stream.readFloat(); } } diff --git a/core/src/mindustry/world/blocks/power/PowerGenerator.java b/core/src/mindustry/world/blocks/power/PowerGenerator.java index e900b68f5c..b5bd06aa15 100644 --- a/core/src/mindustry/world/blocks/power/PowerGenerator.java +++ b/core/src/mindustry/world/blocks/power/PowerGenerator.java @@ -53,7 +53,7 @@ public class PowerGenerator extends PowerDistributor{ return false; } - public static class GeneratorEntity extends Tilec{ + public static class GeneratorEntity extends TileEntity{ public float generateTime; /** The efficiency of the producer. An efficiency of 1.0 means 100% */ public float productionEfficiency = 0.0f; @@ -65,8 +65,8 @@ public class PowerGenerator extends PowerDistributor{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); productionEfficiency = stream.readFloat(); } } diff --git a/core/src/mindustry/world/blocks/production/Cultivator.java b/core/src/mindustry/world/blocks/production/Cultivator.java index e8dd4d05b4..06186b6ea1 100644 --- a/core/src/mindustry/world/blocks/production/Cultivator.java +++ b/core/src/mindustry/world/blocks/production/Cultivator.java @@ -126,8 +126,8 @@ public class Cultivator extends GenericCrafter{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); warmup = stream.readFloat(); } } diff --git a/core/src/mindustry/world/blocks/production/Drill.java b/core/src/mindustry/world/blocks/production/Drill.java index 6286bc106e..0840ef4aec 100644 --- a/core/src/mindustry/world/blocks/production/Drill.java +++ b/core/src/mindustry/world/blocks/production/Drill.java @@ -315,7 +315,7 @@ public class Drill extends Block{ return drops != null && drops.hardness <= tier; } - public static class DrillEntity extends Tilec{ + public static class DrillEntity extends TileEntity{ float progress; int index; float warmup; diff --git a/core/src/mindustry/world/blocks/production/GenericCrafter.java b/core/src/mindustry/world/blocks/production/GenericCrafter.java index a9e7239a06..8db6b86df1 100644 --- a/core/src/mindustry/world/blocks/production/GenericCrafter.java +++ b/core/src/mindustry/world/blocks/production/GenericCrafter.java @@ -145,7 +145,7 @@ public class GenericCrafter extends Block{ return itemCapacity; } - public static class GenericCrafterEntity extends Tilec{ + public static class GenericCrafterEntity extends TileEntity{ public float progress; public float totalProgress; public float warmup; @@ -158,8 +158,8 @@ public class GenericCrafter extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); progress = stream.readFloat(); warmup = stream.readFloat(); } diff --git a/core/src/mindustry/world/blocks/production/Incinerator.java b/core/src/mindustry/world/blocks/production/Incinerator.java index c99d6a1e7e..5064d61702 100644 --- a/core/src/mindustry/world/blocks/production/Incinerator.java +++ b/core/src/mindustry/world/blocks/production/Incinerator.java @@ -84,7 +84,7 @@ public class Incinerator extends Block{ return entity.heat > 0.5f; } - public static class IncineratorEntity extends Tilec{ + public static class IncineratorEntity extends TileEntity{ public float heat; } } diff --git a/core/src/mindustry/world/blocks/production/SolidPump.java b/core/src/mindustry/world/blocks/production/SolidPump.java index 9eae5cbf1d..5675d2302b 100644 --- a/core/src/mindustry/world/blocks/production/SolidPump.java +++ b/core/src/mindustry/world/blocks/production/SolidPump.java @@ -155,7 +155,7 @@ public class SolidPump extends Pump{ return tile.entity.liquids().total(); } - public static class SolidPumpEntity extends Tilec{ + public static class SolidPumpEntity extends TileEntity{ public float warmup; public float pumpTime; public float boost; diff --git a/core/src/mindustry/world/blocks/sandbox/ItemSource.java b/core/src/mindustry/world/blocks/sandbox/ItemSource.java index 2135b3e5e0..4e6755b283 100644 --- a/core/src/mindustry/world/blocks/sandbox/ItemSource.java +++ b/core/src/mindustry/world/blocks/sandbox/ItemSource.java @@ -92,7 +92,7 @@ public class ItemSource extends Block{ return false; } - public class ItemSourceEntity extends Tilec{ + public class ItemSourceEntity extends TileEntity{ Item outputItem; @Override @@ -107,8 +107,8 @@ public class ItemSource extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); outputItem = content.item(stream.readShort()); } } diff --git a/core/src/mindustry/world/blocks/sandbox/LiquidSource.java b/core/src/mindustry/world/blocks/sandbox/LiquidSource.java index 5dee8b94d8..73f89e0668 100644 --- a/core/src/mindustry/world/blocks/sandbox/LiquidSource.java +++ b/core/src/mindustry/world/blocks/sandbox/LiquidSource.java @@ -112,7 +112,7 @@ public class LiquidSource extends Block{ tile.ent().source = value == -1 ? null : content.liquid(value); } - class LiquidSourceEntity extends Tilec{ + class LiquidSourceEntity extends TileEntity{ public @Nullable Liquid source = null; @Override @@ -127,8 +127,8 @@ public class LiquidSource extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); byte id = stream.readByte(); source = id == -1 ? null : content.liquid(id); } diff --git a/core/src/mindustry/world/blocks/storage/CoreBlock.java b/core/src/mindustry/world/blocks/storage/CoreBlock.java index 0f98631d73..6bf1cad182 100644 --- a/core/src/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/mindustry/world/blocks/storage/CoreBlock.java @@ -234,7 +234,7 @@ public class CoreBlock extends StorageBlock{ return entity.spawnPlayer != null; } - public class CoreEntity extends Tilec{ + public class CoreEntity extends TileEntity{ protected Playerc spawnPlayer; protected float progress; protected float time; diff --git a/core/src/mindustry/world/blocks/storage/StorageBlock.java b/core/src/mindustry/world/blocks/storage/StorageBlock.java index b4b678acb5..297bee427e 100644 --- a/core/src/mindustry/world/blocks/storage/StorageBlock.java +++ b/core/src/mindustry/world/blocks/storage/StorageBlock.java @@ -70,7 +70,7 @@ public abstract class StorageBlock extends Block{ } } - public class StorageBlockEntity extends Tilec{ + public class StorageBlockEntity extends TileEntity{ protected @Nullable Tile linkedCore; } diff --git a/core/src/mindustry/world/blocks/storage/Unloader.java b/core/src/mindustry/world/blocks/storage/Unloader.java index 84b3607949..313466b62b 100644 --- a/core/src/mindustry/world/blocks/storage/Unloader.java +++ b/core/src/mindustry/world/blocks/storage/Unloader.java @@ -129,7 +129,7 @@ public class Unloader extends Block{ }); } - public static class UnloaderEntity extends Tilec{ + public static class UnloaderEntity extends TileEntity{ public Item sortItem = null; @Override @@ -144,8 +144,8 @@ public class Unloader extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); byte id = stream.readByte(); sortItem = id == -1 ? null : content.items().get(id); } diff --git a/core/src/mindustry/world/blocks/units/CommandCenter.java b/core/src/mindustry/world/blocks/units/CommandCenter.java index 0737dded25..81ea5cd6ea 100644 --- a/core/src/mindustry/world/blocks/units/CommandCenter.java +++ b/core/src/mindustry/world/blocks/units/CommandCenter.java @@ -117,7 +117,7 @@ public class CommandCenter extends Block{ Events.fire(new CommandIssueEvent(tile, command)); } - public class CommandCenterEntity extends Tilec{ + public class CommandCenterEntity extends TileEntity{ public UnitCommand command = UnitCommand.attack; @Override diff --git a/core/src/mindustry/world/blocks/units/MechPad.java b/core/src/mindustry/world/blocks/units/MechPad.java index 51dc1292c4..b5e9987f6e 100644 --- a/core/src/mindustry/world/blocks/units/MechPad.java +++ b/core/src/mindustry/world/blocks/units/MechPad.java @@ -133,29 +133,13 @@ public class MechPad extends Block{ } } - public class MechFactoryEntity extends Tilec implements SpawnerTrait{ + public class MechFactoryEntity extends TileEntity{ Playerc player; boolean sameMech; float progress; float time; float heat; - @Override - public boolean hasUnit(Unitc unit){ - return unit == player; - } - - @Override - public void updateSpawning(Playerc unit){ - if(player == null){ - progress = 0f; - player = unit; - sameMech = true; - - player.beginRespawning(this); - } - } - @Override public void write(DataOutput stream) throws IOException{ super.write(stream); @@ -165,8 +149,8 @@ public class MechPad extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); progress = stream.readFloat(); time = stream.readFloat(); heat = stream.readFloat(); diff --git a/core/src/mindustry/world/blocks/units/RepairPoint.java b/core/src/mindustry/world/blocks/units/RepairPoint.java index 90cf1fd126..fa18db4e35 100644 --- a/core/src/mindustry/world/blocks/units/RepairPoint.java +++ b/core/src/mindustry/world/blocks/units/RepairPoint.java @@ -139,7 +139,7 @@ public class RepairPoint extends Block{ return entity.target != null; } - public class RepairPointEntity extends Tilec{ + public class RepairPointEntity extends TileEntity{ public Unitc target; public float strength, rotation = 90; } diff --git a/core/src/mindustry/world/blocks/units/UnitFactory.java b/core/src/mindustry/world/blocks/units/UnitFactory.java index cdac08cfc1..df8c50d81a 100644 --- a/core/src/mindustry/world/blocks/units/UnitFactory.java +++ b/core/src/mindustry/world/blocks/units/UnitFactory.java @@ -184,7 +184,7 @@ public class UnitFactory extends Block{ return entity.spawned < maxSpawn; } - public static class UnitFactoryEntity extends Tilec{ + public static class UnitFactoryEntity extends TileEntity{ float buildTime; float time; float speedScl; @@ -198,8 +198,8 @@ public class UnitFactory extends Block{ } @Override - public void read(DataInput stream, byte revision) throws IOException{ - super.read(stream, revision); + public void read(DataInput stream) throws IOException{ + super.read(stream); buildTime = stream.readFloat(); spawned = stream.readInt(); } diff --git a/tests/src/test/java/power/ItemLiquidGeneratorTests.java b/tests/src/test/java/power/ItemLiquidGeneratorTests.java index 138aaa5f9a..fe01e49dca 100644 --- a/tests/src/test/java/power/ItemLiquidGeneratorTests.java +++ b/tests/src/test/java/power/ItemLiquidGeneratorTests.java @@ -88,7 +88,7 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{ assertTrue(generator.acceptLiquid(tile, null, liquid, availableLiquidAmount), inputType + " | " + parameterDescription + ": Liquids which will be declined by the generator don't need to be tested - The code won't be called for those cases."); entity.liquids().add(liquid, availableLiquidAmount); - entity.cons.update(); + entity.cons().update(); // Perform an update on the generator once - This should use up any resource up to the maximum liquid usage generator.update(tile); @@ -132,7 +132,7 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{ if(amount > 0){ entity.items().add(item, amount); } - entity.cons.update(); + entity.cons().update(); // Perform an update on the generator once - This should use up one or zero items - dependent on if the item is accepted and available or not. try{ @@ -163,7 +163,7 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{ // Burn a single coal and test for the duration entity.items().add(Items.coal, 1); - entity.cons.update(); + entity.cons().update(); generator.update(tile); float expectedEfficiency = entity.productionEfficiency;