use of pneumaticCraft.api.universalSensor.ISensorSetting in project PneumaticCraft by MineMaarten.
the class TileEntityUniversalSensor method onEvent.
public void onEvent(Event event) {
ISensorSetting sensor = SensorHandler.instance().getSensorFromPath(sensorSetting);
if (sensor != null && sensor instanceof IEventSensorSetting && getPressure(ForgeDirection.UNKNOWN) > PneumaticValues.MIN_PRESSURE_UNIVERSAL_SENSOR) {
int newRedstoneStrength = ((IEventSensorSetting) sensor).emitRedstoneOnEvent(event, this, getRange(), sensorGuiText);
if (newRedstoneStrength != 0)
eventTimer = ((IEventSensorSetting) sensor).getRedstonePulseLength();
if (invertedRedstone)
newRedstoneStrength = 15 - newRedstoneStrength;
if (eventTimer > 0 && ThirdPartyManager.computerCraftLoaded) {
if (event instanceof PlayerInteractEvent) {
PlayerInteractEvent e = (PlayerInteractEvent) event;
notifyComputers(newRedstoneStrength, e.x, e.y, e.z);
} else {
notifyComputers(newRedstoneStrength);
}
}
if (newRedstoneStrength != redstoneStrength) {
redstoneStrength = newRedstoneStrength;
updateNeighbours();
}
}
}
Aggregations