}
@Override
@SuppressWarnings("rawtypes")
public void onInsertion(int slot, TileEntity tile) {
IFarmHousing housing = getCircuitable(tile);
if (housing == null)
return;
IFarmLogic logic;
try {
logic = logicClass.getConstructor(new Class[] { IFarmHousing.class }).newInstance(housing);
} catch (Exception ex) {
throw new RuntimeException("Failed to instantiate logic of class " + logicClass.getName() + ": " + ex.getMessage());
}
try {
logic.setManual(isManual);
} catch (Throwable e) {
// uses older version of the API that doesn't implement setManual
}
housing.setFarmLogic(ForgeDirection.values()[slot + 2], logic);
}