geolyzer should also update scan level, acting as crop scanner

add 'maxSize' to the scan output to better decide harvest time
This commit is contained in:
repo_alt 2020-02-26 19:15:39 +03:00
parent 0aeca03d6c
commit dbf4dfdc1d
2 changed files with 3 additions and 15 deletions

View File

@ -18,21 +18,7 @@ public final class DriverCrop extends DriverSidedTileEntity {
@Override
public ManagedEnvironment createEnvironment(World world, int x, int y, int z, ForgeDirection side) {
ICropTile tile = (ICropTile) world.getTileEntity(x, y, z);
if (tile.getScanLevel() < 4)
return new DriverCrop.DummyEnvironment((ICropTile) world.getTileEntity(x, y, z));
else
return new DriverCrop.Environment((ICropTile) world.getTileEntity(x, y, z));
}
public static final class DummyEnvironment extends ManagedTileEntityEnvironment<ICropTile> {
public DummyEnvironment(final ICropTile tileEntity) {
super(tileEntity, "crop");
}
@Callback
public Object[] getScanLevel(final Context context, final Arguments args) {
return new Object[]{tileEntity.getScanLevel()};
}
return new DriverCrop.Environment((ICropTile) world.getTileEntity(x, y, z));
}
public static final class Environment extends ManagedTileEntityEnvironment<ICropTile> {
public Environment(final ICropTile tileEntity) {

View File

@ -18,10 +18,12 @@ object EventHandlerIndustrialCraft2 {
val world = e.host.world
val tile = world.getTileEntity(e.x, e.y, e.z) match {
case crop : ICropTile => {
crop.setScanLevel(4)
val cc = crop.getCrop
e.data += "crop:name" -> cc.name()
e.data += "crop:tier" -> Int.box(cc.tier)
e.data += "crop:size" -> Int.box(crop.getSize)
e.data += "crop:maxSize" -> Int.box(cc.maxSize)
e.data += "crop:growth" -> Int.box(crop.getGrowth)
e.data += "crop:gain" -> Int.box(crop.getGain)
e.data += "crop:resistance" -> Int.box(crop.getResistance)