Geiger counter comparator output

This commit is contained in:
abel1502 2025-05-26 14:51:11 +03:00
parent b00e3b9efb
commit 8f2a858f52
No known key found for this signature in database
GPG Key ID: 076926596A536338
2 changed files with 19 additions and 0 deletions

View File

@ -131,4 +131,22 @@ public class GeigerCounter extends BlockContainer {
return false;
}
}
@Override
public boolean hasComparatorInputOverride() {
return true;
}
@Override
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
TileEntityGeiger te = (TileEntityGeiger)world.getTileEntity(x, y, z);
if (te == null) return 0;
float rad = te.check();
// 0 at exactly 0 rads/sec
// +1 per 5 rads/sec
// 15 at 75+ rads/sec
return Math.min((int)Math.ceil(rad / 5f), 15);
}
}

View File

@ -65,6 +65,7 @@ public class TileEntityGeiger extends TileEntity implements SimpleComponent, IIn
public float check() {
return ChunkRadiationManager.proxy.getRadiation(worldObj, xCoord, yCoord, zCoord);
}
@Override
@Optional.Method(modid = "OpenComputers")
public String getComponentName() {