mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge pull request #2180 from abel1502/abel-geiger-redstone
Geiger counter comparator integration
This commit is contained in:
commit
95f3bcb1f5
@ -131,4 +131,22 @@ public class GeigerCounter extends BlockContainer {
|
|||||||
return false;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,9 @@ public class TileEntityGeiger extends TileEntity implements SimpleComponent, IIn
|
|||||||
if(timer == 10) {
|
if(timer == 10) {
|
||||||
timer = 0;
|
timer = 0;
|
||||||
ticker = check();
|
ticker = check();
|
||||||
|
|
||||||
|
// To update the adjacent comparators
|
||||||
|
worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(timer % 5 == 0) {
|
if(timer % 5 == 0) {
|
||||||
@ -65,6 +68,7 @@ public class TileEntityGeiger extends TileEntity implements SimpleComponent, IIn
|
|||||||
public float check() {
|
public float check() {
|
||||||
return ChunkRadiationManager.proxy.getRadiation(worldObj, xCoord, yCoord, zCoord);
|
return ChunkRadiationManager.proxy.getRadiation(worldObj, xCoord, yCoord, zCoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public String getComponentName() {
|
public String getComponentName() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user